Кастомный idle_inhibitor в waybar
This commit is contained in:
1 parent
f246666ced
commit
32a03c747c
4 files changed
+39
-14
No files matched your search
@@ -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": {
|
||||
|
||||
+26
@@ -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
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
Reference in new issue
Block a user