use exported settings

This commit is contained in:
Philipp Unger
2023-08-13 22:58:15 +02:00
parent d634f0cdfd
commit 84159f5df9
10 changed files with 278 additions and 268 deletions

View File

@@ -30,6 +30,7 @@ import St from 'gi://St';
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
import * as Workspace from 'resource:///org/gnome/shell/ui/workspace.js';
import { WindowPreview } from 'resource:///org/gnome/shell/ui/windowPreview.js';
import {SETTINGS} from './extension.js';
import Meta from 'gi://Meta';
@@ -67,7 +68,7 @@ var Overview = class {
this._adaptAlloc(true);
this._signalsHandler.add([
Me.settings,
SETTINGS,
[
'changed::stockgs-keep-dash',
'changed::panel-sizes'
@@ -92,7 +93,7 @@ var Overview = class {
_toggleDash(visible) {
if (visible === undefined) {
visible = Me.settings.get_boolean('stockgs-keep-dash');
visible = SETTINGS.get_boolean('stockgs-keep-dash');
}
let visibilityFunc = visible ? 'show' : 'hide';
@@ -183,19 +184,19 @@ var Overview = class {
}
this._signalsHandler.add([
Me.settings,
SETTINGS,
'changed::isolate-workspaces',
() => {
this._panel.panelManager.allPanels.forEach(p => p.taskbar.resetAppIcons());
if (Me.settings.get_boolean('isolate-workspaces'))
if (SETTINGS.get_boolean('isolate-workspaces'))
enable();
else
disable();
}
]);
if (Me.settings.get_boolean('isolate-workspaces'))
if (SETTINGS.get_boolean('isolate-workspaces'))
enable();
}
@@ -219,7 +220,7 @@ var Overview = class {
let seenAppCount = seenApps[appIcon.app];
let windowCount = appIcon.window || appIcon._hotkeysCycle ? seenAppCount : appIcon._nWindows;
if (Me.settings.get_boolean('shortcut-previews') && windowCount > 1 &&
if (SETTINGS.get_boolean('shortcut-previews') && windowCount > 1 &&
!(modifiers & ~(Clutter.ModifierType.MOD1_MASK | Clutter.ModifierType.SUPER_MASK))) { //ignore the alt (MOD1_MASK) and super key (SUPER_MASK)
if (this._hotkeyPreviewCycleInfo && this._hotkeyPreviewCycleInfo.appIcon != appIcon) {
this._endHotkeyPreviewCycle();
@@ -273,14 +274,14 @@ var Overview = class {
_optionalHotKeys() {
this._hotKeysEnabled = false;
if (Me.settings.get_boolean('hot-keys'))
if (SETTINGS.get_boolean('hot-keys'))
this._enableHotKeys();
this._signalsHandler.add([
Me.settings,
SETTINGS,
'changed::hot-keys',
() => {
if (Me.settings.get_boolean('hot-keys'))
if (SETTINGS.get_boolean('hot-keys'))
this._enableHotKeys();
else
this._disableHotKeys();
@@ -305,12 +306,12 @@ var Overview = class {
}
// Setup keyboard bindings for taskbar elements
let shortcutNumKeys = Me.settings.get_string('shortcut-num-keys');
let shortcutNumKeys = SETTINGS.get_string('shortcut-num-keys');
let bothNumKeys = shortcutNumKeys == 'BOTH';
let keys = [];
let prefixModifiers = Clutter.ModifierType.SUPER_MASK
if (Me.settings.get_string('hotkey-prefix-text') == 'SuperAlt')
if (SETTINGS.get_string('hotkey-prefix-text') == 'SuperAlt')
prefixModifiers |= Clutter.ModifierType.MOD1_MASK
if (bothNumKeys || shortcutNumKeys == 'NUM_ROW') {
@@ -332,13 +333,13 @@ var Overview = class {
for (let i = 0; i < this._numHotkeys; i++) {
let appNum = i;
Utils.addKeybinding(key + (i + 1), Me.settings, () => this._activateApp(appNum, modifiers));
Utils.addKeybinding(key + (i + 1), SETTINGS, () => this._activateApp(appNum, modifiers));
}
}, this);
this._hotKeysEnabled = true;
if (Me.settings.get_string('hotkeys-overlay-combo') === 'ALWAYS')
if (SETTINGS.get_string('hotkeys-overlay-combo') === 'ALWAYS')
this.taskbar.toggleNumberOverlay(true);
}
@@ -369,38 +370,38 @@ var Overview = class {
_optionalNumberOverlay() {
// Enable extra shortcut
if (Me.settings.get_boolean('hot-keys'))
if (SETTINGS.get_boolean('hot-keys'))
this._enableExtraShortcut();
this._signalsHandler.add([
Me.settings,
SETTINGS,
'changed::hot-keys',
this._checkHotkeysOptions.bind(this)
], [
Me.settings,
SETTINGS,
'changed::hotkeys-overlay-combo',
() => {
if (Me.settings.get_boolean('hot-keys') && Me.settings.get_string('hotkeys-overlay-combo') === 'ALWAYS')
if (SETTINGS.get_boolean('hot-keys') && SETTINGS.get_string('hotkeys-overlay-combo') === 'ALWAYS')
this.taskbar.toggleNumberOverlay(true);
else
this.taskbar.toggleNumberOverlay(false);
}
], [
Me.settings,
SETTINGS,
'changed::shortcut-num-keys',
() => this._resetHotkeys()
]);
}
_checkHotkeysOptions() {
if (Me.settings.get_boolean('hot-keys'))
if (SETTINGS.get_boolean('hot-keys'))
this._enableExtraShortcut();
else
this._disableExtraShortcut();
}
_enableExtraShortcut() {
Utils.addKeybinding('shortcut', Me.settings, () => this._showOverlay(true));
Utils.addKeybinding('shortcut', SETTINGS, () => this._showOverlay(true));
}
_disableExtraShortcut() {
@@ -414,7 +415,7 @@ var Overview = class {
}
// Restart the counting if the shortcut is pressed again
let hotkey_option = Me.settings.get_string('hotkeys-overlay-combo');
let hotkey_option = SETTINGS.get_string('hotkeys-overlay-combo');
if (hotkey_option === 'NEVER')
return;
@@ -424,10 +425,10 @@ var Overview = class {
this._panel.intellihide.revealAndHold(Intellihide.Hold.TEMPORARY);
let timeout = Me.settings.get_int('overlay-timeout');
let timeout = SETTINGS.get_int('overlay-timeout');
if (overlayFromShortcut) {
timeout = Me.settings.get_int('shortcut-timeout');
timeout = SETTINGS.get_int('shortcut-timeout');
}
// Hide the overlay/dock after the timeout
@@ -442,14 +443,14 @@ var Overview = class {
_optionalClickToExit() {
this._clickToExitEnabled = false;
if (Me.settings.get_boolean('overview-click-to-exit'))
if (SETTINGS.get_boolean('overview-click-to-exit'))
this._enableClickToExit();
this._signalsHandler.add([
Me.settings,
SETTINGS,
'changed::overview-click-to-exit',
() => {
if (Me.settings.get_boolean('overview-click-to-exit'))
if (SETTINGS.get_boolean('overview-click-to-exit'))
this._enableClickToExit();
else
this._disableClickToExit();