#!/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 &