Merge branch 'master' of github.com:LukeSmithxyz/voidrice
This commit is contained in:
commit
163738e6ad
5 changed files with 20 additions and 23 deletions
|
@ -35,7 +35,7 @@ alias \
|
||||||
g="git" \
|
g="git" \
|
||||||
trem="transmission-remote" \
|
trem="transmission-remote" \
|
||||||
YT="youtube-viewer" \
|
YT="youtube-viewer" \
|
||||||
sdn="sudo shutdown -h now" \
|
sdn="shutdown -h now" \
|
||||||
e="$EDITOR" \
|
e="$EDITOR" \
|
||||||
v="$EDITOR" \
|
v="$EDITOR" \
|
||||||
p="pacman" \
|
p="pacman" \
|
||||||
|
|
|
@ -26,7 +26,7 @@ asktype() { \
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
drives=$(lsblk -nrpo "name,type,size,mountpoint,label" | sed 's/ /:/g' | awk -F':' '$4!~/\/boot|\/efi|\/home$|SWAP/&&length($4)>1{printf "%s (%s) %s\n",$4,$3,$5}')
|
drives=$(lsblk -nrpo "name,type,size,mountpoint,label" | awk -F':' '{gsub(/ /,":")}$4!~/\/boot|\/efi|\/home$|SWAP/&&length($4)>1{printf "%s (%s) %s\n",$4,$3,$5}')
|
||||||
|
|
||||||
if ! grep simple-mtpfs /etc/mtab; then
|
if ! grep simple-mtpfs /etc/mtab; then
|
||||||
[ -z "$drives" ] && echo "No drives to unmount." && exit
|
[ -z "$drives" ] && echo "No drives to unmount." && exit
|
||||||
|
|
|
@ -17,9 +17,10 @@ case $BLOCK_BUTTON in
|
||||||
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
|
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
case "$(cat /sys/class/net/w*/operstate 2>/dev/null)" in
|
if grep -xq 'up' /sys/class/net/w*/operstate 2>/dev/null ; then
|
||||||
down) [ "$(cat /sys/class/net/w*/flags)" = "0x1002" ] && wifiicon="❌ " || wifiicon="📡 " ;;
|
wifiicon="$(awk '/^\s*w/ { print "📶", int($3 * 100 / 70) "% " }' /proc/net/wireless)"
|
||||||
up) wifiicon="$(awk '/^\s*w/ { print "📶", int($3 * 100 / 70) "% " }' /proc/net/wireless)" ;;
|
elif grep -xq 'down' /sys/class/net/w*/operstate 2>/dev/null ; then
|
||||||
esac
|
grep -xq '0x1003' /sys/class/net/w*/flags && wifiicon="📡 " || wifiicon="❌ "
|
||||||
|
fi
|
||||||
|
|
||||||
printf "%s%s%s\n" "$wifiicon" "$(sed "s/down/❎/;s/up/🌐/" /sys/class/net/e*/operstate 2>/dev/null)" "$(sed "s/.*/🔒/" /sys/class/net/tun*/operstate 2>/dev/null)"
|
printf "%s%s%s\n" "$wifiicon" "$(sed "s/down/❎/;s/up/🌐/" /sys/class/net/e*/operstate 2>/dev/null)" "$(sed "s/.*/🔒/" /sys/class/net/tun*/operstate 2>/dev/null)"
|
||||||
|
|
|
@ -1,22 +1,18 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# A dmenu wrapper script for system functions.
|
# A dmenu wrapper script for system functions.
|
||||||
|
|
||||||
# For non-systemd init systems.
|
|
||||||
case "$(readlink -f /sbin/init)" in
|
case "$(readlink -f /sbin/init)" in
|
||||||
*runit*) hib="sudo -A zzz" ;;
|
*systemd*) ctl='systemctl' ;;
|
||||||
*openrc*) reb="sudo -A openrc-shutdown -r"; shut="sudo -A openrc-shutdown -p 0" ;;
|
*) ctl='loginctl' ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
cmds="\
|
case "$(printf "🔒 lock\n🚪 leave dwm\n♻️ renew dwm\n🐻 hibernate\n💤 sleep\n🔃 reboot\n🖥️shutdown\n📺 display off" | dmenu -i -p 'Action: ')" in
|
||||||
🔒 lock slock
|
'🔒 lock') slock ;;
|
||||||
🚪 leave dwm kill -TERM $(pgrep -u $USER "\bdwm$")
|
'🚪 leave dwm') kill -TERM "$(pgrep -u "$USER" "\bdwm$")" ;;
|
||||||
♻ renew dwm kill -HUP $(pgrep -u $USER "\bdwm$")
|
'♻️ renew dwm') kill -HUP "$(pgrep -u "$USER" "\bdwm$")" ;;
|
||||||
🐻 hibernate slock ${hib:-systemctl suspend-then-hibernate -i}
|
'🐻 hibernate') slock $ctl hibernate ;;
|
||||||
🔃 reboot ${reb:-sudo -A reboot}
|
'💤 sleep') slock $ctl suspend ;;
|
||||||
🖥 shutdown ${shut:-sudo -A shutdown -h now}
|
'🔃 reboot') $ctl reboot ;;
|
||||||
📺 display off xset dpms force off"
|
'🖥️shutdown') $ctl poweroff ;;
|
||||||
|
'📺 display off') xset dpms force off ;;
|
||||||
choice="$(echo "$cmds" | cut -d' ' -f 1 | dmenu)" || exit 1
|
*) exit 1 ;;
|
||||||
|
esac
|
||||||
eval "$(echo "$cmds" | grep "^$choice " | cut -d ' ' -f2-)"
|
|
||||||
|
|
Loading…
Reference in a new issue