Wednesday, October 02, 2024

Re: CWM + Monitor Shutoff

On Wed, 02 Oct 2024 07:12:31 -0400
David Anthony <dma@silentsystems.org> wrote:

> Thank you for the suggestions, misc. 
>
> xset -dpms did not seem to work
> xset s noblank seems to partially work. Instead of my screen going
> black - it now goes white-greyish
>
> Nonetheless the screen is now covered and whichever applications I was
> using are no longer visible due to the screen being blanked out Does
> anyone have further suggestions?
>


Let me just copy-paste the macro I wrote in common lisp for my StumpWM
Config. I think you are looking for a couple things:

Try these:

$ xset s noblank (disables screen blanking)
$ xset s off (disables automatic screen turnoff)
$ xset -dpms (disables automatic screen power saving)

This is the toggle macro system I hacked together in common lisp. IDK
how much lisp you know, so might be useful for reference for CWM? IDK
ymmv.

(defun make-toggle-function (command-pair &optional (inverse nil))
"Returns a function that toggles between executing the first and
second command in COMMAND-PAIR. If INVERSE is true, the initial state
is considered 'on'. The command is executed in a separate thread."
(let ((state inverse)) ; Initially 'on' if inverse is true,
otherwise 'off' (lambda ()
(setf state (not state))
(let ((command (if state (first command-pair) (second
command-pair)))) (bt:make-thread
(lambda ()
(run-shell-command-safely command))
:name (format nil "Toggle-Thread-~A" command))
state))))

(defmacro define-toggle-command (name commands inverse description)
"Defines a StumpWM command that toggles a set of commands and
displays the current state." (let ((commands-var (gensym "COMMANDS-")))
`(progn
(defparameter ,commands-var ',commands)
(let ((toggle-functions (mapcar (lambda (pair)
(make-toggle-function pair ,inverse)) ,commands-var)))
(defcommand ,name () ()
,description
(let ((new-states (mapcar #'funcall toggle-functions)))
(message ,(format nil "~a mode: ~~a" (string-capitalize
(symbol-name name))) (if (some #'identity new-states) "Enabled"
"Disabled"))))))))

;;;
;; The commands
;;;

;; toggles
(define-toggle-command toggle-powersave
(("xset s on" "xset s off")
("xset s blank" "xset s noblank")
("xset +dpms" "xset -dpms"))
t
"Toggle power-saving mode and display the current state.")


--
-iz (they/them)

> i like to say mundane things,
> there are too many uninteresting things
> that go unnoticed.

izder456 (dot) neocities (dot) org

No comments:

Post a Comment