diff --git a/appIconIndicators.js b/appIconIndicators.js index 952d1efb8..b3ee5d2cc 100644 --- a/appIconIndicators.js +++ b/appIconIndicators.js @@ -7,14 +7,14 @@ import { St } from './dependencies/gi.js'; -import { Main } from './dependencies/shell/ui.js'; +import {Main} from './dependencies/shell/ui.js'; import { Docking, Utils } from './imports.js'; -const { cairo: Cairo } = imports; +const {cairo: Cairo} = imports; const RunningIndicatorStyle = Object.freeze({ DEFAULT: 0, @@ -44,11 +44,11 @@ export class AppIconIndicator { let runningIndicator = null; let runningIndicatorStyle; - const { settings } = Docking.DockManager; + const {settings} = Docking.DockManager; if (settings.applyCustomTheme) runningIndicatorStyle = RunningIndicatorStyle.DOTS; else - ({ runningIndicatorStyle } = settings); + ({runningIndicatorStyle} = settings); if (settings.showIconsEmblems && !Docking.DockManager.getDefault().notificationsMonitor.dndMode) { @@ -309,7 +309,7 @@ class RunningIndicatorDots extends RunningIndicatorBase { // Apply glossy background // TODO: move to enable/disableBacklit to apply itonly to the running apps? // TODO: move to css class for theming support - const { extension } = Docking.DockManager; + const {extension} = Docking.DockManager; this._glossyBackgroundStyle = `background-image: url('${extension.path}/media/glossy.svg');` + 'background-size: contain;'; } @@ -349,7 +349,7 @@ class RunningIndicatorDots extends RunningIndicatorBase { this._borderWidth = themeNode.get_border_width(this._side); this._bodyColor = themeNode.get_background_color(); - const { settings } = Docking.DockManager; + const {settings} = Docking.DockManager; if (!settings.applyCustomTheme) { // Adjust for the backlit case if (settings.unityBacklitItems) { @@ -694,7 +694,7 @@ class UnityIndicator extends IndicatorBase { this._source._iconContainer.add_child(this._notificationBadgeBin); this.updateNotificationBadgeStyle(); - const { remoteModel, notificationsMonitor } = Docking.DockManager.getDefault(); + const {remoteModel, notificationsMonitor} = Docking.DockManager.getDefault(); const remoteEntry = remoteModel.lookupById(this._source.app.id); this._remoteEntry = remoteEntry; @@ -705,12 +705,12 @@ class UnityIndicator extends IndicatorBase { ], [ remoteEntry, ['progress-changed', 'progress-visible-changed'], - (sender, { progress, progress_visible: progressVisible }) => + (sender, {progress, progress_visible: progressVisible}) => this.setProgress(progressVisible ? progress : -1), ], [ remoteEntry, 'urgent-changed', - (sender, { urgent }) => this.setUrgent(urgent), + (sender, {urgent}) => this.setUrgent(urgent), ], [ notificationsMonitor, 'changed', @@ -741,7 +741,7 @@ class UnityIndicator extends IndicatorBase { const fontDesc = themeContext.get_font(); const defaultFontSize = fontDesc.get_size() / 1024; let fontSize = defaultFontSize * 0.9; - const { iconSize } = Main.overview.dash; + const {iconSize} = Main.overview.dash; const defaultIconSize = Docking.DockManager.settings.get_default_value( 'dash-max-icon-size').unpack(); @@ -798,7 +798,7 @@ class UnityIndicator extends IndicatorBase { return; } - const { notificationsMonitor } = Docking.DockManager.getDefault(); + const {notificationsMonitor} = Docking.DockManager.getDefault(); const notificationsCount = notificationsMonitor.getAppNotificationsCount( this._source.app.id); @@ -821,7 +821,7 @@ class UnityIndicator extends IndicatorBase { return; } - this._progressOverlayArea = new St.DrawingArea({ x_expand: true, y_expand: true }); + this._progressOverlayArea = new St.DrawingArea({x_expand: true, y_expand: true}); this._progressOverlayArea.add_style_class_name('progress-bar'); this._progressOverlayArea.connect('repaint', () => { this._drawProgressOverlay(this._progressOverlayArea); @@ -841,7 +841,7 @@ class UnityIndicator extends IndicatorBase { } _drawProgressOverlay(area) { - const { scaleFactor } = St.ThemeContext.get_for_stage(global.stage); + const {scaleFactor} = St.ThemeContext.get_for_stage(global.stage); const [surfaceWidth, surfaceHeight] = area.get_surface_size(); const cr = area.get_context(); @@ -893,11 +893,11 @@ class UnityIndicator extends IndicatorBase { [hasColor, bg] = node.lookup_color('-progress-bar-background', false); if (!hasColor) - bg = new Clutter.Color({ red: 204, green: 204, blue: 204, alpha: 255 }); + bg = new Clutter.Color({red: 204, green: 204, blue: 204, alpha: 255}); [hasColor, bd] = node.lookup_color('-progress-bar-border', false); if (!hasColor) - bd = new Clutter.Color({ red: 230, green: 230, blue: 230, alpha: 255 }); + bd = new Clutter.Color({red: 230, green: 230, blue: 230, alpha: 255}); stroke = Cairo.SolidPattern.createRGBA( bd.red / 255, bd.green / 255, bd.blue / 255, bd.alpha / 255); diff --git a/appIcons.js b/appIcons.js index 6224efe84..3fc920d95 100644 --- a/appIcons.js +++ b/appIcons.js @@ -23,7 +23,7 @@ import { ParentalControlsManager } from './dependencies/shell/misc.js'; -import { Config } from './dependencies/shell/misc.js'; +import {Config} from './dependencies/shell/misc.js'; import { AppIconIndicators, @@ -35,11 +35,11 @@ import { WindowPreview } from './imports.js'; -import { Extension } from './dependencies/shell/extensions/extension.js'; +import {Extension} from './dependencies/shell/extensions/extension.js'; // Use __ () and N__() for the extension gettext domain, and reuse // the shell domain with the default _() and N_() -const { gettext: __ } = Extension; +const {gettext: __} = Extension; const DBusMenu = await DBusMenuUtils.haveDBusMenu(); @@ -162,7 +162,7 @@ const DockAbstractAppIcon = GObject.registerClass({ this.remove_style_class_name('focused'); }); - const { notificationsMonitor } = Docking.DockManager.getDefault(); + const {notificationsMonitor} = Docking.DockManager.getDefault(); this.connect('notify::urgent', () => { const icon = this.icon._iconBin; @@ -238,7 +238,7 @@ const DockAbstractAppIcon = GObject.registerClass({ } vfunc_scroll_event(scrollEvent) { - const { settings } = Docking.DockManager; + const {settings} = Docking.DockManager; const isEnabled = settings.scrollAction === scrollAction.CYCLE_WINDOWS; if (!isEnabled) return Clutter.EVENT_PROPAGATE; @@ -393,7 +393,7 @@ const DockAbstractAppIcon = GObject.registerClass({ let windows = this.getWindows(); if (Docking.DockManager.settings.multiMonitor) { - const { monitorIndex } = this; + const {monitorIndex} = this; windows = windows.filter(w => w.get_monitor() === monitorIndex); } windows.forEach(w => w.set_icon_geometry(rect)); @@ -429,10 +429,10 @@ const DockAbstractAppIcon = GObject.registerClass({ const monitorIndex = Main.layoutManager.findIndexForActor(this); const workArea = Main.layoutManager.getWorkAreaForMonitor(monitorIndex); const position = Utils.getPosition(); - const { scaleFactor } = St.ThemeContext.get_for_stage(global.stage); + const {scaleFactor} = St.ThemeContext.get_for_stage(global.stage); const isHorizontal = position === St.Side.TOP || position === St.Side.BOTTOM; // If horizontal also remove the height of the dash - const { dockFixed: fixedDock } = Docking.DockManager.settings; + const {dockFixed: fixedDock} = Docking.DockManager.settings; const additionalMargin = isHorizontal && !fixedDock ? Main.overview.dash.height : 0; const verticalMargins = this._menu.actor.margin_top + this._menu.actor.margin_bottom; const maxMenuHeight = workArea.height - additionalMargin - verticalMargins; @@ -482,7 +482,7 @@ const DockAbstractAppIcon = GObject.registerClass({ // being used. We then define what buttonAction should be for this // event. let buttonAction = 0; - const { settings } = Docking.DockManager; + const {settings} = Docking.DockManager; if (button && button === 2) { if (modifiers & Clutter.ModifierType.SHIFT_MASK) buttonAction = settings.shiftMiddleClickAction; @@ -998,11 +998,11 @@ const DockAppIconMenu = class DockAppIconMenu extends PopupMenu.PopupMenu { Main.uiGroup.add_actor(this.actor); - const { remoteModel } = Docking.DockManager.getDefault(); + const {remoteModel} = Docking.DockManager.getDefault(); const remoteModelApp = remoteModel?.lookupById(this._source?.app?.id); if (remoteModelApp && DBusMenu) { const [onQuicklist, onDynamicSection] = Utils.splitHandler((sender, - { quicklist }, dynamicSection) => { + {quicklist}, dynamicSection) => { dynamicSection.removeAll(); if (quicklist) { quicklist.get_children().forEach(remoteItem => @@ -1295,7 +1295,7 @@ function isWindowUrgent(w) { * @param monitorIndex */ export function getInterestingWindows(windows, monitorIndex) { - const { settings } = Docking.DockManager; + const {settings} = Docking.DockManager; // When using workspace isolation, we filter out windows // that are neither in the current workspace nor marked urgent @@ -1329,7 +1329,7 @@ export function getInterestingWindows(windows, monitorIndex) { export const DockShowAppsIcon = GObject.registerClass({ Signals: { - 'menu-state-changed': { param_types: [GObject.TYPE_BOOLEAN] }, + 'menu-state-changed': {param_types: [GObject.TYPE_BOOLEAN]}, 'sync-tooltip': {}, }, } @@ -1338,7 +1338,7 @@ export const DockShowAppsIcon = GObject.registerClass({ super._init(); // Re-use appIcon methods - const { prototype: appIconPrototype } = AppDisplay.AppIcon; + const {prototype: appIconPrototype} = AppDisplay.AppIcon; this.toggleButton.y_expand = false; this.toggleButton.connect('popup-menu', () => appIconPrototype._onKeyboardPopupMenu.call(this)); diff --git a/appSpread.js b/appSpread.js index d06d8ddc6..adea3cc0d 100644 --- a/appSpread.js +++ b/appSpread.js @@ -1,4 +1,4 @@ -import { Atk, Clutter } from './dependencies/gi.js'; +import {Atk, Clutter} from './dependencies/gi.js'; import { Main, @@ -7,7 +7,7 @@ import { WorkspaceThumbnail } from './dependencies/shell/ui.js'; -import { Utils } from './imports.js'; +import {Utils} from './imports.js'; export class AppSpread { constructor() { @@ -57,7 +57,7 @@ export class AppSpread { } _restoreDefaultWindows() { - const { workspaceManager } = global; + const {workspaceManager} = global; for (let i = 0; i < workspaceManager.nWorkspaces; i++) { const metaWorkspace = workspaceManager.get_workspace_by_index(i); @@ -66,7 +66,7 @@ export class AppSpread { } _filterWindows() { - const { workspaceManager } = global; + const {workspaceManager} = global; for (let i = 0; i < workspaceManager.nWorkspaces; i++) { const metaWorkspace = workspaceManager.get_workspace_by_index(i); @@ -139,7 +139,7 @@ export class AppSpread { activitiesButton.constructor.prototype, 'key_release_event', function (keyEvent) { - const { keyval } = keyEvent; + const {keyval} = keyEvent; if (keyval === Clutter.KEY_Return || keyval === Clutter.KEY_space) { if (Main.overview.shouldToggleByCornerOrButton()) appSpread._restoreDefaultOverview(); diff --git a/dash.js b/dash.js index 782120f7e..96b9dafff 100644 --- a/dash.js +++ b/dash.js @@ -27,7 +27,7 @@ import { Utils } from './imports.js'; -const { DASH_ANIMATION_TIME } = Dash; +const {DASH_ANIMATION_TIME} = Dash; const DASH_VISIBILITY_TIMEOUT = 3; const Labels = Object.freeze({ @@ -161,7 +161,7 @@ export const DockDash = GObject.registerClass({ this._box = new St.BoxLayout({ vertical: !this._isHorizontal, clip_to_allocation: false, - ...!this._isHorizontal ? { layout_manager: new DockDashIconsVerticalLayout() } : {}, + ...!this._isHorizontal ? {layout_manager: new DockDashIconsVerticalLayout()} : {}, x_align: rtl ? Clutter.ActorAlign.END : Clutter.ActorAlign.START, y_align: this._isHorizontal ? Clutter.ActorAlign.CENTER : Clutter.ActorAlign.START, y_expand: !this._isHorizontal, @@ -533,7 +533,7 @@ export const DockDash = GObject.registerClass({ }); appIcon.connect('notify::focused', () => { - const { settings } = Docking.DockManager; + const {settings} = Docking.DockManager; if (appIcon.focused && settings.scrollToFocusedApplication) ensureActorVisibleInScrollView(this._scrollView, item); }); @@ -645,8 +645,8 @@ export const DockDash = GObject.registerClass({ const spacing = themeNode.get_length('spacing'); - const [{ child: firstButton }] = iconChildren; - const { child: firstIcon } = firstButton?.icon ?? { child: null }; + const [{child: firstButton}] = iconChildren; + const {child: firstIcon} = firstButton?.icon ?? {child: null}; // if no icons there's nothing to adjust if (!firstIcon) @@ -678,7 +678,7 @@ export const DockDash = GObject.registerClass({ } const maxIconSize = availSpace / iconChildren.length; - const { scaleFactor } = St.ThemeContext.get_for_stage(global.stage); + const {scaleFactor} = St.ThemeContext.get_for_stage(global.stage); const iconSizes = this._availableIconSizes.map(s => s * scaleFactor); let [newIconSize] = this._availableIconSizes; @@ -696,7 +696,7 @@ export const DockDash = GObject.registerClass({ const scale = oldIconSize / newIconSize; for (let i = 0; i < iconChildren.length; i++) { - const { icon } = iconChildren[i].child._delegate; + const {icon} = iconChildren[i].child._delegate; // Set the new size immediately, to keep the icons' sizes // in sync with this.iconSize @@ -726,7 +726,7 @@ export const DockDash = GObject.registerClass({ if (this._separator) { const animateProperties = this._isHorizontal - ? { height: this.iconSize } : { width: this.iconSize }; + ? {height: this.iconSize} : {width: this.iconSize}; this._separator.ease({ ...animateProperties, @@ -741,7 +741,7 @@ export const DockDash = GObject.registerClass({ let running = this._appSystem.get_running(); const dockManager = Docking.DockManager.getDefault(); - const { settings } = dockManager; + const {settings} = dockManager; this._scrollView.set({ xAlign: Clutter.ActorAlign.FILL, @@ -776,7 +776,7 @@ export const DockDash = GObject.registerClass({ // Apps supposed to be in the dash const newApps = []; - const { showFavorites } = settings; + const {showFavorites} = settings; if (showFavorites) newApps.push(...Object.values(favorites)); @@ -956,7 +956,7 @@ export const DockDash = GObject.registerClass({ if (!this._shownInitially) this._shownInitially = true; - addedItems.forEach(({ item }) => item.show(animate)); + addedItems.forEach(({item}) => item.show(animate)); // Workaround for https://bugzilla.gnome.org/show_bug.cgi?id=692744 // Without it, StBoxLayout may use a stale size cache @@ -1063,7 +1063,7 @@ export const DockDash = GObject.registerClass({ if (this._showAppsIcon.get_parent() && !this._showAppsIcon.visible) return; - const { settings } = Docking.DockManager; + const {settings} = Docking.DockManager; const notifiedProperties = []; const showAppsContainer = settings.showAppsAlwaysInTheEdge || !settings.dockExtended ? this._dashContainer : this._boxContainer; @@ -1109,10 +1109,10 @@ export const DockDash = GObject.registerClass({ * @param actor */ function ensureActorVisibleInScrollView(scrollView, actor) { - const { adjustment: vAdjustment } = scrollView.vscroll; - const { adjustment: hAdjustment } = scrollView.hscroll; - const { value: vValue0, pageSize: vPageSize, upper: vUpper } = vAdjustment; - const { value: hValue0, pageSize: hPageSize, upper: hUpper } = hAdjustment; + const {adjustment: vAdjustment} = scrollView.vscroll; + const {adjustment: hAdjustment} = scrollView.hscroll; + const {value: vValue0, pageSize: vPageSize, upper: vUpper} = vAdjustment; + const {value: hValue0, pageSize: hPageSize, upper: hUpper} = hAdjustment; let [hValue, vValue] = [hValue0, vValue0]; let vOffset = 0; let hOffset = 0; @@ -1123,7 +1123,7 @@ function ensureActorVisibleInScrollView(scrollView, actor) { } const box = actor.get_allocation_box(); - let { y1 } = box, { y2 } = box, { x1 } = box, { x2 } = box; + let {y1} = box, {y2} = box, {x1} = box, {x2} = box; let parent = actor.get_parent(); while (parent !== scrollView) { diff --git a/dbusmenuUtils.js b/dbusmenuUtils.js index c57c58b78..1476ebdb8 100644 --- a/dbusmenuUtils.js +++ b/dbusmenuUtils.js @@ -8,9 +8,9 @@ import { St } from './dependencies/gi.js'; -import { PopupMenu } from './dependencies/shell/ui.js'; +import {PopupMenu} from './dependencies/shell/ui.js'; -import { Utils } from './imports.js'; +import {Utils} from './imports.js'; // Dbusmenu features not (yet) supported: // @@ -40,7 +40,7 @@ import { Utils } from './imports.js'; */ export async function haveDBusMenu() { try { - const { default: DBusMenu } = await import('gi://Dbusmenu'); + const {default: DBusMenu} = await import('gi://Dbusmenu'); return DBusMenu; } catch (e) { log(`Failed to import DBusMenu, quicklists are not available: ${e}`); diff --git a/desktopIconsIntegration.js b/desktopIconsIntegration.js index 059655d81..f797d060f 100644 --- a/desktopIconsIntegration.js +++ b/desktopIconsIntegration.js @@ -55,11 +55,11 @@ * *******************************************************************************/ -import { GLib } from './dependencies/gi.js'; -import { Main } from './dependencies/shell/ui.js'; -import { ExtensionUtils } from './dependencies/shell/misc.js'; +import {GLib} from './dependencies/gi.js'; +import {Main} from './dependencies/shell/ui.js'; +import {ExtensionUtils} from './dependencies/shell/misc.js'; -import { DockManager } from './docking.js'; +import {DockManager} from './docking.js'; const IDENTIFIER_UUID = '130cbc66-235c-4bd6-8571-98d2d8bba5e2'; diff --git a/docking.js b/docking.js index 9b74ecc0c..869a9a24c 100644 --- a/docking.js +++ b/docking.js @@ -39,7 +39,7 @@ import { Utils } from './imports.js'; -const { signals: Signals } = imports; +const {signals: Signals} = imports; const DOCK_DWELL_CHECK_INTERVAL = 100; const ICON_ANIMATOR_DURATION = 3000; @@ -232,7 +232,7 @@ const DockedDash = GObject.registerClass({ this._rtl = Clutter.get_default_text_direction() === Clutter.TextDirection.RTL; // Load settings - const { settings } = DockManager; + const {settings} = DockManager; this._isHorizontal = (this._position === St.Side.TOP) || (this._position === St.Side.BOTTOM); // Temporary ignore hover events linked to autohide for whatever reason @@ -511,7 +511,7 @@ const DockedDash = GObject.registerClass({ } _bindSettingsChanges() { - const { settings } = DockManager; + const {settings} = DockManager; this._signalsHandler.add([ settings, 'changed::scroll-action', @@ -666,7 +666,7 @@ const DockedDash = GObject.registerClass({ * This is call when visibility settings change */ _updateVisibilityMode() { - const { settings } = DockManager; + const {settings} = DockManager; if (DockManager.settings.dockFixed || DockManager.settings.manualhide) { this._autohideIsEnabled = false; this._intellihideIsEnabled = false; @@ -707,7 +707,7 @@ const DockedDash = GObject.registerClass({ if (Main.overview.visibleTarget) return; - const { settings } = DockManager; + const {settings} = DockManager; if (DockManager.settings.dockFixed) { this._removeAnimations(); @@ -797,7 +797,7 @@ const DockedDash = GObject.registerClass({ _hide() { // If no hiding animation is running or queued if ((this._dockState === State.SHOWN) || (this._dockState === State.SHOWING)) { - const { settings } = DockManager; + const {settings} = DockManager; const delay = settings.hideDelay; if (this._dockState === State.SHOWING) { @@ -953,9 +953,9 @@ const DockedDash = GObject.registerClass({ } _updatePressureBarrier() { - const { settings } = DockManager; + const {settings} = DockManager; this._canUsePressure = global.display.supports_extended_barriers(); - const { pressureThreshold } = settings; + const {pressureThreshold} = settings; // Remove existing pressure barrier if (this._pressureBarrier) { @@ -1135,7 +1135,7 @@ const DockedDash = GObject.registerClass({ // Ensure variables linked to settings are updated. this._updateVisibilityMode(); - const { dockFixed: fixedIsEnabled, dockExtended: extendHeight } = DockManager.settings; + const {dockFixed: fixedIsEnabled, dockExtended: extendHeight} = DockManager.settings; if (fixedIsEnabled) this.add_style_class_name('fixed'); @@ -1194,7 +1194,7 @@ const DockedDash = GObject.registerClass({ if (!this._intellihideIsEnabled) return; - const { desktopIconsUsableArea } = DockManager.getDefault(); + const {desktopIconsUsableArea} = DockManager.getDefault(); if (this._position === St.Side.BOTTOM) desktopIconsUsableArea.setMargins(this.monitorIndex, 0, this._box.height, 0, 0); else if (this._position === St.Side.TOP) @@ -1247,7 +1247,7 @@ const DockedDash = GObject.registerClass({ // Restore dash accessibility Main.ctrlAltTabManager.addGroup( this.dash, _('Dash'), 'user-bookmarks-symbolic', - { focusCallback: this._onAccessibilityFocus.bind(this) }); + {focusCallback: this._onAccessibilityFocus.bind(this)}); } /** @@ -1437,7 +1437,7 @@ const KeyboardShortcuts = class DashToDockKeyboardShortcuts { // Setup keyboard bindings for dash elements const keys = ['app-hotkey-', 'app-shift-hotkey-', 'app-ctrl-hotkey-']; - const { mainDock } = DockManager.getDefault(); + const {mainDock} = DockManager.getDefault(); keys.forEach(function (key) { for (let i = 0; i < NUM_HOTKEYS; i++) { const appNum = i; @@ -1468,7 +1468,7 @@ const KeyboardShortcuts = class DashToDockKeyboardShortcuts { } _optionalNumberOverlay() { - const { settings } = DockManager; + const {settings} = DockManager; this._shortcutIsSet = false; // Enable extra shortcut if either 'overlay' or 'show-dock' are true if (settings.hotKeys && @@ -1491,7 +1491,7 @@ const KeyboardShortcuts = class DashToDockKeyboardShortcuts { } _checkHotkeysOptions() { - const { settings } = DockManager; + const {settings} = DockManager; if (settings.hotKeys && (settings.hotkeysOverlay || settings.hotkeysShowDock)) @@ -1556,7 +1556,7 @@ const KeyboardShortcuts = class DashToDockKeyboardShortcuts { */ const WorkspaceIsolation = class DashToDockWorkspaceIsolation { constructor() { - const { settings } = DockManager; + const {settings} = DockManager; this._signalsHandler = new Utils.GlobalSignalsHandler(); this._injectionsHandler = new Utils.InjectionsHandler(); @@ -1650,7 +1650,7 @@ export class DockManager { this._propertyInjections = new Utils.PropertyInjectionsHandler(this); this._settings = this._extension.getSettings( 'org.gnome.shell.extensions.dash-to-dock'); - this._appSwitcherSettings = new Gio.Settings({ schema_id: 'org.gnome.shell.app-switcher' }); + this._appSwitcherSettings = new Gio.Settings({schema_id: 'org.gnome.shell.app-switcher'}); this._mapSettingsValues(); this._iconTheme = new Utils.IconTheme(); @@ -1784,7 +1784,7 @@ export class DockManager { } _ensureLocations() { - const { showMounts, showTrash } = this.settings; + const {showMounts, showTrash} = this.settings; if (showTrash || showMounts) { if (!this._fm1Client) @@ -1854,7 +1854,7 @@ export class DockManager { }, ]); - const { get: defaultFocusAppGetter } = Object.getOwnPropertyDescriptor( + const {get: defaultFocusAppGetter} = Object.getOwnPropertyDescriptor( Shell.WindowTracker.prototype, 'focus_app'); this._propertyInjections.addWithLabel(Labels.LOCATIONS, Shell.WindowTracker.prototype, 'focus_app', { @@ -1920,11 +1920,11 @@ export class DockManager { `changed::${key}`, updateSetting); if (key !== camelKey) { Object.defineProperty(this.settings, key, - { get: () => this.settings[camelKey] }); + {get: () => this.settings[camelKey]}); } }); Object.defineProperties(this.settings, { - dockExtended: { get: () => this.settings.extendHeight }, + dockExtended: {get: () => this.settings.extendHeight}, }); } @@ -2048,7 +2048,7 @@ export class DockManager { for (let iMon = 0; iMon < nMon; iMon++) { if (iMon === this._preferredMonitorIndex) continue; - dock = new DockedDash({ monitorIndex: iMon }); + dock = new DockedDash({monitorIndex: iMon}); this._allDocks.push(dock); // connect app icon into the view selector dock.dash.showAppsButton.connect('notify::checked', @@ -2066,7 +2066,7 @@ export class DockManager { _prepareStartupAnimation(callback) { DockManager.allDocks.forEach(dock => { - const { dash } = dock; + const {dash} = dock; dock.opacity = 255; dash.set({ @@ -2103,10 +2103,10 @@ export class DockManager { } _runStartupAnimation(callback) { - const { STARTUP_ANIMATION_TIME } = Layout; + const {STARTUP_ANIMATION_TIME} = Layout; DockManager.allDocks.forEach(dock => { - const { dash } = dock; + const {dash} = dock; switch (dock.position) { case St.Side.LEFT: @@ -2199,7 +2199,7 @@ export class DockManager { return [0, 0]; }); - const { ControlsManager } = OverviewControls; + const {ControlsManager} = OverviewControls; // FIXME: https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2890 // const { ControlsManagerLayout } = OverviewControls; const ControlsManagerLayout = this.overviewControls.layout_manager.constructor; @@ -2264,7 +2264,7 @@ export class DockManager { dockManager._signalsHandler.addWithLabel(Labels.STARTUP_ANIMATION, Utils.getMonitorManager(), 'monitors-changed', () => { - const { x, y, width, height } = this.primaryMonitor; + const {x, y, width, height} = this.primaryMonitor; global.window_group.set_clip(x, y, width, height); this._coverPane?.set({ width: global.screen_width, @@ -2308,7 +2308,7 @@ export class DockManager { const maybeAdjustBoxSize = (state, box, spacing) => { if (state === OverviewControls.ControlsState.WINDOW_PICKER) { const searchBox = this.overviewControls._searchEntry.get_allocation_box(); - const { shouldShow: wsThumbnails } = this.overviewControls._thumbnailsBox; + const {shouldShow: wsThumbnails} = this.overviewControls._thumbnailsBox; if (!wsThumbnails) { box.y1 += spacing; @@ -2357,7 +2357,7 @@ export class DockManager { const oldStartY = workAreaBox.y1; const propertyInjections = new Utils.PropertyInjectionsHandler(); - propertyInjections.add(Main.layoutManager.panelBox, 'height', { value: startY }); + propertyInjections.add(Main.layoutManager.panelBox, 'height', {value: startY}); if (Main.layoutManager.panelBox.y === Main.layoutManager.primaryMonitor.y) workAreaBox.y1 -= oldStartY; @@ -2506,7 +2506,7 @@ export class DockManager { const monitor = Main.layoutManager.primaryMonitor; const x = monitor.x + monitor.width / 2.0; const y = monitor.y + monitor.height / 2.0; - const { STARTUP_ANIMATION_TIME } = Layout; + const {STARTUP_ANIMATION_TIME} = Layout; this._prepareStartupAnimation(callback); Main.uiGroup.set_pivot_point( @@ -2574,8 +2574,8 @@ export class DockManager { } _onShowAppsButtonToggled(button) { - const { checked } = button; - const { overviewControls } = this; + const {checked} = button; + const {overviewControls} = this; if (!Main.overview.visible) { this.mainDock.dash.showAppsButton._fromDesktop = true; @@ -2757,7 +2757,7 @@ export class IconAnimator { addAnimation(target, name) { const targetDestroyId = target.connect('destroy', () => this.removeAnimation(target, name)); - this._animations[name].push({ target, targetDestroyId }); + this._animations[name].push({target, targetDestroyId}); if (this._started && this._count === 0) this._timeline.start(); diff --git a/extension.js b/extension.js index a93855657..68de2acb0 100644 --- a/extension.js +++ b/extension.js @@ -1,7 +1,7 @@ // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- -import { DockManager } from './docking.js'; -import { Extension } from './dependencies/shell/extensions/extension.js'; +import {DockManager} from './docking.js'; +import {Extension} from './dependencies/shell/extensions/extension.js'; // We export this so it can be accessed by other extensions export let dockManager; diff --git a/fileManager1API.js b/fileManager1API.js index 97a545fdc..192214a9d 100644 --- a/fileManager1API.js +++ b/fileManager1API.js @@ -1,9 +1,9 @@ // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- -import { GLib, Gio } from './dependencies/gi.js'; -const { signals: Signals } = imports; +import {GLib, Gio} from './dependencies/gi.js'; +const {signals: Signals} = imports; -import { Utils } from './imports.js'; +import {Utils} from './imports.js'; const FileManager1Iface = '\ \ diff --git a/intellihide.js b/intellihide.js index bf8f4d053..63beade05 100644 --- a/intellihide.js +++ b/intellihide.js @@ -11,7 +11,7 @@ import { Utils } from './imports.js'; -const { signals: Signals } = imports; +const {signals: Signals} = imports; // A good compromise between reactivity and efficiency; to be tuned. const INTELLIHIDE_CHECK_INTERVAL = 100; @@ -290,7 +290,7 @@ export class Intellihide { case IntellihideMode.ALWAYS_ON_TOP: // Always on top, except for fullscreen windows if (this._focusApp) { - const { focusWindow } = global.display; + const {focusWindow} = global.display; if (!focusWindow?.fullscreen) return false; } diff --git a/launcherAPI.js b/launcherAPI.js index 0afd02b7f..cf08c38a3 100644 --- a/launcherAPI.js +++ b/launcherAPI.js @@ -1,7 +1,7 @@ // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- -import { Gio } from './dependencies/gi.js'; -import { DBusMenuUtils } from './imports.js'; +import {Gio} from './dependencies/gi.js'; +import {DBusMenuUtils} from './imports.js'; const DBusMenu = await DBusMenuUtils.haveDBusMenu(); @@ -178,7 +178,7 @@ const LauncherEntry = class DashToDockLauncherEntry { callback(this, this); const id = this._nextId++; - const handler = { id, callback }; + const handler = {id, callback}; eventNames.forEach(name => { let handlerList = this._handlers.get(name); if (!handlerList) diff --git a/lint/eslintrc-gjs.yml b/lint/eslintrc-gjs.yml index 0b146ff16..ea2f74eff 100644 --- a/lint/eslintrc-gjs.yml +++ b/lint/eslintrc-gjs.yml @@ -72,7 +72,10 @@ rules: linebreak-style: - error - unix - lines-between-class-members: error + lines-between-class-members: + - error + - always + - exceptAfterSingleLine: true max-nested-callbacks: error max-statements-per-line: error new-parens: error @@ -111,12 +114,6 @@ rules: no-restricted-globals: [error, window] no-restricted-properties: - error - - object: imports - property: format - message: Use template strings - - object: pkg - property: initFormat - message: Use template strings - object: Lang property: copyProperties message: Use Object.assign() @@ -175,6 +172,7 @@ rules: object-curly-newline: - error - consistent: true + multiline: true object-curly-spacing: error object-shorthand: error operator-assignment: error @@ -227,6 +225,9 @@ rules: - inside yield-star-spacing: error yoda: error +settings: + jsdoc: + mode: typescript globals: ARGV: readonly Debugger: readonly @@ -239,5 +240,12 @@ globals: print: readonly printerr: readonly window: readonly + TextEncoder: readonly + TextDecoder: readonly + console: readonly + setTimeout: readonly + setInterval: readonly + clearTimeout: readonly + clearInterval: readonly parserOptions: ecmaVersion: 2022 diff --git a/lint/eslintrc-shell.yml b/lint/eslintrc-shell.yml index bb0636f02..0ba645218 100644 --- a/lint/eslintrc-shell.yml +++ b/lint/eslintrc-shell.yml @@ -4,20 +4,23 @@ rules: - properties: never allow: [^vfunc_, ^on_] consistent-return: error + eqeqeq: + - error + - smart key-spacing: - error - mode: minimum beforeColon: false afterColon: true - object-curly-spacing: - - error - - always prefer-arrow-callback: error overrides: - - files: js/** + - files: + - js/** + - tests/shell/** excludedFiles: - js/portalHelper/* + - js/extensions/* globals: global: readonly _: readonly diff --git a/locations.js b/locations.js index 86038507a..3a4e752b5 100644 --- a/locations.js +++ b/locations.js @@ -8,20 +8,20 @@ import { St } from './dependencies/gi.js'; -import { ShellMountOperation } from './dependencies/shell/ui.js'; +import {ShellMountOperation} from './dependencies/shell/ui.js'; import { Docking, Utils } from './imports.js'; -import { Extension } from './dependencies/shell/extensions/extension.js'; +import {Extension} from './dependencies/shell/extensions/extension.js'; // Use __ () and N__() for the extension gettext domain, and reuse // the shell domain with the default _() and N_() -const { gettext: __ } = Extension; +const {gettext: __} = Extension; -const { signals: Signals } = imports; +const {signals: Signals} = imports; const FALLBACK_REMOVABLE_MEDIA_ICON = 'drive-removable-media'; const FALLBACK_TRASH_ICON = 'user-trash'; @@ -75,7 +75,7 @@ function makeNautilusFileOperationsProxy() { timestamp: global.get_current_time(), windowPosition: 'center', }; - const { parentHandle, timestamp, windowPosition } = { + const {parentHandle, timestamp, windowPosition} = { ...defaultParams, ...params, }; @@ -249,7 +249,7 @@ export const LocationAppInfo = GObject.registerClass({ } async _queryLocationIcons(params) { - const icons = { standard: null, custom: null }; + const icons = {standard: null, custom: null}; if (!this.location) return icons; @@ -298,14 +298,14 @@ export const LocationAppInfo = GObject.registerClass({ return icons; } - async _updateLocationIcon(params = { standard: true, custom: true }) { + async _updateLocationIcon(params = {standard: true, custom: true}) { const cancellable = new Utils.CancellableChild(this.cancellable); try { this._updateIconCancellable?.cancel(); this._updateIconCancellable = cancellable; - const icons = await this._queryLocationIcons({ cancellable, ...params }); + const icons = await this._queryLocationIcons({cancellable, ...params}); const icon = icons.custom ?? icons.standard; if (icon && !icon.equal(this.icon)) @@ -503,7 +503,7 @@ class MountableVolumeAppInfo extends LocationAppInfo { list_actions() { const actions = []; - const { mount } = this; + const {mount} = this; if (mount) { if (this.mount.can_unmount()) @@ -553,7 +553,7 @@ class MountableVolumeAppInfo extends LocationAppInfo { this.location = this.mount?.get_default_location() ?? this.volume.get_activation_root(); - this._updateLocationIcon({ custom: true }); + this._updateLocationIcon({custom: true}); } _monitorChanges() { @@ -804,7 +804,7 @@ class TrashAppInfo extends LocationAppInfo { const nautilus = makeNautilusFileOperationsProxy(); const askConfirmation = true; nautilus.EmptyTrashRemote(askConfirmation, - nautilus.platformData({ timestamp }), (_p, error) => { + nautilus.platformData({timestamp}), (_p, error) => { if (error) logError(error, 'Empty trash failed'); }, this.cancellable); @@ -838,7 +838,7 @@ function wrapWindowsBackedApp(shellApp) { set: v => (this[p] = v), configurable: true, enumerable: !!o.enumerable, - }, o.readOnly ? { set: undefined } : {})); + }, o.readOnly ? {set: undefined} : {})); if (o.value) this[p] = o.value; this.proxyProperties.push(publicProp); @@ -859,9 +859,9 @@ function wrapWindowsBackedApp(shellApp) { windows: {}, state: {}, startingWorkspace: {}, - isFocused: { public: true }, - signalConnections: { readOnly: true }, - sources: { readOnly: true }, + isFocused: {public: true}, + signalConnections: {readOnly: true}, + sources: {readOnly: true}, checkFocused: {}, setDtdData: {}, }); @@ -870,9 +870,9 @@ function wrapWindowsBackedApp(shellApp) { for (const [name, value] of Object.entries(data)) { if (params.readOnly && name in this._dtdData) throw new Error('Property %s is already defined'.format(name)); - const defaultParams = { public: true, readOnly: true }; + const defaultParams = {public: true, readOnly: true}; this._dtdData.addProxyProperties(this, { - [name]: { ...defaultParams, ...params, value }, + [name]: {...defaultParams, ...params, value}, }); } }; @@ -881,10 +881,10 @@ function wrapWindowsBackedApp(shellApp) { const p = (...args) => shellApp._dtdData.propertyInjections.add(shellApp, ...args); // mi is Method injector, pi is Property injector - shellApp._setDtdData({ mi: m, pi: p }, { public: false }); + shellApp._setDtdData({mi: m, pi: p}, {public: false}); m('get_state', () => shellApp._state ?? shellApp._getStateByWindows()); - p('state', { get: () => shellApp.get_state() }); + p('state', {get: () => shellApp.get_state()}); m('get_windows', () => shellApp._windows); m('get_n_windows', () => shellApp._windows.length); @@ -925,7 +925,7 @@ function wrapWindowsBackedApp(shellApp) { _setWindows(windows) { const oldState = this.state; const oldWindows = this._windows.slice(); - const result = { windowsChanged: false, stateChanged: false }; + const result = {windowsChanged: false, stateChanged: false}; this._state = undefined; if (windows.length !== oldWindows.length || @@ -943,7 +943,7 @@ function wrapWindowsBackedApp(shellApp) { return result; }, - }, { readOnly: false }); + }, {readOnly: false}); shellApp._sources.add(GLib.idle_add(GLib.DEFAULT_PRIORITY, () => { shellApp._updateWindows(); @@ -1017,7 +1017,7 @@ function wrapWindowsBackedApp(shellApp) { m('compare', (_om, other) => Utils.shellAppCompare(shellApp, other)); - const { destroy: defaultDestroy } = shellApp; + const {destroy: defaultDestroy} = shellApp; shellApp.destroy = function () { /* eslint-disable no-invalid-this */ this._dtdData.proxyProperties.forEach(prop => delete this[prop]); @@ -1041,7 +1041,7 @@ function makeLocationApp(params) { if (!(params?.appInfo instanceof LocationAppInfo)) throw new TypeError('Invalid location'); - const { fallbackIconName } = params; + const {fallbackIconName} = params; delete params.fallbackIconName; const shellApp = new Shell.App(params); @@ -1050,7 +1050,7 @@ function makeLocationApp(params) { shellApp._setDtdData({ location: () => shellApp.appInfo.location, isTrash: shellApp.appInfo instanceof TrashAppInfo, - }, { getter: true, enumerable: true }); + }, {getter: true, enumerable: true}); shellApp._mi('toString', defaultToString => '[LocationApp "%s" - %s]'.format(shellApp.get_id(), @@ -1120,7 +1120,7 @@ function makeLocationApp(params) { return parentGetBusy.call(this); /* eslint-enable no-invalid-this */ }); - shellApp._pi('busy', { get: () => shellApp.get_busy() }); + shellApp._pi('busy', {get: () => shellApp.get_busy()}); shellApp._signalConnections.add(shellApp.appInfo, 'notify::busy', _ => shellApp.notify('busy')); } @@ -1133,7 +1133,7 @@ function makeLocationApp(params) { /* eslint-enable no-invalid-this */ }); - const { fm1Client } = Docking.DockManager.getDefault(); + const {fm1Client} = Docking.DockManager.getDefault(); shellApp._setDtdData({ _needsResort: true, @@ -1150,7 +1150,7 @@ function makeLocationApp(params) { _updateWindows() { const windows = fm1Client.getWindows(this.location?.get_uri()).sort( Utils.shellWindowsCompare); - const { windowsChanged } = this._setWindows(windows); + const {windowsChanged} = this._setWindows(windows); if (!windowsChanged) return; @@ -1163,7 +1163,7 @@ function makeLocationApp(params) { this._windowsOrderChanged(); })); }, - }, { readOnly: false }); + }, {readOnly: false}); shellApp._signalConnections.add(fm1Client, 'windows-changed', () => shellApp._updateWindows()); @@ -1196,7 +1196,7 @@ export function wrapFileManagerApp() { const originalGetWindows = fileManagerApp.get_windows; wrapWindowsBackedApp(fileManagerApp); - const { removables, trash } = Docking.DockManager.getDefault(); + const {removables, trash} = Docking.DockManager.getDefault(); fileManagerApp._signalConnections.addWithLabel(Labels.WINDOWS_CHANGED, fileManagerApp, 'windows-changed', () => { fileManagerApp.stop_emission_by_name('windows-changed'); @@ -1402,7 +1402,7 @@ export class Removables { } _onVolumeRemoved(volume) { - const volumeIndex = this._volumeApps.findIndex(({ appInfo }) => + const volumeIndex = this._volumeApps.findIndex(({appInfo}) => appInfo.volume === volume); if (volumeIndex !== -1) { const [volumeApp] = this._volumeApps.splice(volumeIndex, 1); @@ -1417,7 +1417,7 @@ export class Removables { if (!Docking.DockManager.settings.showMountsOnlyMounted) return; - if (!this._volumeApps.find(({ appInfo }) => appInfo.mount === mount)) { + if (!this._volumeApps.find(({appInfo}) => appInfo.mount === mount)) { // In some Gio.Mount implementations the volume may be set after // mount is emitted, so we could just ignore it as we'll get it // later via volume-added diff --git a/notificationsMonitor.js b/notificationsMonitor.js index 8d13e9c7f..7059916b5 100644 --- a/notificationsMonitor.js +++ b/notificationsMonitor.js @@ -1,14 +1,14 @@ // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- -import { Gio } from './dependencies/gi.js'; -import { Main } from './dependencies/shell/ui.js'; +import {Gio} from './dependencies/gi.js'; +import {Main} from './dependencies/shell/ui.js'; import { Docking, Utils } from './imports.js'; -const { signals: Signals } = imports; +const {signals: Signals} = imports; const Labels = Object.freeze({ SOURCES: Symbol('sources'), diff --git a/prefs.js b/prefs.js index 8454bf495..e3ca598aa 100644 --- a/prefs.js +++ b/prefs.js @@ -131,9 +131,9 @@ class MonitorsConfig { // for monitors, it can be removed when we don't care about breaking // old user configurations or external apps configuring this extension // such as ubuntu's gnome-control-center. - const { index: primaryMonitorIndex } = this._primaryMonitor; + const {index: primaryMonitorIndex} = this._primaryMonitor; for (const monitor of this._monitors) { - let { index } = monitor; + let {index} = monitor; // The The dock uses the Gdk index for monitors, where the primary monitor // always has index 0, so let's follow what dash-to-dock does in docking.js // (as part of _createDocks), but using inverted math @@ -180,7 +180,7 @@ const DockSettings = GObject.registerClass({ this._extensionPreferences = extensionPreferences; this._settings = extensionPreferences.getSettings( 'org.gnome.shell.extensions.dash-to-dock'); - this._appSwitcherSettings = new Gio.Settings({ schema_id: 'org.gnome.shell.app-switcher' }); + this._appSwitcherSettings = new Gio.Settings({schema_id: 'org.gnome.shell.app-switcher'}); this._rtl = Gtk.Widget.get_default_direction() === Gtk.TextDirection.RTL; this._builder = new Gtk.Builder(); @@ -1164,7 +1164,7 @@ const DockSettings = GObject.registerClass({ export default class DockPreferences extends ExtensionPreferences { getPreferencesWidget() { const settings = new DockSettings(this); - const { widget } = settings; + const {widget} = settings; return widget; } } diff --git a/theming.js b/theming.js index 3f8bdda13..35e0fdc49 100644 --- a/theming.js +++ b/theming.js @@ -6,14 +6,14 @@ import { St } from './dependencies/gi.js'; -import { Main } from './dependencies/shell/ui.js'; +import {Main} from './dependencies/shell/ui.js'; import { Docking, Utils } from './imports.js'; -const { signals: Signals } = imports; +const {signals: Signals} = imports; /* * DEFAULT: transparency given by theme @@ -48,8 +48,8 @@ export class ThemeManager { this._dash = dock.dash; // initialize colors with generic values - this._customizedBackground = { red: 0, green: 0, blue: 0, alpha: 0 }; - this._customizedBorder = { red: 0, green: 0, blue: 0, alpha: 0 }; + this._customizedBackground = {red: 0, green: 0, blue: 0, alpha: 0}; + this._customizedBorder = {red: 0, green: 0, blue: 0, alpha: 0}; this._transparency = new Transparency(dock); this._signalsHandler.add([ @@ -156,7 +156,7 @@ export class ThemeManager { if (!backgroundColor) return; - const { settings } = Docking.DockManager; + const {settings} = Docking.DockManager; if (settings.customBackgroundColor) { // When applying a custom color, we need to check the alpha value, @@ -165,7 +165,7 @@ export class ThemeManager { // the opacity will be set by the opaque/transparent styles anyway. let newAlpha = Math.round(backgroundColor.alpha / 2.55) / 100; - ({ backgroundColor } = settings); + ({backgroundColor} = settings); // backgroundColor is a string like rgb(0,0,0) const [ret, color] = Clutter.Color.from_string(backgroundColor); if (!ret) { @@ -192,7 +192,7 @@ export class ThemeManager { } _updateCustomStyleClasses() { - const { settings } = Docking.DockManager; + const {settings} = Docking.DockManager; if (settings.applyCustomTheme) this._actor.add_style_class_name('dashtodock'); @@ -239,7 +239,7 @@ export class ThemeManager { if (!this._dash._background.get_stage()) return; - const { settings } = Docking.DockManager; + const {settings} = Docking.DockManager; // Remove prior style edits this._dash._background.set_style(null); @@ -547,7 +547,7 @@ class Transparency { Main.uiGroup.remove_child(dummyObject); - const { settings } = Docking.DockManager; + const {settings} = Docking.DockManager; if (settings.customizeAlphas) { this._opaqueAlpha = settings.maxAlpha; diff --git a/utils.js b/utils.js index 5440c3619..3305b924e 100644 --- a/utils.js +++ b/utils.js @@ -13,7 +13,7 @@ import { Docking } from './imports.js'; -const { _gi: Gi } = imports; +const {_gi: Gi} = imports; export const SignalsHandlerFlags = Object.freeze({ NONE: 0, @@ -232,7 +232,7 @@ export class ColorUtils { // Return {r:r, g:g, b:b} object. static HSVtoRGB(h, s, v) { if (arguments.length === 1) - ({ s, v, h } = h); + ({s, v, h} = h); let r, g, b; const c = v * s; @@ -280,7 +280,7 @@ export class ColorUtils { // Return {h:h, s:s, v:v} object. static RGBtoHSV(r, g, b) { if (arguments.length === 1) - ({ r, g, b } = r); + ({r, g, b} = r); let h, s; @@ -385,14 +385,14 @@ export class PropertyInjectionsHandler extends BasicHandler { if (!(name in instance)) throw new Error(`Object ${instance} has no '${name}' property`); - const { prototype } = instance.constructor; + const {prototype} = instance.constructor; const originalPropertyDescriptor = Object.getOwnPropertyDescriptor(prototype, name) ?? Object.getOwnPropertyDescriptor(instance, name); Object.defineProperty(instance, name, { ...originalPropertyDescriptor, ...injectedPropertyDescriptor, - ...{ configurable: true }, + ...{configurable: true}, }); return [instance, name, originalPropertyDescriptor]; } @@ -478,7 +478,7 @@ export function splitHandler(handler) { const count = handler.length - 1; let missingValueBits = (1 << count) - 1; - const values = Array.from({ length: count }); + const values = Array.from({length: count}); return values.map((_ignored, i) => { const mask = ~(1 << i); return (obj, value) => { @@ -522,7 +522,7 @@ export class IconTheme { */ export function getWindowsByObjectPath() { const windowsByObjectPath = new Map(); - const { workspaceManager } = global; + const {workspaceManager} = global; const workspaces = [...new Array(workspaceManager.nWorkspaces)].map( (_c, i) => workspaceManager.get_workspace_by_index(i)); @@ -615,7 +615,7 @@ class CancellableChild extends Gio.Cancellable { if (parent && !(parent instanceof Gio.Cancellable)) throw TypeError('Not a valid cancellable'); - super._init({ parent }); + super._init({parent}); if (parent?.is_cancelled()) { this.cancel(); diff --git a/windowPreview.js b/windowPreview.js index 2963f9d73..6ffa0d767 100644 --- a/windowPreview.js +++ b/windowPreview.js @@ -45,7 +45,7 @@ export class WindowPreviewMenu extends PopupMenu.PopupMenu { this._app = this._source.app; const workArea = Main.layoutManager.getWorkAreaForMonitor( this._source.monitorIndex); - const { scaleFactor } = St.ThemeContext.get_for_stage(global.stage); + const {scaleFactor} = St.ThemeContext.get_for_stage(global.stage); this.actor.add_style_class_name('app-menu'); this.actor.set_style( @@ -359,7 +359,7 @@ class WindowPreviewMenuItem extends PopupMenu.PopupBaseMenuItem { ? Clutter.ActorAlign.START : Clutter.ActorAlign.END, y_align: Clutter.ActorAlign.START, }); - this.closeButton.add_actor(new St.Icon({ icon_name: 'window-close-symbolic' })); + this.closeButton.add_actor(new St.Icon({icon_name: 'window-close-symbolic'})); this.closeButton.connect('clicked', () => this._closeWindow()); const overlayGroup = new Clutter.Actor({ @@ -370,18 +370,22 @@ class WindowPreviewMenuItem extends PopupMenu.PopupBaseMenuItem { overlayGroup.add_actor(this._cloneBin); overlayGroup.add_actor(this.closeButton); - const label = new St.Label({ text: window.get_title() }); + const label = new St.Label({text: window.get_title()}); label.set_style(`max-width: ${PREVIEW_MAX_WIDTH}px`); - const labelBin = new St.Bin({ child: label, - x_align: Clutter.ActorAlign.CENTER }); + const labelBin = new St.Bin({ + child: label, + x_align: Clutter.ActorAlign.CENTER, + }); this._windowTitleId = this._window.connect('notify::title', () => { label.set_text(this._window.get_title()); }); - const box = new St.BoxLayout({ vertical: true, + const box = new St.BoxLayout({ + vertical: true, reactive: true, - x_expand: true }); + x_expand: true, + }); box.add(overlayGroup); box.add(labelBin); this._box = box; @@ -403,7 +407,7 @@ class WindowPreviewMenuItem extends PopupMenu.PopupBaseMenuItem { let [minHeight, naturalHeight] = this._box.get_preferred_height(naturalWidth); [minWidth, naturalWidth] = themeNode.adjust_preferred_width(minWidth, naturalWidth); [minHeight, naturalHeight] = themeNode.adjust_preferred_height(minHeight, naturalHeight); - this.set({ minWidth, naturalWidth, minHeight, naturalHeight }); + this.set({minWidth, naturalWidth, minHeight, naturalHeight}); } _getWindowPreviewSize() { @@ -417,7 +421,7 @@ class WindowPreviewMenuItem extends PopupMenu.PopupBaseMenuItem { if (!width || !height) return emptySize; - let { previewSizeScale: scale } = Docking.DockManager.settings; + let {previewSizeScale: scale} = Docking.DockManager.settings; if (!scale) { // a simple example with 1680x1050: // * 250/1680 = 0,1488 @@ -461,10 +465,12 @@ class WindowPreviewMenuItem extends PopupMenu.PopupBaseMenuItem { } const mutterWindow = metaWin.get_compositor_private(); - const clone = new Clutter.Clone({ source: mutterWindow, + const clone = new Clutter.Clone({ + source: mutterWindow, reactive: true, width: this._width * this._scale, - height: this._height * this._scale }); + height: this._height * this._scale, + }); // when the source actor is destroyed, i.e. the window closed, first destroy the clone // and then destroy the menu item (do this animating out)