|
7 months ago | |
---|---|---|
README.org | 8 months ago | |
exwm-ss.el | 7 months ago |
README.org
EXWM-SS
EXWM-SS is a global minor mode which inhibits the screensaver automatically when watching videos. This fills a gap in EXWM, compared to other Linux DEs.
The default behavior is to inhibit the screensaver if:
- Any X client is fullscreen and visible (that is: not in a workspace which isn’t being displayed by some monitor).
-
A special X client is visible (even if it’s not fullscreen).
- Special clients are MPV, VLC, and Jellyfin Media Player, but this can be extended.
Installation
Use straight.el. You can install straight-weirdware to add the recipe, or install manually with:
(use-package exwm-ss
:defer t
:after exwm
:straight (exwm-ss :repo "https://codeberg.org/emacs-weirdware/exwm-ss.git")
:init
(exwm-ss-mode 1))
Use
Enable the mode:
(exwm-ss-mode 1)
Design
For maximum flexibility, EXWM-SS is factored out into several pieces:
-
Class
EXWM-SS
determines how the screensaver is inhibited.- Class
EXWM-SS--DPMS-COMMAND
is anEXWM-SS
implementation which usesxset(1)
to control DPMS screen blanking. - Class
EXWM-SS--XSCREENSAVER
is anEXWM-SS
implementation which callsxscreensaver-command -deactivate
every 60 seconds, to prevent it from activating.
- Class
-
Class
EXWM-SS-CONTROL
determines when the screensaver should (or should not) be activated.- It handles hooking into EXWM to pick up state change events.
- Generic function
EXWM-SS-INHIBITED?
determines whether the current WM state should cause the screensaver to be inhibited. - Class
EXWM-SS-BASE
is anEXWM-SS-CONTROL
implementation which contains the default logic for when the screensaver should be inhibited — visible fullscreen or visible special client.
- Class
EXWM-SS-CONTROL-DEFAULT
is the composite defaultEXWM-SS-CONTROL
implementation. It contains no logic of its own, and inherits fromEXWM-SS-CONTROL-BASE
,EXWM-SS--DPMS-COMMAND
, andEXWM-SS--XSCREENSAVER
. - Alternate controller classes may be specified by customizing
EXWM-SS-CONTROLLER-CLASS
. Your controller must inherit fromEXWM-SS-CONTROL
and mix in one or moreEXWM-SS
classes.
Example of Extending EXWM-SS
Say that you’d like the screensaver to be inhibited when a hypothetical new video player, Coolplayer, is visible.
First, create a new implementation of EXWM-SS-CONTROL
:
(defclass my-exwm-ss-control (exwm-ss-control-default)
()
:documentation "My personal `EXWM-SS-CONTROL' implementation.")
(cl-defmethod exwm-ss-special? ((ssc my-exwm-ss-control) buf)
(or (cl-call-next-method ssc buf)
(string= exwm-class-name "coolplayer")))
Then, customize EXWM-SS-CONTROLLER-CLASS
:
(use-package exwm-ss
:defer t
:after exwm
:straight (exwm-ss :repo "http://codeberg.org/ieure/exwm-ss.git")
:custom (exwm-ss-controller-class 'my-exwm-ss-control)
:init
(exwm-ss-mode 1))
If you need a new mechanism for disabling
screensavers, that can be done by creating an EXWM-SS
implementation, and declaring a new class which mixes it in:
(defclass my-exwm-ss-control (exwm-ss-control-base my-exwm-ss-screensaver-method)
())
Then set the controller class the same way.