#!/bin/bash if [ $(grep -r "RUNNING" /proc/asound | wc -l) -eq 0 ] || [[ $# -ne 0 ]]; then # Disables dunst, my notification daemon, so I don't see notification on lock screen # https://github.com/dunst-project/dunst/issues/697 # https://wiki.archlinux.org/title/Dunst#Disable_dunst_temporarily dunstctl set-paused true if [[ "$1" == "suspend" ]]; then # Usually suspending should be done with "systemctl suspend", but I've had issues with that so I directly tell the kernel to sleep the system # For that I have a script in /usr/loca/sbin that just continains: # # #!/bin/bash # echo -n mem>/sys/power/state # # And I've added the following to /etc/sudoers (where kamen is my username), so I don't need to put in my password: # # kamen ALL = (root) NOPASSWD: /usr/local/sbin/sleep.sh sudo -u root /usr/local/sbin/sleep.sh # Audio could get messed up if something is playing while trying to suspend # By restarting pulseaudio, all playback gets "stopped", which should prevent any audio issues post-suspend pulseaudio -k fi i3lock -f -c d49408 -i /home/kamen/.i3lock/lockscreen.png -n dunstctl set-paused false # Enables my notification daemon killall lwa-hot-corners; lwa-hot-corners ~/.lwarc & killall tint2; nohup tint2 2>&1 & disown picom --experimental-backends & # Sometimes my compositor crashes or smth, so I try to launch it, just in case it stopped working fi