From 563d7770d31a69d00c89a115a5046b67866d3518 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Sat, 20 Aug 2022 18:50:51 +0200 Subject: [PATCH 1/5] lint: Sync with gnome-shell gnome-shell started transitioning to gjs' object spacing rule, i.e. `{foo: 42}` instead of `{ foo: 42 }`. We have a much smaller code base than the shell and aren't using a secondary "allowed-but-deprecated" configuration that allows a gradual transition, so just pull the switch and update to the new style. Part-of: --- extensions/apps-menu/extension.js | 14 +++++------ extensions/auto-move-windows/extension.js | 2 +- extensions/auto-move-windows/prefs.js | 14 +++++------ extensions/drive-menu/extension.js | 2 +- .../native-window-placement/extension.js | 4 ++-- extensions/places-menu/extension.js | 2 +- extensions/places-menu/placeDisplay.js | 16 ++++++------- .../screenshot-window-sizer/extension.js | 6 ++--- extensions/user-theme/extension.js | 2 +- extensions/user-theme/prefs.js | 4 ++-- extensions/user-theme/util.js | 2 +- extensions/window-list/extension.js | 24 +++++++++---------- extensions/window-list/prefs.js | 10 ++++---- extensions/window-list/windowPicker.js | 12 +++++----- extensions/window-list/workspaceIndicator.js | 10 ++++---- extensions/windowsNavigator/extension.js | 16 ++++++------- extensions/workspace-indicator/extension.js | 8 +++---- extensions/workspace-indicator/prefs.js | 10 ++++---- lint/eslintrc-shell.yml | 5 ++-- 19 files changed, 82 insertions(+), 81 deletions(-) diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js index cc1d697c..6757f217 100644 --- a/extensions/apps-menu/extension.js +++ b/extensions/apps-menu/extension.js @@ -117,7 +117,7 @@ class CategoryMenuItem extends PopupMenu.PopupBaseMenuItem { else name = _('Favorites'); - this.add_child(new St.Label({ text: name })); + this.add_child(new St.Label({text: name})); this.connect('motion-event', this._onMotionEvent.bind(this)); this.connect('notify::active', this._onActiveChanged.bind(this)); } @@ -408,7 +408,7 @@ class ApplicationsButton extends PanelMenu.Button { }); }); - this._tree = new GMenu.Tree({ menu_basename: 'applications.menu' }); + this._tree = new GMenu.Tree({menu_basename: 'applications.menu'}); this._treeChangedId = this._tree.connect('changed', this._onTreeChanged.bind(this)); @@ -509,7 +509,7 @@ class ApplicationsButton extends PanelMenu.Button { } let app = appSys.lookup_app(id); if (!app) - app = new Shell.App({ app_info: entry.get_app_info() }); + app = new Shell.App({app_info: entry.get_app_info()}); if (app.get_app_info().should_show()) this.applicationsByCategory[categoryId].push(app); } else if (nextType === GMenu.TreeItemType.SEPARATOR) { @@ -555,8 +555,8 @@ class ApplicationsButton extends PanelMenu.Button { _createLayout() { let section = new PopupMenu.PopupMenuSection(); this.menu.addMenuItem(section); - this.mainBox = new St.BoxLayout({ vertical: false }); - this.leftBox = new St.BoxLayout({ vertical: true }); + this.mainBox = new St.BoxLayout({vertical: false}); + this.leftBox = new St.BoxLayout({vertical: true}); this.applicationsScrollBox = new St.ScrollView({ style_class: 'apps-menu vfade', x_expand: true, @@ -578,9 +578,9 @@ class ApplicationsButton extends PanelMenu.Button { vscroll.connect('scroll-stop', () => (this.menu.passEvents = false)); this.leftBox.add_child(this.categoriesScrollBox); - this.applicationsBox = new St.BoxLayout({ vertical: true }); + this.applicationsBox = new St.BoxLayout({vertical: true}); this.applicationsScrollBox.add_actor(this.applicationsBox); - this.categoriesBox = new St.BoxLayout({ vertical: true }); + this.categoriesBox = new St.BoxLayout({vertical: true}); this.categoriesScrollBox.add_actor(this.categoriesBox); this.mainBox.add(this.leftBox); diff --git a/extensions/auto-move-windows/extension.js b/extensions/auto-move-windows/extension.js index 72fed2ec..298de536 100644 --- a/extensions/auto-move-windows/extension.js +++ b/extensions/auto-move-windows/extension.js @@ -2,7 +2,7 @@ // Start apps on custom workspaces /* exported init enable disable */ -const { Shell } = imports.gi; +const {Shell} = imports.gi; const ExtensionUtils = imports.misc.extensionUtils; const Main = imports.ui.main; diff --git a/extensions/auto-move-windows/prefs.js b/extensions/auto-move-windows/prefs.js index acfd7fa2..b849db7d 100644 --- a/extensions/auto-move-windows/prefs.js +++ b/extensions/auto-move-windows/prefs.js @@ -2,7 +2,7 @@ // Start apps on custom workspaces /* exported init buildPrefsWidget */ -const { Adw, Gio, GLib, GObject, Gtk } = imports.gi; +const {Adw, Gio, GLib, GObject, Gtk} = imports.gi; const ExtensionUtils = imports.misc.extensionUtils; @@ -75,7 +75,7 @@ class RulesList extends GObject.Object { append(appInfo) { const pos = this.#rules.length; - this.#rules.push(new Rule({ appInfo })); + this.#rules.push(new Rule({appInfo})); this.#saveRules(); this.items_changed(pos, 0, 1); @@ -97,7 +97,7 @@ class RulesList extends GObject.Object { if (pos < 0) return; - this.#rules[pos].set({ workspace }); + this.#rules[pos].set({workspace}); this.#saveRules(); } @@ -116,7 +116,7 @@ class RulesList extends GObject.Object { const [id, workspace] = stringRule.split(':'); const appInfo = Gio.DesktopAppInfo.new(id); if (appInfo) - this.#rules.push(new Rule({ appInfo, workspace })); + this.#rules.push(new Rule({appInfo, workspace})); else log(`Invalid ID ${id}`); } @@ -154,8 +154,8 @@ class AutoMoveSettingsWidget extends Adw.PreferencesGroup { this._rules = new RulesList(); - const store = new Gio.ListStore({ item_type: Gio.ListModel }); - const listModel = new Gtk.FlattenListModel({ model: store }); + const store = new Gio.ListStore({item_type: Gio.ListModel}); + const listModel = new Gtk.FlattenListModel({model: store}); store.append(this._rules); store.append(new NewItemModel()); @@ -248,7 +248,7 @@ class RuleRow extends Adw.ActionRow { } constructor(rule) { - const { appInfo } = rule; + const {appInfo} = rule; const id = appInfo.get_id(); super({ diff --git a/extensions/drive-menu/extension.js b/extensions/drive-menu/extension.js index d054f879..251687ac 100644 --- a/extensions/drive-menu/extension.js +++ b/extensions/drive-menu/extension.js @@ -1,6 +1,6 @@ /* exported init enable disable */ // Drive menu extension -const { Clutter, Gio, GObject, Shell, St } = imports.gi; +const {Clutter, Gio, GObject, Shell, St} = imports.gi; const ExtensionUtils = imports.misc.extensionUtils; const Main = imports.ui.main; diff --git a/extensions/native-window-placement/extension.js b/extensions/native-window-placement/extension.js index 78d4c7ba..b6b662a8 100644 --- a/extensions/native-window-placement/extension.js +++ b/extensions/native-window-placement/extension.js @@ -1,10 +1,10 @@ // -*- mode: js2; indent-tabs-mode: nil; js2-basic-offset: 4 -*- /* exported enable disable */ -const { Clutter } = imports.gi; +const {Clutter} = imports.gi; const ExtensionUtils = imports.misc.extensionUtils; const Main = imports.ui.main; -const { WindowPreview } = imports.ui.windowPreview; +const {WindowPreview} = imports.ui.windowPreview; const Workspace = imports.ui.workspace; // testing settings for natural window placement strategy: diff --git a/extensions/places-menu/extension.js b/extensions/places-menu/extension.js index 7c51220c..7bad2ff1 100644 --- a/extensions/places-menu/extension.js +++ b/extensions/places-menu/extension.js @@ -1,7 +1,7 @@ /* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */ /* exported init enable disable */ -const { Clutter, GObject, St } = imports.gi; +const {Clutter, GObject, St} = imports.gi; const ExtensionUtils = imports.misc.extensionUtils; const Main = imports.ui.main; diff --git a/extensions/places-menu/placeDisplay.js b/extensions/places-menu/placeDisplay.js index 5d04599b..788f6bf9 100644 --- a/extensions/places-menu/placeDisplay.js +++ b/extensions/places-menu/placeDisplay.js @@ -1,6 +1,6 @@ // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- -const { Gio, GLib, Shell } = imports.gi; +const {Gio, GLib, Shell} = imports.gi; const Signals = imports.signals; const ExtensionUtils = imports.misc.extensionUtils; @@ -31,7 +31,7 @@ class PlaceInfo { this.kind = kind; this.file = file; this.name = name || this._getFileName(); - this.icon = icon ? new Gio.ThemedIcon({ name: icon }) : this.getIcon(); + this.icon = icon ? new Gio.ThemedIcon({name: icon}) : this.getIcon(); } destroy() { @@ -94,16 +94,16 @@ class PlaceInfo { // icon from the query info above switch (this.kind) { case 'network': - return new Gio.ThemedIcon({ name: 'folder-remote-symbolic' }); + return new Gio.ThemedIcon({name: 'folder-remote-symbolic'}); case 'devices': - return new Gio.ThemedIcon({ name: 'drive-harddisk-symbolic' }); + return new Gio.ThemedIcon({name: 'drive-harddisk-symbolic'}); case 'special': case 'bookmarks': default: if (!this.file.is_native()) - return new Gio.ThemedIcon({ name: 'folder-remote-symbolic' }); + return new Gio.ThemedIcon({name: 'folder-remote-symbolic'}); else - return new Gio.ThemedIcon({ name: 'folder-symbolic' }); + return new Gio.ThemedIcon({name: 'folder-symbolic'}); } } @@ -138,7 +138,7 @@ class RootInfo extends PlaceInfo { } getIcon() { - return new Gio.ThemedIcon({ name: 'drive-harddisk-symbolic' }); + return new Gio.ThemedIcon({name: 'drive-harddisk-symbolic'}); } _propertiesChanged(proxy) { @@ -255,7 +255,7 @@ var PlacesManager = class { network: [], }; - this._settings = new Gio.Settings({ schema_id: BACKGROUND_SCHEMA }); + this._settings = new Gio.Settings({schema_id: BACKGROUND_SCHEMA}); this._showDesktopIconsChangedId = this._settings.connect( 'changed::show-desktop-icons', this._updateSpecials.bind(this)); this._updateSpecials(); diff --git a/extensions/screenshot-window-sizer/extension.js b/extensions/screenshot-window-sizer/extension.js index aa613a7d..d59ec3f3 100644 --- a/extensions/screenshot-window-sizer/extension.js +++ b/extensions/screenshot-window-sizer/extension.js @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -const { Clutter, Meta, Shell, St } = imports.gi; +const {Clutter, Meta, Shell, St} = imports.gi; const ExtensionUtils = imports.misc.extensionUtils; const Main = imports.ui.main; @@ -39,7 +39,7 @@ function hideMessage() { */ function flashMessage(message) { if (!text) { - text = new St.Label({ style_class: 'screenshot-sizer-message' }); + text = new St.Label({style_class: 'screenshot-sizer-message'}); Main.uiGroup.add_actor(text); } @@ -132,7 +132,7 @@ function cycleScreenshotSizes(display, window, binding) { * @param {Meta.Window} window - the window whose size changed */ function _notifySizeChange(window) { - const { scaleFactor } = St.ThemeContext.get_for_stage(global.stage); + const {scaleFactor} = St.ThemeContext.get_for_stage(global.stage); let newOuterRect = window.get_frame_rect(); let message = '%d×%d'.format( newOuterRect.width / scaleFactor, diff --git a/extensions/user-theme/extension.js b/extensions/user-theme/extension.js index 98c4e20d..4295519c 100644 --- a/extensions/user-theme/extension.js +++ b/extensions/user-theme/extension.js @@ -2,7 +2,7 @@ // Load shell theme from ~/.local/share/themes/name/gnome-shell /* exported init */ -const { Gio } = imports.gi; +const {Gio} = imports.gi; const ExtensionUtils = imports.misc.extensionUtils; const Main = imports.ui.main; diff --git a/extensions/user-theme/prefs.js b/extensions/user-theme/prefs.js index 3876c5a3..ef5c9fcb 100644 --- a/extensions/user-theme/prefs.js +++ b/extensions/user-theme/prefs.js @@ -4,7 +4,7 @@ // we use async/await here to not block the mainloop, not to parallelize /* eslint-disable no-await-in-loop */ -const { Adw, Gio, GLib, GObject, Gtk } = imports.gi; +const {Adw, Gio, GLib, GObject, Gtk} = imports.gi; const ExtensionUtils = imports.misc.extensionUtils; @@ -21,7 +21,7 @@ class UserThemePrefsWidget extends Adw.PreferencesGroup { } constructor() { - super({ title: 'Themes' }); + super({title: 'Themes'}); this._actionGroup = new Gio.SimpleActionGroup(); this.insert_action_group('theme', this._actionGroup); diff --git a/extensions/user-theme/util.js b/extensions/user-theme/util.js index cb000a76..222eb75f 100644 --- a/extensions/user-theme/util.js +++ b/extensions/user-theme/util.js @@ -1,5 +1,5 @@ /* exported getThemeDirs getModeThemeDirs */ -const { GLib } = imports.gi; +const {GLib} = imports.gi; const fn = (...args) => GLib.build_filenamev(args); diff --git a/extensions/window-list/extension.js b/extensions/window-list/extension.js index 198a30db..1d71d349 100644 --- a/extensions/window-list/extension.js +++ b/extensions/window-list/extension.js @@ -1,5 +1,5 @@ /* exported init */ -const { Clutter, Gio, GLib, GObject, Gtk, Meta, Shell, St } = imports.gi; +const {Clutter, Gio, GLib, GObject, Gtk, Meta, Shell, St} = imports.gi; const DND = imports.ui.dnd; const ExtensionUtils = imports.misc.extensionUtils; @@ -8,8 +8,8 @@ const Overview = imports.ui.overview; const PopupMenu = imports.ui.popupMenu; const Me = ExtensionUtils.getCurrentExtension(); -const { WindowPicker, WindowPickerToggle } = Me.imports.windowPicker; -const { WorkspaceIndicator } = Me.imports.workspaceIndicator; +const {WindowPicker, WindowPickerToggle} = Me.imports.windowPicker; +const {WorkspaceIndicator} = Me.imports.workspaceIndicator; const _ = ExtensionUtils.gettext; @@ -120,9 +120,9 @@ class WindowTitle extends St.BoxLayout { this._metaWindow = metaWindow; - this._icon = new St.Bin({ style_class: 'window-button-icon' }); + this._icon = new St.Bin({style_class: 'window-button-icon'}); this.add(this._icon); - this.label_actor = new St.Label({ y_align: Clutter.ActorAlign.CENTER }); + this.label_actor = new St.Label({y_align: Clutter.ActorAlign.CENTER}); this.label_actor.clutter_text.single_line_mode = true; this.add(this.label_actor); @@ -250,7 +250,7 @@ class BaseButton extends St.Button { if (this._longPressTimeoutId) return; - const { longPressDuration } = Clutter.Settings.get_default(); + const {longPressDuration} = Clutter.Settings.get_default(); this._longPressTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, longPressDuration, () => { delete this._longPressTimeoutId; @@ -543,7 +543,7 @@ class AppButton extends BaseButton { this.app = app; this._updateVisibility(); - let stack = new St.Widget({ layout_manager: new Clutter.BinLayout() }); + let stack = new St.Widget({layout_manager: new Clutter.BinLayout()}); this.set_child(stack); this._singleWindowTitle = new St.Bin({ @@ -742,7 +742,7 @@ class WindowList extends St.Widget { this._perMonitor = perMonitor; this._monitor = monitor; - let box = new St.BoxLayout({ x_expand: true, y_expand: true }); + let box = new St.BoxLayout({x_expand: true, y_expand: true}); this.add_actor(box); let toggle = new WindowPickerToggle(); @@ -751,7 +751,7 @@ class WindowList extends St.Widget { toggle.connect('notify::checked', this._updateWindowListVisibility.bind(this)); - let layout = new Clutter.BoxLayout({ homogeneous: true }); + let layout = new Clutter.BoxLayout({homogeneous: true}); this._windowList = new St.Widget({ style_class: 'window-list', reactive: true, @@ -769,13 +769,13 @@ class WindowList extends St.Widget { }); this._windowList.connect('scroll-event', this._onScrollEvent.bind(this)); - let indicatorsBox = new St.BoxLayout({ x_align: Clutter.ActorAlign.END }); + let indicatorsBox = new St.BoxLayout({x_align: Clutter.ActorAlign.END}); box.add(indicatorsBox); this._workspaceIndicator = new WorkspaceIndicator(); indicatorsBox.add_child(this._workspaceIndicator.container); - this._mutterSettings = new Gio.Settings({ schema_id: 'org.gnome.mutter' }); + this._mutterSettings = new Gio.Settings({schema_id: 'org.gnome.mutter'}); this._workspacesOnlyOnPrimaryChangedId = this._mutterSettings.connect( 'changed::workspaces-only-on-primary', this._updateWorkspaceIndicatorVisibility.bind(this)); @@ -918,7 +918,7 @@ class WindowList extends St.Widget { let children = this._windowList.get_children(); let [, childWidth] = children[0].get_preferred_width(-1); - let { spacing } = this._windowList.layout_manager; + let {spacing} = this._windowList.layout_manager; let workspace = global.workspace_manager.get_active_workspace(); let windows = global.display.get_tab_list(Meta.TabList.NORMAL, workspace); diff --git a/extensions/window-list/prefs.js b/extensions/window-list/prefs.js index 02b52341..6ef097d1 100644 --- a/extensions/window-list/prefs.js +++ b/extensions/window-list/prefs.js @@ -1,7 +1,7 @@ // -*- mode: js2; indent-tabs-mode: nil; js2-basic-offset: 4 -*- /* exported init buildPrefsWidget */ -const { Adw, Gio, GLib, GObject, Gtk } = imports.gi; +const {Adw, Gio, GLib, GObject, Gtk} = imports.gi; const ExtensionUtils = imports.misc.extensionUtils; @@ -37,12 +37,12 @@ class WindowListPrefsWidget extends Adw.PreferencesPage { this.add(groupingGroup); const modes = [ - { mode: 'never', title: _('Never group windows') }, - { mode: 'auto', title: _('Group windows when space is limited') }, - { mode: 'always', title: _('Always group windows') }, + {mode: 'never', title: _('Never group windows')}, + {mode: 'auto', title: _('Group windows when space is limited')}, + {mode: 'always', title: _('Always group windows')}, ]; - for (const { mode, title } of modes) { + for (const {mode, title} of modes) { const check = new Gtk.CheckButton({ action_name: 'window-list.grouping-mode', action_target: new GLib.Variant('s', mode), diff --git a/extensions/window-list/windowPicker.js b/extensions/window-list/windowPicker.js index db331565..8da04cdf 100644 --- a/extensions/window-list/windowPicker.js +++ b/extensions/window-list/windowPicker.js @@ -1,12 +1,12 @@ /* exported WindowPicker, WindowPickerToggle */ -const { Clutter, GObject, Shell, St } = imports.gi; +const {Clutter, GObject, Shell, St} = imports.gi; const Layout = imports.ui.layout; const Main = imports.ui.main; -const { WorkspacesDisplay } = imports.ui.workspacesView; +const {WorkspacesDisplay} = imports.ui.workspacesView; const Workspace = imports.ui.workspace; -const { VIGNETTE_BRIGHTNESS } = imports.ui.lightbox; +const {VIGNETTE_BRIGHTNESS} = imports.ui.lightbox; const { SIDE_CONTROLS_ANIMATION_TIME, OverviewAdjustment, @@ -90,7 +90,7 @@ class MyWorkspace extends Workspace.Workspace { this._adjChangedId = this._overviewAdjustment.connect('notify::value', () => { - const { value: progress } = this._overviewAdjustment; + const {value: progress} = this._overviewAdjustment; const brightness = 1 - (1 - VIGNETTE_BRIGHTNESS) * progress; for (const bg of this._background?._backgroundGroup ?? []) { bg.content.set({ @@ -151,7 +151,7 @@ class MyWorkspaceBackground extends Workspace.WorkspaceBackground { var WindowPicker = class WindowPicker extends Clutter.Actor { static [GObject.signals] = { - 'open-state-changed': { param_types: [GObject.TYPE_BOOLEAN] }, + 'open-state-changed': {param_types: [GObject.TYPE_BOOLEAN]}, }; static { @@ -159,7 +159,7 @@ var WindowPicker = class WindowPicker extends Clutter.Actor { } constructor() { - super({ reactive: true }); + super({reactive: true}); this._visible = false; this._modal = false; diff --git a/extensions/window-list/workspaceIndicator.js b/extensions/window-list/workspaceIndicator.js index 36d66bb6..f59b8444 100644 --- a/extensions/window-list/workspaceIndicator.js +++ b/extensions/window-list/workspaceIndicator.js @@ -1,5 +1,5 @@ /* exported WorkspaceIndicator */ -const { Clutter, Gio, GObject, Meta, St } = imports.gi; +const {Clutter, Gio, GObject, Meta, St} = imports.gi; const DND = imports.ui.dnd; const ExtensionUtils = imports.misc.extensionUtils; @@ -25,7 +25,7 @@ class WindowPreview extends St.Button { }); this._delegate = this; - DND.makeDraggable(this, { restoreOnSuccess: true }); + DND.makeDraggable(this, {restoreOnSuccess: true}); this._window = window; @@ -274,7 +274,7 @@ var WorkspaceIndicator = class WorkspaceIndicator extends PanelMenu.Button { let workspaceManager = global.workspace_manager; this._currentWorkspace = workspaceManager.get_active_workspace_index(); - this._statusLabel = new St.Label({ text: this._getStatusText() }); + this._statusLabel = new St.Label({text: this._getStatusText()}); this._statusBin = new St.Bin({ style_class: 'status-label-bin', @@ -309,7 +309,7 @@ var WorkspaceIndicator = class WorkspaceIndicator extends PanelMenu.Button { this._updateThumbnails(); this._updateThumbnailVisibility(); - this._settings = new Gio.Settings({ schema_id: 'org.gnome.desktop.wm.preferences' }); + this._settings = new Gio.Settings({schema_id: 'org.gnome.desktop.wm.preferences'}); this._settingsChangedId = this._settings.connect( 'changed::workspace-names', this._updateMenuLabels.bind(this)); } @@ -327,7 +327,7 @@ var WorkspaceIndicator = class WorkspaceIndicator extends PanelMenu.Button { } _updateThumbnailVisibility() { - const { workspaceManager } = global; + const {workspaceManager} = global; const vertical = workspaceManager.layout_rows === -1; const useMenu = vertical || workspaceManager.n_workspaces > MAX_THUMBNAILS; diff --git a/extensions/windowsNavigator/extension.js b/extensions/windowsNavigator/extension.js index f2794305..4f55a335 100644 --- a/extensions/windowsNavigator/extension.js +++ b/extensions/windowsNavigator/extension.js @@ -1,6 +1,6 @@ /* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */ /* exported init */ -const { Clutter, Graphene, GObject, St } = imports.gi; +const {Clutter, Graphene, GObject, St} = imports.gi; const Main = imports.ui.main; const OverviewControls = imports.ui.overviewControls; @@ -53,13 +53,13 @@ class MyWorkspace extends Workspace.Workspace { } getWindowWithTooltip(id) { - const { layoutManager } = this._container; + const {layoutManager} = this._container; const slot = layoutManager._windowSlots[id - 1]; return slot ? slot[WINDOW_SLOT].metaWindow : null; } showWindowsTooltips() { - const { layoutManager } = this._container; + const {layoutManager} = this._container; for (let i = 0; i < layoutManager._windowSlots.length; i++) { if (layoutManager._windowSlots[i]) layoutManager._windowSlots[i][WINDOW_SLOT].showTooltip(`${i + 1}`); @@ -67,7 +67,7 @@ class MyWorkspace extends Workspace.Workspace { } hideWindowsTooltips() { - const { layoutManager } = this._container; + const {layoutManager} = this._container; for (let i in layoutManager._windowSlots) { if (layoutManager._windowSlots[i]) layoutManager._windowSlots[i][WINDOW_SLOT].hideTooltip(); @@ -93,13 +93,13 @@ class MyWorkspace extends Workspace.Workspace { this._text.add_constraint(new Clutter.AlignConstraint({ source: this.windowContainer, align_axis: Clutter.AlignAxis.X_AXIS, - pivot_point: new Graphene.Point({ x: 0.5, y: -1 }), + pivot_point: new Graphene.Point({x: 0.5, y: -1}), factor: this._closeButtonSide === St.Side.LEFT ? 1 : 0, })); this._text.add_constraint(new Clutter.AlignConstraint({ source: this.windowContainer, align_axis: Clutter.AlignAxis.Y_AXIS, - pivot_point: new Graphene.Point({ x: -1, y: 0.5 }), + pivot_point: new Graphene.Point({x: -1, y: 0.5}), factor: 0, })); @@ -107,7 +107,7 @@ class MyWorkspace extends Workspace.Workspace { }).call(clone); clone.showTooltip = function (text) { - this._text.set({ text }); + this._text.set({text}); this._text.show(); }; @@ -170,7 +170,7 @@ class MyWorkspacesView extends WorkspacesView.WorkspacesView { } _onKeyPress(s, o) { - const { ControlsState } = OverviewControls; + const {ControlsState} = OverviewControls; if (this._overviewAdjustment.value !== ControlsState.WINDOW_PICKER) return false; diff --git a/extensions/workspace-indicator/extension.js b/extensions/workspace-indicator/extension.js index e424a69a..2da644e9 100644 --- a/extensions/workspace-indicator/extension.js +++ b/extensions/workspace-indicator/extension.js @@ -1,7 +1,7 @@ // -*- mode: js2; indent-tabs-mode: nil; js2-basic-offset: 4 -*- /* exported init enable disable */ -const { Clutter, Gio, GObject, Meta, St } = imports.gi; +const {Clutter, Gio, GObject, Meta, St} = imports.gi; const DND = imports.ui.dnd; const ExtensionUtils = imports.misc.extensionUtils; @@ -30,7 +30,7 @@ class WindowPreview extends St.Button { }); this._delegate = this; - DND.makeDraggable(this, { restoreOnSuccess: true }); + DND.makeDraggable(this, {restoreOnSuccess: true}); this._window = window; @@ -310,7 +310,7 @@ class WorkspaceIndicator extends PanelMenu.Button { this._updateThumbnails(); this._updateThumbnailVisibility(); - this._settings = new Gio.Settings({ schema_id: WORKSPACE_SCHEMA }); + this._settings = new Gio.Settings({schema_id: WORKSPACE_SCHEMA}); this._settingsChangedId = this._settings.connect( `changed::${WORKSPACE_KEY}`, this._updateMenuLabels.bind(this)); @@ -331,7 +331,7 @@ class WorkspaceIndicator extends PanelMenu.Button { } _updateThumbnailVisibility() { - const { workspaceManager } = global; + const {workspaceManager} = global; const vertical = workspaceManager.layout_rows === -1; const useMenu = vertical || workspaceManager.n_workspaces > MAX_THUMBNAILS; diff --git a/extensions/workspace-indicator/prefs.js b/extensions/workspace-indicator/prefs.js index 5a1da46a..002be954 100644 --- a/extensions/workspace-indicator/prefs.js +++ b/extensions/workspace-indicator/prefs.js @@ -1,7 +1,7 @@ // -*- mode: js2; indent-tabs-mode: nil; js2-basic-offset: 4 -*- /* exported init buildPrefsWidget */ -const { Adw, Gio, GLib, GObject, Gtk, Pango } = imports.gi; +const {Adw, Gio, GLib, GObject, Gtk, Pango} = imports.gi; const ExtensionUtils = imports.misc.extensionUtils; @@ -41,7 +41,7 @@ class WorkspacesList extends GObject.Object { GObject.registerClass(this); } - #settings = new Gio.Settings({ schema_id: WORKSPACE_SCHEMA }); + #settings = new Gio.Settings({schema_id: WORKSPACE_SCHEMA}); #names = this.#settings.get_strv(WORKSPACE_KEY); #items = Gtk.StringList.new(this.#names); #changedId; @@ -131,8 +131,8 @@ class WorkspaceSettingsWidget extends Adw.PreferencesGroup { this._workspaces = new WorkspacesList(); - const store = new Gio.ListStore({ item_type: Gio.ListModel }); - const listModel = new Gtk.FlattenListModel({ model: store }); + const store = new Gio.ListStore({item_type: Gio.ListModel}); + const listModel = new Gtk.FlattenListModel({model: store}); store.append(this._workspaces); store.append(new NewItemModel()); @@ -157,7 +157,7 @@ class WorkspaceRow extends Adw.PreferencesRow { } constructor(name) { - super({ name }); + super({name}); const box = new Gtk.Box({ spacing: 12, diff --git a/lint/eslintrc-shell.yml b/lint/eslintrc-shell.yml index 22915326..75a78187 100644 --- a/lint/eslintrc-shell.yml +++ b/lint/eslintrc-shell.yml @@ -3,9 +3,10 @@ rules: - error - properties: never allow: [^vfunc_, ^on_] - object-curly-spacing: + consistent-return: error + eqeqeq: - error - - always + - smart prefer-arrow-callback: error globals: global: readonly From 4b7055d0dade62aedee50ce5926175ae0f83ad27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Sat, 20 Aug 2022 18:59:26 +0200 Subject: [PATCH 2/5] places-menu: Mark PlacesManager as exported For some reason eslint failed to complain about this. Part-of: --- extensions/places-menu/placeDisplay.js | 1 + 1 file changed, 1 insertion(+) diff --git a/extensions/places-menu/placeDisplay.js b/extensions/places-menu/placeDisplay.js index 788f6bf9..37ca1661 100644 --- a/extensions/places-menu/placeDisplay.js +++ b/extensions/places-menu/placeDisplay.js @@ -1,4 +1,5 @@ // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- +/* exported PlacesManager */ const {Gio, GLib, Shell} = imports.gi; const Signals = imports.signals; From 9f88e98d1bfbd5f1b20c574c2c761765ebf1d939 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Sat, 20 Aug 2022 18:48:25 +0200 Subject: [PATCH 3/5] extensions: Stop monkey-patching signal methods gnome-shell added an EventEmitter class that can be used as base for any non-GObject class that needs to emit signals. Use that instead of the old monkey-patching. Part-of: --- extensions/apps-menu/extension.js | 7 ++++--- extensions/places-menu/placeDisplay.js | 12 +++++++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js index 6757f217..23da6c08 100644 --- a/extensions/apps-menu/extension.js +++ b/extensions/apps-menu/extension.js @@ -4,7 +4,7 @@ const { Atk, Clutter, Gio, GLib, GMenu, GObject, Gtk, Meta, Shell, St, } = imports.gi; -const Signals = imports.signals; +const {EventEmitter} = imports.misc.signals; const DND = imports.ui.dnd; const ExtensionUtils = imports.misc.extensionUtils; @@ -239,8 +239,10 @@ class ApplicationsMenu extends PopupMenu.PopupMenu { } } -class DesktopTarget { +class DesktopTarget extends EventEmitter { constructor() { + super(); + this._desktop = null; this._desktopDestroyedId = 0; @@ -357,7 +359,6 @@ class DesktopTarget { return true; } } -Signals.addSignalMethods(DesktopTarget.prototype); class ApplicationsButton extends PanelMenu.Button { static { diff --git a/extensions/places-menu/placeDisplay.js b/extensions/places-menu/placeDisplay.js index 37ca1661..9b5c205f 100644 --- a/extensions/places-menu/placeDisplay.js +++ b/extensions/places-menu/placeDisplay.js @@ -2,7 +2,7 @@ /* exported PlacesManager */ const {Gio, GLib, Shell} = imports.gi; -const Signals = imports.signals; +const {EventEmitter} = imports.misc.signals; const ExtensionUtils = imports.misc.extensionUtils; const Main = imports.ui.main; @@ -23,8 +23,10 @@ const Hostname1Iface = ' \ '; const Hostname1 = Gio.DBusProxy.makeProxyWrapper(Hostname1Iface); -class PlaceInfo { +class PlaceInfo extends EventEmitter { constructor(...params) { + super(); + this._init(...params); } @@ -119,7 +121,6 @@ class PlaceInfo { } } } -Signals.addSignalMethods(PlaceInfo.prototype); class RootInfo extends PlaceInfo { _init() { @@ -247,8 +248,10 @@ const DEFAULT_DIRECTORIES = [ GLib.UserDirectory.DIRECTORY_VIDEOS, ]; -var PlacesManager = class { +var PlacesManager = class extends EventEmitter { constructor() { + super(); + this._places = { special: [], devices: [], @@ -544,4 +547,3 @@ var PlacesManager = class { return this._places[kind]; } }; -Signals.addSignalMethods(PlacesManager.prototype); From 47c2834ffadb5f21c0221c11c031174c7e9d0426 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Sun, 4 Sep 2022 15:24:50 +0200 Subject: [PATCH 4/5] Update sass submodule --- data/gnome-shell-sass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/gnome-shell-sass b/data/gnome-shell-sass index 0f09f2ab..78781f0a 160000 --- a/data/gnome-shell-sass +++ b/data/gnome-shell-sass @@ -1 +1 @@ -Subproject commit 0f09f2abc798e2878d95199d44a1d4464733a156 +Subproject commit 78781f0a487a575efc4a54562903accfc47f5f9d From 01d3d8fd6da65e82dfb995db6912c66a25d30cf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Sun, 4 Sep 2022 15:25:43 +0200 Subject: [PATCH 5/5] Bump version to 43.rc Update NEWS. --- NEWS | 7 +++++++ meson.build | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 1f9ca3c7..9cc1c6ef 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,10 @@ +43.rc +===== +* Misc. bug fixes and cleanups [Florian; !240] + +Contributors: + Florian Müllner + 43.beta ======= * Misc. bug fixes and cleanups [Florian; !237, !238] diff --git a/meson.build b/meson.build index 3c93e8bb..d6a4aa29 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,5 @@ project('gnome-shell-extensions', - version: '43.beta', + version: '43.rc', meson_version: '>= 0.53.0', license: 'GPL2+' )