[SOLVED] How to set "windows" key to standalone for shortcut
FedoraForum.org - Fedora Support Forums and Community
Results 1 to 9 of 9
  1. #1
    Join Date
    Aug 2009
    Location
    Minneapolis/St. Paul
    Age
    41
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Red face How to set "windows" key to standalone for shortcut

    Sorry if the title is enigmatic,

    I just installed F13. What I want to do is set a shortcut to gnome-terminal by pressing the "windows" key (Super_L). By default, F13 assigns this key as a modifier. This I do not want. How can I unset it as a modifier and set it as a standalone key (like a letter key)?

    Any help is much appreciated.
    Tony_Harrison

  2. #2
    Join Date
    Jul 2009
    Location
    England, UK
    Posts
    969
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How to set "windows" key to standalone for shortcut

    One way to do this is to use xmodmap to change the keyboard map.

    First, run
    Code:
    $ xev | grep keysym
    in a terminal, click on the xev window, and press your Windows key. Now go back to the terminal, and you should have something like
    Code:
        state 0x10, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
        state 0x50, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
    as output. Note the number that appears after "keycode" (133 for me).

    Now run
    Code:
    $ xmodmap -pke > ~/.xmodmaprc
    and open the file ~/.xmodmaprc with your favourite text editor, perhaps
    Code:
    $ gedit ~/.xmodmaprc
    Scroll down to the line starting with the right keycode (so "keycode 133 = " for me), and change what follows the '=' to what you want. You can check which names are available as "keysyms" (after the '=') by looking at the file `/usr/share/X11/XKeysymDB'.

    Now save ~/.xmodmaprc, and as a test, try
    Code:
    $ xmodmap ~/.xmodmaprc
    After that, your Windows key should generate the character you asked for.

    You need to get this change carried out every time you log in. I am not too sure how to do that using Gnome; perhaps others can help? For KDE, you can do that from System Settings -> Advanced -> Autostart.

    Hope that gets you started.

  3. #3
    Join Date
    Aug 2009
    Location
    Minneapolis/St. Paul
    Age
    41
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How to set "windows" key to standalone for shortcut

    I ran these commands and generated the .xmodmaprc file. While everything was exactly as mention in your post, I found that this did not change the behavior of the key.

    This is what I see when I run xmodmap alone:
    Code:
    $ xmodmap
    xmodmap:  up to 4 keys per modifier, (keycodes in parentheses):
    
    shift       Shift_L (0x32),  Shift_R (0x3e)
    lock        Caps_Lock (0x42)
    control     Control_L (0x25),  Control_R (0x69)
    mod1        Alt_L (0x40),  Alt_R (0x6c),  Meta_L (0xcd)
    mod2        Num_Lock (0x4d)
    mod3      
    mod4        Super_L (0x85),  Super_R (0x86),  Super_L (0xce),  Hyper_L (0xcf)
    mod5        ISO_Level3_Shift (0x5c),  Mode_switch (0xcb)
    mod4 seems to be the offender here. I can only assume that this entry designates Super_L as a modifier key. I don't know what file xmodmap is pulling these entries from, but would it be useful to remove the Super_L from mod4? Perhaps then the .xmodmap would take precedence.

    For further clarity, my goal is to set the Super_L key in System->Preferences->Keyboard Shortcut to trigger gnome-terminal. Presently, the key will not register unless I use it as a modifier (e.g. <Super_L>+T) If there is another way to get this done, let me know.

    Thanks for the response.
    Tony_Harrison

  4. #4
    Join Date
    Sep 2010
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How to set "windows" key to standalone for shortcut

    Tony,

    saw your post and was intrigued, good way to use those WIN keys. I followed the suggestions and came to the same conclusion as you did. Didn't work. So I dug around and goggled a bit and came up with a kludgey solution.

    From what I have gathered is that the “WIN” buttons are used as modifiers like “Shift”, “Alt”, and “Ctrl”. See the xmodmap output:

    Code:
    mod4        Super_L (0x85),  Super_R (0x86),  Super_L (0xce),  Hyper_L (0xcf)
    I am using this on a ASUS A2500 laptop with Fedora 13 and Gnome, and I only have a left WIN button or in xmodmap speak the “Super_L” button.

    First I removed “Super_L” from the “mod4” line using this:

    Code:
    /usr/bin/xmodmap -e 'remove mod4 = Super_L'
    Note: there needs to be spaces around the “=” sign.

    Can be easily verified by running xmodmap again, “Super_L” should NOT be in the “mod4” line.

    Next I opened System >> Preferences >> Keyboard Shortcuts and searched in the “Desktop” section for the “Run a terminal” entry and changed the shortcut key to “Super_L”.

    After that the left “WIN” button launched a terminal.

    Ok – it worked once – done! Not so fast. I do not want to set this up every time I login, so I made a shell script and opened System >> Preferences >> Startup Applications and added it to the list to be launched when logging in.

    Xkludge.sh
    Code:
    #!/bin/bash
    
    # Xkludge.sh
    # attempting to kludge in the Xmodmap stuff
    
    # remove our key from the mod4 line
    /usr/bin/xmodmap -e 'remove mod4 = Super_L'
    Now it is set up every time I log in. A neat way to use that button.

    Marriedto51's info is all correct and works. Its just that the Super_L button is defaulted to be a modifier key like Shift, Alt, and Ctrl. Once you remove it from the mod4 list then its just like any other key.

    Thank you both for the idea and the initial directions. I am also sure that there is a more elegant way to remove the Super_L key from the mod4 list.

    George

    P.S. I dual boot that laptop and did the exact same thing on Ubuntu 10.04 with Gnome.

  5. #5
    Join Date
    Aug 2007
    Location
    London Postbox (the red one)
    Age
    56
    Posts
    3,868
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How to set "windows" key to standalone for shortcut

    You should not need the script, it should hold after reboots anyway, mine does

    I did the below command as user and root thats it.

    xmodmap -e "remove mod4 = Super_L"

  6. #6
    Join Date
    Jul 2009
    Location
    England, UK
    Posts
    969
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How to set "windows" key to standalone for shortcut

    That's intriguing.

    What I suggested initially works for me (using Fedora 12 and KDE) without needing to remove Super_L from the mod4 list. (For example, I remapped keycode 133 to XF86Launch0, and then bound that key to an action using System Settings -> Keyboard and Mouse -> Global Keyboard Shortcuts.)

    Anyway, the key thing (sorry for the pun) is that you have it working now.

  7. #7
    Join Date
    Sep 2010
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How to set "windows" key to standalone for shortcut

    Very interesting!

    I just now removed the kludgey script from startup and rebooted; and the button still works and launches a terminal. However when I now attempt to assign the WIN ie. Super_L key in Keyboard Shortcuts it behaves like a modifier key. Which does make sense after all.

    So to assign a “MODx” key to a keyboard short cut it needs to NOT be a modifier key to do so. Once its assigned then it will just do its thing.

    Bye Bye kludgey script.

    Thank you dangermouse.

    I can only imagine that there are some underlying differences between F12/F13 and KDE/Gnome that would explain the different behaviors marrierto51 describes.

    Any way it works.

    Thank you all.

    George

  8. #8
    Join Date
    Aug 2009
    Location
    Minneapolis/St. Paul
    Age
    41
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up Re: How to set "windows" key to standalone for shortcut

    Thank you georgemc. This post is solved! You solution worked for me. I certainly hope that this will be helpful to users with a similar goal. Thanks again to everyone!
    Tony_Harrison

  9. #9
    Join Date
    Mar 2012
    Location
    UK
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How to set "windows" key to standalone for shortcut

    Hi all,
    This is a good question, indeed. So just to updating it purposes, I'm using (now) an English gb keyboard and wanted to set the win-Right key to be the Multi_key key (also known as the compose key). So that using that (in my case) with vowels or "~" (win-r+ aposthrophe + vowel or ~) produced out respectively á, é, í, ó, ú or ñ.

    I'm also using fedora 20 Xfce desktop (for furthering context references, if needed). So, as also explaiined here: http://forum.xfce.org/viewtopic.php?id=5995
    I only had to use de xmodmap command at home command line
    Code:
    $ xmodmap ~/.xmodmap
    then create a file called ".xmodmap" and put the following line in:
    Code:
    keycode 134 = Multi_key
    PS. as said somewhere, you can check, exactly, the keycode your system is submiting to by using the xev command at command line and hiting on the key you want to know the code about. Im my case the win-Right key code is 134.
    Code:
    $ xev
    That's it.
    Last edited by txell; 1st August 2014 at 01:55 PM. Reason: spelling

Similar Threads

  1. Can't use "windows" key as shortcut key
    By daviddoria in forum Using Fedora
    Replies: 19
    Last Post: 29th April 2018, 07:58 AM
  2. Replies: 3
    Last Post: 1st January 2009, 11:24 AM
  3. Replies: 10
    Last Post: 28th May 2008, 01:33 AM
  4. "Show Desktop" shortcut/icon?
    By ixlam in forum Using Fedora
    Replies: 3
    Last Post: 18th July 2007, 11:51 PM
  5. Replies: 0
    Last Post: 23rd May 2005, 04:59 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •