Vigilare is a DBus based service to inhibit system sleep for desktop users. I wrote this program because I need a status bar widget that allows me:
- to quickly adjust sleep inhibition time via mouse scroll
- see the accurate remaining time in the status bar
- has different ways to inhibit sleep
- inhibit sleep modes:
- xscreensaver
- logind
- xfce4 power manager
- xfce4 screensaver
- simulated mouse activity
- increase/decrease duration of inhibition
- set duration of inhibition
- monitor for real-time remaining inhibition time in json
- asynchronous, efficient, light on system resources
cargo build --release
cp target/release/vigilare ~/.local/bin
Here’s a sample eww widget just for reference:
(deflisten vigilare :initial
'{"active":false,"mode":null,"remaining_seconds":null,"message":""}'
`vigilare monitor`)
(defwidget vigilare-toggle []
(tooltip
(vigilare-toggle-tooltip)
(eventbox
:cursor "hand"
:onclick "(notify-send 'Display off in 2 secs'; sleep 2; xset dpms force off) &"
:onrightclick "(notify-send 'Suspending in 2 secs'; sleep 2; systemctl suspend) &"
:onscroll "test {} = up && vigilare msg +15m || vigilare msg -15m"
:class { vigilare.active ? "toggle-enabled" : "toggle-disabled" }
(box :space-evenly false
(label :visible {vigilare.mode!="null"} :text "${vigilare.mode}")
(label :visible {vigilare.message!=""} :text "/${vigilare.message}")))))
(defwidget vigilare-toggle-tooltip []
(box
:orientation "v"
:space-evenly false
(label :xalign 0 :text "Left-click: screen-off")
(label :xalign 0 :text "Right-click: suspend")
(label :xalign 0 :text "Scroll: adjust duration")))
You must start the dbus service with vigilare daemon
for the widget to function. I recommend starting it in your X session startup script or systemd user service. An example systemd user service is provided in the repository.
Run vigilare --help
for detailed usage information.