mirror of
https://github.com/Ahwxorg/nixos-config.git
synced 2025-12-04 15:00:13 +01:00
feat: adds unfuck audio subcommand; also fix some other things with the script
This commit is contained in:
parent
a9bad28ba6
commit
1259d5fe79
1 changed files with 38 additions and 5 deletions
|
|
@ -1,9 +1,22 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# unfuck system when shit goes wrong
|
# unfuck system when shit goes wrong
|
||||||
|
|
||||||
|
unfuckable=(
|
||||||
|
"wallpaper"
|
||||||
|
"bar"
|
||||||
|
"networkmanager"
|
||||||
|
"spotify"
|
||||||
|
"audio"
|
||||||
|
"screenlock"
|
||||||
|
)
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "usage: unfuck [OPTION]"
|
echo "INFO: usage; unfuck [OPTION]"
|
||||||
echo "example: unfuck everything"
|
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() {
|
unfuck_wallpaper() {
|
||||||
|
|
@ -17,29 +30,49 @@ unfuck_bar() {
|
||||||
}
|
}
|
||||||
|
|
||||||
unfuck_networkmanager() {
|
unfuck_networkmanager() {
|
||||||
|
# sudo modprobe -r 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
|
||||||
ncspot
|
kitty -e ncspot
|
||||||
elif pgrep spotify; then
|
elif pgrep spotify; then
|
||||||
pkill spotify
|
pkill spotify
|
||||||
spotify
|
spotify
|
||||||
fi
|
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() {
|
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 lockscreen'
|
hyprctl --instance 0 'dispatch exec hyprlock'
|
||||||
}
|
}
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
"")
|
"")
|
||||||
echo "what is fucked?"
|
echo "what is fucked?"
|
||||||
;;
|
;;
|
||||||
-h | --help)
|
-h | --help | help)
|
||||||
usage
|
usage
|
||||||
;;
|
;;
|
||||||
everything)
|
everything)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue