From e70d140a340ec33693375a0a670f4436cf08e2a5 Mon Sep 17 00:00:00 2001 From: Roman Suvorov Date: Mon, 31 Jan 2022 21:33:40 +0300 Subject: [PATCH 1/3] follow guidlines changes --- extension.js | 32 +++++++++++++++++++++----------- metadata.json | 4 ++-- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/extension.js b/extension.js index c9c76a8..b4a39a1 100644 --- a/extension.js +++ b/extension.js @@ -2,6 +2,8 @@ const { Clutter, St, GObject } = imports.gi; const Main = imports.ui.main; const PanelMenu = imports.ui.panelMenu; +const Me = ExtensionUtils.getCurrenExtension(); + const bullet = "●"; const circle = "○"; @@ -13,7 +15,7 @@ let _indicator; let WorkspaceIndicator = GObject.registerClass( class WorkspaceIndicator extends PanelMenu.Button { _init() { - super._init(0.0, _('Workspace Indicator')); + super._init(0.0, _('Horizontal workspace indicator')); this._container = new St.Widget({ layout_manager: new Clutter.BinLayout(), @@ -72,6 +74,22 @@ let WorkspaceIndicator = GObject.registerClass( } ); +class Extension { + constructor(uuid) { + this._uuid = uuid; + } + + enable() { + this._indicator = new WorkspaceIndicator(); + Main.panel.addToStatusArea(this._uuid, this._indicator); + } + + disable() { + this._indicator.destroy(); + this._indicator = null; + } +} + function getWidgetText() { let txt = ""; let numberWorkspaces = global.workspace_manager.get_n_workspaces(); @@ -86,14 +104,6 @@ function getWidgetText() { return txt } -function init() { -} - -function enable() { - _indicator = new WorkspaceIndicator(); - Main.panel.addToStatusArea('workspace-indicator', _indicator); -} - -function disable() { - _indicator.destroy(); +function init(meta) { + return new Extension(meta.uuid); } \ No newline at end of file diff --git a/metadata.json b/metadata.json index ab9396c..96a94b7 100644 --- a/metadata.json +++ b/metadata.json @@ -1,8 +1,8 @@ { "description": "Workspace indicator shows the amount of opened workspaces and the current one", "name": "Workspace indicator", - "shell-version": ["3.38","40", "40.0", "40.0.0", "41"], + "shell-version": ["3.38","40", "41"], "url": "https://github.com/tty2/horizontal-workspace-indicator", "uuid": "horizontal-workspace-indicator@tty2.io", - "version": "0.0.8" + "version": "0.0.9" } From 270831aa9379229573738993692eac8c8b0525b4 Mon Sep 17 00:00:00 2001 From: Roman Suvorov Date: Mon, 31 Jan 2022 21:39:21 +0300 Subject: [PATCH 2/3] remove redundant import --- extension.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/extension.js b/extension.js index b4a39a1..1ad16f6 100644 --- a/extension.js +++ b/extension.js @@ -2,9 +2,6 @@ const { Clutter, St, GObject } = imports.gi; const Main = imports.ui.main; const PanelMenu = imports.ui.panelMenu; -const Me = ExtensionUtils.getCurrenExtension(); - - const bullet = "●"; const circle = "○"; const leftButton = 1; From c945e322bf571d574863a9f1e72379a37a216453 Mon Sep 17 00:00:00 2001 From: Roman Suvorov Date: Mon, 31 Jan 2022 21:43:50 +0300 Subject: [PATCH 3/3] remove redundant let --- extension.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/extension.js b/extension.js index 1ad16f6..249065a 100644 --- a/extension.js +++ b/extension.js @@ -7,8 +7,6 @@ const circle = "○"; const leftButton = 1; const rightButton = 3; -let _indicator; - let WorkspaceIndicator = GObject.registerClass( class WorkspaceIndicator extends PanelMenu.Button { _init() {