[STUMP] Lisp toggle code / xrandr projector control

<[email protected]>
Newsgroups gmane.comp.window-managers.stumpwm.devel
Message-ID <[email protected]>
Hi,

I am trying to find a good way to control output to a projector via
stumpwm and am thinking xrandr and a keybinding could be the best
option. So far, I have bounf to keys, one to toggle output on and one to
toggle off, but it would be nifty to only use one key that loops
different states (basically on/off, but possibly a way to loop through a
list of resolutions, alternatively choose between some available
resolutions after keypress if projector is off, otherwise just turn
output off). Unfortunately, my lisp skills are not supporting me in
this, so I am wondering if someone has an idea of how this can be done?

The code I am using now: 

,----
| (defcommand toggle-screen-out () ()                                                            |
| "Toggle to/from projector out."                                                                |
| (run-shell-command "xrandr --output DVI-1 --mode 832x624"))                                    |
| (defcommand toggle-screen-out-2 () ()                                                          |
| "Toggle to/from projector out."                                                                |
| (run-shell-command "xrandr --output DVI-1 --off"))                                             |
| (define-key *top-map* (kbd "s-SunPageUp") "toggle-screen-out") ; Turn on projector output      |
| (define-key *top-map* (kbd "s-SunPageDown") "toggle-screen-out-2") ; Turn off projector output |
`----


Many thanks!

/Johnny
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.