diff --git a/desktopenvs/hyprlua/eww-nobattery/eww.yuck b/desktopenvs/hyprlua/eww-nobattery/eww.yuck index b88e136..b41fd2d 100644 --- a/desktopenvs/hyprlua/eww-nobattery/eww.yuck +++ b/desktopenvs/hyprlua/eww-nobattery/eww.yuck @@ -38,6 +38,7 @@ :value {round((1 - (EWW_DISK["/"].free / EWW_DISK["/"].total)) * 100, 0)} :onchange "" :onclick "")) + (caffeine) (clock) (systray :class "music" :orientation "h" :spacing 2 :space-evenly true) )) @@ -112,3 +113,12 @@ (defpoll disks :interval "600s" "~/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" ? "☕" : "󰅺"})) + diff --git a/desktopenvs/hyprlua/eww-touch/eww.yuck b/desktopenvs/hyprlua/eww-touch/eww.yuck index 066ae5d..6413d1d 100644 --- a/desktopenvs/hyprlua/eww-touch/eww.yuck +++ b/desktopenvs/hyprlua/eww-touch/eww.yuck @@ -37,6 +37,7 @@ (defwidget sidestuff [] (box :class "sidestuff" :orientation "h" :space-evenly false :halign "end" + (caffeine) (clock) (systray :class "music" :orientation "h" :spacing 2 :space-evenly true) )) @@ -158,4 +159,14 @@ (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" ? "☕" : "󰅺"})) + diff --git a/desktopenvs/hyprlua/eww/eww.yuck b/desktopenvs/hyprlua/eww/eww.yuck index 69c5f14..bc39bd1 100644 --- a/desktopenvs/hyprlua/eww/eww.yuck +++ b/desktopenvs/hyprlua/eww/eww.yuck @@ -44,6 +44,7 @@ :onchange "" :onclick "")) + (caffeine) (clock) (systray :class "music" :orientation "h" :spacing 2 :space-evenly true) )) @@ -117,3 +118,12 @@ (defpoll disks :interval "600s" "~/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" ? "☕" : "󰅺"})) + diff --git a/desktopenvs/hyprlua/hypr/hypridle.conf b/desktopenvs/hyprlua/hypr/hypridle.conf index fbf07ba..8786b0d 100644 --- a/desktopenvs/hyprlua/hypr/hypridle.conf +++ b/desktopenvs/hyprlua/hypr/hypridle.conf @@ -9,7 +9,7 @@ general { # Presence detection resets the idle timer every 2 minutes while you're visible, # so these timeouts only run when you've actually stepped away. listener { - timeout = 180 # 3 min — lock screen + timeout = 150 # 2.5 min — lock screen on-timeout = loginctl lock-session } diff --git a/desktopenvs/hyprlua/hypr/usr/binds.lua b/desktopenvs/hyprlua/hypr/usr/binds.lua index 359d046..0a4a2e9 100644 --- a/desktopenvs/hyprlua/hypr/usr/binds.lua +++ b/desktopenvs/hyprlua/hypr/usr/binds.lua @@ -12,8 +12,8 @@ local winswitch = "" -- TODO: define your window switcher command ---- LID SWITCH ---- -------------------- -hl.bind("switch:on:Lid Switch", hl.dsp.exec_cmd("bash -c 'pidof hypridle > /dev/null && hyprlock'"), { locked = true }) -hl.bind("switch:off:Lid Switch", hl.dsp.exec_cmd("hyprctl dispatch exec 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 dpms on"), { locked = true }) -------------------- ---- GESTURES ------ diff --git a/desktopenvs/hyprlua/scripts/caffeine-status.sh b/desktopenvs/hyprlua/scripts/caffeine-status.sh new file mode 100755 index 0000000..3b86ea0 --- /dev/null +++ b/desktopenvs/hyprlua/scripts/caffeine-status.sh @@ -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" diff --git a/desktopenvs/hyprlua/scripts/caffeine.sh b/desktopenvs/hyprlua/scripts/caffeine.sh index b21cc27..84dab61 100755 --- a/desktopenvs/hyprlua/scripts/caffeine.sh +++ b/desktopenvs/hyprlua/scripts/caffeine.sh @@ -7,7 +7,7 @@ if [[ -f "$PID_FILE" ]] && kill -0 "$(cat "$PID_FILE")" 2>/dev/null; then rm -f "$PID_FILE" notify-send -t 2000 "Caffeine" "Idle inhibit OFF" else - systemd-inhibit --what=idle:sleep \ + systemd-inhibit --what=idle \ --who="caffeine" \ --why="Caffeine mode active" \ --mode=block \