From 7e43f126103a95b9d01531959d1bfb95e58f9e32 Mon Sep 17 00:00:00 2001 From: GaugeK Date: Sun, 9 Aug 2020 05:14:27 +1000 Subject: [PATCH] support more wms & a fair bit of DEs --- fet.sh | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/fet.sh b/fet.sh index 2d86368..f351c81 100755 --- a/fet.sh +++ b/fet.sh @@ -27,25 +27,31 @@ done ## WM # requires the WM to include 'wm' or 'monad' (for you leon) pg() { + # i hate myself for this + [ $# = 1 ] && set -- $1 $1 $1 $1 $1 ab= for i in /proc/[0-9]*; do ab="$ab ${i##*/}" read -r a < "$i"/comm case $a in - *$1*|*${2:-$1}*) echo "$a" "${i##*/}"; break;; + *$1*|*$2*|*$3*|*$4*|*$5*) echo "$a" "${i##*/}"; break;; esac done } -[ "$DISPLAY" ] && { +if [ "$XDG_CURRENT_DESKTOP" ]; then + wm="$XDG_CURRENT_DESKTOP" +elif [ "$DESKTOP_SESSION" ]; then + wm="$DESKTOP_SESSION" +elif [ "$DISPLAY" ]; then xorg="$(pg Xorg)" xorg="${xorg##* }" - aa="$(pg wm monad)" + aa="$(pg wm monad box i3 tile)" # make sure it was started near enough after the X server [ "${aa##* }" -gt "$xorg" ] && - [ "${aa##* }" -lt "$((xorg + 20))" ] && + [ "${aa##* }" -lt "$((xorg + 30))" ] && wm="${aa%% *}" -} +fi ## Distro . /etc/os-release # lol EZ