getting MATE + Openbox to work: gnome-panel-control?

getting MATE + Openbox to work: gnome-panel-control?

Postby Morrog on Mon Aug 06, 2012 12:07 pm

Due to all the changes recently with Gnome 2, Gnome 3, MATE, Cinnamon and what not, i'm left in between DE/WMs.
Before i was using Gnome 2 with Openbox. I am interested in MATE (even though it's still young and obviously has some quirks still in it), but i'm wondering whether this fully works with Openbox.

One thing to have a comfortable work environment is gnome-panel-control. With this Openbox can invoke the Alt+F1 main menu and the Alt+F2 run application dialog. I know MATE and Openbox play sort of nicely, but i'd like to keep my main menu and run dialog.
Any thoughts on how i can adjust gnome-panel-control to MATE? Or are there plans to port it to MATE?

Openbox and Gnome 3 also work together, but Gnome 3 just doesn't look right, maybe has to do with Gtk3, or something else. it's just not Gnome 2...

Anyway, thank you for any information about MATE and gnome-panel-control!
Morrog
Level 1
Level 1
 
Posts: 27
Joined: Mon Aug 22, 2011 9:15 am

Linux Mint is funded by ads and donations.
 

Re: getting MATE + Openbox to work: gnome-panel-control?

Postby nahuel80 on Thu Aug 16, 2012 11:54 pm

Hey Morrog, I have good news for you :)

I downloaded gnome-panel-control.c and replaced GNOME calls for MATE calls, saved it as mate-panel-control.c, compiled it, and it works like a charm!

Here is mate-panel-control.c:

Code: Select all
#include <X11/Xlib.h>
#include <string.h>
#include <stdio.h>
#include <assert.h>

typedef enum
{
    NONE,
    MAIN_MENU,
    RUN_DIALOG
} Action;

int main(int argc, char **argv)
{
    int i;
    Action a = NONE;

    for (i = 1; i < argc; ++i) {
        if (!strcmp(argv[i], "--help")) {
            a = NONE;
            break;
        }
        if (!strcmp(argv[i], "--main-menu")) {
            a = MAIN_MENU;
            break;
        }
        if (!strcmp(argv[i], "--run-dialog")) {
            a = RUN_DIALOG;
            break;
        }
    }

    if (!a) {
        printf("Usage: mate-panel-control ACTION\n\n");
        printf("Actions:\n");
        printf("    --help       Display this help and exit\n");
        printf("    --main-menu  Show the main menu\n");
        printf("    --run-dialog Show the run dialog\n\n");
        return 0;
    }

    {
        Display *d;
        Window root;
        XClientMessageEvent ce;
        Atom act_atom;
        Time timestamp;

        d = XOpenDisplay(NULL);
        if (!d) {
            fprintf(stderr,
                    "Unable to open the X display specified by the DISPLAY "
                    "environment variable. Ensure you have permission to "
                    "connect to the display.");
            return 1;
        }
        root = RootWindowOfScreen(DefaultScreenOfDisplay(d));

        switch (a) {
        case MAIN_MENU:
            act_atom = XInternAtom(d, "_MATE_PANEL_ACTION_MAIN_MENU", False);
            break;
        case RUN_DIALOG:
            act_atom = XInternAtom(d, "_MATE_PANEL_ACTION_RUN_DIALOG", False);
            break;
        default:
            assert(0);
        }

        /* Generate a timestamp */
        {
            XEvent event;
            Window win;

            win = XCreateSimpleWindow(d, root, 0, 0, 1, 1, 0, 0, 0);

            XSelectInput(d, win, PropertyChangeMask);

            XChangeProperty(d, win, act_atom, act_atom, 8,
                            PropModeAppend, NULL, 0);
            XWindowEvent(d, win, PropertyChangeMask, &event);

            XDestroyWindow(d, win);

            timestamp = event.xproperty.time;
        }

        ce.type = ClientMessage;
        ce.window = root;
        ce.message_type = XInternAtom(d, "_MATE_PANEL_ACTION", False);
        ce.format = 32;
        ce.data.l[0] = act_atom;
        ce.data.l[1] = timestamp;
        XSendEvent(d, root, False, StructureNotifyMask, (XEvent*) &ce);

        XCloseDisplay(d);
    }

    return 0;
}


You'll need to install this to be able to compile it:

Code: Select all
sudo apt-get install libx11-dev


And then compile it like this:

Code: Select all
gcc ./mate-panel-control.c -o mate-panel-control -L/usr/X11R6/lib -lX11


You can copy it to /usr/bin if you like:

Code: Select all
sudo cp ./mate-panel-control /usr/bin


And there you have it!

You can now attach ALT+F1 to main menu and ALT+F2 to run dialog.

Cheers!

Nahuel.
nahuel80
Level 1
Level 1
 
Posts: 1
Joined: Thu Aug 16, 2012 11:50 pm

Re: getting MATE + Openbox to work: gnome-panel-control?

Postby Morrog on Fri Aug 17, 2012 3:49 am

cool, thanks :-)
Morrog
Level 1
Level 1
 
Posts: 27
Joined: Mon Aug 22, 2011 9:15 am

Re: getting MATE + Openbox to work: gnome-panel-control?

Postby aalemann on Thu Jan 10, 2013 9:35 am

Hi, I am using MATE and Compiz and had the same problem like Morrog, i.e. ALT+<F1> and ALT+<F2> was not working.

With your nice script, Nahuel, everything runs perfectly now, thanks a lot :)
Linux Mint 17 Qiana
Linux 3.13.0-24-generic x86_64
Intel(R) Core(TM) i3-2100
aalemann
Level 1
Level 1
 
Posts: 21
Joined: Wed Nov 28, 2012 5:57 am


Return to MATE

Who is online

Users browsing this forum: No registered users and 3 guests