mirror of
https://github.com/gosticks/PaperWM.git
synced 2026-07-01 14:40:02 +00:00
Set workspace name utility function
Arguments ordered for convenience for now since the repl is the UI atm.
This commit is contained in:
18
utils.js
18
utils.js
@@ -124,3 +124,21 @@ var toggleWindowBoxes = function(metaWindow) {
|
||||
function sum(array) {
|
||||
return array.reduce((a, b) => a + b, 0);
|
||||
}
|
||||
|
||||
function setWorkspaceName(name, workspace) {
|
||||
let i;
|
||||
if (workspaceOrIndex === undefined) {
|
||||
i = global.screen.get_active_workspace_index();
|
||||
} else {
|
||||
i = workspace.index();
|
||||
}
|
||||
let settings = new Gio.Settings({ schema_id:
|
||||
'org.gnome.desktop.wm.preferences'});
|
||||
let names = settings.get_strv('workspace-names');
|
||||
|
||||
let oldName = names[i];
|
||||
names[i] = name;
|
||||
settings.set_strv('workspace-names', names);
|
||||
|
||||
return oldName;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user