Git Product home page Git Product logo

ksuperkey's Introduction

KSUPERKEY

ksuperkey allows you to open the application launcher in desktop environments such as KDE Plasma < 5.8 and Xfce using the Super key (also known as "Meta" or "the Windows key"). If you hold down the Super key it will still act as a modifier key, allowing you to use it for other keyboard shortcuts.

ksuperkey is a small desktop-agnostic application that runs in the background as a daemon under X11. It does not work under Wayland. ksuperkey was forked from xcape created by Albin Olsson: https://github.com/alols/xcape

Plasma 5.8 and above: This feature is supported by default in Plasma 5.8 and above. However, ksuperkey may still be useful to map modifier keys (such as the Super key) to arbitrary keyboard shortcuts. If you want to use ksuperkey to map the Super key in Plasma > 5.8, make sure to disable the Plasma mapping by modifying ~/.config/kwinrc to:

[ModifierOnlyShortcuts]
Meta=

Installation

For a list of distribution-specific packages, please see the ksuperkey page in the KDE Store. Below are some generic instructions for how to compile ksuperkey from source.

  1. Install dependencies.

    Ubuntu:

    $ sudo apt-get install git gcc make libx11-dev libxtst-dev pkg-config
    

    CentOS:

    $ sudo yum install git gcc make libX11-devel libXtst-devel pkgconfig
    

    On some systems you also need to install the build-essential (or equivalent) package.

  2. Clone project and compile:

    $ git clone https://github.com/hanschen/ksuperkey.git
    $ cd ksuperkey
    $ make
    
  3. Install system-wide using e.g. sudo (optional):

    $ sudo make install
    
  4. Launch ksuperkey. Make sure that the shortcut for the application launcher is set to Alt+F1.

Usage

$ ksuperkey [-d] [-t <timeout ms>] [-e <map-expression>]

-d

Debug mode. Does not fork into the background.

-t <timeout ms>

If you hold a key longer than this timeout, ksuperkey will not generate a key event. Default is 500 ms.

-e <map-expression>

The expression has the grammar 'ModKey=Key[|OtherKey][;NextExpression]'

The list of key names is found in the header file X11/keysymdef.h (remove the XK_ prefix). Note that due to limitations of X11 shifted keys must be specified as a shift key followed by the key to be pressed rather than the actual name of the character. For example to generate "{" the expression 'ModKey=Shift_L|bracketleft' could be used (assuming that you have a key with "{" above "[").

You can also specify ModKey in decimal (prefix #), octal (#0), or hexadecimal (#0x). It will be interpreted as a keycode unless no corresponding key name is found.

Example 1

ksuperkey

Makes left Super key generate Alt+F1 when pressed and released on its own (does not affect existing keyboard combinations using the Super key).

Example 2

ksuperkey -e 'Control_L=Escape;Super_L=Alt_L|F2'

This will make Left Control generate Escape when pressed and released on its own, and Left Super generate Alt+F2 combination when pressed and released on its own.

Note regarding xmodmap

If you are in the habit of remapping keycodes to keysyms (e.g. using xmodmap), there are two issues you may encounter:

  1. You will need to restart ksuperkey after every time you modify the mapping from keycodes to keysyms (e.g. with xmodmap), or ksuperkey will still use the old mapping.

  2. The key you wish to send must have a defined keycode. So for example, with Control_L=Escape, you need an Escape key defined in your xmodmap mapping. (A workaround is to use 255, which some keyboards cannot send.)

Contact

Find the latest version at https://github.com/hanschen/ksuperkey

The author can be reached at contact at hanschen dot org

ksuperkey's People

Contributors

alols avatar atykhonov avatar calmofthestorm avatar davidshepherd7 avatar dexterthedragon avatar dhouck avatar hanschen avatar joetw avatar johnhill avatar mar04 avatar mehanik avatar mortal avatar otommod avatar phy1729 avatar polachok avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ksuperkey's Issues

Usefull also on plasma 5.8

Actually this small program is also useful on plasma 5.8.
I suggest to change the documentation to add the following use case

For example if you want to assign the super key to a different action than the ALT+F1 / run application launcher

In my case I wanted to show desktop (Control + F12) with the super key, so remove the association ALT+F1 to the launcher and then ksuperkey -e 'Super_L=Control_L|F12'

Doesn't work with key press in Plasma 5.8.4, need to hold super key for about a second

system info

Installed from https://launchpad.net/~kubuntu-ppa/+archive/ubuntu/backports.

Debug output when pressing super key:

Intercepted key event 2, key code 133
Key pressed!
Intercepted key event 3, key code 133
Key released!
Generating Alt_L!
Generating F1!
Ignoring generated event.
Ignoring generated event.
Ignoring generated event.
Ignoring generated event.

Debug output when holding super key for about a second:

Intercepted key event 2, key code 133
Key pressed!
Intercepted key event 3, key code 133
Key released!

Don't work in wayland

I understand the reason behind this and if you won't/can't do anything with it, just write "Don't work in Wayland" in description.

include dependencies in README.md

Thank you very much for this wonderful little utility that is still invaluable in (nearly) 2015!

Just my $.02: would be helpful perhaps to include a list of dependencies in the readme to make compilation more easy:

e.g.

For Fedora-based systems, need:

  • development version of xtst library: sudo yum install libXtst-devel

For Ubuntu-based systems, need:

  • development version of xtst library: sudo apt-get install libxtst-dev

Adding Super_R support?

Some keyboards have Super_R ḱey in addition to Super_L key. Yesterday I helped a friend of mine to set up this program for his KDE installation. However, he still can't use his Super_R key since there are no support for it provided by this program.

Have you considered on adding proper Super_R support (like alt+F2 key combination) to ksuperkey? It would be very helpful to some KDE users. I first though I could patch the program myself but figured out that official/native support would be better in all scales for many users.

If it's any help for possible implementation of this feature, xmodmap output for Super_R is as follows:

[fincer@fincer-laptop ~]$ 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),  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)

Add instructions for Centos 7 build

Hi,

To compile under Centos, we need these options:

sudo yum install git gcc make libX11-devel libXtst-devel pkgconfig

Can you add them to the readme for next users? Thanks!

ksuperkey only working when holding superkey down for a couple of seconds?

Don't know how to troubleshoot this. Any advice welcome. Alt+F1 does open Launcher. And so does the super key, but only when I press it down for a couple of seconds. It used to work earlier. Recently I installed a whole bunch of updates, which also changed the skin and look of my launcher menu as well.

Can't "make" - also me noob in linux :)

~/ksuperkey $ make cc -Wallpkg-config --cflags xtst x11-o ksuperkey xcape.cpkg-config --libs xtst x11-pthread xcape.c:22:20: fatal error: stdlib.h: No such file or directory compilation terminated. Makefile:14: recipe for target 'ksuperkey' failed make: *** [ksuperkey] Error 1 ~/ksuperkey $

[ question ] krunner support

Hi,
I know there is a fork that aims KRunner so my question is quite simple:
Would you consider adding KRunner support for (this, the official) ksuperkey?
As cool as it is right now to unfold Kickoff using the Super_L key it would be really useful to bring up KRunner with the Super_L + ALT_L combination (or whatever similar one you prefer).
Thank you for making ksuperkey public.
Cheers!

fork of xcape

Hello,

Thanks for this useful tool for users transitioning from Windows. Could you summarize how

ksuperkey

differs from

xcape -e 'Super_L=Alt_L|F1' ?

I noticed that with xcape the input field of the KDE Launcher lacks often focus.

~12 second delay when no application in running

okay so I installed in on my laptop, I have dwm as window manager and sxhkd for keyboard shortcuts.
the problem is when I start the xorg server, in my xinitrc I start ksuperkey with just 'ksuperkey' and nothing passed to it. the ksuperkey is running, I press super key and it took around 12 seconds to generate the Alt_L + F1 keybinding, but when I open an application for example st terminal or qutebrowser or just anything, and the app is running and it's window is open, it takes less than 1 second, why is that hapening? is it just my problem?

update: I have same issue with xcape, what is going on? any helps?

Using different keyboard layout

In my keyboard settings, I have set alt+f1 as a shortcut for rofi. I also set the super key as alt+f1:

ksuperkey -e 'Super_L=Alt_L|F1' &
ksuperkey -e 'Super_R=Alt_L|F1' &

Hoverver if i use alt+f1, i get rofi with the right keyboard layout (I use fr_CH, qwertz), but if I use the super key, I get a qwerty layout.

I use arch linux with xfce.

ksuperkey not working in Ubuntu 13.04

I compiled the latest git master, and ran it:

$ ksuperkey -d
sig_handler running...
Intercepted key event 3, key code 36
Intercepted key event 2, key code 133
Key pressed!
Intercepted key event 3, key code 133
Key released!
Generating Alt_L!
Generating F1!
Ignoring generated event.
Ignoring generated event.
Ignoring generated event.
Ignoring generated event.

And nothing happens. KDE launcher shortcut is set to Alt+F1

Different behaviour than ALT+F1 on Plasma 2 (Fedora 22)

While it's base functionality works in Plasma 2 on Fedora 22, I notice the following difference between pressing the Super key and pressing ALT+F1:

  1. In Firefox, the Menu toolbar is shown (triggers on ALT press). This doesn't happen on ALT+F1.
  2. Pressing Super a second time doesn't close Kickoff. Again, this works with ALT+F1.

Version info:

$ rpm -q plasma-workspace  libX11-devel libXtst-devel 
plasma-workspace-5.2.2-1.fc22.x86_64
libX11-devel-1.6.3-1.fc22.x86_64
libXtst-devel-1.2.2-4.fc22.x86_64

Debug output (pressed Super two times):

/ksuperkey -h
./ksuperkey: invalid option -- 'h'
Usage: ./ksuperkey [-d] [-t timeout_ms] [-e <mapping>]
Runs as a daemon unless -d flag is set
[test@yoga ksuperkey]$ ./ksuperkey -d
sig_handler running...
Intercepted key event 3, key code 36
Intercepted key event 2, key code 133
Key pressed!
Intercepted key event 3, key code 133
Key released!
Generating Alt_L!
Generating F1!
Ignoring generated event.
Ignoring generated event.
Ignoring generated event.
Ignoring generated event.
Intercepted key event 2, key code 133
Key pressed!
Intercepted key event 3, key code 133
Key released!
Generating Alt_L!
Generating F1!
Ignoring generated event.
Ignoring generated event.
Ignoring generated event.
Ignoring generated event.
Intercepted key event 4, key code 1
Intercepted key event 5, key code 1
Intercepted key event 2, key code 37
Intercepted key event 2, key code 54
^CCaught signal 2!
sig_handler exiting...
main exiting

I don't know if this used to work better before, it's the first time running ksuperkey. In any case, thanks for your work!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.