How do I bind left and right shifts simultaneous pressing

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How do I bind left and right shifts simultaneous pressing

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
[hidden email]
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
Reply | Threaded
Open this post in threaded view
|

Re: How do I bind left and right shifts simultaneous pressing

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

> On Apr 13, 2018, at 12:47 AM, York Zhao <[hidden email]> wrote:
>
> 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
> [hidden email]
> https://lists.nongnu.org/mailman/listinfo/stumpwm-devel

_______________________________________________
Stumpwm-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
Reply | Threaded
Open this post in threaded view
|

Re: How do I bind left and right shifts simultaneous pressing

York Zhao
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


On Fri, Apr 13, 2018 at 10:25 PM, David Bjergaard <[hidden email]> wrote:

> 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
>
>> On Apr 13, 2018, at 12:47 AM, York Zhao <[hidden email]> wrote:
>>
>> 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
>> [hidden email]
>> https://lists.nongnu.org/mailman/listinfo/stumpwm-devel

_______________________________________________
Stumpwm-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel