Compare commits

..

5 Commits

Author SHA1 Message Date
Florian Müllner 01d3d8fd6d Bump version to 43.rc
Update NEWS.
2022-09-04 15:25:43 +02:00
Florian Müllner 47c2834ffa Update sass submodule 2022-09-04 15:24:50 +02:00
Florian Müllner 9f88e98d1b extensions: Stop monkey-patching signal methods
gnome-shell added an EventEmitter class that can be used as base
for any non-GObject class that needs to emit signals.

Use that instead of the old monkey-patching.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/240>
2022-08-20 19:03:36 +02:00
Florian Müllner 4b7055d0da places-menu: Mark PlacesManager as exported
For some reason eslint failed to complain about this.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/240>
2022-08-20 19:03:36 +02:00
Florian Müllner 563d7770d3 lint: Sync with gnome-shell
gnome-shell started transitioning to gjs' object spacing rule,
i.e. `{foo: 42}` instead of `{ foo: 42 }`.

We have a much smaller code base than the shell and aren't using
a secondary "allowed-but-deprecated" configuration that allows a
gradual transition, so just pull the switch and update to the new
style.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/240>
2022-08-20 19:00:32 +02:00
22 changed files with 103 additions and 91 deletions
+7
View File
@@ -1,3 +1,10 @@
43.rc
=====
* Misc. bug fixes and cleanups [Florian; !240]
Contributors:
Florian Müllner
43.beta 43.beta
======= =======
* Misc. bug fixes and cleanups [Florian; !237, !238] * Misc. bug fixes and cleanups [Florian; !237, !238]
+11 -10
View File
@@ -4,7 +4,7 @@
const { const {
Atk, Clutter, Gio, GLib, GMenu, GObject, Gtk, Meta, Shell, St, Atk, Clutter, Gio, GLib, GMenu, GObject, Gtk, Meta, Shell, St,
} = imports.gi; } = imports.gi;
const Signals = imports.signals; const {EventEmitter} = imports.misc.signals;
const DND = imports.ui.dnd; const DND = imports.ui.dnd;
const ExtensionUtils = imports.misc.extensionUtils; const ExtensionUtils = imports.misc.extensionUtils;
@@ -117,7 +117,7 @@ class CategoryMenuItem extends PopupMenu.PopupBaseMenuItem {
else else
name = _('Favorites'); name = _('Favorites');
this.add_child(new St.Label({ text: name })); this.add_child(new St.Label({text: name}));
this.connect('motion-event', this._onMotionEvent.bind(this)); this.connect('motion-event', this._onMotionEvent.bind(this));
this.connect('notify::active', this._onActiveChanged.bind(this)); this.connect('notify::active', this._onActiveChanged.bind(this));
} }
@@ -239,8 +239,10 @@ class ApplicationsMenu extends PopupMenu.PopupMenu {
} }
} }
class DesktopTarget { class DesktopTarget extends EventEmitter {
constructor() { constructor() {
super();
this._desktop = null; this._desktop = null;
this._desktopDestroyedId = 0; this._desktopDestroyedId = 0;
@@ -357,7 +359,6 @@ class DesktopTarget {
return true; return true;
} }
} }
Signals.addSignalMethods(DesktopTarget.prototype);
class ApplicationsButton extends PanelMenu.Button { class ApplicationsButton extends PanelMenu.Button {
static { static {
@@ -408,7 +409,7 @@ class ApplicationsButton extends PanelMenu.Button {
}); });
}); });
this._tree = new GMenu.Tree({ menu_basename: 'applications.menu' }); this._tree = new GMenu.Tree({menu_basename: 'applications.menu'});
this._treeChangedId = this._tree.connect('changed', this._treeChangedId = this._tree.connect('changed',
this._onTreeChanged.bind(this)); this._onTreeChanged.bind(this));
@@ -509,7 +510,7 @@ class ApplicationsButton extends PanelMenu.Button {
} }
let app = appSys.lookup_app(id); let app = appSys.lookup_app(id);
if (!app) if (!app)
app = new Shell.App({ app_info: entry.get_app_info() }); app = new Shell.App({app_info: entry.get_app_info()});
if (app.get_app_info().should_show()) if (app.get_app_info().should_show())
this.applicationsByCategory[categoryId].push(app); this.applicationsByCategory[categoryId].push(app);
} else if (nextType === GMenu.TreeItemType.SEPARATOR) { } else if (nextType === GMenu.TreeItemType.SEPARATOR) {
@@ -555,8 +556,8 @@ class ApplicationsButton extends PanelMenu.Button {
_createLayout() { _createLayout() {
let section = new PopupMenu.PopupMenuSection(); let section = new PopupMenu.PopupMenuSection();
this.menu.addMenuItem(section); this.menu.addMenuItem(section);
this.mainBox = new St.BoxLayout({ vertical: false }); this.mainBox = new St.BoxLayout({vertical: false});
this.leftBox = new St.BoxLayout({ vertical: true }); this.leftBox = new St.BoxLayout({vertical: true});
this.applicationsScrollBox = new St.ScrollView({ this.applicationsScrollBox = new St.ScrollView({
style_class: 'apps-menu vfade', style_class: 'apps-menu vfade',
x_expand: true, x_expand: true,
@@ -578,9 +579,9 @@ class ApplicationsButton extends PanelMenu.Button {
vscroll.connect('scroll-stop', () => (this.menu.passEvents = false)); vscroll.connect('scroll-stop', () => (this.menu.passEvents = false));
this.leftBox.add_child(this.categoriesScrollBox); this.leftBox.add_child(this.categoriesScrollBox);
this.applicationsBox = new St.BoxLayout({ vertical: true }); this.applicationsBox = new St.BoxLayout({vertical: true});
this.applicationsScrollBox.add_actor(this.applicationsBox); this.applicationsScrollBox.add_actor(this.applicationsBox);
this.categoriesBox = new St.BoxLayout({ vertical: true }); this.categoriesBox = new St.BoxLayout({vertical: true});
this.categoriesScrollBox.add_actor(this.categoriesBox); this.categoriesScrollBox.add_actor(this.categoriesBox);
this.mainBox.add(this.leftBox); this.mainBox.add(this.leftBox);
+1 -1
View File
@@ -2,7 +2,7 @@
// Start apps on custom workspaces // Start apps on custom workspaces
/* exported init enable disable */ /* exported init enable disable */
const { Shell } = imports.gi; const {Shell} = imports.gi;
const ExtensionUtils = imports.misc.extensionUtils; const ExtensionUtils = imports.misc.extensionUtils;
const Main = imports.ui.main; const Main = imports.ui.main;
+7 -7
View File
@@ -2,7 +2,7 @@
// Start apps on custom workspaces // Start apps on custom workspaces
/* exported init buildPrefsWidget */ /* exported init buildPrefsWidget */
const { Adw, Gio, GLib, GObject, Gtk } = imports.gi; const {Adw, Gio, GLib, GObject, Gtk} = imports.gi;
const ExtensionUtils = imports.misc.extensionUtils; const ExtensionUtils = imports.misc.extensionUtils;
@@ -75,7 +75,7 @@ class RulesList extends GObject.Object {
append(appInfo) { append(appInfo) {
const pos = this.#rules.length; const pos = this.#rules.length;
this.#rules.push(new Rule({ appInfo })); this.#rules.push(new Rule({appInfo}));
this.#saveRules(); this.#saveRules();
this.items_changed(pos, 0, 1); this.items_changed(pos, 0, 1);
@@ -97,7 +97,7 @@ class RulesList extends GObject.Object {
if (pos < 0) if (pos < 0)
return; return;
this.#rules[pos].set({ workspace }); this.#rules[pos].set({workspace});
this.#saveRules(); this.#saveRules();
} }
@@ -116,7 +116,7 @@ class RulesList extends GObject.Object {
const [id, workspace] = stringRule.split(':'); const [id, workspace] = stringRule.split(':');
const appInfo = Gio.DesktopAppInfo.new(id); const appInfo = Gio.DesktopAppInfo.new(id);
if (appInfo) if (appInfo)
this.#rules.push(new Rule({ appInfo, workspace })); this.#rules.push(new Rule({appInfo, workspace}));
else else
log(`Invalid ID ${id}`); log(`Invalid ID ${id}`);
} }
@@ -154,8 +154,8 @@ class AutoMoveSettingsWidget extends Adw.PreferencesGroup {
this._rules = new RulesList(); this._rules = new RulesList();
const store = new Gio.ListStore({ item_type: Gio.ListModel }); const store = new Gio.ListStore({item_type: Gio.ListModel});
const listModel = new Gtk.FlattenListModel({ model: store }); const listModel = new Gtk.FlattenListModel({model: store});
store.append(this._rules); store.append(this._rules);
store.append(new NewItemModel()); store.append(new NewItemModel());
@@ -248,7 +248,7 @@ class RuleRow extends Adw.ActionRow {
} }
constructor(rule) { constructor(rule) {
const { appInfo } = rule; const {appInfo} = rule;
const id = appInfo.get_id(); const id = appInfo.get_id();
super({ super({
+1 -1
View File
@@ -1,6 +1,6 @@
/* exported init enable disable */ /* exported init enable disable */
// Drive menu extension // Drive menu extension
const { Clutter, Gio, GObject, Shell, St } = imports.gi; const {Clutter, Gio, GObject, Shell, St} = imports.gi;
const ExtensionUtils = imports.misc.extensionUtils; const ExtensionUtils = imports.misc.extensionUtils;
const Main = imports.ui.main; const Main = imports.ui.main;
@@ -1,10 +1,10 @@
// -*- mode: js2; indent-tabs-mode: nil; js2-basic-offset: 4 -*- // -*- mode: js2; indent-tabs-mode: nil; js2-basic-offset: 4 -*-
/* exported enable disable */ /* exported enable disable */
const { Clutter } = imports.gi; const {Clutter} = imports.gi;
const ExtensionUtils = imports.misc.extensionUtils; const ExtensionUtils = imports.misc.extensionUtils;
const Main = imports.ui.main; const Main = imports.ui.main;
const { WindowPreview } = imports.ui.windowPreview; const {WindowPreview} = imports.ui.windowPreview;
const Workspace = imports.ui.workspace; const Workspace = imports.ui.workspace;
// testing settings for natural window placement strategy: // testing settings for natural window placement strategy:
+1 -1
View File
@@ -1,7 +1,7 @@
/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */ /* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
/* exported init enable disable */ /* exported init enable disable */
const { Clutter, GObject, St } = imports.gi; const {Clutter, GObject, St} = imports.gi;
const ExtensionUtils = imports.misc.extensionUtils; const ExtensionUtils = imports.misc.extensionUtils;
const Main = imports.ui.main; const Main = imports.ui.main;
+16 -13
View File
@@ -1,7 +1,8 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
/* exported PlacesManager */
const { Gio, GLib, Shell } = imports.gi; const {Gio, GLib, Shell} = imports.gi;
const Signals = imports.signals; const {EventEmitter} = imports.misc.signals;
const ExtensionUtils = imports.misc.extensionUtils; const ExtensionUtils = imports.misc.extensionUtils;
const Main = imports.ui.main; const Main = imports.ui.main;
@@ -22,8 +23,10 @@ const Hostname1Iface = '<node> \
</node>'; </node>';
const Hostname1 = Gio.DBusProxy.makeProxyWrapper(Hostname1Iface); const Hostname1 = Gio.DBusProxy.makeProxyWrapper(Hostname1Iface);
class PlaceInfo { class PlaceInfo extends EventEmitter {
constructor(...params) { constructor(...params) {
super();
this._init(...params); this._init(...params);
} }
@@ -31,7 +34,7 @@ class PlaceInfo {
this.kind = kind; this.kind = kind;
this.file = file; this.file = file;
this.name = name || this._getFileName(); this.name = name || this._getFileName();
this.icon = icon ? new Gio.ThemedIcon({ name: icon }) : this.getIcon(); this.icon = icon ? new Gio.ThemedIcon({name: icon}) : this.getIcon();
} }
destroy() { destroy() {
@@ -94,16 +97,16 @@ class PlaceInfo {
// icon from the query info above // icon from the query info above
switch (this.kind) { switch (this.kind) {
case 'network': case 'network':
return new Gio.ThemedIcon({ name: 'folder-remote-symbolic' }); return new Gio.ThemedIcon({name: 'folder-remote-symbolic'});
case 'devices': case 'devices':
return new Gio.ThemedIcon({ name: 'drive-harddisk-symbolic' }); return new Gio.ThemedIcon({name: 'drive-harddisk-symbolic'});
case 'special': case 'special':
case 'bookmarks': case 'bookmarks':
default: default:
if (!this.file.is_native()) if (!this.file.is_native())
return new Gio.ThemedIcon({ name: 'folder-remote-symbolic' }); return new Gio.ThemedIcon({name: 'folder-remote-symbolic'});
else else
return new Gio.ThemedIcon({ name: 'folder-symbolic' }); return new Gio.ThemedIcon({name: 'folder-symbolic'});
} }
} }
@@ -118,7 +121,6 @@ class PlaceInfo {
} }
} }
} }
Signals.addSignalMethods(PlaceInfo.prototype);
class RootInfo extends PlaceInfo { class RootInfo extends PlaceInfo {
_init() { _init() {
@@ -138,7 +140,7 @@ class RootInfo extends PlaceInfo {
} }
getIcon() { getIcon() {
return new Gio.ThemedIcon({ name: 'drive-harddisk-symbolic' }); return new Gio.ThemedIcon({name: 'drive-harddisk-symbolic'});
} }
_propertiesChanged(proxy) { _propertiesChanged(proxy) {
@@ -246,8 +248,10 @@ const DEFAULT_DIRECTORIES = [
GLib.UserDirectory.DIRECTORY_VIDEOS, GLib.UserDirectory.DIRECTORY_VIDEOS,
]; ];
var PlacesManager = class { var PlacesManager = class extends EventEmitter {
constructor() { constructor() {
super();
this._places = { this._places = {
special: [], special: [],
devices: [], devices: [],
@@ -255,7 +259,7 @@ var PlacesManager = class {
network: [], network: [],
}; };
this._settings = new Gio.Settings({ schema_id: BACKGROUND_SCHEMA }); this._settings = new Gio.Settings({schema_id: BACKGROUND_SCHEMA});
this._showDesktopIconsChangedId = this._settings.connect( this._showDesktopIconsChangedId = this._settings.connect(
'changed::show-desktop-icons', this._updateSpecials.bind(this)); 'changed::show-desktop-icons', this._updateSpecials.bind(this));
this._updateSpecials(); this._updateSpecials();
@@ -543,4 +547,3 @@ var PlacesManager = class {
return this._places[kind]; return this._places[kind];
} }
}; };
Signals.addSignalMethods(PlacesManager.prototype);
@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
const { Clutter, Meta, Shell, St } = imports.gi; const {Clutter, Meta, Shell, St} = imports.gi;
const ExtensionUtils = imports.misc.extensionUtils; const ExtensionUtils = imports.misc.extensionUtils;
const Main = imports.ui.main; const Main = imports.ui.main;
@@ -39,7 +39,7 @@ function hideMessage() {
*/ */
function flashMessage(message) { function flashMessage(message) {
if (!text) { if (!text) {
text = new St.Label({ style_class: 'screenshot-sizer-message' }); text = new St.Label({style_class: 'screenshot-sizer-message'});
Main.uiGroup.add_actor(text); Main.uiGroup.add_actor(text);
} }
@@ -132,7 +132,7 @@ function cycleScreenshotSizes(display, window, binding) {
* @param {Meta.Window} window - the window whose size changed * @param {Meta.Window} window - the window whose size changed
*/ */
function _notifySizeChange(window) { function _notifySizeChange(window) {
const { scaleFactor } = St.ThemeContext.get_for_stage(global.stage); const {scaleFactor} = St.ThemeContext.get_for_stage(global.stage);
let newOuterRect = window.get_frame_rect(); let newOuterRect = window.get_frame_rect();
let message = '%d×%d'.format( let message = '%d×%d'.format(
newOuterRect.width / scaleFactor, newOuterRect.width / scaleFactor,
+1 -1
View File
@@ -2,7 +2,7 @@
// Load shell theme from ~/.local/share/themes/name/gnome-shell // Load shell theme from ~/.local/share/themes/name/gnome-shell
/* exported init */ /* exported init */
const { Gio } = imports.gi; const {Gio} = imports.gi;
const ExtensionUtils = imports.misc.extensionUtils; const ExtensionUtils = imports.misc.extensionUtils;
const Main = imports.ui.main; const Main = imports.ui.main;
+2 -2
View File
@@ -4,7 +4,7 @@
// we use async/await here to not block the mainloop, not to parallelize // we use async/await here to not block the mainloop, not to parallelize
/* eslint-disable no-await-in-loop */ /* eslint-disable no-await-in-loop */
const { Adw, Gio, GLib, GObject, Gtk } = imports.gi; const {Adw, Gio, GLib, GObject, Gtk} = imports.gi;
const ExtensionUtils = imports.misc.extensionUtils; const ExtensionUtils = imports.misc.extensionUtils;
@@ -21,7 +21,7 @@ class UserThemePrefsWidget extends Adw.PreferencesGroup {
} }
constructor() { constructor() {
super({ title: 'Themes' }); super({title: 'Themes'});
this._actionGroup = new Gio.SimpleActionGroup(); this._actionGroup = new Gio.SimpleActionGroup();
this.insert_action_group('theme', this._actionGroup); this.insert_action_group('theme', this._actionGroup);
+1 -1
View File
@@ -1,5 +1,5 @@
/* exported getThemeDirs getModeThemeDirs */ /* exported getThemeDirs getModeThemeDirs */
const { GLib } = imports.gi; const {GLib} = imports.gi;
const fn = (...args) => GLib.build_filenamev(args); const fn = (...args) => GLib.build_filenamev(args);
+12 -12
View File
@@ -1,5 +1,5 @@
/* exported init */ /* exported init */
const { Clutter, Gio, GLib, GObject, Gtk, Meta, Shell, St } = imports.gi; const {Clutter, Gio, GLib, GObject, Gtk, Meta, Shell, St} = imports.gi;
const DND = imports.ui.dnd; const DND = imports.ui.dnd;
const ExtensionUtils = imports.misc.extensionUtils; const ExtensionUtils = imports.misc.extensionUtils;
@@ -8,8 +8,8 @@ const Overview = imports.ui.overview;
const PopupMenu = imports.ui.popupMenu; const PopupMenu = imports.ui.popupMenu;
const Me = ExtensionUtils.getCurrentExtension(); const Me = ExtensionUtils.getCurrentExtension();
const { WindowPicker, WindowPickerToggle } = Me.imports.windowPicker; const {WindowPicker, WindowPickerToggle} = Me.imports.windowPicker;
const { WorkspaceIndicator } = Me.imports.workspaceIndicator; const {WorkspaceIndicator} = Me.imports.workspaceIndicator;
const _ = ExtensionUtils.gettext; const _ = ExtensionUtils.gettext;
@@ -120,9 +120,9 @@ class WindowTitle extends St.BoxLayout {
this._metaWindow = metaWindow; this._metaWindow = metaWindow;
this._icon = new St.Bin({ style_class: 'window-button-icon' }); this._icon = new St.Bin({style_class: 'window-button-icon'});
this.add(this._icon); this.add(this._icon);
this.label_actor = new St.Label({ y_align: Clutter.ActorAlign.CENTER }); this.label_actor = new St.Label({y_align: Clutter.ActorAlign.CENTER});
this.label_actor.clutter_text.single_line_mode = true; this.label_actor.clutter_text.single_line_mode = true;
this.add(this.label_actor); this.add(this.label_actor);
@@ -250,7 +250,7 @@ class BaseButton extends St.Button {
if (this._longPressTimeoutId) if (this._longPressTimeoutId)
return; return;
const { longPressDuration } = Clutter.Settings.get_default(); const {longPressDuration} = Clutter.Settings.get_default();
this._longPressTimeoutId = this._longPressTimeoutId =
GLib.timeout_add(GLib.PRIORITY_DEFAULT, longPressDuration, () => { GLib.timeout_add(GLib.PRIORITY_DEFAULT, longPressDuration, () => {
delete this._longPressTimeoutId; delete this._longPressTimeoutId;
@@ -543,7 +543,7 @@ class AppButton extends BaseButton {
this.app = app; this.app = app;
this._updateVisibility(); this._updateVisibility();
let stack = new St.Widget({ layout_manager: new Clutter.BinLayout() }); let stack = new St.Widget({layout_manager: new Clutter.BinLayout()});
this.set_child(stack); this.set_child(stack);
this._singleWindowTitle = new St.Bin({ this._singleWindowTitle = new St.Bin({
@@ -742,7 +742,7 @@ class WindowList extends St.Widget {
this._perMonitor = perMonitor; this._perMonitor = perMonitor;
this._monitor = monitor; this._monitor = monitor;
let box = new St.BoxLayout({ x_expand: true, y_expand: true }); let box = new St.BoxLayout({x_expand: true, y_expand: true});
this.add_actor(box); this.add_actor(box);
let toggle = new WindowPickerToggle(); let toggle = new WindowPickerToggle();
@@ -751,7 +751,7 @@ class WindowList extends St.Widget {
toggle.connect('notify::checked', toggle.connect('notify::checked',
this._updateWindowListVisibility.bind(this)); this._updateWindowListVisibility.bind(this));
let layout = new Clutter.BoxLayout({ homogeneous: true }); let layout = new Clutter.BoxLayout({homogeneous: true});
this._windowList = new St.Widget({ this._windowList = new St.Widget({
style_class: 'window-list', style_class: 'window-list',
reactive: true, reactive: true,
@@ -769,13 +769,13 @@ class WindowList extends St.Widget {
}); });
this._windowList.connect('scroll-event', this._onScrollEvent.bind(this)); this._windowList.connect('scroll-event', this._onScrollEvent.bind(this));
let indicatorsBox = new St.BoxLayout({ x_align: Clutter.ActorAlign.END }); let indicatorsBox = new St.BoxLayout({x_align: Clutter.ActorAlign.END});
box.add(indicatorsBox); box.add(indicatorsBox);
this._workspaceIndicator = new WorkspaceIndicator(); this._workspaceIndicator = new WorkspaceIndicator();
indicatorsBox.add_child(this._workspaceIndicator.container); indicatorsBox.add_child(this._workspaceIndicator.container);
this._mutterSettings = new Gio.Settings({ schema_id: 'org.gnome.mutter' }); this._mutterSettings = new Gio.Settings({schema_id: 'org.gnome.mutter'});
this._workspacesOnlyOnPrimaryChangedId = this._mutterSettings.connect( this._workspacesOnlyOnPrimaryChangedId = this._mutterSettings.connect(
'changed::workspaces-only-on-primary', 'changed::workspaces-only-on-primary',
this._updateWorkspaceIndicatorVisibility.bind(this)); this._updateWorkspaceIndicatorVisibility.bind(this));
@@ -918,7 +918,7 @@ class WindowList extends St.Widget {
let children = this._windowList.get_children(); let children = this._windowList.get_children();
let [, childWidth] = children[0].get_preferred_width(-1); let [, childWidth] = children[0].get_preferred_width(-1);
let { spacing } = this._windowList.layout_manager; let {spacing} = this._windowList.layout_manager;
let workspace = global.workspace_manager.get_active_workspace(); let workspace = global.workspace_manager.get_active_workspace();
let windows = global.display.get_tab_list(Meta.TabList.NORMAL, workspace); let windows = global.display.get_tab_list(Meta.TabList.NORMAL, workspace);
+5 -5
View File
@@ -1,7 +1,7 @@
// -*- mode: js2; indent-tabs-mode: nil; js2-basic-offset: 4 -*- // -*- mode: js2; indent-tabs-mode: nil; js2-basic-offset: 4 -*-
/* exported init buildPrefsWidget */ /* exported init buildPrefsWidget */
const { Adw, Gio, GLib, GObject, Gtk } = imports.gi; const {Adw, Gio, GLib, GObject, Gtk} = imports.gi;
const ExtensionUtils = imports.misc.extensionUtils; const ExtensionUtils = imports.misc.extensionUtils;
@@ -37,12 +37,12 @@ class WindowListPrefsWidget extends Adw.PreferencesPage {
this.add(groupingGroup); this.add(groupingGroup);
const modes = [ const modes = [
{ mode: 'never', title: _('Never group windows') }, {mode: 'never', title: _('Never group windows')},
{ mode: 'auto', title: _('Group windows when space is limited') }, {mode: 'auto', title: _('Group windows when space is limited')},
{ mode: 'always', title: _('Always group windows') }, {mode: 'always', title: _('Always group windows')},
]; ];
for (const { mode, title } of modes) { for (const {mode, title} of modes) {
const check = new Gtk.CheckButton({ const check = new Gtk.CheckButton({
action_name: 'window-list.grouping-mode', action_name: 'window-list.grouping-mode',
action_target: new GLib.Variant('s', mode), action_target: new GLib.Variant('s', mode),
+6 -6
View File
@@ -1,12 +1,12 @@
/* exported WindowPicker, WindowPickerToggle */ /* exported WindowPicker, WindowPickerToggle */
const { Clutter, GObject, Shell, St } = imports.gi; const {Clutter, GObject, Shell, St} = imports.gi;
const Layout = imports.ui.layout; const Layout = imports.ui.layout;
const Main = imports.ui.main; const Main = imports.ui.main;
const { WorkspacesDisplay } = imports.ui.workspacesView; const {WorkspacesDisplay} = imports.ui.workspacesView;
const Workspace = imports.ui.workspace; const Workspace = imports.ui.workspace;
const { VIGNETTE_BRIGHTNESS } = imports.ui.lightbox; const {VIGNETTE_BRIGHTNESS} = imports.ui.lightbox;
const { const {
SIDE_CONTROLS_ANIMATION_TIME, SIDE_CONTROLS_ANIMATION_TIME,
OverviewAdjustment, OverviewAdjustment,
@@ -90,7 +90,7 @@ class MyWorkspace extends Workspace.Workspace {
this._adjChangedId = this._adjChangedId =
this._overviewAdjustment.connect('notify::value', () => { this._overviewAdjustment.connect('notify::value', () => {
const { value: progress } = this._overviewAdjustment; const {value: progress} = this._overviewAdjustment;
const brightness = 1 - (1 - VIGNETTE_BRIGHTNESS) * progress; const brightness = 1 - (1 - VIGNETTE_BRIGHTNESS) * progress;
for (const bg of this._background?._backgroundGroup ?? []) { for (const bg of this._background?._backgroundGroup ?? []) {
bg.content.set({ bg.content.set({
@@ -151,7 +151,7 @@ class MyWorkspaceBackground extends Workspace.WorkspaceBackground {
var WindowPicker = class WindowPicker extends Clutter.Actor { var WindowPicker = class WindowPicker extends Clutter.Actor {
static [GObject.signals] = { static [GObject.signals] = {
'open-state-changed': { param_types: [GObject.TYPE_BOOLEAN] }, 'open-state-changed': {param_types: [GObject.TYPE_BOOLEAN]},
}; };
static { static {
@@ -159,7 +159,7 @@ var WindowPicker = class WindowPicker extends Clutter.Actor {
} }
constructor() { constructor() {
super({ reactive: true }); super({reactive: true});
this._visible = false; this._visible = false;
this._modal = false; this._modal = false;
+5 -5
View File
@@ -1,5 +1,5 @@
/* exported WorkspaceIndicator */ /* exported WorkspaceIndicator */
const { Clutter, Gio, GObject, Meta, St } = imports.gi; const {Clutter, Gio, GObject, Meta, St} = imports.gi;
const DND = imports.ui.dnd; const DND = imports.ui.dnd;
const ExtensionUtils = imports.misc.extensionUtils; const ExtensionUtils = imports.misc.extensionUtils;
@@ -25,7 +25,7 @@ class WindowPreview extends St.Button {
}); });
this._delegate = this; this._delegate = this;
DND.makeDraggable(this, { restoreOnSuccess: true }); DND.makeDraggable(this, {restoreOnSuccess: true});
this._window = window; this._window = window;
@@ -274,7 +274,7 @@ var WorkspaceIndicator = class WorkspaceIndicator extends PanelMenu.Button {
let workspaceManager = global.workspace_manager; let workspaceManager = global.workspace_manager;
this._currentWorkspace = workspaceManager.get_active_workspace_index(); this._currentWorkspace = workspaceManager.get_active_workspace_index();
this._statusLabel = new St.Label({ text: this._getStatusText() }); this._statusLabel = new St.Label({text: this._getStatusText()});
this._statusBin = new St.Bin({ this._statusBin = new St.Bin({
style_class: 'status-label-bin', style_class: 'status-label-bin',
@@ -309,7 +309,7 @@ var WorkspaceIndicator = class WorkspaceIndicator extends PanelMenu.Button {
this._updateThumbnails(); this._updateThumbnails();
this._updateThumbnailVisibility(); this._updateThumbnailVisibility();
this._settings = new Gio.Settings({ schema_id: 'org.gnome.desktop.wm.preferences' }); this._settings = new Gio.Settings({schema_id: 'org.gnome.desktop.wm.preferences'});
this._settingsChangedId = this._settings.connect( this._settingsChangedId = this._settings.connect(
'changed::workspace-names', this._updateMenuLabels.bind(this)); 'changed::workspace-names', this._updateMenuLabels.bind(this));
} }
@@ -327,7 +327,7 @@ var WorkspaceIndicator = class WorkspaceIndicator extends PanelMenu.Button {
} }
_updateThumbnailVisibility() { _updateThumbnailVisibility() {
const { workspaceManager } = global; const {workspaceManager} = global;
const vertical = workspaceManager.layout_rows === -1; const vertical = workspaceManager.layout_rows === -1;
const useMenu = const useMenu =
vertical || workspaceManager.n_workspaces > MAX_THUMBNAILS; vertical || workspaceManager.n_workspaces > MAX_THUMBNAILS;
+8 -8
View File
@@ -1,6 +1,6 @@
/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */ /* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
/* exported init */ /* exported init */
const { Clutter, Graphene, GObject, St } = imports.gi; const {Clutter, Graphene, GObject, St} = imports.gi;
const Main = imports.ui.main; const Main = imports.ui.main;
const OverviewControls = imports.ui.overviewControls; const OverviewControls = imports.ui.overviewControls;
@@ -53,13 +53,13 @@ class MyWorkspace extends Workspace.Workspace {
} }
getWindowWithTooltip(id) { getWindowWithTooltip(id) {
const { layoutManager } = this._container; const {layoutManager} = this._container;
const slot = layoutManager._windowSlots[id - 1]; const slot = layoutManager._windowSlots[id - 1];
return slot ? slot[WINDOW_SLOT].metaWindow : null; return slot ? slot[WINDOW_SLOT].metaWindow : null;
} }
showWindowsTooltips() { showWindowsTooltips() {
const { layoutManager } = this._container; const {layoutManager} = this._container;
for (let i = 0; i < layoutManager._windowSlots.length; i++) { for (let i = 0; i < layoutManager._windowSlots.length; i++) {
if (layoutManager._windowSlots[i]) if (layoutManager._windowSlots[i])
layoutManager._windowSlots[i][WINDOW_SLOT].showTooltip(`${i + 1}`); layoutManager._windowSlots[i][WINDOW_SLOT].showTooltip(`${i + 1}`);
@@ -67,7 +67,7 @@ class MyWorkspace extends Workspace.Workspace {
} }
hideWindowsTooltips() { hideWindowsTooltips() {
const { layoutManager } = this._container; const {layoutManager} = this._container;
for (let i in layoutManager._windowSlots) { for (let i in layoutManager._windowSlots) {
if (layoutManager._windowSlots[i]) if (layoutManager._windowSlots[i])
layoutManager._windowSlots[i][WINDOW_SLOT].hideTooltip(); layoutManager._windowSlots[i][WINDOW_SLOT].hideTooltip();
@@ -93,13 +93,13 @@ class MyWorkspace extends Workspace.Workspace {
this._text.add_constraint(new Clutter.AlignConstraint({ this._text.add_constraint(new Clutter.AlignConstraint({
source: this.windowContainer, source: this.windowContainer,
align_axis: Clutter.AlignAxis.X_AXIS, align_axis: Clutter.AlignAxis.X_AXIS,
pivot_point: new Graphene.Point({ x: 0.5, y: -1 }), pivot_point: new Graphene.Point({x: 0.5, y: -1}),
factor: this._closeButtonSide === St.Side.LEFT ? 1 : 0, factor: this._closeButtonSide === St.Side.LEFT ? 1 : 0,
})); }));
this._text.add_constraint(new Clutter.AlignConstraint({ this._text.add_constraint(new Clutter.AlignConstraint({
source: this.windowContainer, source: this.windowContainer,
align_axis: Clutter.AlignAxis.Y_AXIS, align_axis: Clutter.AlignAxis.Y_AXIS,
pivot_point: new Graphene.Point({ x: -1, y: 0.5 }), pivot_point: new Graphene.Point({x: -1, y: 0.5}),
factor: 0, factor: 0,
})); }));
@@ -107,7 +107,7 @@ class MyWorkspace extends Workspace.Workspace {
}).call(clone); }).call(clone);
clone.showTooltip = function (text) { clone.showTooltip = function (text) {
this._text.set({ text }); this._text.set({text});
this._text.show(); this._text.show();
}; };
@@ -170,7 +170,7 @@ class MyWorkspacesView extends WorkspacesView.WorkspacesView {
} }
_onKeyPress(s, o) { _onKeyPress(s, o) {
const { ControlsState } = OverviewControls; const {ControlsState} = OverviewControls;
if (this._overviewAdjustment.value !== ControlsState.WINDOW_PICKER) if (this._overviewAdjustment.value !== ControlsState.WINDOW_PICKER)
return false; return false;
+4 -4
View File
@@ -1,7 +1,7 @@
// -*- mode: js2; indent-tabs-mode: nil; js2-basic-offset: 4 -*- // -*- mode: js2; indent-tabs-mode: nil; js2-basic-offset: 4 -*-
/* exported init enable disable */ /* exported init enable disable */
const { Clutter, Gio, GObject, Meta, St } = imports.gi; const {Clutter, Gio, GObject, Meta, St} = imports.gi;
const DND = imports.ui.dnd; const DND = imports.ui.dnd;
const ExtensionUtils = imports.misc.extensionUtils; const ExtensionUtils = imports.misc.extensionUtils;
@@ -30,7 +30,7 @@ class WindowPreview extends St.Button {
}); });
this._delegate = this; this._delegate = this;
DND.makeDraggable(this, { restoreOnSuccess: true }); DND.makeDraggable(this, {restoreOnSuccess: true});
this._window = window; this._window = window;
@@ -310,7 +310,7 @@ class WorkspaceIndicator extends PanelMenu.Button {
this._updateThumbnails(); this._updateThumbnails();
this._updateThumbnailVisibility(); this._updateThumbnailVisibility();
this._settings = new Gio.Settings({ schema_id: WORKSPACE_SCHEMA }); this._settings = new Gio.Settings({schema_id: WORKSPACE_SCHEMA});
this._settingsChangedId = this._settings.connect( this._settingsChangedId = this._settings.connect(
`changed::${WORKSPACE_KEY}`, `changed::${WORKSPACE_KEY}`,
this._updateMenuLabels.bind(this)); this._updateMenuLabels.bind(this));
@@ -331,7 +331,7 @@ class WorkspaceIndicator extends PanelMenu.Button {
} }
_updateThumbnailVisibility() { _updateThumbnailVisibility() {
const { workspaceManager } = global; const {workspaceManager} = global;
const vertical = workspaceManager.layout_rows === -1; const vertical = workspaceManager.layout_rows === -1;
const useMenu = const useMenu =
vertical || workspaceManager.n_workspaces > MAX_THUMBNAILS; vertical || workspaceManager.n_workspaces > MAX_THUMBNAILS;
+5 -5
View File
@@ -1,7 +1,7 @@
// -*- mode: js2; indent-tabs-mode: nil; js2-basic-offset: 4 -*- // -*- mode: js2; indent-tabs-mode: nil; js2-basic-offset: 4 -*-
/* exported init buildPrefsWidget */ /* exported init buildPrefsWidget */
const { Adw, Gio, GLib, GObject, Gtk, Pango } = imports.gi; const {Adw, Gio, GLib, GObject, Gtk, Pango} = imports.gi;
const ExtensionUtils = imports.misc.extensionUtils; const ExtensionUtils = imports.misc.extensionUtils;
@@ -41,7 +41,7 @@ class WorkspacesList extends GObject.Object {
GObject.registerClass(this); GObject.registerClass(this);
} }
#settings = new Gio.Settings({ schema_id: WORKSPACE_SCHEMA }); #settings = new Gio.Settings({schema_id: WORKSPACE_SCHEMA});
#names = this.#settings.get_strv(WORKSPACE_KEY); #names = this.#settings.get_strv(WORKSPACE_KEY);
#items = Gtk.StringList.new(this.#names); #items = Gtk.StringList.new(this.#names);
#changedId; #changedId;
@@ -131,8 +131,8 @@ class WorkspaceSettingsWidget extends Adw.PreferencesGroup {
this._workspaces = new WorkspacesList(); this._workspaces = new WorkspacesList();
const store = new Gio.ListStore({ item_type: Gio.ListModel }); const store = new Gio.ListStore({item_type: Gio.ListModel});
const listModel = new Gtk.FlattenListModel({ model: store }); const listModel = new Gtk.FlattenListModel({model: store});
store.append(this._workspaces); store.append(this._workspaces);
store.append(new NewItemModel()); store.append(new NewItemModel());
@@ -157,7 +157,7 @@ class WorkspaceRow extends Adw.PreferencesRow {
} }
constructor(name) { constructor(name) {
super({ name }); super({name});
const box = new Gtk.Box({ const box = new Gtk.Box({
spacing: 12, spacing: 12,
+3 -2
View File
@@ -3,9 +3,10 @@ rules:
- error - error
- properties: never - properties: never
allow: [^vfunc_, ^on_] allow: [^vfunc_, ^on_]
object-curly-spacing: consistent-return: error
eqeqeq:
- error - error
- always - smart
prefer-arrow-callback: error prefer-arrow-callback: error
globals: globals:
global: readonly global: readonly
+1 -1
View File
@@ -1,5 +1,5 @@
project('gnome-shell-extensions', project('gnome-shell-extensions',
version: '43.beta', version: '43.rc',
meson_version: '>= 0.53.0', meson_version: '>= 0.53.0',
license: 'GPL2+' license: 'GPL2+'
) )