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

Archived topics about LMDE 1 and LMDE 2
Locked
Morrog

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

Post by Morrog »

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!
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
nahuel80

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

Post by nahuel80 »

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.
Morrog

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

Post by Morrog »

cool, thanks :-)
aalemann

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

Post by aalemann »

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 :)
Locked

Return to “LMDE Archive”