mirror of
https://gitlab.com/thebiblelover7/dotfiles.git
synced 2025-12-14 04:03:50 +00:00
initial commit
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
const Meta = imports.gi.Meta;
|
||||
const Main = imports.ui.main;
|
||||
const Shell = imports.gi.Shell;
|
||||
|
||||
const SHORTCUT_KEY = 'shortcut-key';
|
||||
|
||||
let settings = imports.misc.extensionUtils.getSettings();
|
||||
|
||||
var currentWorkspace = -1;
|
||||
var lastWorkspace = -1;
|
||||
|
||||
function goToLastWorkspace() {
|
||||
if (lastWorkspace < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// keep global.screen for backwards compatibility
|
||||
let ws = (global.screen || global.workspace_manager).get_workspace_by_index(lastWorkspace);
|
||||
ws.activate(global.get_current_time());
|
||||
}
|
||||
|
||||
|
||||
function init() {
|
||||
}
|
||||
|
||||
let signals = [];
|
||||
|
||||
function enable() {
|
||||
var ModeType = Shell.hasOwnProperty('ActionMode') ? Shell.ActionMode : Shell.KeyBindingMode;
|
||||
Main.wm.addKeybinding(SHORTCUT_KEY, settings, Meta.KeyBindingFlags.NONE, ModeType.NORMAL | ModeType.OVERVIEW, goToLastWorkspace);
|
||||
|
||||
signals.push((global.screen || global.workspace_manager).connect('workspace-switched', function(display, prev, current, direction) {
|
||||
lastWorkspace = currentWorkspace;
|
||||
currentWorkspace = current;
|
||||
}));
|
||||
}
|
||||
|
||||
function disable() {
|
||||
// clean up
|
||||
Main.wm.removeKeybinding(SHORTCUT_KEY);
|
||||
|
||||
let i = signals.length;
|
||||
while (i--) {
|
||||
(global.screen || global.workspace_manager).disconnect(signals.pop());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user