mirror of
https://github.com/eepykate/fet.sh.git
synced 2026-11-07 16:01:03 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
43152b2837 | ||
|
|
0d8ab196c4 | ||
|
|
ea9abc7ffb | ||
|
|
accf87f751 | ||
|
|
7d2097cf00 | ||
|
|
1a4ecf462b | ||
|
|
81d4666525 |
No files matched your search
@@ -9,6 +9,7 @@ fetch written in POSIX shell with no external commands
|
||||
**Arch:** [fet.sh-git](https://aur.archlinux.org/packages/fet.sh-git/) (AUR)
|
||||
**Nix:** [fet-sh](https://search.nixos.org/packages?show=fet-sh&query=fet-sh&channel=unstable) (nixpkgs-unstable)
|
||||
**Gentoo:** [app-misc/fetsh](https://gpo.zugaina.org/Overlays/guru/app-misc/fetsh) (GURU overlay)
|
||||
**KISS:** [fetsh](https://github.com/kisslinux/community/tree/master/community/fetsh) (Community)
|
||||
**Other Distros:** copy `fet.sh` to somewhere in $PATH
|
||||
|
||||
### Customization
|
||||
|
||||
@@ -17,7 +17,7 @@ eq() { # equals | [ a = b ] with globbing
|
||||
|
||||
## DE
|
||||
wm="$XDG_CURRENT_DESKTOP"
|
||||
wm="$DESKTOP_SESSION"
|
||||
[ "$wm" ] || wm="$DESKTOP_SESSION"
|
||||
|
||||
## Distro
|
||||
# freedesktop.org/software/systemd/man/os-release.html
|
||||
@@ -36,8 +36,13 @@ if [ -e /proc/$$/comm ]; then
|
||||
eq "$line" "PPid*" && ppid=${line##*:?} && break
|
||||
done < "/proc/${ppid:-$PPID}/status"
|
||||
|
||||
# Make sure not to do an infinite loop
|
||||
[ "$pppid" = "$ppid" ] && break
|
||||
pppid="$ppid"
|
||||
|
||||
# get name of binary
|
||||
read -r name < "/proc/$ppid/comm"
|
||||
|
||||
case $name in
|
||||
*sh|"${0##*/}") ;; # skip shells
|
||||
*[Ll]ogin*|*init*) break;; # exit when the top is reached
|
||||
@@ -46,14 +51,12 @@ if [ -e /proc/$$/comm ]; then
|
||||
done
|
||||
|
||||
## WM/DE
|
||||
# standard variables, mostly used for DEs
|
||||
[ "$DISPLAY" ] && [ ! "$wm" ] &&
|
||||
# non-standard WMs
|
||||
[ ! "$wm" ] &&
|
||||
# loop over all processes and check the binary name
|
||||
for i in /proc/*/comm; do
|
||||
read -r c < "$i"
|
||||
case $c in
|
||||
awesome|xmonad*|qtile|sway|i3|*box*|*wm*) wm="${c%%-*}"; break;;
|
||||
awesome|xmonad*|qtile|sway|i3|[bfo]*box|*wm*) wm="${c%%-*}"; break;;
|
||||
esac
|
||||
done
|
||||
|
||||
@@ -94,6 +97,7 @@ if [ -e /proc/$$/comm ]; then
|
||||
set --
|
||||
[ -d /var/db/kiss/installed ] && set -- /var/db/kiss/installed/*
|
||||
[ -d /var/lib/pacman/local ] && set -- /var/lib/pacman/local/[0-9a-z]*
|
||||
[ -d /var/lib/dpkg/info ] && set -- /var/lib/dpkg/info/*.list
|
||||
[ -d /var/db/xbps ] && set -- /var/db/xbps/.*
|
||||
[ -d /var/db/pkg ] && set -- /var/db/pkg/*/* # gentoo
|
||||
pkgs=${###0}
|
||||
@@ -198,6 +202,9 @@ fi
|
||||
|
||||
eq "$0" "*fetish" && printf 'Step on me daddy\n' && exit
|
||||
|
||||
# help i dont know if it's a capital consistently
|
||||
eq "$wm" "*[Gg][Nn][Oo][Mm][Ee]*" && wm="foot DE"
|
||||
|
||||
## GTK
|
||||
while read -r line; do
|
||||
eq "$line" "gtk-theme*" && gtk="${line##*=}" && break
|
||||
|
||||
Reference in new issue
Block a user