diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js index 171b788c4ae0438ae27088ada16904f934d89bb3..0c991231f2d7fa837724b9dd0b4092c02caa3299 100644 --- a/extensions/apps-menu/extension.js +++ b/extensions/apps-menu/extension.js @@ -1,8 +1,9 @@ /* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */ /* exported init enable disable */ -const { Atk, Clutter, Gio, GLib, GMenu, - GObject, Gtk, Meta, Shell, St } = imports.gi; +const { + Atk, Clutter, Gio, GLib, GMenu, GObject, Gtk, Meta, Shell, St +} = imports.gi; const DND = imports.ui.dnd; const Main = imports.ui.main; const PanelMenu = imports.ui.panelMenu; @@ -25,7 +26,7 @@ class ActivitiesMenuItem extends PopupMenu.PopupBaseMenuItem { constructor(button) { super(); this._button = button; - this.actor.add_child(new St.Label({ text: _("Activities Overview") })); + this.actor.add_child(new St.Label({ text: _('Activities Overview') })); } activate(event) { @@ -44,8 +45,11 @@ class ApplicationMenuItem extends PopupMenu.PopupBaseMenuItem { this._iconBin = new St.Bin(); this.actor.add_child(this._iconBin); - let appLabel = new St.Label({ text: app.get_name(), y_expand: true, - y_align: Clutter.ActorAlign.CENTER }); + let appLabel = new St.Label({ + text: app.get_name(), + y_expand: true, + y_align: Clutter.ActorAlign.CENTER + }); this.actor.add_child(appLabel); this.actor.label_actor = appLabel; @@ -111,7 +115,7 @@ class CategoryMenuItem extends PopupMenu.PopupBaseMenuItem { if (this._category) name = this._category.get_name(); else - name = _("Favorites"); + name = _('Favorites'); this.actor.add_child(new St.Label({ text: name })); this.actor.connect('motion-event', this._onMotionEvent.bind(this)); @@ -399,9 +403,11 @@ class ApplicationsButton extends PanelMenu.Button { let hbox = new St.BoxLayout({ style_class: 'panel-status-menu-box' }); - this._label = new St.Label({ text: _("Applications"), - y_expand: true, - y_align: Clutter.ActorAlign.CENTER }); + this._label = new St.Label({ + text: _('Applications'), + y_expand: true, + y_align: Clutter.ActorAlign.CENTER + }); hbox.add_child(this._label); hbox.add_child(PopupMenu.arrowIcon(St.Side.BOTTOM)); @@ -457,8 +463,10 @@ class ApplicationsButton extends PanelMenu.Button { } _createVertSeparator() { - let separator = new St.DrawingArea({ style_class: 'calendar-vertical-separator', - pseudo_class: 'highlighted' }); + let separator = new St.DrawingArea({ + style_class: 'calendar-vertical-separator', + pseudo_class: 'highlighted' + }); separator.connect('repaint', this._onVertSepRepaint.bind(this)); return separator; } @@ -470,12 +478,12 @@ class ApplicationsButton extends PanelMenu.Button { this._tree.disconnect(this._treeChangedId); this._tree = null; + let handler = Main.sessionMode.hasOverview ? + Main.overview.toggle.bind(Main.overview) : null; Main.wm.setCustomKeybindingHandler('panel-main-menu', Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW, - Main.sessionMode.hasOverview ? - Main.overview.toggle.bind(Main.overview) : - null); + handler); this._desktopTarget.destroy(); } @@ -491,8 +499,8 @@ class ApplicationsButton extends PanelMenu.Button { _onMenuKeyPress(actor, event) { let symbol = event.get_key_symbol(); if (symbol == Clutter.KEY_Left || symbol == Clutter.KEY_Right) { - let direction = symbol == Clutter.KEY_Left ? Gtk.DirectionType.LEFT - : Gtk.DirectionType.RIGHT; + let direction = symbol == Clutter.KEY_Left ? + Gtk.DirectionType.LEFT : Gtk.DirectionType.RIGHT; if (this.menu.actor.navigate_focus(global.stage.key_focus, direction, false)) return true; } @@ -529,7 +537,7 @@ class ApplicationsButton extends PanelMenu.Button { Main.wm.setCustomKeybindingHandler('panel-main-menu', Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW, - () => { this.menu.toggle(); }); + () => this.menu.toggle()); } _redisplay() { @@ -600,9 +608,12 @@ class ApplicationsButton extends PanelMenu.Button { this.menu.addMenuItem(section); this.mainBox = new St.BoxLayout({ vertical: false }); this.leftBox = new St.BoxLayout({ vertical: true }); - this.applicationsScrollBox = new St.ScrollView({ x_fill: true, y_fill: false, - y_align: St.Align.START, - style_class: 'apps-menu vfade' }); + this.applicationsScrollBox = new St.ScrollView({ + x_fill: true, + y_fill: false, + y_align: St.Align.START, + style_class: 'apps-menu vfade' + }); this.applicationsScrollBox.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC); let vscroll = this.applicationsScrollBox.get_vscroll_bar(); vscroll.connect('scroll-start', () => { @@ -611,21 +622,30 @@ class ApplicationsButton extends PanelMenu.Button { vscroll.connect('scroll-stop', () => { this.menu.passEvents = false; }); - this.categoriesScrollBox = new St.ScrollView({ x_fill: true, y_fill: false, - y_align: St.Align.START, - style_class: 'vfade' }); + this.categoriesScrollBox = new St.ScrollView({ + x_fill: true, + y_fill: false, + y_align: St.Align.START, + style_class: 'vfade' + }); this.categoriesScrollBox.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC); vscroll = this.categoriesScrollBox.get_vscroll_bar(); - vscroll.connect('scroll-start', () => { this.menu.passEvents = true; }); - vscroll.connect('scroll-stop', () => { this.menu.passEvents = false; }); - this.leftBox.add(this.categoriesScrollBox, { expand: true, - x_fill: true, y_fill: true, - y_align: St.Align.START }); + vscroll.connect('scroll-start', () => this.menu.passEvents = true); + vscroll.connect('scroll-stop', () => this.menu.passEvents = false); + this.leftBox.add(this.categoriesScrollBox, { + expand: true, + x_fill: true, + y_fill: true, + y_align: St.Align.START + }); let activities = new ActivitiesMenuItem(this); - this.leftBox.add(activities.actor, { expand: false, - x_fill: true, y_fill: false, - y_align: St.Align.START }); + this.leftBox.add(activities.actor, { + expand: false, + x_fill: true, + y_fill: false, + y_align: St.Align.START + }); this.applicationsBox = new St.BoxLayout({ vertical: true }); this.applicationsScrollBox.add_actor(this.applicationsBox); @@ -633,8 +653,16 @@ class ApplicationsButton extends PanelMenu.Button { this.categoriesScrollBox.add_actor(this.categoriesBox); this.mainBox.add(this.leftBox); - this.mainBox.add(this._createVertSeparator(), { expand: false, x_fill: false, y_fill: true }); - this.mainBox.add(this.applicationsScrollBox, { expand: true, x_fill: true, y_fill: true }); + this.mainBox.add(this._createVertSeparator(), { + expand: false, + x_fill: false, + y_fill: true + }); + this.mainBox.add(this.applicationsScrollBox, { + expand: true, + x_fill: true, + y_fill: true + }); section.actor.add_actor(this.mainBox); } diff --git a/extensions/auto-move-windows/extension.js b/extensions/auto-move-windows/extension.js index 359799716481eb1361608579037524c410203510..646156aa14ad6f4be5117579e6f238946a8fb32b 100644 --- a/extensions/auto-move-windows/extension.js +++ b/extensions/auto-move-windows/extension.js @@ -125,9 +125,9 @@ function myCheckWorkspaces() { } // make sure the original method only removes empty workspaces at the end - keepAliveWorkspaces.forEach(ws => { ws._keepAliveId = 1; }); + keepAliveWorkspaces.forEach(ws => ws._keepAliveId = 1); prevCheckWorkspaces.call(this); - keepAliveWorkspaces.forEach(ws => { delete ws._keepAliveId; }); + keepAliveWorkspaces.forEach(ws => delete ws._keepAliveId); return false; } diff --git a/extensions/auto-move-windows/prefs.js b/extensions/auto-move-windows/prefs.js index fd448f0b5547a962b3282e8b55cb76c07315e5d4..f808347ca61bba6a9d2e37d7b93be39afa1c4cdd 100644 --- a/extensions/auto-move-windows/prefs.js +++ b/extensions/auto-move-windows/prefs.js @@ -34,35 +34,48 @@ const Widget = GObject.registerClass({ this._changedPermitted = false; this._store = new Gtk.ListStore(); - this._store.set_column_types([Gio.AppInfo, GObject.TYPE_STRING, Gio.Icon, GObject.TYPE_INT, - Gtk.Adjustment]); + this._store.set_column_types([ + Gio.AppInfo, + GObject.TYPE_STRING, + Gio.Icon, + GObject.TYPE_INT, + Gtk.Adjustment + ]); let scrolled = new Gtk.ScrolledWindow({ shadow_type: Gtk.ShadowType.IN }); scrolled.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC); this.add(scrolled); - this._treeView = new Gtk.TreeView({ model: this._store, - hexpand: true, vexpand: true }); + this._treeView = new Gtk.TreeView({ + model: this._store, + hexpand: true, + vexpand: true + }); this._treeView.get_selection().set_mode(Gtk.SelectionMode.SINGLE); - let appColumn = new Gtk.TreeViewColumn({ expand: true, sort_column_id: Columns.DISPLAY_NAME, - title: _("Application") }); + let appColumn = new Gtk.TreeViewColumn({ + expand: true, + sort_column_id: Columns.DISPLAY_NAME, + title: _('Application') + }); let iconRenderer = new Gtk.CellRendererPixbuf; appColumn.pack_start(iconRenderer, false); - appColumn.add_attribute(iconRenderer, "gicon", Columns.ICON); + appColumn.add_attribute(iconRenderer, 'gicon', Columns.ICON); let nameRenderer = new Gtk.CellRendererText; appColumn.pack_start(nameRenderer, true); - appColumn.add_attribute(nameRenderer, "text", Columns.DISPLAY_NAME); + appColumn.add_attribute(nameRenderer, 'text', Columns.DISPLAY_NAME); this._treeView.append_column(appColumn); - let workspaceColumn = new Gtk.TreeViewColumn({ title: _("Workspace"), - sort_column_id: Columns.WORKSPACE }); + let workspaceColumn = new Gtk.TreeViewColumn({ + title: _('Workspace'), + sort_column_id: Columns.WORKSPACE + }); let workspaceRenderer = new Gtk.CellRendererSpin({ editable: true }); workspaceRenderer.connect('edited', this._workspaceEdited.bind(this)); workspaceColumn.pack_start(workspaceRenderer, true); - workspaceColumn.add_attribute(workspaceRenderer, "adjustment", Columns.ADJUSTMENT); - workspaceColumn.add_attribute(workspaceRenderer, "text", Columns.WORKSPACE); + workspaceColumn.add_attribute(workspaceRenderer, 'adjustment', Columns.ADJUSTMENT); + workspaceColumn.add_attribute(workspaceRenderer, 'text', Columns.WORKSPACE); this._treeView.append_column(workspaceColumn); scrolled.add(this._treeView); @@ -71,13 +84,15 @@ const Widget = GObject.registerClass({ toolbar.get_style_context().add_class(Gtk.STYLE_CLASS_INLINE_TOOLBAR); this.add(toolbar); - let newButton = new Gtk.ToolButton({ icon_name: 'bookmark-new-symbolic', - label: _("Add Rule"), - is_important: true }); + let newButton = new Gtk.ToolButton({ + icon_name: 'bookmark-new-symbolic', + label: _('Add Rule'), + is_important: true + }); newButton.connect('clicked', this._createNew.bind(this)); toolbar.add(newButton); - let delButton = new Gtk.ToolButton({ icon_name: 'edit-delete-symbolic' }); + let delButton = new Gtk.ToolButton({ icon_name: 'edit-delete-symbolic' }); delButton.connect('clicked', this._deleteSelected.bind(this)); toolbar.add(delButton); @@ -92,17 +107,21 @@ const Widget = GObject.registerClass({ } _createNew() { - let dialog = new Gtk.Dialog({ title: _("Create new matching rule"), - transient_for: this.get_toplevel(), - use_header_bar: true, - modal: true }); + let dialog = new Gtk.Dialog({ + title: _('Create new matching rule'), + transient_for: this.get_toplevel(), + use_header_bar: true, + modal: true + }); dialog.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL); - let addButton = dialog.add_button(_("Add"), Gtk.ResponseType.OK); + let addButton = dialog.add_button(_('Add'), Gtk.ResponseType.OK); dialog.set_default_response(Gtk.ResponseType.OK); - let grid = new Gtk.Grid({ column_spacing: 10, - row_spacing: 15, - margin: 10 }); + let grid = new Gtk.Grid({ + column_spacing: 10, + row_spacing: 15, + margin: 10 + }); dialog._appChooser = new Gtk.AppChooserWidget({ show_all: true }); dialog._appChooser.connect('application-selected', (w, appInfo) => { addButton.sensitive = appInfo && this._checkId(appInfo.get_id()); @@ -111,13 +130,19 @@ const Widget = GObject.registerClass({ addButton.sensitive = appInfo && this._checkId(appInfo.get_id()); grid.attach(dialog._appChooser, 0, 0, 2, 1); - grid.attach(new Gtk.Label({ label: _("Workspace"), - halign: Gtk.Align.END }), 0, 1, 1, 1); - let adjustment = new Gtk.Adjustment({ lower: 1, - upper: WORKSPACE_MAX, - step_increment: 1 }); - dialog._spin = new Gtk.SpinButton({ adjustment: adjustment, - snap_to_ticks: true }); + grid.attach(new Gtk.Label({ + label: _('Workspace'), + halign: Gtk.Align.END + }), 0, 1, 1, 1); + let adjustment = new Gtk.Adjustment({ + lower: 1, + upper: WORKSPACE_MAX, + step_increment: 1 + }); + dialog._spin = new Gtk.SpinButton({ + adjustment: adjustment, + snap_to_ticks: true + }); dialog._spin.set_value(1); grid.attach(dialog._spin, 1, 1, 1, 1); dialog.get_content_area().add(grid); @@ -140,10 +165,12 @@ const Widget = GObject.registerClass({ this._changedPermitted = true; let iter = this._store.append(); - let adj = new Gtk.Adjustment({ lower: 1, - upper: WORKSPACE_MAX, - step_increment: 1, - value: index }); + let adj = new Gtk.Adjustment({ + lower: 1, + upper: WORKSPACE_MAX, + step_increment: 1, + value: index + }); this._store.set(iter, [Columns.APPINFO, Columns.ICON, Columns.DISPLAY_NAME, Columns.WORKSPACE, Columns.ADJUSTMENT], [appInfo, appInfo.get_icon(), appInfo.get_display_name(), index, adj]); @@ -197,10 +224,12 @@ const Widget = GObject.registerClass({ validItems.push(currentItems[i]); let iter = this._store.append(); - let adj = new Gtk.Adjustment({ lower: 1, - upper: WORKSPACE_MAX, - step_increment: 1, - value: index }); + let adj = new Gtk.Adjustment({ + lower: 1, + upper: WORKSPACE_MAX, + step_increment: 1, + value: index + }); this._store.set(iter, [Columns.APPINFO, Columns.ICON, Columns.DISPLAY_NAME, Columns.WORKSPACE, Columns.ADJUSTMENT], [appInfo, appInfo.get_icon(), appInfo.get_display_name(), parseInt(index), adj]); diff --git a/extensions/drive-menu/extension.js b/extensions/drive-menu/extension.js index 4c1fdbf1cbaf7d5da65503085314615fffa822de..51b4aa67af9c219bcea78f4d47039e2832e95542 100644 --- a/extensions/drive-menu/extension.js +++ b/extensions/drive-menu/extension.js @@ -22,8 +22,10 @@ class MountMenuItem extends PopupMenu.PopupBaseMenuItem { this.mount = mount; - let ejectIcon = new St.Icon({ icon_name: 'media-eject-symbolic', - style_class: 'popup-menu-icon ' }); + let ejectIcon = new St.Icon({ + icon_name: 'media-eject-symbolic', + style_class: 'popup-menu-icon' + }); let ejectButton = new St.Button({ child: ejectIcon }); ejectButton.connect('clicked', this._eject.bind(this)); this.actor.add(ejectButton); @@ -95,7 +97,7 @@ class MountMenuItem extends PopupMenu.PopupBaseMenuItem { _reportFailure(exception) { // TRANSLATORS: %s is the filesystem name - let msg = _("Ejecting drive “%s” failed:").format(this.mount.get_name()); + let msg = _('Ejecting drive “%s” failed:').format(this.mount.get_name()); Main.notifyError(msg, exception.message); } @@ -111,11 +113,13 @@ class MountMenuItem extends PopupMenu.PopupBaseMenuItem { let DriveMenu = GObject.registerClass( class DriveMenu extends PanelMenu.Button { _init() { - super._init(0.0, _("Removable devices")); + super._init(0.0, _('Removable devices')); let hbox = new St.BoxLayout({ style_class: 'panel-status-menu-box' }); - let icon = new St.Icon({ icon_name: 'media-eject-symbolic', - style_class: 'system-status-icon' }); + let icon = new St.Icon({ + icon_name: 'media-eject-symbolic', + style_class: 'system-status-icon' + }); hbox.add_child(icon); hbox.add_child(PopupMenu.arrowIcon(St.Side.BOTTOM)); @@ -136,7 +140,7 @@ class DriveMenu extends PanelMenu.Button { this._monitor.get_mounts().forEach(this._addMount.bind(this)); this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem()); - this.menu.addAction(_("Open Files"), event => { + this.menu.addAction(_('Open Files'), event => { let appSystem = Shell.AppSystem.get_default(); let app = appSystem.lookup_app('org.gnome.Nautilus.desktop'); app.activate_full(-1, event.get_time()); diff --git a/extensions/places-menu/extension.js b/extensions/places-menu/extension.js index b98d38579b84471605ed6037a55e95dbf2eac877..c477a4acc09ef744040c9b3f51fe054ff4eefb5a 100644 --- a/extensions/places-menu/extension.js +++ b/extensions/places-menu/extension.js @@ -22,16 +22,20 @@ class PlaceMenuItem extends PopupMenu.PopupBaseMenuItem { super(); this._info = info; - this._icon = new St.Icon({ gicon: info.icon, - icon_size: PLACE_ICON_SIZE }); + this._icon = new St.Icon({ + gicon: info.icon, + icon_size: PLACE_ICON_SIZE + }); this.actor.add_child(this._icon); this._label = new St.Label({ text: info.name, x_expand: true }); this.actor.add_child(this._label); if (info.isRemovable()) { - this._ejectIcon = new St.Icon({ icon_name: 'media-eject-symbolic', - style_class: 'popup-menu-icon ' }); + this._ejectIcon = new St.Icon({ + icon_name: 'media-eject-symbolic', + style_class: 'popup-menu-icon' + }); this._ejectButton = new St.Button({ child: this._ejectIcon }); this._ejectButton.connect('clicked', info.eject.bind(info)); this.actor.add_child(this._ejectButton); @@ -72,12 +76,14 @@ const SECTIONS = [ let PlacesMenu = GObject.registerClass( class PlacesMenu extends PanelMenu.Button { _init() { - super._init(0.0, _("Places")); + super._init(0.0, _('Places')); let hbox = new St.BoxLayout({ style_class: 'panel-status-menu-box' }); - let label = new St.Label({ text: _("Places"), - y_expand: true, - y_align: Clutter.ActorAlign.CENTER }); + let label = new St.Label({ + text: _('Places'), + y_expand: true, + y_align: Clutter.ActorAlign.CENTER + }); hbox.add_child(label); hbox.add_child(PopupMenu.arrowIcon(St.Side.BOTTOM)); this.add_actor(hbox); diff --git a/extensions/places-menu/placeDisplay.js b/extensions/places-menu/placeDisplay.js index dbd3308c24ef2e867cbde469b78039c9316445fe..037a3394cd42529195784c169ad3ec81514b0789 100644 --- a/extensions/places-menu/placeDisplay.js +++ b/extensions/places-menu/placeDisplay.js @@ -45,7 +45,7 @@ class PlaceInfo { } catch (e) { if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.NOT_MOUNTED)) { let source = { - get_icon: () => { return this.icon; } + get_icon: () => this.icon }; let op = new ShellMountOperation.ShellMountOperation(source); this.file.mount_enclosing_volume(0, op.mountOp, null, (file, result) => { @@ -56,7 +56,7 @@ class PlaceInfo { if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.FAILED_HANDLED)) // e.g. user canceled the password dialog return; - Main.notifyError(_("Failed to mount volume for “%s”").format(this.name), e.message); + Main.notifyError(_('Failed to mount volume for “%s”').format(this.name), e.message); return; } @@ -69,7 +69,7 @@ class PlaceInfo { } }); } else { - Main.notifyError(_("Failed to launch “%s”").format(this.name), e.message); + Main.notifyError(_('Failed to launch “%s”').format(this.name), e.message); } } }; @@ -130,7 +130,7 @@ Signals.addSignalMethods(PlaceInfo.prototype); class RootInfo extends PlaceInfo { _init() { - super._init('devices', Gio.File.new_for_path('/'), _("Computer")); + super._init('devices', Gio.File.new_for_path('/'), _('Computer')); let busName = 'org.freedesktop.hostname1'; let objPath = '/org/freedesktop/hostname1'; @@ -153,7 +153,7 @@ class RootInfo extends PlaceInfo { // GDBusProxy will emit a g-properties-changed when hostname1 goes down // ignore it if (proxy.g_name_owner) { - this.name = proxy.PrettyHostname || _("Computer"); + this.name = proxy.PrettyHostname || _('Computer'); this.emit('changed'); } } @@ -214,7 +214,7 @@ class PlaceDeviceInfo extends PlaceInfo { } _reportFailure(exception) { - let msg = _("Ejecting drive “%s” failed:").format(this._mount.get_name()); + let msg = _('Ejecting drive “%s” failed:').format(this._mount.get_name()); Main.notifyError(msg, exception.message); } } @@ -298,9 +298,17 @@ var PlacesManager = class { } _connectVolumeMonitorSignals() { - const signals = ['volume-added', 'volume-removed', 'volume-changed', - 'mount-added', 'mount-removed', 'mount-changed', - 'drive-connected', 'drive-disconnected', 'drive-changed']; + const signals = [ + 'volume-added', + 'volume-removed', + 'volume-changed', + 'mount-added', + 'mount-removed', + 'mount-changed', + 'drive-connected', + 'drive-disconnected', + 'drive-changed' + ]; this._volumeMonitorSignals = []; let func = this._updateMounts.bind(this); @@ -325,14 +333,14 @@ var PlacesManager = class { } _updateSpecials() { - this._places.special.forEach(p => { p.destroy(); }); + this._places.special.forEach(p => p.destroy()); this._places.special = []; let homePath = GLib.get_home_dir(); this._places.special.push(new PlaceInfo('special', Gio.File.new_for_path(homePath), - _("Home"))); + _('Home'))); let specials = []; let dirs = DEFAULT_DIRECTORIES.slice(); @@ -367,16 +375,16 @@ var PlacesManager = class { let networkMounts = []; let networkVolumes = []; - this._places.devices.forEach(p => { p.destroy(); }); + this._places.devices.forEach(p => p.destroy()); this._places.devices = []; - this._places.network.forEach(p => { p.destroy(); }); + this._places.network.forEach(p => p.destroy()); this._places.network = []; /* Add standard places */ this._places.devices.push(new RootInfo()); this._places.network.push(new PlaceInfo('network', Gio.File.new_for_uri('network:///'), - _("Browse Network"), + _('Browse Network'), 'network-workgroup-symbolic')); /* first go through all connected drives */ diff --git a/extensions/screenshot-window-sizer/extension.js b/extensions/screenshot-window-sizer/extension.js index bf31f8158742d121cf3701b1d36108226393ccd2..13d29f7cae4e604b15347ba9927f011ef645002d 100644 --- a/extensions/screenshot-window-sizer/extension.js +++ b/extensions/screenshot-window-sizer/extension.js @@ -50,11 +50,12 @@ function flashMessage(message) { text.set_position(monitor.x + Math.floor(monitor.width / 2 - text.width / 2), monitor.y + Math.floor(monitor.height / 2 - text.height / 2)); - Tweener.addTween(text, - { opacity: 0, - time: MESSAGE_FADE_TIME, - transition: 'easeOutQuad', - onComplete: hideMessage }); + Tweener.addTween(text, { + opacity: 0, + time: MESSAGE_FADE_TIME, + transition: 'easeOutQuad', + onComplete: hideMessage + }); } let SIZES = [ diff --git a/extensions/window-list/extension.js b/extensions/window-list/extension.js index cb2edb05761070d9df7c2b6e4a723c17471e950b..9e2ee94cb3de095a80661a883b6aa72b68d69ec6 100644 --- a/extensions/window-list/extension.js +++ b/extensions/window-list/extension.js @@ -97,7 +97,7 @@ class WindowContextMenu extends PopupMenu.PopupMenu { this._updateMaximizeItem.bind(this)); this._updateMaximizeItem(); - this._closeItem = new PopupMenu.PopupMenuItem(_("Close")); + this._closeItem = new PopupMenu.PopupMenuItem(_('Close')); this._closeItem.connect('activate', () => { this._metaWindow.delete(global.get_current_time()); }); @@ -116,15 +116,15 @@ class WindowContextMenu extends PopupMenu.PopupMenu { } _updateMinimizeItem() { - this._minimizeItem.label.text = this._metaWindow.minimized ? _("Unminimize") - : _("Minimize"); + this._minimizeItem.label.text = this._metaWindow.minimized ? + _('Unminimize') : _('Minimize'); } _updateMaximizeItem() { let maximized = this._metaWindow.maximized_vertically && this._metaWindow.maximized_horizontally; - this._maximizeItem.label.text = maximized ? _("Unmaximize") - : _("Maximize"); + this._maximizeItem.label.text = maximized ? + _('Unmaximize') : _('Maximize'); } _onDestroy() { @@ -137,8 +137,11 @@ class WindowContextMenu extends PopupMenu.PopupMenu { class WindowTitle { constructor(metaWindow) { this._metaWindow = metaWindow; - this.actor = new St.BoxLayout({ style_class: 'window-button-box', - x_expand: true, y_expand: true }); + this.actor = new St.BoxLayout({ + style_class: 'window-button-box', + x_expand: true, + y_expand: true + }); this._icon = new St.Bin({ style_class: 'window-button-icon' }); this.actor.add(this._icon); @@ -188,8 +191,10 @@ class WindowTitle { if (app) this._icon.child = app.create_icon_texture(ICON_TEXTURE_SIZE); else - this._icon.child = new St.Icon({ icon_name: 'icon-missing', - icon_size: ICON_TEXTURE_SIZE }); + this._icon.child = new St.Icon({ + icon_name: 'icon-missing', + icon_size: ICON_TEXTURE_SIZE + }); } _onDestroy() { @@ -210,12 +215,13 @@ class BaseButton { this._perMonitor = perMonitor; this._monitorIndex = monitorIndex; - this.actor = new St.Button({ style_class: 'window-button', - x_fill: true, - y_fill: true, - can_focus: true, - button_mask: St.ButtonMask.ONE | - St.ButtonMask.THREE }); + this.actor = new St.Button({ + style_class: 'window-button', + x_fill: true, + y_fill: true, + can_focus: true, + button_mask: St.ButtonMask.ONE | St.ButtonMask.THREE + }); this.actor._delegate = this; this.actor.connect('allocation-changed', @@ -399,19 +405,19 @@ class AppContextMenu extends PopupMenu.PopupMenu { this._appButton = appButton; - this._minimizeItem = new PopupMenu.PopupMenuItem(_("Minimize all")); + this._minimizeItem = new PopupMenu.PopupMenuItem(_('Minimize all')); this._minimizeItem.connect('activate', () => { - this._appButton.getWindowList().forEach(w => { w.minimize(); }); + this._appButton.getWindowList().forEach(w => w.minimize()); }); this.addMenuItem(this._minimizeItem); - this._unminimizeItem = new PopupMenu.PopupMenuItem(_("Unminimize all")); + this._unminimizeItem = new PopupMenu.PopupMenuItem(_('Unminimize all')); this._unminimizeItem.connect('activate', () => { - this._appButton.getWindowList().forEach(w => { w.unminimize(); }); + this._appButton.getWindowList().forEach(w => w.unminimize()); }); this.addMenuItem(this._unminimizeItem); - this._maximizeItem = new PopupMenu.PopupMenuItem(_("Maximize all")); + this._maximizeItem = new PopupMenu.PopupMenuItem(_('Maximize all')); this._maximizeItem.connect('activate', () => { this._appButton.getWindowList().forEach(w => { w.maximize(Meta.MaximizeFlags.HORIZONTAL | @@ -420,7 +426,7 @@ class AppContextMenu extends PopupMenu.PopupMenu { }); this.addMenuItem(this._maximizeItem); - this._unmaximizeItem = new PopupMenu.PopupMenuItem(_("Unmaximize all")); + this._unmaximizeItem = new PopupMenu.PopupMenuItem(_('Unmaximize all')); this._unmaximizeItem.connect('activate', () => { this._appButton.getWindowList().forEach(w => { w.unmaximize(Meta.MaximizeFlags.HORIZONTAL | @@ -429,7 +435,7 @@ class AppContextMenu extends PopupMenu.PopupMenu { }); this.addMenuItem(this._unmaximizeItem); - let item = new PopupMenu.PopupMenuItem(_("Close all")); + let item = new PopupMenu.PopupMenuItem(_('Close all')); item.connect('activate', () => { this._appButton.getWindowList().forEach(w => { w.delete(global.get_current_time()); @@ -463,21 +469,29 @@ class AppButton extends BaseButton { let stack = new St.Widget({ layout_manager: new Clutter.BinLayout() }); this.actor.set_child(stack); - this._singleWindowTitle = new St.Bin({ x_expand: true, - y_fill: true, - x_align: St.Align.START }); + this._singleWindowTitle = new St.Bin({ + x_expand: true, + y_fill: true, + x_align: St.Align.START + }); stack.add_actor(this._singleWindowTitle); - this._multiWindowTitle = new St.BoxLayout({ style_class: 'window-button-box', - x_expand: true }); + this._multiWindowTitle = new St.BoxLayout({ + style_class: 'window-button-box', + x_expand: true + }); stack.add_actor(this._multiWindowTitle); - this._icon = new St.Bin({ style_class: 'window-button-icon', - child: app.create_icon_texture(ICON_TEXTURE_SIZE) }); + this._icon = new St.Bin({ + style_class: 'window-button-icon', + child: app.create_icon_texture(ICON_TEXTURE_SIZE) + }); this._multiWindowTitle.add(this._icon); - let label = new St.Label({ text: app.get_name(), - y_align: Clutter.ActorAlign.CENTER }); + let label = new St.Label({ + text: app.get_name(), + y_align: Clutter.ActorAlign.CENTER + }); this._multiWindowTitle.add(label); this._multiWindowTitle.label_actor = label; @@ -538,7 +552,7 @@ class AppButton extends BaseButton { let rect = this._getIconGeometry(); let windows = this.app.get_windows(); - windows.forEach(w => { w.set_icon_geometry(rect); }); + windows.forEach(w => w.set_icon_geometry(rect)); } getWindowList() { @@ -638,21 +652,26 @@ class AppButton extends BaseButton { let WorkspaceIndicator = GObject.registerClass( class WorkspaceIndicator extends PanelMenu.Button { _init() { - super._init(0.0, _("Workspace Indicator"), true); + super._init(0.0, _('Workspace Indicator'), true); this.setMenu(new PopupMenu.PopupMenu(this, 0.0, St.Side.BOTTOM)); this.add_style_class_name('window-list-workspace-indicator'); this.menu.actor.remove_style_class_name('panel-menu'); - let container = new St.Widget({ layout_manager: new Clutter.BinLayout(), - x_expand: true, y_expand: true }); + let container = new St.Widget({ + layout_manager: new Clutter.BinLayout(), + x_expand: true, + y_expand: true + }); this.add_actor(container); let workspaceManager = global.workspace_manager; this._currentWorkspace = workspaceManager.get_active_workspace().index(); - this.statusLabel = new St.Label({ text: this._getStatusText(), - x_align: Clutter.ActorAlign.CENTER, - y_align: Clutter.ActorAlign.CENTER }); + this.statusLabel = new St.Label({ + text: this._getStatusText(), + x_align: Clutter.ActorAlign.CENTER, + y_align: Clutter.ActorAlign.CENTER + }); container.add_actor(this.statusLabel); this.workspacesItems = []; @@ -761,23 +780,27 @@ class WindowList { this._perMonitor = perMonitor; this._monitor = monitor; - this.actor = new St.Widget({ name: 'panel', - style_class: 'bottom-panel solid', - reactive: true, - track_hover: true, - layout_manager: new Clutter.BinLayout() }); + this.actor = new St.Widget({ + name: 'panel', + style_class: 'bottom-panel solid', + reactive: true, + track_hover: true, + layout_manager: new Clutter.BinLayout() + }); this.actor.connect('destroy', this._onDestroy.bind(this)); let box = new St.BoxLayout({ x_expand: true, y_expand: true }); this.actor.add_actor(box); let layout = new Clutter.BoxLayout({ homogeneous: true }); - this._windowList = new St.Widget({ style_class: 'window-list', - reactive: true, - layout_manager: layout, - x_align: Clutter.ActorAlign.START, - x_expand: true, - y_expand: true }); + this._windowList = new St.Widget({ + style_class: 'window-list', + reactive: true, + layout_manager: layout, + x_align: Clutter.ActorAlign.START, + x_expand: true, + y_expand: true + }); box.add(this._windowList, { expand: true }); this._windowList.connect('style-changed', () => { @@ -805,10 +828,12 @@ class WindowList { this._menuManager = new PopupMenu.PopupMenuManager(this); this._menuManager.addMenu(this._workspaceIndicator.menu); - Main.layoutManager.addChrome(this.actor, { affectsStruts: true, - trackFullscreen: true }); + Main.layoutManager.addChrome(this.actor, { + affectsStruts: true, + trackFullscreen: true + }); Main.uiGroup.set_child_above_sibling(this.actor, Main.layoutManager.panelBox); - Main.ctrlAltTabManager.addGroup(this.actor, _("Window List"), 'start-here-symbolic'); + Main.ctrlAltTabManager.addGroup(this.actor, _('Window List'), 'start-here-symbolic'); this.actor.width = this._monitor.width; this.actor.connect('notify::height', this._updatePosition.bind(this)); @@ -1205,7 +1230,7 @@ class Extension { } _buildWindowLists() { - this._windowLists.forEach(list => { list.actor.destroy(); }); + this._windowLists.forEach(list => list.actor.destroy()); this._windowLists = []; let showOnAllMonitors = this._settings.get_boolean('show-on-all-monitors'); diff --git a/extensions/window-list/prefs.js b/extensions/window-list/prefs.js index 59fd69755ddd37d3054384983d7af823d82693ba..78792b5a505f1ebb6eaba47f06a37d5f540d1c10 100644 --- a/extensions/window-list/prefs.js +++ b/extensions/window-list/prefs.js @@ -22,16 +22,20 @@ class WindowListPrefsWidget extends Gtk.Grid { this.row_spacing = 6; this.orientation = Gtk.Orientation.VERTICAL; - let groupingLabel = '%s'.format(_("Window Grouping")); - this.add(new Gtk.Label({ label: groupingLabel, use_markup: true, - halign: Gtk.Align.START })); + let groupingLabel = '%s'.format(_('Window Grouping')); + this.add(new Gtk.Label({ + label: groupingLabel, use_markup: true, + halign: Gtk.Align.START + })); let align = new Gtk.Alignment({ left_padding: 12 }); this.add(align); - let grid = new Gtk.Grid({ orientation: Gtk.Orientation.VERTICAL, - row_spacing: 6, - column_spacing: 6 }); + let grid = new Gtk.Grid({ + orientation: Gtk.Orientation.VERTICAL, + row_spacing: 6, + column_spacing: 6 + }); align.add(grid); this._settings = ExtensionUtils.getSettings(); @@ -40,9 +44,9 @@ class WindowListPrefsWidget extends Gtk.Grid { let modes = range.deep_unpack()[1].deep_unpack(); let modeLabels = { - 'never': _("Never group windows"), - 'auto': _("Group windows when space is limited"), - 'always': _("Always group windows") + 'never': _('Never group windows'), + 'auto': _('Group windows when space is limited'), + 'always': _('Always group windows') }; let radio = null; @@ -54,9 +58,11 @@ class WindowListPrefsWidget extends Gtk.Grid { continue; } - radio = new Gtk.RadioButton({ active: currentMode == mode, - label: label, - group: radio }); + radio = new Gtk.RadioButton({ + active: currentMode == mode, + label: label, + group: radio + }); grid.add(radio); radio.connect('toggled', button => { @@ -65,8 +71,10 @@ class WindowListPrefsWidget extends Gtk.Grid { }); } - let check = new Gtk.CheckButton({ label: _("Show on all monitors"), - margin_top: 6 }); + let check = new Gtk.CheckButton({ + label: _('Show on all monitors'), + margin_top: 6 + }); this._settings.bind('show-on-all-monitors', check, 'active', Gio.SettingsBindFlags.DEFAULT); this.add(check); } diff --git a/extensions/windowsNavigator/extension.js b/extensions/windowsNavigator/extension.js index 13de1bc3537c84584be75930365a46dc6e728167..7d58ebe2cbac7343a44ddc472887a36d3ed68fe1 100644 --- a/extensions/windowsNavigator/extension.js +++ b/extensions/windowsNavigator/extension.js @@ -229,8 +229,10 @@ function enable() { workspaceInjections['_init'] = injectToFunction(Workspace.Workspace.prototype, '_init', function(metaWorkspace) { if (metaWorkspace && metaWorkspace.index() < 9) { - createdActors.push(this._tip = new St.Label({ style_class: 'extension-windowsNavigator-window-tooltip', - visible: false })); + createdActors.push(this._tip = new St.Label({ + style_class: 'extension-windowsNavigator-window-tooltip', + visible: false + })); this.actor.add_actor(this._tip); let signalId = this.actor.connect('notify::scale-x', () => { diff --git a/extensions/workspace-indicator/extension.js b/extensions/workspace-indicator/extension.js index 9e1dfd70ad74e1984f4c0ecb7e1aa1967710dd96..3be126864d509d8fe6a2cff7972dd83888342ba5 100644 --- a/extensions/workspace-indicator/extension.js +++ b/extensions/workspace-indicator/extension.js @@ -18,13 +18,15 @@ const WORKSPACE_KEY = 'workspace-names'; let WorkspaceIndicator = GObject.registerClass( class WorkspaceIndicator extends PanelMenu.Button { _init() { - super._init(0.0, _("Workspace Indicator")); + super._init(0.0, _('Workspace Indicator')); let workspaceManager = global.workspace_manager; this._currentWorkspace = workspaceManager.get_active_workspace().index(); - this.statusLabel = new St.Label({ y_align: Clutter.ActorAlign.CENTER, - text: this._labelText() }); + this.statusLabel = new St.Label({ + y_align: Clutter.ActorAlign.CENTER, + text: this._labelText() + }); this.add_actor(this.statusLabel); diff --git a/extensions/workspace-indicator/prefs.js b/extensions/workspace-indicator/prefs.js index 64a64fdc524a4d3441fd785f51eb3c64f77fe71b..d8640559a204baae317ca04338778b97caa876eb 100644 --- a/extensions/workspace-indicator/prefs.js +++ b/extensions/workspace-indicator/prefs.js @@ -127,22 +127,28 @@ class WorkspaceSettingsWidget extends Gtk.Grid { this.margin = 12; this.orientation = Gtk.Orientation.VERTICAL; - this.add(new Gtk.Label({ label: '%s'.format(_("Workspace Names")), - use_markup: true, margin_bottom: 6, - hexpand: true, halign: Gtk.Align.START })); + this.add(new Gtk.Label({ + label: '%s'.format(_('Workspace Names')), + use_markup: true, + margin_bottom: 6, + hexpand: true, + halign: Gtk.Align.START + })); let scrolled = new Gtk.ScrolledWindow({ shadow_type: Gtk.ShadowType.IN }); scrolled.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC); this.add(scrolled); this._store = new WorkspaceNameModel(); - this._treeView = new Gtk.TreeView({ model: this._store, - headers_visible: false, - reorderable: true, - hexpand: true, - vexpand: true }); + this._treeView = new Gtk.TreeView({ + model: this._store, + headers_visible: false, + reorderable: true, + hexpand: true, + vexpand: true + }); - let column = new Gtk.TreeViewColumn({ title: _("Name") }); + let column = new Gtk.TreeViewColumn({ title: _('Name') }); let renderer = new Gtk.CellRendererText({ editable: true }); renderer.connect('edited', this._cellEdited.bind(this)); column.pack_start(renderer, true); @@ -182,7 +188,7 @@ class WorkspaceSettingsWidget extends Gtk.Grid { let iter = this._store.append(); let index = this._store.get_path(iter).get_indices()[0]; - let label = _("Workspace %d").format(index + 1); + let label = _('Workspace %d').format(index + 1); this._store.set(iter, [this._store.Columns.LABEL], [label]); } diff --git a/lint/eslintrc-legacy.json b/lint/eslintrc-legacy.json index 0bbbff18217e39e354088e69a0d28fe709c24c1f..aca79adf8a21e30cd32a0289e1f026be02b74df4 100644 --- a/lint/eslintrc-legacy.json +++ b/lint/eslintrc-legacy.json @@ -5,16 +5,12 @@ 4, { "ignoredNodes": [ - "ConditionalExpression", "CallExpression > ArrowFunctionExpression", "CallExpression[callee.object.name=GObject][callee.property.name=registerClass] > ClassExpression:first-child" ], "CallExpression": { "arguments": "first" }, - "ArrayExpression": "first", - "ObjectExpression": "first", "MemberExpression": "off" } - ], - "quotes": "off" + ] } } diff --git a/lint/eslintrc-shell.json b/lint/eslintrc-shell.json index 198a7509d8701392318cefb939be8b58d3fa4cee..eb96266ab811c275b09f64e58ef6051e34c15fce 100644 --- a/lint/eslintrc-shell.json +++ b/lint/eslintrc-shell.json @@ -1,13 +1,6 @@ { "rules": { "arrow-spacing": "error", - "brace-style": [ - "error", - "1tbs", - { - "allowSingleLine": true - } - ], "camelcase": [ "error", { @@ -20,19 +13,22 @@ 4, { "ignoredNodes": [ - "ArrayExpression > ObjectExpression", - "CallExpression[callee.object.name=GObject][callee.property.name=registerClass] > ClassExpression:first-child", - "ConditionalExpression" + "CallExpression[callee.object.name=GObject][callee.property.name=registerClass] > ClassExpression:first-child" ], "MemberExpression": "off" } ], - "key-spacing": [ + "no-restricted-properties": [ "error", { - "mode": "minimum", - "beforeColon": false, - "afterColon": true + "object": "Lang", + "property": "bind", + "message": "Please use arrow notation or Function.prototype.bind()." + }, + { + "object": "Lang", + "property": "Class", + "message": "Please use ES6 classes." } ], "no-unused-vars": [