I want my windows key (or super_l) to toggle the lubuntu menu. I'm able to open it with the windows key after adding the key binding from the question below, but so far I haven't found a way to close it by pressing the same key again. A comment in said question here asked about the same thing in november 2011, but after googling I haven't found a solution. Does anyone know if it's possible?

Bind the windows key to Lubuntu start menu

  • That might be another issue for another question. In sublime text (as an example), I have a binding for ctrl+alt+r, and one for ctrl+alt+r+r. It works like this: If I click ctrl+alt+r nothing happens until I either click r again (activating the second key binding) or click any other key than r (activating the first key binding).
    – L42
    Aug 15, 2015 at 16:48
  • My english isnt that good so I didnt understand the 5th step. Where should I add "python3 /path/to/click_menu.py -run" excactly?
    – user734514
    Sep 8, 2017 at 14:17

1 Answer 1


Alternative way to toggle the menu

This answer is only "half" of the answer that was posted here . Since that question was on Gnome, and tagged likewise, I think it is legitimate to post a slightly edited version here to cover Lubuntu (lxde), or any other window manager.

I tested it on Lubuntu 14.04, and (as expected) did exactly what it should do.

The solution is actually a script that you can easily set up to automatically (virtually) click on any position on your screen, including the menu. Since clicking the menu once will open it, clicking it again will close it, placing the command under your key, as you did, will do exactly what you are after.

The script

#!/usr/bin/env python3
import subprocess
import time
import sys
import os

option = sys.argv[1]
datafile = os.path.join(os.environ["HOME"], ".run_click")

def get_mousepos():
    cursordata = subprocess.check_output(["xdotool", "getmouselocation"]).decode("utf-8").split()
    return [d.split(":")[1] for d in cursordata[:2]]

if option == "-run":
        data = open(datafile).read()
        coords = (" ").join([l for l in data.splitlines()])
    except FileNotFoundError:
        message = "Please run the command: 'run_click -set' first, to set the click position"
        subprocess.Popen(["zenity", "--info", "--text", message])
        cmd1 = "xdotool mousemove "+coords; cmd2 = "xdotool click 1"; cmd3 = "xdotool mousemove "+(" ").join(get_mousepos())
        for cmd in [cmd1, cmd2, cmd3]:
            subprocess.Popen(["/bin/bash", "-c", cmd])
elif option == "-set":
    open(datafile, "wt").write(("\n").join(get_mousepos()))

About the script; how to set up

  1. The script needs xdotool:

    sudo apt-get install xdotool
  2. Copy the script above into an empty file, save it as click_menu.py

  3. Now you need to make the script remember the menu position to (virtually) click:

    The script needs to be run with the option -set, with the mouse in position:

    • open a terminal window, type the command:

      sleep 5 && python3 /path/to/click_menu.py -set
    • immediatley position the mouse above the menu (do not click)

    • after the 5 seconds have passed, the menu position is "remembered". The position is written to an invisible file, so you will only need to do this once.
  4. Test if all works fine with the command:

    python3 /path/to/click_menu.py -run

    enter image description here

    The menu should open, as shown in th image above.

  5. If all works fine add the command:

    python3 /path/to/click_menu.py -run

    to the key, as you did with the other command you mentioned in your question. Now pressing the key should toggle the menu.

  • Nice solution! I can't test it right now, but I will tomorrow. Thanks :)
    – L42
    Aug 15, 2015 at 16:47
  • @L42 just curious, but did you try? Aug 17, 2015 at 13:08
  • Haha, just as you said man. Thanks a lot! I never thought about solving it like this.
    – L42
    Aug 17, 2015 at 20:23
  • @L42 perfect, great that you like it :) Aug 17, 2015 at 20:27
  • 1
    @L42 AHA, that makes clear the script works fine, it must be something with processing the shortcut. Aug 17, 2015 at 20:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.