diff --git a/modules/home/scripts/scripts/unfuck.sh b/modules/home/scripts/scripts/unfuck.sh index a4fb47b..667f09d 100644 --- a/modules/home/scripts/scripts/unfuck.sh +++ b/modules/home/scripts/scripts/unfuck.sh @@ -1,9 +1,22 @@ #!/usr/bin/env bash # unfuck system when shit goes wrong +unfuckable=( + "wallpaper" + "bar" + "networkmanager" + "spotify" + "audio" + "screenlock" +) + usage() { - echo "usage: unfuck [OPTION]" - echo "example: unfuck everything" + echo "INFO: usage; unfuck [OPTION]" + echo "INFO: example; unfuck everything" + echo "" + echo "INFO: items: ${unfuckable[*]}" + echo "" + echo "WARN: unfuck everything should only be used when *everything* is broken and nothing works anymore!" } unfuck_wallpaper() { @@ -17,29 +30,49 @@ unfuck_bar() { } unfuck_networkmanager() { + # sudo modprobe -r iwlwifi + # sudo modprobe iwlwifi sudo systemctl restart NetworkManager } unfuck_spotify() { if pgrep ncspot; then pkill ncspot - ncspot + kitty -e ncspot elif pgrep spotify; then pkill spotify spotify fi } +unfuck_audio() { + if [[ "$(playerctl status)" == "Playing" ]]; then + playerctl pause + fi + for device in $(bluetoothctl devices Connected | awk '{print $2}'); do + devices+=("$device") + done + systemctl --user restart wireplumber pipewire pipewire-pulse bluetooth + bluetoothctl power off + bluetoothctl power on + for device in ${devices[*]}; do + # 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" + bluetoothctl disconnect "$device" + bluetoothctl connect "$device" + done +} + unfuck_screenlock() { hyprctl --instance 0 'keyword misc:allow_session_lock_restore 1' - hyprctl --instance 0 'dispatch exec lockscreen' + hyprctl --instance 0 'dispatch exec hyprlock' } case $1 in "") echo "what is fucked?" ;; --h | --help) +-h | --help | help) usage ;; everything)