feat: adds better unfucking to swww

This commit is contained in:
Ahwx 2025-06-09 14:02:03 +02:00
parent a442e77e32
commit 71211c38da

View file

@ -2,86 +2,87 @@
# unfuck system when shit goes wrong # unfuck system when shit goes wrong
unfuckable=( unfuckable=(
"wallpaper" "wallpaper"
"bar" "bar"
"networkmanager" "networkmanager"
"spotify" "spotify"
"audio" "audio"
"screenlock" "screenlock"
) )
usage() { usage() {
echo "INFO: usage; unfuck [OPTION]" echo "INFO: usage; unfuck [OPTION]"
echo "INFO: example; unfuck everything" echo "INFO: example; unfuck everything"
echo "" echo ""
echo "INFO: items: ${unfuckable[*]}" echo "INFO: items: ${unfuckable[*]}"
echo "" echo ""
echo "WARN: unfuck everything should only be used when *everything* is broken and nothing works anymore!" echo "WARN: unfuck everything should only be used when *everything* is broken and nothing works anymore!"
} }
unfuck_wallpaper() { unfuck_wallpaper() {
pkill swww-daemon pkill swww-daemon
setsid swww-daemon & setsid swww-daemon &
swww img ~/.local/share/bg.png
} }
unfuck_bar() { unfuck_bar() {
pkill waybar pkill waybar
setsid waybar & setsid waybar &
} }
unfuck_networkmanager() { unfuck_networkmanager() {
# sudo modprobe -r iwlwifi # sudo modprobe -r iwlwifi
# sudo modprobe iwlwifi # sudo modprobe iwlwifi
sudo systemctl restart NetworkManager sudo systemctl restart NetworkManager
} }
unfuck_spotify() { unfuck_spotify() {
if pgrep ncspot; then if pgrep ncspot; then
pkill ncspot pkill ncspot
kitty -e ncspot kitty -e ncspot
elif pgrep spotify; then elif pgrep spotify; then
pkill spotify pkill spotify
spotify spotify
fi fi
} }
unfuck_audio() { unfuck_audio() {
if [[ "$(playerctl status)" == "Playing" ]]; then if [[ "$(playerctl status)" == "Playing" ]]; then
playerctl pause playerctl pause
fi fi
for device in $(bluetoothctl devices Connected | awk '{print $2}'); do for device in $(bluetoothctl devices Connected | awk '{print $2}'); do
devices+=("$device") devices+=("$device")
done done
systemctl --user restart wireplumber pipewire pipewire-pulse bluetooth systemctl --user restart wireplumber pipewire pipewire-pulse bluetooth
bluetoothctl power off bluetoothctl power off
bluetoothctl power on bluetoothctl power on
for device in ${devices[*]}; do for device in ${devices[*]}; do
# because bluetooth is the worst thing ever created and defaults to handset mode, devices will need to reconnect # because bluetooth is the worst thing ever created and defaults to handset mode, devices will need to reconnect
echo "INFO: disconnecting and reconnecting to $device" echo "INFO: disconnecting and reconnecting to $device"
bluetoothctl disconnect "$device" bluetoothctl disconnect "$device"
bluetoothctl connect "$device" bluetoothctl connect "$device"
done done
} }
unfuck_screenlock() { unfuck_screenlock() {
hyprctl --instance 0 'keyword misc:allow_session_lock_restore 1' hyprctl --instance 0 'keyword misc:allow_session_lock_restore 1'
hyprctl --instance 0 'dispatch exec hyprlock' hyprctl --instance 0 'dispatch exec hyprlock'
} }
case $1 in case $1 in
"") "")
echo "what is fucked?" echo "what is fucked?"
;; ;;
-h | --help | help) -h | --help | help)
usage usage
;; ;;
everything) everything)
unfuck_screenlock unfuck_screenlock
unfuck_bar unfuck_bar
unfuck_spotify unfuck_spotify
unfuck_wallpaper unfuck_wallpaper
;; ;;
*) *)
eval "unfuck_$1" eval "unfuck_$1"
;; ;;
esac esac