Programming a Gnome extension to disable left edge

2019-09-13 01:30发布

问题:

My apologies to all, if this is in the wrong group.

We’d like to use Fedora 23 in Kiosk mode, but there is was a recently added left edge swipe feature that was added to Gnome Shell (https://github.com/GNOME/gnome-shell)that cannot be disabled easily.

https://github.com/GNOME/gnome-shell/commit/9c4ffc4bf353fe9c64368f3e194e38b0e8f61311

As far as I can tell, our options are:

1) Write an extension to fix this — My favorite

We spoke to the original author, who recommended removing the gesture via an extension.

We have tried writing an extension, but cannot figure out a way to iterate over the gesture list in global.stage to remove it.

(These gestures were added using global.stage.add_action(gesture) and can be removed using global.stage.remove_action(gesture).)

The author has since stopped responding to our emails :(

Any advice on this would be great!

2) Check out the version that we’re on, comment out the code, recompile and install onto our machines

This sounds great! That way we can fix other bugs also. Looking at the README file

https:// github.com/GNOME/gnome-shell/blob/master/README

It says:

For more information about GNOME Shell, including instructions on how

to build GNOME Shell from source and how to get involved with the project,

See https:// wiki.gnome.org/Projects/GnomeShell

So, we’ve followed it to this page:

https:// wiki.gnome.org/Newcomers/BuildGnome

And this tells us to check out JHBuild, but we can’t seem to figure out where the gnome shell code is checked out on the machine when we use JHBuild.

If there’s an easier way to make/install, that’d be great. We probably just followed the wrong recommended link.

3) Roll back to an earlier version of gnome shell

But this brings us back to the problem of checking out the gnome shell and make/install as shown in #2.

4) Switch to KDE

We could try KDE instead of Gnome, but we've done lots of testing in Gnome already and could be a major setback.

5) Build a Fedora 22 box to get back to Gnome 3.16 — my least favorite

It’s a huge effort and we can’t be sure what’s changed and what will break. Our Kiosk software may not even run on Fedora 22. But it’s the hail mary back up plan

回答1:

I work with SciComputing, and, with the help of Florian Müllner, we realized that an extension with the following Javascript code would get rid of the gestures that closed our kiosk window:

/*
 * Disable all of the unwanted touchscreen gestures.
 */
function enable() {

global.stage.get_actions().forEach(a => a.enabled = false);

}

/*
 * Re-enable the touchscreen gestures.
 */
function disable() {

    global.stage.get_actions().forEach(a => a.enabled = true);
}