Skip to content

Commit d8ee95e

Browse files
authored
smart-panel: Fixes #850 (#853)
1 parent 8a3a536 commit d8ee95e

File tree

20 files changed

+1002
-1116
lines changed

20 files changed

+1002
-1116
lines changed

smart-panel@mohammad-sn/files/smart-panel@mohammad-sn/extension.js

Lines changed: 27 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -56,28 +56,30 @@ function SmartPanelExt(metadata, orientation, panel_height, instanceId) {
5656
SmartPanelExt.prototype = {
5757
_init: function(metadata, orientation, panel_height, instanceId) {
5858

59-
Settings.BindingDirection.BI = Settings.BindingDirection.BIDIRECTIONAL
6059
this.settings = new Settings.ExtensionSettings(this, "smart-panel@mohammad-sn");
61-
this.settings.bindProperty(Settings.BindingDirection.BI, "scroll-action" , "scrl_action", this._onScrollActionChanged, null);
62-
this.settings.bindProperty(Settings.BindingDirection.BI, "sep-scroll-action" , "sep_acts", this._onScrollSettingsChanged, null);
63-
this.settings.bindProperty(Settings.BindingDirection.IN, "scroll-action-up" , "scrl_up_action", null, null);
64-
this.settings.bindProperty(Settings.BindingDirection.IN, "scroll-action-down", "scrl_down_action", null, null);
65-
this.settings.bindProperty(Settings.BindingDirection.IN, "dblclck-action" , "dblclck_action", null, null);
66-
this.settings.bindProperty(Settings.BindingDirection.IN, "mdlclck-action" , "mdlclck_action", null, null);
67-
this.settings.bindProperty(Settings.BindingDirection.IN, "use-gestures" , "use_gestures", null, null);
68-
this.settings.bindProperty(Settings.BindingDirection.IN, "to-left-action" , "to_left", null, null);
69-
this.settings.bindProperty(Settings.BindingDirection.IN, "to-right-action" , "to_right", null, null);
70-
this.settings.bindProperty(Settings.BindingDirection.IN, "vert-out-action" , "vert_out", null, null);
71-
this.settings.bindProperty(Settings.BindingDirection.IN, "cc1-action" , "cc1", null, null);
72-
this.settings.bindProperty(Settings.BindingDirection.IN, "cc2-action" , "cc2", null, null);
73-
this.settings.bindProperty(Settings.BindingDirection.IN, "cc3-action" , "cc3", null, null);
74-
this.settings.bindProperty(Settings.BindingDirection.IN, "prev-fast-scroll" , "no_fast_scroll", null, null);
75-
this.settings.bindProperty(Settings.BindingDirection.IN, "topleft-osd" , "topleft_osd", null, null);
76-
this.settings.bindProperty(Settings.BindingDirection.IN, "scroll-delay" , "scroll_delay", null, null);
77-
this.settings.bindProperty(Settings.BindingDirection.IN, "appswitcher-style" , "switcher_style", null, null);
78-
this.settings.bindProperty(Settings.BindingDirection.IN, "appswitcher-scope" , "switcher_scope", null, null);
79-
this.settings.bindProperty(Settings.BindingDirection.IN, "scope-modified" , "switcher_modified", null, null);
80-
this.settings.bindProperty(Settings.BindingDirection.IN, "appswitcher-modifier", "switcher_modifier", null, null);
60+
this.settings.bind("scroll-action" , "scrl_action", this._onScrollActionChanged);
61+
this.settings.bind("sep-scroll-action" , "sep_acts", this._onScrollSettingsChanged);
62+
this.settings.bind("scroll-action-up" , "scrl_up_action", null);
63+
this.settings.bind("scroll-action-down", "scrl_down_action", null);
64+
this.settings.bind("dblclck-action" , "dblclck_action", null);
65+
this.settings.bind("mdlclck-action" , "mdlclck_action", null);
66+
this.settings.bind("use-gestures" , "use_gestures", null);
67+
this.settings.bind("to-left-action" , "to_left", null);
68+
this.settings.bind("to-right-action" , "to_right", null);
69+
this.settings.bind("vert-out-action" , "vert_out", null);
70+
this.settings.bind("cc1-action" , "cc1", null);
71+
this.settings.bind("cc2-action" , "cc2", null);
72+
this.settings.bind("cc3-action" , "cc3", null);
73+
this.settings.bind("prev-fast-scroll" , "no_fast_scroll", null);
74+
this.settings.setValue("show-osd", global.settings.get_boolean('workspace-osd-visible'));
75+
this.settings.bind("show-osd" , "show_osd", this._onShowOSDChanged, null);
76+
this.settings.bind("scroll-delay" , "scroll_delay", null);
77+
this.settings.bind("appswitcher-style" , "switcher_style", null);
78+
this.settings.bind("appswitcher-scope" , "switcher_scope", null);
79+
this.settings.bind("scope-modified" , "switcher_modified", null);
80+
this.settings.bind("appswitcher-modifier", "switcher_modifier", null);
81+
this._onShowOSDChanged();
82+
global.settings.connect("changed::workspace-osd-visible", () => { this.show_osd = global.settings.get_boolean('workspace-osd-visible') });
8183

8284
this.cwm_settings = new Gio.Settings({ schema: "org.cinnamon.desktop.wm.preferences" });
8385

@@ -101,6 +103,10 @@ SmartPanelExt.prototype = {
101103
this.dblb_T = this.mos_settings.get_int('double-click');
102104
},
103105

106+
_onShowOSDChanged : function() {
107+
global.settings.set_boolean('workspace-osd-visible', this.show_osd);
108+
},
109+
104110
_onScrollActionChanged : function() {
105111
if (this.scrl_action != "none") this.sep_acts = false;
106112
},
@@ -284,7 +290,6 @@ SmartPanelExt.prototype = {
284290
this.workspaceSwitcherExt.ExtSwitchToWorkspace(reqWs);
285291
} else {
286292
reqWs.activate(global.get_current_time());
287-
this.showWorkspaceOSD();
288293
}
289294
}
290295
}
@@ -401,88 +406,10 @@ SmartPanelExt.prototype = {
401406
this.workspaceSwitcherExt.ExtSwitchToWorkspace(reqWs);
402407
} else {
403408
reqWs.activate(global.get_current_time());
404-
this.showWorkspaceOSD();
405409
}
406410
}
407411
},
408412

409-
showWorkspaceOSD : function() {
410-
this._hideWorkspaceOSD();
411-
if (
412-
global.settings.get_boolean('workspace-osd-visible') &&
413-
this.topleft_osd
414-
) {
415-
let current_workspace_index =
416-
global.screen.get_active_workspace_index();
417-
let monitor = Main.layoutManager.primaryMonitor;
418-
if (this._workspace_osd == null)
419-
this._workspace_osd = new St.Label({
420-
style_class: 'workspace-osd',
421-
});
422-
this._workspace_osd.set_text(
423-
Main.getWorkspaceName(current_workspace_index)
424-
);
425-
//this._workspace_osd.set_opacity = 0;
426-
this._workspace_osd.set_opacity(0);
427-
Main.layoutManager.addChrome(this._workspace_osd, {
428-
visibleInFullscreen: false,
429-
affectsInputRegion: false,
430-
});
431-
let workspace_osd_x = global.settings.get_int('workspace-osd-x');
432-
let workspace_osd_y = global.settings.get_int('workspace-osd-y');
433-
/*
434-
* This aligns the osd edges to the minimum/maximum values from gsettings,
435-
436-
* if those are selected to be used. For values in between minimum/maximum,
437-
* it shifts the osd by half of the percentage used of the overall space available
438-
* for display (100% - (left and right 'padding')).
439-
* The horizontal minimum/maximum values are 5% and 95%, resulting in 90% available for positioning
440-
* If the user choses 50% as osd position, these calculations result the osd being centered onscreen
441-
*/
442-
let [minX, maxX, minY, maxY] = [5, 95, 5, 95];
443-
let delta = (workspace_osd_x - minX) / (maxX - minX);
444-
let x = Math.round(
445-
(monitor.width * workspace_osd_x) / 100 -
446-
this._workspace_osd.width * delta
447-
);
448-
delta = (workspace_osd_y - minY) / (maxY - minY);
449-
let y = Math.round(
450-
(monitor.height * workspace_osd_y) / 100 -
451-
this._workspace_osd.height * delta
452-
);
453-
this._workspace_osd.set_position(x, y);
454-
let duration =
455-
global.settings.get_int('workspace-osd-duration') / 1000;
456-
Tweener.addTween(this._workspace_osd, {
457-
opacity: 255,
458-
time: duration,
459-
transition: 'linear',
460-
onComplete: this._fadeWorkspaceOSD,
461-
onCompleteScope: this,
462-
});
463-
}
464-
},
465-
466-
_fadeWorkspaceOSD : function() {
467-
if (this._workspace_osd != null) {
468-
let duration = global.settings.get_int("workspace-osd-duration") / 2000;
469-
Tweener.addTween(this._workspace_osd, { opacity: 0,
470-
time: duration,
471-
transition: 'easeOutExpo',
472-
onComplete: this._hideWorkspaceOSD,
473-
onCompleteScope: this });
474-
}
475-
},
476-
477-
_hideWorkspaceOSD : function() {
478-
if (this._workspace_osd != null) {
479-
this._workspace_osd.hide();
480-
Main.layoutManager.removeChrome(this._workspace_osd);
481-
this._workspace_osd.destroy();
482-
this._workspace_osd = null;
483-
}
484-
},
485-
486413
_updateWorkspaceSwitcherExt : function() {
487414
// Check if one of the workspace switcher extensions are installed or if the state has changed since we last checked
488415
if (ExtensionSystem.runningExtensions.indexOf('DesktopCube@yare') > -1 ) {

smart-panel@mohammad-sn/files/smart-panel@mohammad-sn/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
],
2424
"description": "Switch between workspaces, show desktop, activate overview or expo, ... by scrolling, double click, mouse gestures etc on free space of the panel.",
2525
"name": "Smart Panel",
26-
"version": "1.4.4",
26+
"version": "1.5.0",
2727
"uuid": "smart-panel@mohammad-sn",
2828
"url": "https://cinnamon-spices.linuxmint.com/extensions/view/80",
2929
"author": "mohammad-sn"

smart-panel@mohammad-sn/files/smart-panel@mohammad-sn/po/ca.po

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SOME DESCRIPTIVE TITLE.
1+
# SMART PANEL
22
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
33
# This file is distributed under the same license as the PACKAGE package.
44
# Odyssey <odysseyhyd@gmail.com>, 2024
@@ -7,8 +7,9 @@
77
msgid ""
88
msgstr ""
99
"Project-Id-Version: \n"
10-
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2023-07-25 01:27+0000\n"
10+
"Report-Msgid-Bugs-To: https://github.com/linuxmint/cinnamon-spices-"
11+
"extensions/issues\n"
12+
"POT-Creation-Date: 2025-03-23 22:02+0100\n"
1213
"PO-Revision-Date: 2024-07-25 18:35+0200\n"
1314
"Last-Translator: Odyssey <odysseyhyd@gmail.com>\n"
1415
"Language-Team: \n"
@@ -23,9 +24,9 @@ msgid ""
2324
"Switch between workspaces, show desktop, activate overview or expo, ... by "
2425
"scrolling, double click, mouse gestures etc on free space of the panel."
2526
msgstr ""
26-
"Canvieu entre espais de treball, mostreu l'escriptori, activeu vista "
27-
"general o expo, ... mitjançant desplaçament, doble clic, moviments del "
28-
"ratolí, etc. a l'espai lliure del tauler."
27+
"Canvieu entre espais de treball, mostreu l'escriptori, activeu vista general "
28+
"o expo, ... mitjançant desplaçament, doble clic, moviments del ratolí, etc. "
29+
"a l'espai lliure del tauler."
2930

3031
#. metadata.json->name
3132
msgid "Smart Panel"
@@ -84,13 +85,9 @@ msgstr "mil·lisegons"
8485
msgid "Independent actions for scrolling up and down"
8586
msgstr "Accions independents per desplaçar-se cap a dalt i cap a baix"
8687

87-
#. settings-schema.json->topleft-osd->description
88-
msgid ""
89-
"Show workspace notification on the top left corner of the scren when "
90-
"switching workspaces"
88+
#. settings-schema.json->show-osd->description
89+
msgid "Display OSD for workspace change notification"
9190
msgstr ""
92-
"Mostrar notificació d'espai de treball a la cantonada superior esquerra de "
93-
"la pantalla en canviar d'espai de treball"
9491

9592
#. settings-schema.json->scroll-action-up->description
9693
msgid "Action on scrolling up: "
@@ -285,8 +282,7 @@ msgstr "Aplicació actual"
285282

286283
#. settings-schema.json->scope-modified->description
287284
msgid "When a modifier key is pressed, switch between windows from: "
288-
msgstr ""
289-
"En polsar una tecla modificadora, canvia entre les finestres des de: "
285+
msgstr "En polsar una tecla modificadora, canvia entre les finestres des de: "
290286

291287
#. settings-schema.json->appswitcher-modifier->description
292288
msgid "Modifier key: "

smart-panel@mohammad-sn/files/smart-panel@mohammad-sn/po/da.po

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
# SOME DESCRIPTIVE TITLE.
1+
# SMART PANEL
22
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
33
# This file is distributed under the same license as the PACKAGE package.
4-
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
4+
# mohammad-sn, 2017
55
#
66
msgid ""
77
msgstr ""
88
"Project-Id-Version: \n"
9-
"Report-Msgid-Bugs-To: \n"
10-
"POT-Creation-Date: 2023-07-25 01:27+0000\n"
9+
"Report-Msgid-Bugs-To: https://github.com/linuxmint/cinnamon-spices-"
10+
"extensions/issues\n"
11+
"POT-Creation-Date: 2025-03-23 22:02+0100\n"
1112
"PO-Revision-Date: 2023-12-07 15:38+0100\n"
1213
"Last-Translator: Alan Mortensen <alanmortensen.am@gmail.com>\n"
1314
"Language-Team: \n"
@@ -83,13 +84,9 @@ msgstr "millisekunder"
8384
msgid "Independent actions for scrolling up and down"
8485
msgstr "Forskellige handlinger ved rulning op og ned"
8586

86-
#. settings-schema.json->topleft-osd->description
87-
msgid ""
88-
"Show workspace notification on the top left corner of the scren when "
89-
"switching workspaces"
87+
#. settings-schema.json->show-osd->description
88+
msgid "Display OSD for workspace change notification"
9089
msgstr ""
91-
"Vis arbejdsområdeunderretning i skærmens øverste venstre hjørne, når der "
92-
"skiftes arbejdsområde"
9390

9491
#. settings-schema.json->scroll-action-up->description
9592
msgid "Action on scrolling up: "

smart-panel@mohammad-sn/files/smart-panel@mohammad-sn/po/es.po

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
# SOME DESCRIPTIVE TITLE.
1+
# SMART PANEL
22
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
33
# This file is distributed under the same license as the PACKAGE package.
4-
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
4+
# mohammad-sn, 2017
55
#
66
msgid ""
77
msgstr ""
88
"Project-Id-Version: \n"
9-
"Report-Msgid-Bugs-To: \n"
10-
"POT-Creation-Date: 2023-07-25 01:27+0000\n"
9+
"Report-Msgid-Bugs-To: https://github.com/linuxmint/cinnamon-spices-"
10+
"extensions/issues\n"
11+
"POT-Creation-Date: 2025-03-23 22:02+0100\n"
1112
"PO-Revision-Date: 2023-11-03 10:56-0300\n"
1213
"Last-Translator: \n"
1314
"Language-Team: \n"
@@ -22,9 +23,9 @@ msgid ""
2223
"Switch between workspaces, show desktop, activate overview or expo, ... by "
2324
"scrolling, double click, mouse gestures etc on free space of the panel."
2425
msgstr ""
25-
"Cambie entre espacios de trabajo, mostrar escritorio, activar vista "
26-
"general o expo, ... mediante desplazamiento, doble clic, gestos del ratón, "
27-
"etc. en el espacio libre del panel."
26+
"Cambie entre espacios de trabajo, mostrar escritorio, activar vista general "
27+
"o expo, ... mediante desplazamiento, doble clic, gestos del ratón, etc. en "
28+
"el espacio libre del panel."
2829

2930
#. metadata.json->name
3031
msgid "Smart Panel"
@@ -83,13 +84,9 @@ msgstr "milisegundos"
8384
msgid "Independent actions for scrolling up and down"
8485
msgstr "Acciones independientes para desplazarse hacia arriba y hacia abajo"
8586

86-
#. settings-schema.json->topleft-osd->description
87-
msgid ""
88-
"Show workspace notification on the top left corner of the scren when "
89-
"switching workspaces"
87+
#. settings-schema.json->show-osd->description
88+
msgid "Display OSD for workspace change notification"
9089
msgstr ""
91-
"Mostrar notificación de espacio de trabajo en la esquina superior "
92-
"izquierda de la pantalla al cambiar de espacio de trabajo"
9390

9491
#. settings-schema.json->scroll-action-up->description
9592
msgid "Action on scrolling up: "

smart-panel@mohammad-sn/files/smart-panel@mohammad-sn/po/eu.po

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
# SOME DESCRIPTIVE TITLE.
1+
# SMART PANEL
22
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
33
# This file is distributed under the same license as the PACKAGE package.
4-
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
4+
# mohammad-sn, 2017
55
#
66
#, fuzzy
77
msgid ""
88
msgstr ""
99
"Project-Id-Version: \n"
10-
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2023-07-25 01:27+0000\n"
10+
"Report-Msgid-Bugs-To: https://github.com/linuxmint/cinnamon-spices-"
11+
"extensions/issues\n"
12+
"POT-Creation-Date: 2025-03-23 22:02+0100\n"
1213
"PO-Revision-Date: 2024-05-30 9:50+1\n"
1314
"Last-Translator: Muxutruk <muxutruk2@users.noreply.github.com>\n"
1415
"Language-Team: Basque <muxutruk2@users.noreply.github.com>\n"
@@ -23,8 +24,8 @@ msgid ""
2324
"scrolling, double click, mouse gestures etc on free space of the panel."
2425
msgstr ""
2526
"Lan-espazioen artean aldatu, mahaigaina erakutsi, ikuspegi orokorra edo "
26-
"expoa aktibatu... korritzerakoan, klik bikoitzan, saguaren keinuekin eta abar, "
27-
"panelaren espazio librean."
27+
"expoa aktibatu... korritzerakoan, klik bikoitzan, saguaren keinuekin eta "
28+
"abar, panelaren espazio librean."
2829

2930
#. metadata.json->name
3031
msgid "Smart Panel"
@@ -48,7 +49,7 @@ msgstr "Leihoen opakutasuna aldatu"
4849

4950
#. settings-schema.json->scroll-action->options
5051
msgid "Toggle show desktop"
51-
msgstr "Mahaigaina erakutsi"
52+
msgstr "Mahaigaina erakutsi"
5253

5354
#. settings-schema.json->scroll-action->options
5455
msgid "Switch between windows"
@@ -67,8 +68,7 @@ msgstr "Bat ere ez"
6768

6869
#. settings-schema.json->prev-fast-scroll->description
6970
msgid "Prevent accidental workspace/window switching on rapid scrolling"
70-
msgstr ""
71-
"Ustekabeko lan-espazio/leiho aldaketa korritze azkarrean eragoztea"
71+
msgstr "Ustekabeko lan-espazio/leiho aldaketa korritze azkarrean eragoztea"
7272

7373
#. settings-schema.json->scroll-delay->description
7474
msgid "Minimum delay between scrolls:"
@@ -82,13 +82,9 @@ msgstr "milisegundoak"
8282
msgid "Independent actions for scrolling up and down"
8383
msgstr "Gora eta behera korritzerakoan ekintza independenteak."
8484

85-
#. settings-schema.json->topleft-osd->description
86-
msgid ""
87-
"Show workspace notification on the top left corner of the scren when "
88-
"switching workspaces"
85+
#. settings-schema.json->show-osd->description
86+
msgid "Display OSD for workspace change notification"
8987
msgstr ""
90-
"Erakutsi lan-espazioaren jakinarazpena pantailaren goiko eta ezkerreko izkinatan, "
91-
"lan-espazioak aldatzean."
9288

9389
#. settings-schema.json->scroll-action-up->description
9490
msgid "Action on scrolling up: "
@@ -224,7 +220,8 @@ msgstr "3. Agindu pertsonalizatua: "
224220

225221
#. settings-schema.json->head5->description
226222
msgid "App Switcher Settings: "
227-
msgstr "Aplikazio aldaketen ezarpenak: "
223+
msgstr "Aplikazio aldaketen ezarpenak: "
224+
228225
#. settings-schema.json->appswitcher-style->description
229226
msgid "App switcher style: "
230227
msgstr "Aplikazio aldaketen estiloa: "

0 commit comments

Comments
 (0)