stumpwm-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[STUMP] Lisp toggle code / xrandr projector control


From: yggdrasil
Subject: [STUMP] Lisp toggle code / xrandr projector control
Date: Thu, 01 May 2014 17:15:59 +0200
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3 (gnu/linux)

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]