0

This is the result of xmodmap -pm:

control     Control_L (0x25),  Control_L (0x42),  Control_R (0x69), Control_L (0x85),  Control_R (0x86)
mod4        Super_L (0xce),  Hyper_L (0xcf)

I have this .xmodmap:

clear mod4
add control = Super_L

After I run this, it changes my command modifier list, but the windows key doesn't actually behave as control. Why? Can I fix this?

  • which windows manager do you use? default WM uses wayland, so do you use xorg or not? – MolbOrg Mar 21 '17 at 08:17
  • I was not able to find my windows manager. default for fedora 25 I think – user2889981 Mar 21 '17 at 15:15
  • from the [answer](http://unix.stackexchange.com/a/167959/64187) - for your case try 'setxkbmap -option ctrl:swap_lwin_lctl' – MolbOrg Mar 21 '17 at 21:24
  • after that command I got of xmodmap -pm: control Control_R (0x69), Control_L (0x85) mod4 Super_L (0x25), Super_R (0x86), Super_L (0xce), Hyper_L (0xcf) so looks like it changed nothing. I also tried this option: altwin:ctrl_win. The same result – user2889981 Mar 22 '17 at 08:49

3 Answers3

1

As mentioned by @user2889981 in https://superuser.com/a/1193894/1032352, it can be done in Gnome Tweaks app. In Fedora 29 it's in Keyboard & Mouse > Additional Layout Options (button next to Overview Shortcut) > Ctrl position > check next to Swap Left Win with Left Ctrl

sudodoki
  • 11
  • 1
0

Ok, on my system

Version

~$cat /etc/fedora-release 
Fedora release 25 (Twenty Five)

Window manager

~$env | grep -i desktop
DESKTOP_SESSION=gnome
GNOME_DESKTOP_SESSION_ID=this-is-deprecated
XDG_SESSION_DESKTOP=gnome
XDG_CURRENT_DESKTOP=GNOME

Keyboard settings

~$setxkbmap -print
xkb_keymap {
    xkb_keycodes  { include "evdev+aliases(qwerty)" };
    xkb_types     { include "complete"  };
    xkb_compat    { include "complete"  };
    xkb_symbols   { include "pc+us+ru:2+us:3+inet(evdev)"   };
    xkb_geometry  { include "pc(pc105)" };
};

with more or less accurate physical representation of the keyboard (PC105) enter image description here

The command

setxkbmap -option altwin:ctrl_win

replaces 'win' key and makes it 'ctrl' key.

What has been changed after the executions is

~$setxkbmap -print
xkb_keymap {
    xkb_keycodes  { include "evdev+aliases(qwerty)" };
    xkb_types     { include "complete"  };
    xkb_compat    { include "complete"  };
    xkb_symbols   { include "pc+us+ru:2+us:3+inet(evdev)+altwin(ctrl_win)"  };
    xkb_geometry  { include "pc(pc105)" };
};

I have one display, setxkbmap have display and device options, it may be important.

to clear options 'setxkbmap -option'
to restore options later seems to be better to use 'setxkbmap -query' instead of 'setxkbmap -print' before

more sophisticated replacement tricks with setxkbmap in the answer Adding custom setxkbmap options and in the complicated article.

Other possible replacements, according to the answer from Rebind Alt key to win using setxkbmap? are available to see with:

grep alt /usr/share/X11/xkb/rules/evdev.lst | grep win
MolbOrg
  • 212
  • 2
  • 9
  • this is my keyboard: http://www.lenovo.com/images/gallery/1060x596/lenovo-laptop-ideapad-510s-14-red-keyboard-3.jpg. everything else is like yours. that option doesn't work – user2889981 Mar 22 '17 at 15:19
  • @user2889981 interesting, my is lenovo g570. Does the key something at all for you - in gnome default action is to show desktops and that application shortcuts. Try to bind the key for any action - does it work - in settings keyboard. – MolbOrg Mar 22 '17 at 15:32
  • @user2889981 also try the to check the key code like in the [answer](https://superuser.com/a/834336/312809) , my gets 133 – MolbOrg Mar 22 '17 at 15:36
  • I disabled default action for it. the code 133 is like for you – user2889981 Mar 22 '17 at 15:37
  • I enabled it now. tried again your solution. doesn't work – user2889981 Mar 22 '17 at 15:39
  • I'm not able to bind this key to any action. When I press it it is not get selected as hot key – user2889981 Mar 22 '17 at 15:42
  • @user2889981 For me it does not matter is default action enabled or not, when applied default action just stops working, when I reset the setxkbmap options it just starts working gnome way again. Yes, not assigning to actions seems to be normal behaviour. what 'setxkbmap -query' shows you? – MolbOrg Mar 22 '17 at 15:48
  • $ setxkbmap -query rules: evdev model: pc105 layout: us – user2889981 Mar 22 '17 at 15:53
  • @user2889981 after applying 'setxkbmap -option altwin:ctrl_win' try 'xev | grep key' what it shows you - mine detects pressing ctrl and winkey like 'state 0x4, keycode 37 (keysym 0xffe3, Control_L), same_screen YES' and 'state 0x0, keycode 133 (keysym 0xffe3, Control_L), same_screen YES, XKeysymToKeycode returns keycode: 37' – MolbOrg Mar 22 '17 at 15:54
  • and after I execute your command: rules: evdev model: pc105 layout: us options: altwin:ctrl_win – user2889981 Mar 22 '17 at 15:54
  • xev | grep key returns the same as for you – user2889981 Mar 22 '17 at 15:58
  • @user2889981 hm, how do you check then if it works as ctrl or not - I press win+a - to see if it works as ctrl-a, and other hotkeys ctrl-hotkeys I use. But seems to be interesting magic – MolbOrg Mar 22 '17 at 16:01
  • I tried ctr-r and win-r in konsole to search in history. also tried ctrl-a – user2889981 Mar 22 '17 at 16:15
  • @user2889981 works for me in gnome console. I'm out of ideas then at the moment. – MolbOrg Mar 22 '17 at 23:10
-1

I was able to do that with gnome-tweak-tool. There is an option there in Typing section. in 'Ctrl key position' section select checkbox 'Swap Left Win key with Left Ctrl key'