New grid layout with Up/Down



Hi everybody,

I'm trying to modify the js files so to have working <Ctrl><Alt> Up /
Down to switch between up/down layouts as well.

I managed to change between workspaces :

...
... and here a piece of the part of windowManager.js :
...
workspaceDown: function(currentIndex) {
        let N = global.screen.n_workspaces;
        switch(currentIndex) {
            case 0 : return N > 2 ? 2 : 0;
            case 1 : return N > 3 ? 3 : 1;
            case 2 : return N > 6 ? 6 : 0;
            case 3 : return N > 7 ? 7 : 1;
            case 4 : return N > 5 ? 5 : 4;
            case 5 : return N > 8 ? 8 : 4;
            case 6 : return N > 12 ? 12 : 0;
            case 7 : return N > 13 ? 13 : 1;
            case 8 : return N > 14 ? 14 : 4;
            case 9 : return N > 10 ? 10 : 9;
            case 10 : return N > 11 ? 11 : 9;
            case 11 : return N > 15 ? 15 : 9;
            case 12 : return 0;
            case 13 : return 1;
            case 14 : return 4;
            case 15 : return 9;
        }
        return currentIndex;
    },

    actionMoveWorkspaceDown: function() {
        let newIndex =
this.workspaceDown(global.screen.get_active_workspace_index());

global.screen.get_workspace_by_index(newIndex).activate(global.get_current_time());
        if (!Main.overview.visible)

this._workspaceSwitcherPopup.display(WorkspaceSwitcherPopup.DOWN,
newIndex);
    }

----------------

(ok, this is a dirty hack since it only works up to 16 workspaces...)
but well, even if I could get a better way to find the top/down
neighboring workspace, this would'nt fix all problems I have.

1.
get_workspace_by_index(newIndex).activate(...); does the workspace
switching. Sadly, I couldn't even find it.
I suppose it is some kind of "signal" since the Workspace object doesn't
have an "activate" function (but there's an "addSignals" on it,
then...).
Is it the case ?
What is added to Workspace then ?

2.
And how can I change the workspace switching behaviour ?
Because now, it is switching to the correct workspace, but in an
horizontal manner which looks really bad since I'd like to switch from a
cell to a vertical neighbor in this case.

3.
I added images and the css binding to them in workspaceSwitcherPopup.js.
It is great. Except for the current layout (St.BoxLayout) which isn't
what I want.
I'd like to use something like a St.Table (looks like it exists
according to gnome-shell sources).
But I really don't know how to find informations about those kind of
objects. How do core and gnome-shell native things get imported ?

const imports.gi.St is what ? some js file I couldn't find ?

Where can I found it to know how to use it and St.BoxLayout and / or
St.Table if there is one ?

I suppose it gets translated into something related to gnome-shell C
code for there are similar things in gnome-shell source code
(st-boxlayout, workspace, screen ...).
And there are many imports which don't have their js corresponding file
(I'd like to know how to use things in my js-hacked files).
All imports.ui.* stuff seems to be pseudo-javascript and present in
share/gnome-shell/js/ui, but the other like imports.gi.* ... where are
they ???

Is there information about how to customize the pseudo-js things ? Now
I'm trying by intuition. But I'm missing some good documentation about
how things get really translated, where are imported / importable
things, what to do with them...)
Or maybe it is present in the sources and I missed it ?

Thanks for you help
Alexandre Kaspar



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]