Difference between revisions of "Synergy"

From WTFwiki
Jump to navigation Jump to search
 
Line 1: Line 1:
== Map Alt_R to Super_L w/setxkbmap ==
+
== Map Alt_R to Super_L ==
=== Quick/Easy Way ===
+
=== Quick/Easy Way (xmodmap) ===
 
This method works for the basic case, but somehow fails to send the correct event when combined with other keys, like "Alt_R+Space" sends "Alt_L"?  Use the "Hard Way" if this is a problem.
 
This method works for the basic case, but somehow fails to send the correct event when combined with other keys, like "Alt_R+Space" sends "Alt_L"?  Use the "Hard Way" if this is a problem.
 
   $ xmodmap -e "keysym Alt_R = Super_L"
 
   $ xmodmap -e "keysym Alt_R = Super_L"
  
=== Hard Way ===
+
=== Hard Way (setxkbmap) ===
 
* Upstream code located at: https://github.com/xkbcommon/libxkbcommon
 
* Upstream code located at: https://github.com/xkbcommon/libxkbcommon
 
* Files on disk located at: /usr/share/X11/xkb/{symbols/altwin,rules/evdev}
 
* Files on disk located at: /usr/share/X11/xkb/{symbols/altwin,rules/evdev}

Latest revision as of 20:00, 3 February 2022

Map Alt_R to Super_L

Quick/Easy Way (xmodmap)

This method works for the basic case, but somehow fails to send the correct event when combined with other keys, like "Alt_R+Space" sends "Alt_L"? Use the "Hard Way" if this is a problem.

 $ xmodmap -e "keysym Alt_R = Super_L"

Hard Way (setxkbmap)

(ins)^:jontow@phoenix:~/GIT-external/libxkbcommon/test/data/symbols$ git diff
diff --git a/test/data/rules/evdev b/test/data/rules/evdev
index e949490..890deaf 100644
--- a/test/data/rules/evdev
+++ b/test/data/rules/evdev
@@ -970,6 +970,8 @@
   altwin:hyper_win     =       +altwin(hyper_win)
   altwin:alt_super_win =       +altwin(alt_super_win)
   altwin:swap_lalt_lwin        =       +altwin(swap_lalt_lwin)
+  altwin:swap_ralt_lwin        =       +altwin(swap_ralt_lwin)
+  altwin:swap_ralt_rwin        =       +altwin(swap_ralt_rwin)
   altwin:swap_alt_win  =       +altwin(swap_alt_win)
   altwin:prtsc_rwin    =       +altwin(prtsc_rwin)
   grab:debug           =       +srvr_ctrl(grab_debug)
diff --git a/test/data/symbols/altwin b/test/data/symbols/altwin
index 038456b..354700c 100644
--- a/test/data/symbols/altwin
+++ b/test/data/symbols/altwin
@@ -114,6 +114,14 @@ xkb_symbols "swap_ralt_rwin" {
     key <RWIN> { [ Alt_R, Meta_R ] };
 };
 
+// Swap the right Alt and Super_L.
+hidden partial modifier_keys
+xkb_symbols "swap_ralt_lwin" {
+    key <RALT> { type[Group1] = "ONE_LEVEL",
+                 symbols[Group1] = [ Super_L ] };
+    key <RWIN> { [ Alt_R, Meta_R ] };
+};
+
 // Win is mapped to the PrtSc key (and the usual Win key).
 partial modifier_keys
 xkb_symbols "prtsc_rwin" {

Once patched, use with setxkbmap(1):

 $ setxkbmap -option altwin:swap_ralt_lwin