diff --git a/Configs/.config/waybar/config.jsonc b/Configs/.config/waybar/config.jsonc index d13b1aa..3006ef4 100644 --- a/Configs/.config/waybar/config.jsonc +++ b/Configs/.config/waybar/config.jsonc @@ -11,7 +11,7 @@ // Positions "modules-left": [ - "idle_inhibitor", + "custom/idle_inhibitor", "hyprland/workspaces", // workspaces "hyprland/window" // window title ], @@ -38,13 +38,12 @@ // Left modules - "idle_inhibitor": { - "format": "  ", + "custom/idle_inhibitor": { + "exec": "~/.config/waybar/scripts/idle-inhibitor.sh", + "on-click": "~/.config/waybar/scripts/idle-inhibitor.sh --toggle", + "return-type": "json", "tooltip": true, - "tooltip-format-activated": "Presentation Mode", - "tooltip-format-deactivated": "Idle Mode", - "start-activated": false, - "timeout": 5 + "interval": 10 }, "hyprland/workspaces": { diff --git a/Configs/.config/waybar/scripts/idle-inhibitor.sh b/Configs/.config/waybar/scripts/idle-inhibitor.sh new file mode 100755 index 0000000..dd6bcca --- /dev/null +++ b/Configs/.config/waybar/scripts/idle-inhibitor.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +PID_FILE="$HOME/.cache/idle_inhibit.pid" + +toggle() { + if [[ -f "$PID_FILE" ]] && kill -0 "$(cat "$PID_FILE")" 2>/dev/null; then + kill "$(cat "$PID_FILE")" + rm -f "$PID_FILE" + else + systemd-inhibit --what=idle:sleep --why="Manual Idle Inhibit" sleep infinity & + echo $! > "$PID_FILE" + fi +} + +status_json() { + if [[ -f "$PID_FILE" ]] && kill -0 "$(cat "$PID_FILE")" 2>/dev/null; then + echo '{"text":"  ","tooltip":"Idle Inhibitor: On"}' + else + echo '{"text":"  ","tooltip":"Idle Inhibitor: Off"}' + fi +} + +case "$1" in + --toggle) toggle ;; + *) status_json ;; +esac diff --git a/Configs/.config/waybar/styles.css b/Configs/.config/waybar/styles.css index b045eda..c99c56d 100644 --- a/Configs/.config/waybar/styles.css +++ b/Configs/.config/waybar/styles.css @@ -11,11 +11,11 @@ } window#waybar { - background: @background; + background: transparent; } window#waybar > box { - margin-top: 4px; + margin: 6px 4px 0 4px; } /* -- Tooltip Styling -- */ @@ -29,7 +29,7 @@ tooltip { } /* -- General Module Styling -- */ -#idle_inhibitor, +#custom-idle_inhibitor, #workspaces, #window, #custom-cpuinfo, @@ -55,7 +55,7 @@ tooltip { /* -- Left Modules -- */ /* Idle Inhibitor */ -#idle_inhibitor { +#custom-idle_inhibitor { background: @logo; margin-left: 6px; padding-right: 7px; diff --git a/Configs/.config/waybar/theme.css b/Configs/.config/waybar/theme.css index 6503fc7..5ca3f6f 100644 --- a/Configs/.config/waybar/theme.css +++ b/Configs/.config/waybar/theme.css @@ -1,5 +1,5 @@ /* General */ -@define-color background rgba(0, 0, 0, 0); +@define-color background rgba(35, 35, 35, 0.95); @define-color foreground rgba(200, 200, 200, 1.0); @define-color hover rgba(200, 200, 200, 0.2); @@ -10,7 +10,7 @@ @define-color hover-fg rgba(200, 200, 200, 1.0); /* Modules */ -@define-color module-bg rgba(40, 40, 40, 0.95); +@define-color module-bg rgba(37, 37, 37, 0.95); /* Left */ @define-color tooltip @module-bg; @@ -35,4 +35,4 @@ @define-color power-profiles @module-bg; @define-color battery @module-bg; @define-color power @module-bg; -@define-color power-hv rgba(55, 55, 55, 1); +@define-color power-hv rgba(50, 50, 50, 1);