mirror of
https://github.com/eepykate/fet.sh.git
synced 2026-10-16 10:39:31 +00:00
Add *really* hacky WM checker
I am not proud of this.
This commit is contained in:
1 parent
7c5b1ca755
commit
447a2a2356
2 files changed
+27
-2
No files matched your search
@@ -1,3 +1,5 @@
|
||||
fetch written in POSIX shell with no external commands
|
||||
|
||||

|
||||
<div align="center">
|
||||
<img src="http://0x0.st/i3ty.png" width="393px">
|
||||
</div>
|
||||
+24
-1
@@ -24,6 +24,28 @@ while [ ! "$term" ]; do
|
||||
ppid=$(ppid "$ppid")
|
||||
done
|
||||
|
||||
## WM
|
||||
# requires the WM to include 'wm'
|
||||
pg() {
|
||||
ab=
|
||||
for i in /proc/[0-9]*; do
|
||||
ab="$ab ${i##*/}"
|
||||
read -r a < "$i"/comm
|
||||
case $a in
|
||||
*$1*) echo "$a" "${i##*/}"; break;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
[ "$DISPLAY" ] && {
|
||||
xorg="$(pg Xorg)"
|
||||
xorg="${xorg##* }"
|
||||
aa="$(pg wm)"
|
||||
# make sure it was started near enough after the X server
|
||||
[ "${aa##* }" -gt "$xorg" ] &&
|
||||
[ "${aa##* }" -lt "$((xorg + 20))" ] &&
|
||||
wm="${aa%% *}"
|
||||
}
|
||||
|
||||
## Distro
|
||||
. /etc/os-release # lol EZ
|
||||
|
||||
@@ -102,11 +124,12 @@ read -r model < /sys/devices/virtual/dmi/id/product_name
|
||||
}
|
||||
|
||||
print() {
|
||||
printf '\033[35m%6s\033[0m | %s\n' "$1" "$2"
|
||||
printf '\033[34m%6s\033[0m | %s\n' "$1" "$2"
|
||||
}
|
||||
|
||||
print os "$ID"
|
||||
print sh "${SHELL##*/}"
|
||||
[ "$wm" ] && print wm "$wm"
|
||||
print up "${d}d ${h}:${m}"
|
||||
[ "$gtk" ] && print gtk "$gtk"
|
||||
print cpu "$vendor $cpu"
|
||||
|
||||
Reference in new issue
Block a user