inhibitShortcuts: Whitelist OS components
Users already have to trust their OS, so asking whether an OS component should be allowed to perform an OS operation is odd at best, if not confusing. Account for this by allowing system components that require a keyboard grab to work - namely Setting's keyboard shortcuts panel - to do so without triggering the permissions dialog. https://bugzilla.gnome.org/show_bug.cgi?id=786146
This commit is contained in:
parent
b35dfc8914
commit
e8a2c06e4e
@ -12,6 +12,8 @@ const ModalDialog = imports.ui.modalDialog;
|
|||||||
|
|
||||||
const WAYLAND_KEYBINDINGS_SCHEMA = 'org.gnome.mutter.wayland.keybindings';
|
const WAYLAND_KEYBINDINGS_SCHEMA = 'org.gnome.mutter.wayland.keybindings';
|
||||||
|
|
||||||
|
const APP_WHITELIST = ['gnome-control-center.desktop'];
|
||||||
|
|
||||||
var DialogResponse = Meta.InhibitShortcutsDialogResponse;
|
var DialogResponse = Meta.InhibitShortcutsDialogResponse;
|
||||||
|
|
||||||
var InhibitShortcutsDialog = new Lang.Class({
|
var InhibitShortcutsDialog = new Lang.Class({
|
||||||
@ -38,6 +40,11 @@ var InhibitShortcutsDialog = new Lang.Class({
|
|||||||
this._window = window;
|
this._window = window;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
get _app() {
|
||||||
|
let windowTracker = Shell.WindowTracker.get_default();
|
||||||
|
return windowTracker.get_window_app(this._window);
|
||||||
|
},
|
||||||
|
|
||||||
_getRestoreAccel: function() {
|
_getRestoreAccel: function() {
|
||||||
let settings = new Gio.Settings({ schema_id: WAYLAND_KEYBINDINGS_SCHEMA });
|
let settings = new Gio.Settings({ schema_id: WAYLAND_KEYBINDINGS_SCHEMA });
|
||||||
let accel = settings.get_strv('restore-shortcuts')[0] || '';
|
let accel = settings.get_strv('restore-shortcuts')[0] || '';
|
||||||
@ -46,9 +53,7 @@ var InhibitShortcutsDialog = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
_buildLayout: function() {
|
_buildLayout: function() {
|
||||||
let windowTracker = Shell.WindowTracker.get_default();
|
let name = this._app ? this._app.get_name() : this._window.title;
|
||||||
let app = windowTracker.get_window_app(this._window);
|
|
||||||
let name = app ? app.get_name() : this._window.title;
|
|
||||||
|
|
||||||
/* Translators: %s is an application name like "Settings" */
|
/* Translators: %s is an application name like "Settings" */
|
||||||
let title = name ? _("%s wants to inhibit shortcuts").format(name)
|
let title = name ? _("%s wants to inhibit shortcuts").format(name)
|
||||||
@ -85,7 +90,10 @@ var InhibitShortcutsDialog = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
vfunc_show: function() {
|
vfunc_show: function() {
|
||||||
this._dialog.open();
|
if (this._app && APP_WHITELIST.indexOf(this._app.get_id()) != -1)
|
||||||
|
this._emitResponse(DialogResponse.ALLOW);
|
||||||
|
else
|
||||||
|
this._dialog.open();
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_hide: function() {
|
vfunc_hide: function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user