Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I like the Linux-Mint 13 Mate Alt-F1 menu and the Alt-F2 run-dialog, but as soon as I installed Compiz those keys became non-functional.

Conpiz has a Gnome compaatibility settings panel which allows you to set these keys, but using that Compix settings panel did not make any diference (probably because Mate is not Gnome, strictly speaking)...

Is there some way to get those two shortcut keys back into acton with Compiz?

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

Alt+F2 from Mint forums http://forums.linuxmint.com/viewtopic.php?f=206&t=104169

In short (for those who want to skip reading the whole thread). Paste the code below into mate-run.c

#include <stdio.h>
#include <stdlib.h>
#include <X11/Xlib.h>

void die(const char *message)
{
   fputs(message, stderr);
   exit(1);
}

Atom get_atom(Display *display, const char *atom_name)
{
   Atom atom = XInternAtom(display, atom_name, False);
   if (atom == None)
      die("can't find an atom I need");
   return atom;
}

int main()
{
   Display *display;
   Atom gnome_panel_atom, run_atom;
   XClientMessageEvent event;

   display = XOpenDisplay(NULL);
   if (display == NULL)
      die("can't open display");

   gnome_panel_atom = get_atom(display, "_MATE_PANEL_ACTION");
   run_atom = get_atom(display, "_MATE_PANEL_ACTION_RUN_DIALOG");

   event.type = ClientMessage;
   event.window = DefaultRootWindow(display);
   event.message_type = gnome_panel_atom;
   event.format = 32;
   event.data.l[0] = run_atom;
   event.data.l[1] = (Time)(time(NULL) * 1000);

   XSendEvent(display, event.window, False, StructureNotifyMask,
              (XEvent *)&event);

   XCloseDisplay(display);

   return 0;
}

Compile and install with:

$ gcc mate-run.c -o mate-run -L/usr/X11R6/lib -lX11
$ chmod 755 mate-run
$ sudo cp mate-run /usr/local/bin

and simply in CCSM > Commands add a command that links "mate-run" to "ALT+F2" key-combo.

Works in Maya x64 (I do have build-essentials and whatnot so you might want to check out what to install to have X11 libraries and gcc).

I deserve no credit for this other than discovering it in the forums.

share|improve this answer
1  
Thanks Bojan. I works nicely, and I find it behaves better with this following extra bash step to focus it: mate-run; sleep .1; xdotool windowactivate $(wmctrl -lx | sed -nr 's/^([^ ]+).* mate-panel.Mate-panel .* Run Application/\1/p') –  Peter.O Nov 2 '12 at 8:11
    
Thanks, it is much better now since I often forget to click in the textfield and CCSM doesn't have Focus Protection Windows option any more. Also you might want to check this out as an elegant solution that solves both Alt+F1 and Alt+F2 issue with one executable that's equally easy to compile: forums.linuxmint.com/viewtopic.php?f=219&p=615178 –  Bojan Markovic Nov 3 '12 at 13:15
add comment

As it seems there is no standard way to do it, I've written a script which enables Alt-F1 to open the main menu. It utilizes the Panel Applet Main Menu (the main MATE menu)

  • Add a New psanel applet: Main Menu
  • Make it the leftmost icon in the top panel. If you want a different position, change the first 'mousemove' accordingly, so that it clicks on your icon's screen-position.
  • Put this script somewhere in your PATH

    #!/bin/bash
    # name: mouse-click-screen
    { eval $(xdotool getmouselocation --shell)  # save current mouse position
      sleep .15               # It needs a delay (?!).. Your Mileage May Vary
      xdotool mousemove --sync ${1:-10} ${2:-10} click 1
      xdotool mousemove --sync $X $Y           # restore saved mouse position
    } 2>/dev/null
    
  • In System -> Preferences -> Keyboard Shortcuts, click ADD.
    Note that because compiz is the desktop manager, there is no clash with the previous Alt-F1)

    Name:     main-menu    
    Command:  mouse-click-screen
    Shortcut: Alt+F1
    

That's it. Alt+F2 is still pending. but at least Alt+F1 works. It isn't perfect, but it works pretty well.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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