more to be fix on niri

This commit is contained in:
2025-10-05 04:56:05 +02:00
parent 01c6e70dab
commit 22955ec73d
29 changed files with 478 additions and 28 deletions

View File

@@ -17,7 +17,7 @@
"custom/mediaplayer"
],
"modules-center": ["clock"],
"modules-right": ["group/monitors", "custom/separator", "group/tray-expander", "idle_inhibitor", "custom/power"],
"modules-right": ["group/monitors", "custom/separator", "group/tray-expander", "custom/caffeine", "custom/power"],
// -------------------------------------------------------------------------
// Modules
// -------------------------------------------------------------------------
@@ -53,6 +53,21 @@
"min-length": 2,
"max-length": 2
},
"custom/caffeine": {
"format": "{icon}",
"format-icons": {
"active": "",
"inactive": ""
},
"return-type": "json",
"interval": "once",
"exec": "$HOME/.config/waybar/modules/caffeine.sh",
"on-click": "$HOME/.config/waybar/modules/caffeine.sh toggle && sleep 0.2",
"exec-on-event": true,
"tooltip": false,
"min-length": 2,
"max-length": 2
},
// Time and Date
"clock": {
"format": "{:%H:%M | %e %b}",
@@ -166,7 +181,7 @@
"max-length": 6,
"min-length": 6
},
// Hyprland
// Niri
"group/workspaceactions": {
"modules": ["niri/workspaces", "custom/workspacenew"],
"orientation": "inherit"

31
waybar-niri/modules/caffeine.sh Executable file
View File

@@ -0,0 +1,31 @@
#!/bin/env bash
function output() {
jq -n --unbuffered --compact-output \
--arg alt "$1" \
--arg class "$2" \
'{alt: $alt, class: [$class]}'
}
if [ "$1" = "toggle" ]; then
pid=$(pgrep -x "swayidle")
if [ -n "$pid" ]; then
killall swayidle > /dev/null 2>&1
notify-send "Caffeine enabled" "POWERRR!!!"
else
nohup niri-swayidle > /dev/null 2>&1 &
notify-send "Caffeine disabled" "zzz..."
fi
exit 0
fi
# sleep 0.2 # Allow hypridle to start
pid=$(pgrep -x "swayidle")
if [ -n "$pid" ]; then
output "inactive" "inactive"
else
output "active" "active"
fi

View File

@@ -45,6 +45,7 @@ tooltip {
#tray,
#custom-rofi,
#idle_inhibitor,
#custom-caffeine,
#custom-power {
padding: 0px 10px;
}
@@ -55,6 +56,7 @@ tooltip {
}
#custom-rofi,
#custom-caffeine
#idle_inhibitor,
#custom-power,
#custom-expand-icon {
@@ -168,14 +170,17 @@ window#waybar.empty #window {
color: @green;
}
#custom-caffeine,
#idle_inhibitor {
color: @yellow;
}
#custom-caffeine:hover,
#idle_inhibitor:hover {
background-color: alpha(@yellow, 0.3);
}
#custom-caffeine.active,
#idle_inhibitor.activated {
color: @peach;
}

View File

@@ -45,6 +45,7 @@ tooltip {
#tray,
#custom-rofi,
#idle_inhibitor,
#custom-caffeine,
#custom-power {
padding: 0px 10px;
}
@@ -55,6 +56,7 @@ tooltip {
}
#custom-rofi,
#custom-caffeine
#idle_inhibitor,
#custom-power,
#custom-expand-icon {
@@ -168,14 +170,17 @@ window#waybar.empty #window {
color: @green;
}
#custom-caffeine,
#idle_inhibitor {
color: @yellow;
}
#custom-caffeine:hover,
#idle_inhibitor:hover {
background-color: alpha(@yellow, 0.3);
}
#custom-caffeine.active,
#idle_inhibitor.activated {
color: @peach;
}