Skip to content

Commit

Permalink
eslint: Update rules to match gnome-shell 45 and fix syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
3v1n0 committed Aug 17, 2023
1 parent 2ec2e0e commit 574c424
Show file tree
Hide file tree
Showing 19 changed files with 191 additions and 177 deletions.
30 changes: 15 additions & 15 deletions appIconIndicators.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;';
}
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;

Expand All @@ -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',
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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);

Expand All @@ -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);
Expand All @@ -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();

Expand Down Expand Up @@ -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);
Expand Down
28 changes: 14 additions & 14 deletions appIcons.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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();

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 =>
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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': {},
},
}
Expand All @@ -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));
Expand Down
10 changes: 5 additions & 5 deletions appSpread.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Atk, Clutter } from './dependencies/gi.js';
import {Atk, Clutter} from './dependencies/gi.js';

import {
Main,
Expand All @@ -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() {
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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();
Expand Down
Loading

0 comments on commit 574c424

Please sign in to comment.