Skip to content

Commit

Permalink
Merge branch 'develop' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
jtaala committed Sep 15, 2023
2 parents 47fa9a1 + ac7b5dd commit 3986699
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 17 deletions.
12 changes: 6 additions & 6 deletions acceleratorparse.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ function accelerator_mods(keystr) {
* @param {String} keystr
*/
// GDK keystr mask values.
let GDK_SHIFT_MASK = 1 << 0;
let GDK_CONTROL_MASK = 1 << 2;
let GDK_ALT_MASK = 1 << 3;
let GDK_SUPER_MASK = 1 << 26;
let GDK_HYPER_MASK = 1 << 27;
let GDK_META_MASK = 1 << 28;
const GDK_SHIFT_MASK = 1 << 0;
const GDK_CONTROL_MASK = 1 << 2;
const GDK_ALT_MASK = 1 << 3;
const GDK_SUPER_MASK = 1 << 26;
const GDK_HYPER_MASK = 1 << 27;
const GDK_META_MASK = 1 << 28;
function accelerator_mask(keystr) {
// need to extact all mods from keystr
const mods = accelerator_mods(keystr);
Expand Down
19 changes: 14 additions & 5 deletions prefs.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const ExtensionUtils = imports.misc.extensionUtils;
const Extension = ExtensionUtils.getCurrentExtension();
const Settings = Extension.imports.settings;
const AcceleratorParse = Extension.imports.acceleratorparse;
const Workspace = Extension.imports.workspace;
const { Gio, GLib, GObject, Gtk, Gdk } = imports.gi;
const { KeybindingsPane } = Extension.imports.prefsKeybinding;
Expand Down Expand Up @@ -678,7 +679,7 @@ function parseAccelerator(accelerator) {
if (accelerator.match(/Above_Tab/)) {
accelerator = accelerator.replace('Above_Tab', 'grave');
}
let [ok, key, mods] = Settings.accelerator_parse(accelerator);
let [ok, key, mods] = AcceleratorParse.accelerator_parse(accelerator);
// log(`PaperWM: parseAccelerator(${accelerator}) -> [${key}, ${mods}]`);

return [key, mods];
Expand Down Expand Up @@ -836,18 +837,26 @@ function syncStringSetting(settings, key, callback) {
* (not when initialising the extension on login).
*/
function init() {
Settings.initAcceleratorParse();
Workspace.enable();

}

function fillPreferencesWindow(window) {
const provider = new Gtk.CssProvider();
provider.load_from_path(`${Extension.path}/resources/prefs.css`);
Gtk.StyleContext.add_provider_for_display(
Gdk.Display.get_default(),
provider,
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
);
}

function fillPreferencesWindow(window) {
Workspace.enable();
AcceleratorParse.initKeycodeMap();
// cleanup on prefs window close request
window.connect('close-request', () => {
Workspace.disable();
AcceleratorParse.destroyKeycodeMap();
});

let selectedWorkspace = null;
try {
const tempFile = Gio.File.new_for_path(GLib.get_tmp_dir()).get_child('paperwm.workspace');
Expand Down
5 changes: 1 addition & 4 deletions settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function getConflictSettings() {
var prefs;
let gsettings, _overriddingConflicts;
function enable() {
initAcceleratorParse();
AcceleratorParse.initKeycodeMap();
gsettings = ExtensionUtils.getSettings();
_overriddingConflicts = false;
prefs = {};
Expand Down Expand Up @@ -85,9 +85,6 @@ function disable() {
}

// / Keybindings
function initAcceleratorParse() {
AcceleratorParse.initKeycodeMap();
}

function accelerator_parse(keystr) {
return AcceleratorParse.accelerator_parse(keystr);
Expand Down
4 changes: 2 additions & 2 deletions workspace.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const { Gio, GLib } = imports.gi;
/**
* Workspace related utility functions used by other modules.
*/
let WORKSPACE_LIST_KEY = 'org.gnome.shell.extensions.paperwm.workspacelist';
let WORKSPACE_KEY = 'org.gnome.shell.extensions.paperwm.workspace';
const WORKSPACE_LIST_KEY = 'org.gnome.shell.extensions.paperwm.workspacelist';
const WORKSPACE_KEY = 'org.gnome.shell.extensions.paperwm.workspace';
let workspaceSettingsCache;

let schemaSource, workspaceList;
Expand Down

0 comments on commit 3986699

Please sign in to comment.