mirror of
https://github.com/eepykate/fet.sh.git
synced 2026-11-03 13:18:35 +00:00
Redid unknown wm(xmonad,qtile,etc) detection
This commit is contained in:
1 parent
505a7196fc
commit
23e2170eeb
1 file changed
+6
-23
@@ -26,34 +26,17 @@ while [ ! "$term" ]; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
## WM/DE
|
## WM/DE
|
||||||
pg() {
|
|
||||||
unset ab var
|
|
||||||
# i hate myself for this
|
|
||||||
for i in "$@"; do
|
|
||||||
var="${var:+$var|}*$i*"
|
|
||||||
done
|
|
||||||
for i in /proc/[0-9]*; do
|
|
||||||
ab="$ab ${i##*/}"
|
|
||||||
read -r a < "$i"/comm
|
|
||||||
# this was sadly the better option...
|
|
||||||
eval "case \$a in
|
|
||||||
$var) echo \"\$a\" \"\${i##*/}\"; break;;
|
|
||||||
esac"
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ "$XDG_CURRENT_DESKTOP" ]; then
|
if [ "$XDG_CURRENT_DESKTOP" ]; then
|
||||||
wm="$XDG_CURRENT_DESKTOP"
|
wm="$XDG_CURRENT_DESKTOP"
|
||||||
elif [ "$DESKTOP_SESSION" ]; then
|
elif [ "$DESKTOP_SESSION" ]; then
|
||||||
wm="$DESKTOP_SESSION"
|
wm="$DESKTOP_SESSION"
|
||||||
elif [ "$DISPLAY" ]; then
|
elif [ "$DISPLAY" ]; then
|
||||||
xorg="$(pg Xorg)"
|
for i in /proc/*/comm; do
|
||||||
xorg="${xorg##* }"
|
read -r c < "$i"
|
||||||
aa="$(pg wm monad box i3 tile)"
|
case $c in
|
||||||
# make sure it was started near enough after the X server
|
xmonad|qtile|i3*|*box*|*wm*) wm="$c"; break;;
|
||||||
[ "${aa##* }" -gt "$xorg" ] &&
|
esac
|
||||||
[ "${aa##* }" -lt "$((xorg + 30))" ] &&
|
done
|
||||||
wm="${aa%% *}"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## Distro
|
## Distro
|
||||||
|
|||||||
Reference in new issue
Block a user