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 | 198fa8e9cb94527733e09bc1b04c878320079520 (patch) | |
| tree | 7d089b166918a18f4e1a7d6af304689559ab6f14 /roles/hyprland | |
| parent | 018fdcb5a16b7a984a38c78d8715f5e05bad3137 (diff) | |
Refactor waybar/hyprland
Diffstat (limited to 'roles/hyprland')
| -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 | ||||
| -rw-r--r-- | roles/hyprland/meta/main.yml | 5 | ||||
| -rw-r--r-- | roles/hyprland/tasks/main.yml | 6 |
8 files changed, 117 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 diff --git a/roles/hyprland/meta/main.yml b/roles/hyprland/meta/main.yml index 9ef1205e..a657398b 100644 --- a/roles/hyprland/meta/main.yml +++ b/roles/hyprland/meta/main.yml @@ -3,11 +3,16 @@ dependencies: - role: "uwsm" - role: "greetd" - role: "nautilus" + - role: "alacritty" - role: "mako" - role: "pipewire" - role: "brightnessctl" - role: "ddcutil" - role: "font" + - role: "wlctl" + - role: "btop" + - role: "bluetui" + - role: "wiremix" - role: "waybar" - role: "clipse" - role: "tofi" diff --git a/roles/hyprland/tasks/main.yml b/roles/hyprland/tasks/main.yml index 61a693bf..07f121c9 100644 --- a/roles/hyprland/tasks/main.yml +++ b/roles/hyprland/tasks/main.yml @@ -100,9 +100,15 @@ dest: "{{ item.dest }}" mode: "0755" loop: + - src: "scripts/launch-tui" + dest: "/etc/hypr/scripts/launch-tui" - src: "scripts/brightness.sh" dest: "/etc/hypr/scripts/brightness.sh" - src: "scripts/volume.sh" dest: "/etc/hypr/scripts/volume.sh" - src: "scripts/sunset.sh" dest: "/etc/hypr/scripts/sunset.sh" + - src: "scripts/wifi.sh" + dest: "/etc/hypr/scripts/wifi.sh" + - src: "scripts/bluetooth.sh" + dest: "/etc/hypr/scripts/bluetooth.sh" |
