summaryrefslogtreecommitdiffstats
path: root/roles
diff options
context:
space:
mode:
authorAhmed Abdelhalim <[email protected]>2026-02-20 15:40:27 +0100
committerAhmed Abdelhalim <[email protected]>2026-02-20 16:13:11 +0100
commit198fa8e9cb94527733e09bc1b04c878320079520 (patch)
tree7d089b166918a18f4e1a7d6af304689559ab6f14 /roles
parent018fdcb5a16b7a984a38c78d8715f5e05bad3137 (diff)
Refactor waybar/hyprland
Diffstat (limited to 'roles')
-rwxr-xr-xroles/hyprland/files/scripts/bluetooth.sh49
-rwxr-xr-xroles/hyprland/files/scripts/brightness.sh2
-rwxr-xr-xroles/hyprland/files/scripts/launch-tui (renamed from roles/waybar/files/waybar/scripts/launch-tui)0
-rwxr-xr-xroles/hyprland/files/scripts/sunset.sh4
-rwxr-xr-xroles/hyprland/files/scripts/volume.sh4
-rwxr-xr-xroles/hyprland/files/scripts/wifi.sh49
-rw-r--r--roles/hyprland/meta/main.yml5
-rw-r--r--roles/hyprland/tasks/main.yml6
-rwxr-xr-xroles/waybar/files/waybar/scripts/toggle-bt11
-rwxr-xr-xroles/waybar/files/waybar/scripts/toggle-wifi11
-rw-r--r--roles/waybar/meta/main.yml5
-rw-r--r--roles/waybar/tasks/main.yml14
-rw-r--r--roles/waybar/templates/waybar/config.jsonc.j215
13 files changed, 123 insertions, 52 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/waybar/files/waybar/scripts/launch-tui b/roles/hyprland/files/scripts/launch-tui
index 16efba9b..16efba9b 100755
--- a/roles/waybar/files/waybar/scripts/launch-tui
+++ b/roles/hyprland/files/scripts/launch-tui
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"
diff --git a/roles/waybar/files/waybar/scripts/toggle-bt b/roles/waybar/files/waybar/scripts/toggle-bt
deleted file mode 100755
index 1b9d4374..00000000
--- a/roles/waybar/files/waybar/scripts/toggle-bt
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/bash
-
-# Ensure bluetooth is unblocked
-rfkill unblock bluetooth
-
-# Better UI than rfkill toggle bluetooth
-if bluetoothctl show | grep -q "Powered: yes"; then
- bluetoothctl power off
-else
- bluetoothctl power on
-fi
diff --git a/roles/waybar/files/waybar/scripts/toggle-wifi b/roles/waybar/files/waybar/scripts/toggle-wifi
deleted file mode 100755
index 78e0699f..00000000
--- a/roles/waybar/files/waybar/scripts/toggle-wifi
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/bash
-
-# Ensure wifi is unblocked
-rfkill unblock wifi
-
-# Better UI than rfkill toggle wif
-if nmcli radio wifi | grep -q "enabled"; then
- nmcli radio wifi off
-else
- nmcli radio wifi on
-fi
diff --git a/roles/waybar/meta/main.yml b/roles/waybar/meta/main.yml
index 42bff5f1..2cc72e09 100644
--- a/roles/waybar/meta/main.yml
+++ b/roles/waybar/meta/main.yml
@@ -1,11 +1,6 @@
---
dependencies:
- role: "font"
- - role: "alacritty"
- - role: "btop"
- - role: "bluetui"
- - role: "wlctl"
- - role: "wiremix"
- role: "gnome-calendar"
galaxy_info:
author: "a14m"
diff --git a/roles/waybar/tasks/main.yml b/roles/waybar/tasks/main.yml
index 47f026be..40c730fb 100644
--- a/roles/waybar/tasks/main.yml
+++ b/roles/waybar/tasks/main.yml
@@ -34,17 +34,3 @@
dest: "/etc/xdg/waybar/config.jsonc"
- src: "waybar/style.css.j2"
dest: "/etc/xdg/waybar/style.css"
-
-- name: "Copy waybar scripts"
- become: true
- ansible.builtin.copy:
- src: "{{ item.src }}"
- dest: "{{ item.dest }}"
- mode: "0755"
- loop:
- - src: "waybar/scripts/toggle-bt"
- dest: "/etc/xdg/waybar/scripts/toggle-bt"
- - src: "waybar/scripts/toggle-wifi"
- dest: "/etc/xdg/waybar/scripts/toggle-wifi"
- - src: "waybar/scripts/launch-tui"
- dest: "/etc/xdg/waybar/scripts/launch-tui"
diff --git a/roles/waybar/templates/waybar/config.jsonc.j2 b/roles/waybar/templates/waybar/config.jsonc.j2
index 953230cb..e3dc54bb 100644
--- a/roles/waybar/templates/waybar/config.jsonc.j2
+++ b/roles/waybar/templates/waybar/config.jsonc.j2
@@ -47,6 +47,7 @@
"on-click-right": "uwsm-app -- gnome-calendar"
},
"network": {
+ "tooltip": true,
"format-icons": ["󰤯", "󰤟", "󰤢", "󰤥", "󰤨"],
"format": "{icon}",
"format-wifi": "{icon}",
@@ -57,10 +58,11 @@
"tooltip-format-disconnected": "Disconnected",
"interval": 5,
"spacing": 1,
- "on-click": "/etc/xdg/waybar/scripts/toggle-wifi",
- "on-click-right": "/etc/xdg/waybar/scripts/launch-tui wlctl"
+ "on-click": "/etc/hypr/scripts/wifi.sh --toggle",
+ "on-click-right": "/etc/hypr/scripts/launch-tui wlctl"
},
"bluetooth": {
+ "tooltip": true,
"format-on": "󰂯",
"format-off": "󰂲",
"format-disabled": "󰂲",
@@ -68,10 +70,11 @@
"format-no-controller": "",
"tooltip-format-connected": "Devices connected: {num_connections}\n{device_enumerate}",
"tooltip-format-enumerate-connected": "- {device_alias}\t{device_battery_percentage}% 󰂁",
- "on-click": "/etc/xdg/waybar/scripts/toggle-bt",
- "on-click-right": "/etc/xdg/waybar/scripts/launch-tui bluetui"
+ "on-click": "/etc/hypr/scripts/bluetooth.sh --toggle",
+ "on-click-right": "/etc/hypr/scripts/launch-tui bluetui"
},
"pulseaudio": {
+ "tooltip": true,
"format": "{icon}",
"tooltip-format": "Volume: {volume}% {icon}",
"scroll-step": 5,
@@ -79,8 +82,8 @@
"format-icons": {
"default": ["", "", ""]
},
- "on-click": "pamixer -t",
- "on-click-right": "/etc/xdg/waybar/scripts/launch-tui wiremix"
+ "on-click": "/etc/hypr/scripts/volume.sh --toggle-mute-vol",
+ "on-click-right": "/etc/hypr/scripts/launch-tui wiremix"
},
"backlight": {
"device": "intel_backlight",