Xfce Forum

Sub domains
 

You are not logged in.

#1 2017-11-21 22:10:14

Misko_2083
Member
Registered: 2015-10-13
Posts: 30

Whisker Menu and Super keys

A little help please. I want to run Whisker Menu plugin with Super_L and Super_R keys.
I removed the old Whisker Menu keyboard shortcut first.
That way it won't interfere with the sript. With this script below I monitor X keyboard input.
If one of the Super keys is pressed and released it will show or hide the Whisker Menu.
Now, if I press some key combo, like Super_L+F, It launches whatever command is set.
That's alright, but when I release the Super key, Whisker is being shown.
How do I filter out the key-combos so that Whisker doesn't launch?

#!/bin/bash

  xinput test-xi2 --root | perl -lne '
    BEGIN{$"=",";
      open X, "-|", "xmodmap -pke";
      while (<X>) {$k{$1}=$2 if /^keycode\s+(\d+) = (\w+)/}
      open X, "-|", "xmodmap -pm"; <X>;<X>;
      while (<X>) {if (/^(\w+)\s+(\w*)/){($k=$2)=~s/_[LR]$//;$m[$i++]=$k||$1}}
      close X;
    }
    if (/^EVENT type.*\((.*)\)/) {$e = $1}
    elsif (/detail: (\d+)/) {$d=$1}
    elsif (/modifiers:.*effective: (.*)/) {
      $m=$1;
      if ($e =~ /^Key/){
        my @mods;
        for (0..$#m) {push @mods, $m[$_] if (hex($m) & (1<<$_))}
          # Comment out next line to see what key is pressed
          # print "$e $d [$k{$d}] $m [@mods]";
          if (($k{$d} eq "Super_L" or $k{$d} eq "Super_R") && $e eq "KeyRelease"){
             system ("xfce4-popup-whiskermenu > /dev/null 2>&1");
          }
      }
   }'

Offline

#2 2017-11-22 05:58:45

ozjd
Member
From: Hawkesbury NSW Australia
Registered: 2012-02-05
Posts: 439
Website

Re: Whisker Menu and Super keys

I use Ksuperkey to do that. Despite the name it isn't part of KDE. See https://github.com/hanschen/ksuperkey

Offline

#3 2017-11-22 08:02:09

marko
Member
Registered: 2017-10-20
Posts: 9

Re: Whisker Menu and Super keys

- Launch Settings->Hardware->Keyboard->Application Shortcuts and click the "Add" button
- Type: xfce4-popup-whiskermenu
- Press the Left Super key when prompted for a keyboard shortcut.
- Repeat the process for the Right Super Key

Here is another cool trick smile Open up a terminal and run this command: xfce4-popup-whiskermenu --pointer

smile Xfce4 rules!

Last edited by marko (2017-11-22 08:06:05)

Offline

#4 2017-11-22 15:55:33

k-3.14
Member
From: Rhineland
Registered: 2017-02-18
Posts: 95

Re: Whisker Menu and Super keys

marko wrote:

- Launch Settings->Hardware->Keyboard->Application Shortcuts and click the "Add" button
- Type: xfce4-popup-whiskermenu
- Press the Left Super key when prompted for a keyboard shortcut.
- Repeat the process for the Right Super Key

Nice tip marko.

New for ARCH and DEBIAN, bit Linux Mint has LEFT SUPER key for that by default.

br

Offline

#5 2017-11-23 10:04:10

marko
Member
Registered: 2017-10-20
Posts: 9

Re: Whisker Menu and Super keys

No worries, what you can also do is, should you wish to use a dock instead of the panel (personally, I have to have the panel + a window button list, please keep this as an option), you can add a custom command to the dock and the command would be: xfce4-popup-whiskermenu --pointer and the menu would pop up right there where you click the button.

Last edited by marko (2017-11-23 10:04:44)

Offline

#6 2017-11-23 18:49:53

Misko_2083
Member
Registered: 2015-10-13
Posts: 30

Re: Whisker Menu and Super keys

ozjd wrote:

I use Ksuperkey to do that. Despite the name it isn't part of KDE. See https://github.com/hanschen/ksuperkey

Thank you ozjd. That's one neat little tool. As long as it is running it does what is advertising.

marko wrote:

- Launch Settings->Hardware->Keyboard->Application Shortcuts and click the "Add" button
- Type: xfce4-popup-whiskermenu
- Press the Left Super key when prompted for a keyboard shortcut.
- Repeat the process for the Right Super Key

Here is another cool trick smile Open up a terminal and run this command: xfce4-popup-whiskermenu --pointer

smile Xfce4 rules!

I had some trouble with the Super_L key and overlaping with keyboard combo shortcuts on this 4.10 xfce.

Offline

Board footer

Powered by FluxBB