Discussion:
[STUMP] How do I bind left and right shifts simultaneous pressing
York Zhao
2018-04-13 04:47:39 UTC
Permalink
Hi List,

I would like to be able to toggle keyboard layout between DWERT and DVORAK
by pressing both left and right SHIFT keys. I've already written the
following command to do this. However, I'm not sure how to bind this
command to pressing both SHIFT in Stumpwm.

(defcommand set-kbd-layout (layout) ()
"Set keyboard layout"
(setf layout (cdr (assoc layout '(("qwert" . "qwert")
("dvorak" . "dvorak,"))
:test 'equal)))
(when layout
(run-shell-command (concatenate 'string "setxkbmap -variant " layout))))

Thanks,
David Bjergaard
2018-04-14 02:25:13 UTC
Permalink
I will play with this a bit but I don’t know if stumpwm is set up to respond to two modifier keys pressed to trigger a keybinding.

David
Post by York Zhao
Hi List,
I would like to be able to toggle keyboard layout between DWERT and DVORAK by pressing both left and right SHIFT keys. I've already written the following command to do this. However, I'm not sure how to bind this command to pressing both SHIFT in Stumpwm.
(defcommand set-kbd-layout (layout) ()
"Set keyboard layout"
(setf layout (cdr (assoc layout '(("qwert" . "qwert")
("dvorak" . "dvorak,"))
:test 'equal)))
(when layout
(run-shell-command (concatenate 'string "setxkbmap -variant " layout))))
Thanks,
_______________________________________________
Stumpwm-devel mailing list
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
York Zhao
2018-04-14 16:53:37 UTC
Permalink
Thank you very much David. I've found a way to do this first making
Shift_R + Shift_L available as F21
inX11:

xmodmap -e "clear Shift"
xmodmap -e "add Shift = Shift_R"
xmodmap -e "keycode 50 = Shift_L F21 NoSymbol"
xmodmap -e "keycode 62 = Shift_R F21 NoSymbol"

Then bind "F21":

(define-key *top-map* (kbd "F21") "toggle-kbd-layout")
The only problem is that I have to press right shift first, and press
left shift while keep holding the right shift,
but can't do it the other way around by pressing and holding left shift first.

York
Post by David Bjergaard
I will play with this a bit but I don’t know if stumpwm is set up to respond to two modifier keys pressed to trigger a keybinding.
David
Post by York Zhao
Hi List,
I would like to be able to toggle keyboard layout between DWERT and DVORAK by pressing both left and right SHIFT keys. I've already written the following command to do this. However, I'm not sure how to bind this command to pressing both SHIFT in Stumpwm.
(defcommand set-kbd-layout (layout) ()
"Set keyboard layout"
(setf layout (cdr (assoc layout '(("qwert" . "qwert")
("dvorak" . "dvorak,"))
:test 'equal)))
(when layout
(run-shell-command (concatenate 'string "setxkbmap -variant " layout))))
Thanks,
_______________________________________________
Stumpwm-devel mailing list
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
Loading...