diff --git a/.config/newsboat/urls b/.config/newsboat/urls index e838478..ad1d119 100644 --- a/.config/newsboat/urls +++ b/.config/newsboat/urls @@ -2,6 +2,6 @@ https://lukesmith.xyz/rss.xml https://notrelated.xyz/rss https://www.youtube.com/feeds/videos.xml?channel_id=UC2eYFnH61tmytImy1mTYvhA "~Luke Smith (YouTube)" https://landchad.net/rss.xml -https://based.cooking/rss.xml +https://based.cooking/index.xml https://artixlinux.org/feed.php "tech" https://www.archlinux.org/feeds/news/ "tech" diff --git a/.local/bin/sysact b/.local/bin/sysact index b13690e..eb9390f 100755 --- a/.local/bin/sysact +++ b/.local/bin/sysact @@ -1,14 +1,22 @@ #!/bin/sh + # A dmenu wrapper script for system functions. +export WM="dwm" case "$(readlink -f /sbin/init)" in *systemd*) ctl='systemctl' ;; *) ctl='loginctl' ;; esac -case "$(printf "🔒 lock\n🚪 leave dwm\n♻️ renew dwm\n🐻 hibernate\n🔃 reboot\n🖥️shutdown\n💤 sleep\n📺 display off" | dmenu -i -p 'Action: ')" in +wmpid(){ # This function is needed if there are multiple instances of the window manager. + tree="$(pstree -ps $$)" + tree="${tree#*$WM(}" + echo "${tree%%)*}" +} + +case "$(printf "🔒 lock\n🚪 leave $WM\n♻️ renew $WM\n🐻 hibernate\n🔃 reboot\n🖥️shutdown\n💤 sleep\n📺 display off" | dmenu -i -p 'Action: ')" in '🔒 lock') slock ;; - '🚪 leave dwm') kill -TERM "$(pgrep -u "$USER" "\bdwm$")" ;; - '♻️ renew dwm') kill -HUP "$(pgrep -u "$USER" "\bdwm$")" ;; + "🚪 leave $WM") kill -TERM "$(wmpid)" ;; + "♻️ renew $WM") kill -HUP "$(wmpid)" ;; '🐻 hibernate') slock $ctl hibernate ;; '💤 sleep') slock $ctl suspend ;; '🔃 reboot') $ctl reboot -i ;;