mirror of
https://github.com/Ahwxorg/nixos-config.git
synced 2025-12-04 15:00:13 +01:00
feat: adds better unfucking to swww
This commit is contained in:
parent
a442e77e32
commit
71211c38da
1 changed files with 55 additions and 54 deletions
|
|
@ -2,86 +2,87 @@
|
|||
# unfuck system when shit goes wrong
|
||||
|
||||
unfuckable=(
|
||||
"wallpaper"
|
||||
"bar"
|
||||
"networkmanager"
|
||||
"spotify"
|
||||
"audio"
|
||||
"screenlock"
|
||||
"wallpaper"
|
||||
"bar"
|
||||
"networkmanager"
|
||||
"spotify"
|
||||
"audio"
|
||||
"screenlock"
|
||||
)
|
||||
|
||||
usage() {
|
||||
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!"
|
||||
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() {
|
||||
pkill swww-daemon
|
||||
setsid swww-daemon &
|
||||
pkill swww-daemon
|
||||
setsid swww-daemon &
|
||||
swww img ~/.local/share/bg.png
|
||||
}
|
||||
|
||||
unfuck_bar() {
|
||||
pkill waybar
|
||||
setsid waybar &
|
||||
pkill waybar
|
||||
setsid waybar &
|
||||
}
|
||||
|
||||
unfuck_networkmanager() {
|
||||
# sudo modprobe -r iwlwifi
|
||||
# sudo modprobe iwlwifi
|
||||
sudo systemctl restart NetworkManager
|
||||
# sudo modprobe -r iwlwifi
|
||||
# sudo modprobe iwlwifi
|
||||
sudo systemctl restart NetworkManager
|
||||
}
|
||||
|
||||
unfuck_spotify() {
|
||||
if pgrep ncspot; then
|
||||
pkill ncspot
|
||||
kitty -e ncspot
|
||||
elif pgrep spotify; then
|
||||
pkill spotify
|
||||
spotify
|
||||
fi
|
||||
if pgrep ncspot; then
|
||||
pkill 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
|
||||
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 hyprlock'
|
||||
hyprctl --instance 0 'keyword misc:allow_session_lock_restore 1'
|
||||
hyprctl --instance 0 'dispatch exec hyprlock'
|
||||
}
|
||||
|
||||
case $1 in
|
||||
"")
|
||||
echo "what is fucked?"
|
||||
;;
|
||||
echo "what is fucked?"
|
||||
;;
|
||||
-h | --help | help)
|
||||
usage
|
||||
;;
|
||||
usage
|
||||
;;
|
||||
everything)
|
||||
unfuck_screenlock
|
||||
unfuck_bar
|
||||
unfuck_spotify
|
||||
unfuck_wallpaper
|
||||
;;
|
||||
unfuck_screenlock
|
||||
unfuck_bar
|
||||
unfuck_spotify
|
||||
unfuck_wallpaper
|
||||
;;
|
||||
*)
|
||||
eval "unfuck_$1"
|
||||
;;
|
||||
eval "unfuck_$1"
|
||||
;;
|
||||
esac
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue