diff options
| author | Ahmed AbdelHalim <[email protected]> | 2026-02-20 15:40:27 +0100 |
|---|---|---|
| committer | Ahmed AbdelHalim <[email protected]> | 2026-02-20 16:13:11 +0100 |
| commit | 9716329f33d99503bcd519e9b4c8adb178febe70 (patch) | |
| tree | 7d089b166918a18f4e1a7d6af304689559ab6f14 /roles/hyprland/files/scripts | |
| parent | 2071d4bbebf94c0f4796bb051d7b765d238f7a7d (diff) | |
Refactor waybar/hyprland
Diffstat (limited to 'roles/hyprland/files/scripts')
| -rwxr-xr-x | roles/hyprland/files/scripts/bluetooth.sh | 49 | ||||
| -rwxr-xr-x | roles/hyprland/files/scripts/brightness.sh | 2 | ||||
| -rwxr-xr-x | roles/hyprland/files/scripts/launch-tui | 3 | ||||
| -rwxr-xr-x | roles/hyprland/files/scripts/sunset.sh | 4 | ||||
| -rwxr-xr-x | roles/hyprland/files/scripts/volume.sh | 4 | ||||
| -rwxr-xr-x | roles/hyprland/files/scripts/wifi.sh | 49 |
6 files changed, 106 insertions, 5 deletions
diff --git a/roles/hyprland/files/scripts/bluetooth.sh b/roles/hyprland/files/scripts/bluetooth.sh new file mode 100755 index 00000000..7f276df4 --- /dev/null +++ b/roles/hyprland/files/scripts/bluetooth.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +turn_on() { + rfkill unblock bluetooth + bluetoothctl power on + notify "on" +} + +turn_off() { + rfkill unblock bluetooth + bluetoothctl power off + notify "off" +} + +toggle() { + if bluetoothctl <<< show | grep -q "Powered: yes"; then + turn_off + else + turn_on + fi +} + +notify() { + local class="$1" + notify-send -e \ + -h string:x-canonical-private-synchronous:bluetooth \ + -u low \ + "Bluetooth" \ + " ${class}" +} + +case "$1" in + "--on") + turn_on + ;; + "--off") + turn_off + ;; + "--toggle") + toggle + ;; + *) + echo -e "Usage:" + echo -e " --on to turn bluetooth on" + echo -e " --off to turn bluetooth off" + echo -e " --toggle to toggle bluetooth state" + exit 0 + ;; +esac diff --git a/roles/hyprland/files/scripts/brightness.sh b/roles/hyprland/files/scripts/brightness.sh index 1d935f28..7489d9d9 100755 --- a/roles/hyprland/files/scripts/brightness.sh +++ b/roles/hyprland/files/scripts/brightness.sh @@ -89,7 +89,7 @@ notify() { -h string:x-canonical-private-synchronous:brightness-"$serial" \ -u low \ "Brightness" \ - " $name: ${value}%" + " $name: ${value}%" } STEP="${2:-1}" diff --git a/roles/hyprland/files/scripts/launch-tui b/roles/hyprland/files/scripts/launch-tui new file mode 100755 index 00000000..16efba9b --- /dev/null +++ b/roles/hyprland/files/scripts/launch-tui @@ -0,0 +1,3 @@ +#!/bin/bash + +exec setsid uwsm-app -- alacritty --class="work.kartoffln.$(basename "$1")" -e "$@" diff --git a/roles/hyprland/files/scripts/sunset.sh b/roles/hyprland/files/scripts/sunset.sh index 52f3ea7c..1659aaab 100755 --- a/roles/hyprland/files/scripts/sunset.sh +++ b/roles/hyprland/files/scripts/sunset.sh @@ -51,8 +51,8 @@ notify() { notify-send -e \ -h string:x-canonical-private-synchronous:sunset \ -u low \ - "${icon} Nightshift ${class}" \ - "Temprature: ${temp}" + "Nightshift ${class}" \ + "${icon} Temprature: ${temp}" } TEMP="${2:-$TEMP_ON}" diff --git a/roles/hyprland/files/scripts/volume.sh b/roles/hyprland/files/scripts/volume.sh index 5c2ad3d5..d2168ce1 100755 --- a/roles/hyprland/files/scripts/volume.sh +++ b/roles/hyprland/files/scripts/volume.sh @@ -44,13 +44,13 @@ notify() { -h string:x-canonical-private-synchronous:volume \ -u low \ "$label" \ - "$mute_icon\tmute" + "$mute_icon mute" else notify-send -e \ -h string:x-canonical-private-synchronous:volume \ -u low \ "$label" \ - "$icon\t${value}%" + "$icon ${value}%" fi } diff --git a/roles/hyprland/files/scripts/wifi.sh b/roles/hyprland/files/scripts/wifi.sh new file mode 100755 index 00000000..838d03a8 --- /dev/null +++ b/roles/hyprland/files/scripts/wifi.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +turn_on() { + rfkill unblock wifi + nmcli radio wifi on + notify "on" +} + +turn_off() { + nmcli radio wifi off + rfkill unblock wifi + notify "off" +} + +toggle() { + if nmcli radio wifi | grep -q "enabled"; then + turn_off + else + turn_on + fi +} + +notify() { + local class="$1" + notify-send -e \ + -h string:x-canonical-private-synchronous:wifi \ + -u low \ + "Wifi" \ + " ${class}" +} + +case "$1" in + "--on") + turn_on + ;; + "--off") + turn_off + ;; + "--toggle") + toggle + ;; + *) + echo -e "Usage:" + echo -e " --on to turn wifi on" + echo -e " --off to turn wifi off" + echo -e " --toggle to toggle wifi state" + exit 0 + ;; +esac |
