command ALT + F2 with mate and compiz

Support on MATE usage

Moderator: flexiondotorg

command ALT + F2 with mate and compiz

Postby Siphax » Mon Apr 02, 2012 4:40 pm

sudo apt-get install git wget
git clone https://github.com/benpicco/mate-scripts.git
cd mate-scripts
wget https://launchpad.net/gnomenu/trunk/2.9 ... 9.1.tar.gz
tar xvzf gnomenu-2.9.1.tar.g
./migrate.sh
Close Terminal
sudo apt-get install python-mate python-mate-desktop python-mate-menu python python-xdg python-cairo python-gtk2 python-xml
cd mate-scripts/matenu
sudo make install

add this commands in mate-keybinding-properties :

http://img15.hostingpics.net/pics/554456screenshot1.png
http://www.youtube.com/watch?v=vpY_gLie ... e=youtu.be

python -u /usr/lib/matenu/Mate_run_dialog.py
python -u /usr/lib/matenu/session-manager.py suspend
python -u /usr/lib/matenu/session-manager.py hibernate
python -u /usr/lib/matenu/Mate_run_dialog.py
python -u /usr/lib/matenu/session-manager.py shutdown
nm-connection-editor
Last edited by Siphax on Mon Apr 02, 2012 10:17 pm, edited 1 time in total.
Siphax
 
Posts: 10
Joined: Sun Dec 25, 2011 9:05 pm

Re: command ALT + F2 with mate and compiz

Postby LewRockwellFAN » Mon Apr 02, 2012 8:42 pm

Looks like an answer without a question. What is this for? Alt-F2 continues to work for me just fine, the same way it always has, bringing up a run dialogue.
LewRockwellFAN
 
Posts: 42
Joined: Thu Feb 23, 2012 10:03 pm

Re: command ALT + F2 with mate and compiz

Postby Xpander » Wed Apr 04, 2012 9:23 am

LewRockwellFAN wrote:Looks like an answer without a question. What is this for? Alt-F2 continues to work for me just fine, the same way it always has, bringing up a run dialogue.


it doesnt when u are using compiz
thatswhy.
Linux Gaming Videos: http://www.youtube.com/user/Xpander666


-----------


Gfire - Xfire For Pidgin
Xpander
 
Posts: 46
Joined: Thu Feb 02, 2012 3:41 pm

Re: command ALT + F2 with mate and compiz

Postby LewRockwellFAN » Thu Apr 05, 2012 2:58 am

I see. Thank you. I should have noticed that part in the subject. You are correct in assuming that I do not use compiz.
LewRockwellFAN
 
Posts: 42
Joined: Thu Feb 23, 2012 10:03 pm

Re: command ALT + F2 with mate and compiz

Postby Rmantingh » Thu Jul 12, 2012 11:35 am

A more elegant solution is to call the Mate Panel run dialog directly.

Following C code will do that ( borrowed & adapted from http://darkness.codefu.org/wordpress/20 ... -a-script/ - with thanks )

Code: Select all
#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;
}


Copy the code and save as "mate-run.c"
Then compile with "gcc mate-run.c -o mate-run -L/usr/X11R6/lib -lX11"
Make it executable "chmod 755 mate-run"
And then run either as stand-alone or from Compiz CCSM -> General -> Commands.

I'm currently looking into creating a separate plugin for Compiz based on the Gnome Compatibility
plugin that will invoke the right calls to the Mate Panel in similar style as above program.

Ruud
Rmantingh
 
Posts: 1
Joined: Thu Jul 12, 2012 10:27 am

Re: command ALT + F2 with mate and compiz

Postby WinRiddance » Fri Jul 13, 2012 8:05 pm

Rmantingh wrote:A more elegant solution is to call the Mate Panel run dialog directly.

Following C code will do that ( borrowed & adapted from http://darkness.codefu.org/wordpress/20 ... -a-script/ - with thanks )

Code: Select all
#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;
}


Copy the code and save as "mate-run.c"
Then compile with "gcc mate-run.c -o mate-run -L/usr/X11R6/lib -lX11"
Make it executable "chmod 755 mate-run"
And then run either as stand-alone or from Compiz CCSM -> General -> Commands.

I'm currently looking into creating a separate plugin for Compiz based on the Gnome Compatibility
plugin that will invoke the right calls to the Mate Panel in similar style as above program.

Ruud


That would be awesome! Just one more little thing to make Mate even better yet! :)

.
WinRiddance
 

Re: command ALT + F2 with mate and compiz

Postby NeXxGeN » Sun Jul 29, 2012 1:49 pm

This code works perfect, but i have a question: is it possible to implement that the run dialog get focused?
NeXxGeN
 
Posts: 3
Joined: Sat May 26, 2012 4:16 pm

Re: command ALT + F2 with mate and compiz

Postby Giant Speck » Sat Aug 04, 2012 12:05 pm

NeXxGeN wrote:This code works perfect, but i have a question: is it possible to implement that the run dialog get focused?


In CCSM, go to "General Options" and click on the "Focus & Raise Behavior" tab.

In the "Focus Protection Windows" textbox, add "!(class=Mate-panel)".
Giant Speck
 
Posts: 1
Joined: Sat Aug 04, 2012 11:55 am

Re: command ALT + F2 with mate and compiz

Postby cb474 » Sun Sep 09, 2012 7:43 am

Rmantingh wrote:A more elegant solution is to call the Mate Panel run dialog directly.

Following C code will do that ( borrowed & adapted from http://darkness.codefu.org/wordpress/20 ... -a-script/ - with thanks )

...

Copy the code and save as "mate-run.c"
Then compile with "gcc mate-run.c -o mate-run -L/usr/X11R6/lib -lX11"
Make it executable "chmod 755 mate-run"
And then run either as stand-alone or from Compiz CCSM -> General -> Commands.

I'm currently looking into creating a separate plugin for Compiz based on the Gnome Compatibility
plugin that will invoke the right calls to the Mate Panel in similar style as above program.

Ruud

Thanks for the script. This works great. Can you suggest a similar script for getting Alt + F1 to work? Actually, I like to assign that to Alt + Menu key. Any help would be much appreciated.
cb474
 
Posts: 16
Joined: Sun Sep 09, 2012 7:31 am

Re: command ALT + F2 with mate and compiz

Postby atarixle » Wed Oct 31, 2012 10:24 pm

cb474 wrote:... Can you suggest a similar script for getting Alt + F1 to work? Actually, I like to assign that to Alt + Menu key. Any help would be much appreciated.


I can, quick and dirty:

To activate the Alt+F1 keystroke, you can use the xte tool to simulate the mouseclick onto the menu.

As I have the Main Menu in the region of the upper-left corner, for me the command is

Code: Select all
xte 'keyup F1' 'keyup Alt' 'mousemove 25 10' 'mousedown 1' 'mouseup 1'


Simply enter this line in ccsm > Commands > Command line x, and set the keybinding to Alt+F1 in the Key Bindungs tab.

For you, enter the screen-position of the main menu on your screen behind the mousemove command.

Note, that it is neccassary to 'keyup F1' and 'keyup Alt', as the main menu does not appear when these keys are pressed (double weird, huh?).

Yes, the mouse will move to your menu, and doesn't stay at the position it was before. But this should be ok, as you just decided to control your PC via keyboard at this very moment.

The xte command by the way is part of the xautomation package in debian based Linux'es.
atarixle
 
Posts: 83
Joined: Thu Apr 19, 2012 9:19 pm

Next

Return to Desktop Help

Who is online

Users browsing this forum: Google [Bot] and 1 guest