1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
|
#!/usr/bin/env bash
readonly WM="marco"
if ! command -v "${WM}" &>/dev/null; then
echo "ERROR! Can't find ${WM}."
exit 1
fi
UNAME="$(id -un)"
killall --user "${UNAME}" "${WM}" 2>/dev/null
BACKEND=$(echo "${0}" | cut -d'-' -f2-)
echo "${BACKEND}"
# Handle mutliple personalities.
case ${BACKEND} in
no-composite)
COMP=""
;;
xrender|glx|xr_glx_hybrid)
COMP="picom"
;;
*)
COMP="picom"
BACKEND="xrender"
;;
esac
VSYNC="--vsync"
# Disable vsync if the NVIDIA compositor is enabled.
if command -v nvidia-settings &>/dev/null; then
if nvidia-settings -q CurrentMetaMode -t | grep ForceCompositionPipeline=On; then
VSYNC="--no-vsync"
fi
fi
killall --user "${UNAME}" compton 2>/dev/null
killall --user "${UNAME}" picom 2>/dev/null
if [ -n "${COMP}" ]; then
# Allow users to override the defaults by creating their own config
# for this wrapper.
if [ -f "${HOME}/.config/${WM}-${COMP}.conf" ]; then
${COMP} \
--daemon \
--config "${HOME}/.config/${WM}-${COMP}.conf"
else
${COMP} \
--daemon \
--config /dev/null \
--backend ${BACKEND} ${VSYNC} \
--detect-rounded-corners \
--detect-client-leader \
--detect-transient \
--detect-client-opacity \
--glx-no-stencil \
--no-use-damage \
--mark-wmwin-focused \
--mark-ovredir-focused \
--shadow \
--shadow-radius=12 \
--shadow-opacity=0.125 \
--shadow-offset-x=-12 \
--shadow-offset-y=-12 \
--fading \
--fade-delta=8 \
--no-fading-destroyed-argb \
--xinerama-shadow-crop \
--use-ewmh-active-win \
--unredir-if-possible \
--unredir-if-possible-exclude "class_g = 'Mate-screensaver'" \
--fade-exclude "window_type *= 'menu'" \
--shadow-exclude "window_type *= 'dnd'" \
--shadow-exclude "window_type *= 'dock'" \
--shadow-exclude "window_type *= 'notification'" \
--shadow-exclude "class_g = 'albert'" \
--shadow-exclude "class_g = 'Cairo-clock'" \
--shadow-exclude "class_g = 'Conky'" \
--shadow-exclude "class_g ?= 'Firefox' && argb" \
--shadow-exclude "class_g ?= 'Notify-osd'" \
--shadow-exclude "class_g = 'Synapse'" \
--shadow-exclude "class_g = 'Ulauncher'" \
--shadow-exclude "_GTK_FRAME_EXTENTS@:c" \
--shadow-exclude "_NET_WM_STATE@:32a *= '_NET_WM_STATE_HIDDEN'" \
--shadow-exclude "_NET_WM_STATE@:32a *= '_NET_WM_STATE_MAXIMIZED'"
fi
fi
# Replace window manager and force compositing off.
${WM} --no-composite --replace &
|