feat(hyprlua): tighten lid-lock, idle timer, and add caffeine eww widget
- caffeine: inhibit only `idle`, not `sleep`, so lid close still locks
- binds: lid-close unconditionally calls hyprlock; lid-open does dpms on
- hypridle: reduce lock timeout from 3 min to 2.5 min (150 s)
- eww (all 3 variants): add caffeine toggle button (☕/) with tooltip
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
main
parent
88f3b72343
commit
49ece6a238
|
|
@ -38,6 +38,7 @@
|
||||||
:value {round((1 - (EWW_DISK["/"].free / EWW_DISK["/"].total)) * 100, 0)}
|
:value {round((1 - (EWW_DISK["/"].free / EWW_DISK["/"].total)) * 100, 0)}
|
||||||
:onchange ""
|
:onchange ""
|
||||||
:onclick ""))
|
:onclick ""))
|
||||||
|
(caffeine)
|
||||||
(clock)
|
(clock)
|
||||||
(systray :class "music" :orientation "h" :spacing 2 :space-evenly true)
|
(systray :class "music" :orientation "h" :spacing 2 :space-evenly true)
|
||||||
))
|
))
|
||||||
|
|
@ -112,3 +113,12 @@
|
||||||
(defpoll disks :interval "600s"
|
(defpoll disks :interval "600s"
|
||||||
"~/Dotfiles/desktopenvs/hyprland/scripts/dysk-phydisks.sh")
|
"~/Dotfiles/desktopenvs/hyprland/scripts/dysk-phydisks.sh")
|
||||||
|
|
||||||
|
(defpoll caffeine-active :interval "2s"
|
||||||
|
"~/Dotfiles/desktopenvs/hyprlua/scripts/caffeine-status.sh")
|
||||||
|
|
||||||
|
(defwidget caffeine []
|
||||||
|
(button :class "music"
|
||||||
|
:onclick "~/Dotfiles/desktopenvs/hyprlua/scripts/caffeine.sh"
|
||||||
|
:tooltip {caffeine-active == "true" ? "Caffeine: ON" : "Caffeine: OFF"}
|
||||||
|
{caffeine-active == "true" ? "☕" : ""}))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@
|
||||||
|
|
||||||
(defwidget sidestuff []
|
(defwidget sidestuff []
|
||||||
(box :class "sidestuff" :orientation "h" :space-evenly false :halign "end"
|
(box :class "sidestuff" :orientation "h" :space-evenly false :halign "end"
|
||||||
|
(caffeine)
|
||||||
(clock)
|
(clock)
|
||||||
(systray :class "music" :orientation "h" :spacing 2 :space-evenly true)
|
(systray :class "music" :orientation "h" :spacing 2 :space-evenly true)
|
||||||
))
|
))
|
||||||
|
|
@ -159,3 +160,13 @@
|
||||||
|
|
||||||
(defpoll calender :interval "600s"
|
(defpoll calender :interval "600s"
|
||||||
"~/Dotfiles/desktopenvs/hyprland/scripts/calender-fix.sh")
|
"~/Dotfiles/desktopenvs/hyprland/scripts/calender-fix.sh")
|
||||||
|
|
||||||
|
(defpoll caffeine-active :interval "2s"
|
||||||
|
"~/Dotfiles/desktopenvs/hyprlua/scripts/caffeine-status.sh")
|
||||||
|
|
||||||
|
(defwidget caffeine []
|
||||||
|
(button :class "music"
|
||||||
|
:onclick "~/Dotfiles/desktopenvs/hyprlua/scripts/caffeine.sh"
|
||||||
|
:tooltip {caffeine-active == "true" ? "Caffeine: ON" : "Caffeine: OFF"}
|
||||||
|
{caffeine-active == "true" ? "☕" : ""}))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@
|
||||||
:onchange ""
|
:onchange ""
|
||||||
:onclick ""))
|
:onclick ""))
|
||||||
|
|
||||||
|
(caffeine)
|
||||||
(clock)
|
(clock)
|
||||||
(systray :class "music" :orientation "h" :spacing 2 :space-evenly true)
|
(systray :class "music" :orientation "h" :spacing 2 :space-evenly true)
|
||||||
))
|
))
|
||||||
|
|
@ -117,3 +118,12 @@
|
||||||
(defpoll disks :interval "600s"
|
(defpoll disks :interval "600s"
|
||||||
"~/Dotfiles/desktopenvs/hyprland/scripts/dysk-phydisks.sh")
|
"~/Dotfiles/desktopenvs/hyprland/scripts/dysk-phydisks.sh")
|
||||||
|
|
||||||
|
(defpoll caffeine-active :interval "2s"
|
||||||
|
"~/Dotfiles/desktopenvs/hyprlua/scripts/caffeine-status.sh")
|
||||||
|
|
||||||
|
(defwidget caffeine []
|
||||||
|
(button :class "music"
|
||||||
|
:onclick "~/Dotfiles/desktopenvs/hyprlua/scripts/caffeine.sh"
|
||||||
|
:tooltip {caffeine-active == "true" ? "Caffeine: ON" : "Caffeine: OFF"}
|
||||||
|
{caffeine-active == "true" ? "☕" : ""}))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ general {
|
||||||
# Presence detection resets the idle timer every 2 minutes while you're visible,
|
# Presence detection resets the idle timer every 2 minutes while you're visible,
|
||||||
# so these timeouts only run when you've actually stepped away.
|
# so these timeouts only run when you've actually stepped away.
|
||||||
listener {
|
listener {
|
||||||
timeout = 180 # 3 min — lock screen
|
timeout = 150 # 2.5 min — lock screen
|
||||||
on-timeout = loginctl lock-session
|
on-timeout = loginctl lock-session
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,8 @@ local winswitch = "" -- TODO: define your window switcher command
|
||||||
---- LID SWITCH ----
|
---- LID SWITCH ----
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
hl.bind("switch:on:Lid Switch", hl.dsp.exec_cmd("bash -c 'pidof hypridle > /dev/null && hyprlock'"), { locked = true })
|
hl.bind("switch:on:Lid Switch", hl.dsp.exec_cmd("hyprlock"), { locked = true })
|
||||||
hl.bind("switch:off:Lid Switch", hl.dsp.exec_cmd("hyprctl dispatch exec hyprlock"), { locked = true })
|
hl.bind("switch:off:Lid Switch", hl.dsp.exec_cmd("hyprctl dispatch dpms on"), { locked = true })
|
||||||
|
|
||||||
--------------------
|
--------------------
|
||||||
---- GESTURES ------
|
---- GESTURES ------
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/bash
|
||||||
|
PID_FILE="/tmp/caffeine-inhibit.pid"
|
||||||
|
[[ -f "$PID_FILE" ]] && kill -0 "$(cat "$PID_FILE")" 2>/dev/null && echo "true" || echo "false"
|
||||||
|
|
@ -7,7 +7,7 @@ if [[ -f "$PID_FILE" ]] && kill -0 "$(cat "$PID_FILE")" 2>/dev/null; then
|
||||||
rm -f "$PID_FILE"
|
rm -f "$PID_FILE"
|
||||||
notify-send -t 2000 "Caffeine" "Idle inhibit OFF"
|
notify-send -t 2000 "Caffeine" "Idle inhibit OFF"
|
||||||
else
|
else
|
||||||
systemd-inhibit --what=idle:sleep \
|
systemd-inhibit --what=idle \
|
||||||
--who="caffeine" \
|
--who="caffeine" \
|
||||||
--why="Caffeine mode active" \
|
--why="Caffeine mode active" \
|
||||||
--mode=block \
|
--mode=block \
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue