Compare commits

...

18 Commits

Author SHA1 Message Date
Florian Müllner
a36331522f Bump version to 3.33.2
Update NEWS.
2019-05-22 18:58:31 +00:00
Florian Müllner
25e43a5d08 lint: Remove legacy configuration
After the last batch of indentation changes, the whole code base
conforms to the new style now, so we can drop the legacy eslint
configuration.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/66
2019-05-22 20:40:19 +02:00
Florian Müllner
ad914441a2 window-list: Reindent to conform with new style
Instead of aligning arguments like we used to do, use a consistent
four-space indent as mandated by gjs' current style guide.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/66
2019-05-22 20:40:19 +02:00
Florian Müllner
200d337769 apps-menu: Reindent to conform with new style
Instead of aligning arguments like we used to do, use a consistent
four-space indent as mandated by gjs' current style guide.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/66
2019-05-22 20:40:19 +02:00
Florian Müllner
e56f1a976e native-window-placement: Reindent to conform with new style
Instead of aligning arguments like we used to do, use a consistent
four-space indent as mandated by gjs' current style guide.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/66
2019-05-22 20:40:19 +02:00
Florian Müllner
6a66cd4fa6 places-menu: Reindent to conform with new style
Instead of aligning arguments like we used to do, use a consistent
four-space indent as mandated by gjs' current style guide.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/66
2019-05-22 20:40:19 +02:00
Florian Müllner
55c493389a auto-move-windows: Reindent to conform with new style
Instead of aligning arguments like we used to do, use a consistent
four-space indent as mandated by gjs' current style guide.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/66
2019-05-22 20:40:18 +02:00
Florian Müllner
06f1303834 drive-menu: Reindent to conform with new style
Instead of aligning arguments like we used to do, use a consistent
four-space indent as mandated by gjs' current style guide.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/66
2019-05-22 20:40:18 +02:00
Florian Müllner
3d5687ae3c workspace-indicator: Reindent to conform with new style
Instead of aligning arguments like we used to do, use a consistent
four-space indent as mandated by gjs' current style guide.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/66
2019-05-22 20:40:18 +02:00
Florian Müllner
cdd3fba593 screenshot-window-sizer: Reindent to conform with new style
Instead of aligning arguments like we used to do, use a consistent
four-space indent as mandated by gjs' current style guide.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/66
2019-05-22 20:40:18 +02:00
Florian Müllner
f11c101878 Bump version to 3.33.1
Update NEWS.
2019-05-14 17:53:56 +00:00
Florian Müllner
7c412ca7d9 window-list: Don't use anchor point
It is deprecated and we can easily replace it with a translation.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/64
2019-04-28 11:08:02 +00:00
Florian Müllner
e3a6e8f82c Bump version to 3.32.1
Update NEWS.
2019-04-17 22:09:40 +02:00
Florian Müllner
ce10ad64c4 Update sass submodule 2019-04-17 22:06:50 +02:00
Adrien Plazas
5b43d4733c screenshot-window-sizer: Add phone screenshot sizes
This is going to be convenient to take fake screenshots for phones like
the Librem 5.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/65
2019-04-12 14:31:53 +02:00
Florian Müllner
3671d5a299 cleanup: Use an extension object instead of globals
https://gitlab.gnome.org/GNOME/gnome-shell-extensions/issues/143
2019-04-08 06:00:29 +00:00
Florian Müllner
a024d9f005 windowsNavigator: Use subclasses instead of injections
gnome-shell moved to ES6 classes, which means the constructor is
no longer a regular method that we can swap out with an injected
version.

Instead, do our modifications in subclasses and use them to replace
the original classes.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/issues/143
2019-04-08 06:00:29 +00:00
Fabian P. Schmidt
d94a3500f6 README: Re-add extension alternate-tab with obsolescence notice
This commit adds a short notice about the former extension
alternate-tab to the README. This notice should be removed once
the traffic of users searching for this obsolete extension settled
down.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/62
2019-03-20 12:00:08 +01:00
18 changed files with 327 additions and 411 deletions

View File

@@ -24,7 +24,7 @@ eslint:
image: registry.gitlab.gnome.org/gnome/gnome-shell/extension-ci:v1
stage: source_check
script:
- sh lint/generate-report.sh -o $LINT_LOG || { cat $LINT_LOG; false; }
- eslint -o $LINT_LOG --no-color || { cat $LINT_LOG; false; }
<<: *only_default
artifacts:
paths:

23
NEWS
View File

@@ -1,3 +1,26 @@
3.33.2
======
* Misc. bug fixes and cleanups [Florian; !66]
Contributors:
Florian Müllner
3.33.1
======
* Misc. bug fixes [Florian; !64]
Contributors:
Florian Müllner
3.32.1
======
* Fix windowsNavigator extension after ES6 port [Florian; #143]
* screenshot-window-sizer: Add phone screenshot sizes [Adrien; !65]
* Misc. bug fixes and cleanups [Fabian; !62]
Contributors:
Florian Müllner, Adrien Plazas, Fabian P. Schmidt
3.32.0
======

View File

@@ -15,6 +15,12 @@ Bugs should be reported to the GNOME [bug tracking system][bug-tracker].
## Extensions
* alternate-tab (**OBSOLETE**)
Lets you use classic Alt+Tab (window-based instead of app-based) in GNOME Shell.
This extension is obsolete since GNOME 3.30, see [this blogpost][alternatetab-post]
for further details.
* apps-menu
Lets you reach an application using gnome 2.x style menu on the panel.
@@ -74,3 +80,4 @@ file for details.
[shell-page]: https://wiki.gnome.org/Projects/GnomeShell
[bug-tracker]: https://gitlab.gnome.org/GNOME/gnome-shell-extensions/issues
[license]: COPYING
[alternatetab-post]: https://blogs.gnome.org/fmuellner/2018/10/11/the-future-of-alternatetab-and-why-you-need-not-worry/

View File

@@ -58,7 +58,7 @@ class ApplicationMenuItem extends PopupMenu.PopupBaseMenuItem {
let textureCache = St.TextureCache.get_default();
let iconThemeChangedId = textureCache.connect('icon-theme-changed',
this._updateIcon.bind(this));
this._updateIcon.bind(this));
this.actor.connect('destroy', () => {
textureCache.disconnect(iconThemeChangedId);
});
@@ -262,7 +262,7 @@ class DesktopTarget {
this._windowAddedId =
global.window_group.connect('actor-added',
this._onWindowAdded.bind(this));
this._onWindowAdded.bind(this));
global.get_window_actors().forEach(a => {
this._onWindowAdded(a.get_parent(), a);
@@ -322,8 +322,8 @@ class DesktopTarget {
// Hack: force nautilus to reload file info
info = new Gio.FileInfo();
info.set_attribute_uint64(Gio.FILE_ATTRIBUTE_TIME_ACCESS,
GLib.get_real_time());
info.set_attribute_uint64(
Gio.FILE_ATTRIBUTE_TIME_ACCESS, GLib.get_real_time());
try {
await file.set_attributes_async(info, queryFlags, ioPriority, null);
} catch (e) {
@@ -411,7 +411,7 @@ class ApplicationsButton extends PanelMenu.Button {
this.remove_accessible_state (Atk.StateType.CHECKED);
});
Main.layoutManager.connect('startup-complete',
this._setKeybinding.bind(this));
this._setKeybinding.bind(this));
this._setKeybinding();
this._desktopTarget = new DesktopTarget();
@@ -426,14 +426,14 @@ class ApplicationsButton extends PanelMenu.Button {
this._tree = new GMenu.Tree({ menu_basename: 'applications.menu' });
this._treeChangedId = this._tree.connect('changed',
this._onTreeChanged.bind(this));
this._onTreeChanged.bind(this));
this._applicationsButtons = new Map();
this.reloadFlag = false;
this._createLayout();
this._display();
this._installedChangedId = appSys.connect('installed-changed',
this._onTreeChanged.bind(this));
this._onTreeChanged.bind(this));
}
_onTreeChanged() {
@@ -465,12 +465,11 @@ 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,
handler);
Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW,
Main.sessionMode.hasOverview
? Main.overview.toggle.bind(Main.overview)
: null);
this._desktopTarget.destroy();
}
@@ -522,9 +521,8 @@ class ApplicationsButton extends PanelMenu.Button {
_setKeybinding() {
Main.wm.setCustomKeybindingHandler('panel-main-menu',
Shell.ActionMode.NORMAL |
Shell.ActionMode.OVERVIEW,
() => this.menu.toggle());
Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW,
() => this.menu.toggle());
}
_redisplay() {

View File

@@ -17,7 +17,7 @@ class WindowMover {
this._appsChangedId =
this._appSystem.connect('installed-changed',
this._updateAppData.bind(this));
this._updateAppData.bind(this));
this._settings.connect('changed', this._updateAppConfigs.bind(this));
this._updateAppConfigs();
@@ -50,7 +50,7 @@ class WindowMover {
addedApps.forEach(app => {
let data = {
windowsChangedId: app.connect('windows-changed',
this._appWindowsChanged.bind(this)),
this._appWindowsChanged.bind(this)),
moveWindowsId: 0,
windows: app.get_windows()
};

View File

@@ -233,8 +233,8 @@ const Widget = GObject.registerClass({
});
let { APPINFO, ICON, DISPLAY_NAME, WORKSPACE, ADJUSTMENT } = Columns;
this._store.set(iter,
[APPINFO, ICON, DISPLAY_NAME, WORKSPACE, ADJUSTMENT],
[appInfo, icon, displayName, workspace, adj]);
[APPINFO, ICON, DISPLAY_NAME, WORKSPACE, ADJUSTMENT],
[appInfo, icon, displayName, workspace, adj]);
}
_checkId(id) {

View File

@@ -73,10 +73,10 @@ class MountMenuItem extends PopupMenu.PopupBaseMenuItem {
if (this.mount.can_eject())
this.mount.eject_with_operation(...unmountArgs,
this._ejectFinish.bind(this));
this._ejectFinish.bind(this));
else
this.mount.unmount_with_operation(...unmountArgs,
this._unmountFinish.bind(this));
this._unmountFinish.bind(this));
}
_unmountFinish(mount, result) {
@@ -102,9 +102,9 @@ class MountMenuItem extends PopupMenu.PopupBaseMenuItem {
}
activate(event) {
let uri = this.mount.get_root().get_uri();
let context = global.create_app_launch_context(event.get_time(), -1);
Gio.AppInfo.launch_default_for_uri(this.mount.get_root().get_uri(),
context);
Gio.AppInfo.launch_default_for_uri(uri, context);
super.activate(event);
}

View File

@@ -203,9 +203,10 @@ class NaturalLayoutStrategy extends Workspace.LayoutStrategy {
// Work out scaling by getting the most top-left and most bottom-right window coords.
let scale;
scale = Math.min(areaRect.width / bounds.width,
areaRect.height / bounds.height,
1.0);
scale = Math.min(
areaRect.width / bounds.width,
areaRect.height / bounds.height,
1.0);
// Make bounding rect fill the screen size for later steps
bounds.x = bounds.x - (areaRect.width - bounds.width * scale) / 2;

View File

@@ -42,7 +42,7 @@ class PlaceMenuItem extends PopupMenu.PopupBaseMenuItem {
}
this._changedId = info.connect('changed',
this._propertiesChanged.bind(this));
this._propertiesChanged.bind(this));
}
destroy() {

View File

@@ -71,18 +71,21 @@ class PlaceInfo {
}
getIcon() {
this.file.query_info_async('standard::symbolic-icon', 0, 0, null,
(file, result) => {
try {
let info = file.query_info_finish(result);
this.icon = info.get_symbolic_icon();
this.emit('changed');
} catch (e) {
if (e instanceof Gio.IOErrorEnum)
return;
throw e;
}
});
this.file.query_info_async('standard::symbolic-icon',
Gio.FileQueryInfoFlags.NONE,
0,
null,
(file, result) => {
try {
let info = file.query_info_finish(result);
this.icon = info.get_symbolic_icon();
this.emit('changed');
} catch (e) {
if (e instanceof Gio.IOErrorEnum)
return;
throw e;
}
});
// return a generic icon for this kind for now, until we have the
// icon from the query info above
@@ -152,7 +155,7 @@ class RootInfo extends PlaceInfo {
this._proxy = obj;
this._proxy.connect('g-properties-changed',
this._propertiesChanged.bind(this));
this._propertiesChanged.bind(this));
this._propertiesChanged(obj);
});
}
@@ -203,10 +206,10 @@ class PlaceDeviceInfo extends PlaceInfo {
if (this._mount.can_eject())
this._mount.eject_with_operation(...unmountArgs,
this._ejectFinish.bind(this));
this._ejectFinish.bind(this));
else
this._mount.unmount_with_operation(...unmountArgs,
this._unmountFinish.bind(this));
this._unmountFinish.bind(this));
}
_ejectFinish(mount, result) {
@@ -275,9 +278,8 @@ var PlacesManager = class {
};
this._settings = new Gio.Settings({ schema_id: BACKGROUND_SCHEMA });
this._showDesktopIconsChangedId =
this._settings.connect('changed::show-desktop-icons',
this._updateSpecials.bind(this));
this._showDesktopIconsChangedId = this._settings.connect(
'changed::show-desktop-icons', this._updateSpecials.bind(this));
this._updateSpecials();
/*
@@ -350,9 +352,10 @@ var PlacesManager = class {
let homePath = GLib.get_home_dir();
this._places.special.push(new PlaceInfo('special',
Gio.File.new_for_path(homePath),
_('Home')));
this._places.special.push(new PlaceInfo(
'special',
Gio.File.new_for_path(homePath),
_('Home')));
let specials = [];
let dirs = DEFAULT_DIRECTORIES.slice();
@@ -394,10 +397,11 @@ var PlacesManager = class {
/* Add standard places */
this._places.devices.push(new RootInfo());
this._places.network.push(new PlaceInfo('network',
Gio.File.new_for_uri('network:///'),
_('Browse Network'),
'network-workgroup-symbolic'));
this._places.network.push(new PlaceInfo(
'network',
Gio.File.new_for_uri('network:///'),
_('Browse Network'),
'network-workgroup-symbolic'));
/* first go through all connected drives */
let drives = this._volumeMonitor.get_connected_drives();

View File

@@ -47,8 +47,9 @@ function flashMessage(message) {
text.opacity = 255;
let monitor = Main.layoutManager.primaryMonitor;
text.set_position(monitor.x + Math.floor(monitor.width / 2 - text.width / 2),
monitor.y + Math.floor(monitor.height / 2 - text.height / 2));
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,
@@ -63,7 +64,9 @@ let SIZES = [
[800, 450],
[1024, 576],
[1200, 675],
[1600, 900]
[1600, 900],
[360, 654], // Phone portrait maximized
[720, 360] // Phone landscape fullscreen
];
function cycleScreenshotSizes(display, window, binding) {
@@ -135,17 +138,18 @@ function cycleScreenshotSizes(display, window, binding) {
}
function enable() {
Main.wm.addKeybinding('cycle-screenshot-sizes',
ExtensionUtils.getSettings(),
Meta.KeyBindingFlags.PER_WINDOW,
Shell.ActionMode.NORMAL,
cycleScreenshotSizes);
Main.wm.addKeybinding('cycle-screenshot-sizes-backward',
ExtensionUtils.getSettings(),
Meta.KeyBindingFlags.PER_WINDOW |
Meta.KeyBindingFlags.IS_REVERSED,
Shell.ActionMode.NORMAL,
cycleScreenshotSizes);
Main.wm.addKeybinding(
'cycle-screenshot-sizes',
ExtensionUtils.getSettings(),
Meta.KeyBindingFlags.PER_WINDOW,
Shell.ActionMode.NORMAL,
cycleScreenshotSizes);
Main.wm.addKeybinding(
'cycle-screenshot-sizes-backward',
ExtensionUtils.getSettings(),
Meta.KeyBindingFlags.PER_WINDOW | Meta.KeyBindingFlags.IS_REVERSED,
Shell.ActionMode.NORMAL,
cycleScreenshotSizes);
}
function disable() {

View File

@@ -72,9 +72,8 @@ class WindowContextMenu extends PopupMenu.PopupMenu {
});
this.addMenuItem(this._minimizeItem);
this._notifyMinimizedId =
this._metaWindow.connect('notify::minimized',
this._updateMinimizeItem.bind(this));
this._notifyMinimizedId = this._metaWindow.connect(
'notify::minimized', this._updateMinimizeItem.bind(this));
this._updateMinimizeItem();
this._maximizeItem = new PopupMenu.PopupMenuItem('');
@@ -86,12 +85,12 @@ class WindowContextMenu extends PopupMenu.PopupMenu {
});
this.addMenuItem(this._maximizeItem);
this._notifyMaximizedHId =
this._metaWindow.connect('notify::maximized-horizontally',
this._updateMaximizeItem.bind(this));
this._notifyMaximizedVId =
this._metaWindow.connect('notify::maximized-vertically',
this._updateMaximizeItem.bind(this));
this._notifyMaximizedHId = this._metaWindow.connect(
'notify::maximized-horizontally',
this._updateMaximizeItem.bind(this));
this._notifyMaximizedVId = this._metaWindow.connect(
'notify::maximized-vertically',
this._updateMaximizeItem.bind(this));
this._updateMaximizeItem();
this._closeItem = new PopupMenu.PopupMenuItem(_('Close'));
@@ -146,25 +145,20 @@ class WindowTitle {
this.actor.add(this.label_actor);
this._textureCache = St.TextureCache.get_default();
this._iconThemeChangedId =
this._textureCache.connect('icon-theme-changed',
this._updateIcon.bind(this));
this._notifyWmClass =
this._metaWindow.connect_after('notify::wm-class',
this._updateIcon.bind(this));
this._notifyAppId =
this._metaWindow.connect_after('notify::gtk-application-id',
this._updateIcon.bind(this));
this._iconThemeChangedId = this._textureCache.connect(
'icon-theme-changed', this._updateIcon.bind(this));
this._notifyWmClass = this._metaWindow.connect_after(
'notify::wm-class', this._updateIcon.bind(this));
this._notifyAppId = this._metaWindow.connect_after(
'notify::gtk-application-id', this._updateIcon.bind(this));
this._updateIcon();
this.actor.connect('destroy', this._onDestroy.bind(this));
this._notifyTitleId =
this._metaWindow.connect('notify::title',
this._updateTitle.bind(this));
this._notifyMinimizedId =
this._metaWindow.connect('notify::minimized',
this._minimizedChanged.bind(this));
this._notifyTitleId = this._metaWindow.connect(
'notify::title', this._updateTitle.bind(this));
this._notifyMinimizedId = this._metaWindow.connect(
'notify::minimized', this._minimizedChanged.bind(this));
this._minimizedChanged();
}
@@ -222,24 +216,23 @@ class BaseButton {
this.actor._delegate = this;
this.actor.connect('allocation-changed',
this._updateIconGeometry.bind(this));
this._updateIconGeometry.bind(this));
this.actor.connect('clicked', this._onClicked.bind(this));
this.actor.connect('destroy', this._onDestroy.bind(this));
this.actor.connect('popup-menu', this._onPopupMenu.bind(this));
this._contextMenuManager = new PopupMenu.PopupMenuManager(this);
this._switchWorkspaceId =
global.window_manager.connect('switch-workspace',
this._updateVisibility.bind(this));
this._switchWorkspaceId = global.window_manager.connect(
'switch-workspace', this._updateVisibility.bind(this));
if (this._perMonitor) {
this._windowEnteredMonitorId =
global.display.connect('window-entered-monitor',
this._windowEnteredOrLeftMonitor.bind(this));
this._windowLeftMonitorId =
global.display.connect('window-left-monitor',
this._windowEnteredOrLeftMonitor.bind(this));
this._windowEnteredMonitorId = global.display.connect(
'window-entered-monitor',
this._windowEnteredOrLeftMonitor.bind(this));
this._windowLeftMonitorId = global.display.connect(
'window-left-monitor',
this._windowEnteredOrLeftMonitor.bind(this));
}
}
@@ -339,13 +332,11 @@ class WindowButton extends BaseButton {
this._contextMenuManager.addMenu(this._contextMenu);
Main.uiGroup.add_actor(this._contextMenu.actor);
this._workspaceChangedId =
this.metaWindow.connect('workspace-changed',
this._updateVisibility.bind(this));
this._workspaceChangedId = this.metaWindow.connect(
'workspace-changed', this._updateVisibility.bind(this));
this._notifyFocusId =
global.display.connect('notify::focus-window',
this._updateStyle.bind(this));
this._notifyFocusId = global.display.connect(
'notify::focus-window', this._updateStyle.bind(this));
this._updateStyle();
}
@@ -509,15 +500,13 @@ class AppButton extends BaseButton {
this._icon.child = app.create_icon_texture(ICON_TEXTURE_SIZE);
});
this._windowsChangedId =
this.app.connect('windows-changed',
this._windowsChanged.bind(this));
this._windowsChangedId = this.app.connect(
'windows-changed', this._windowsChanged.bind(this));
this._windowsChanged();
this._windowTracker = Shell.WindowTracker.get_default();
this._notifyFocusId =
this._windowTracker.connect('notify::focus-app',
this._updateStyle.bind(this));
this._notifyFocusId = this._windowTracker.connect(
'notify::focus-app', this._updateStyle.bind(this));
this._updateStyle();
}
@@ -565,8 +554,8 @@ class AppButton extends BaseButton {
this._windowTitle = new WindowTitle(this.metaWindow);
this._singleWindowTitle.child = this._windowTitle.actor;
this._windowContextMenu = new WindowContextMenu(this.actor, this.metaWindow);
this._windowContextMenu.connect('open-state-changed',
_onMenuStateChanged);
this._windowContextMenu.connect(
'open-state-changed', _onMenuStateChanged);
Main.uiGroup.add_actor(this._windowContextMenu.actor);
this._windowContextMenu.actor.hide();
this._contextMenuManager.addMenu(this._windowContextMenu);
@@ -671,19 +660,19 @@ class WorkspaceIndicator extends PanelMenu.Button {
this.workspacesItems = [];
this._workspaceManagerSignals = [];
this._workspaceManagerSignals.push(workspaceManager.connect('notify::n-workspaces',
this._updateMenu.bind(this)));
this._workspaceManagerSignals.push(workspaceManager.connect_after('workspace-switched',
this._updateIndicator.bind(this)));
this._workspaceManagerSignals = [
workspaceManager.connect('notify::n-workspaces',
this._updateMenu.bind(this)),
workspaceManager.connect_after('workspace-switched',
this._updateIndicator.bind(this))
];
this.connect('scroll-event', this._onScrollEvent.bind(this));
this._updateMenu();
this._settings = new Gio.Settings({ schema_id: 'org.gnome.desktop.wm.preferences' });
this._settingsChangedId =
this._settings.connect('changed::workspace-names',
this._updateMenu.bind(this));
this._settingsChangedId = this._settings.connect(
'changed::workspace-names', this._updateMenu.bind(this));
}
_onDestroy() {
@@ -812,12 +801,12 @@ class WindowList {
indicatorsBox.add(this._workspaceIndicator.container, { expand: false, y_fill: true });
this._mutterSettings = new Gio.Settings({ schema_id: 'org.gnome.mutter' });
this._workspacesOnlyOnPrimaryChangedId =
this._mutterSettings.connect('changed::workspaces-only-on-primary',
this._updateWorkspaceIndicatorVisibility.bind(this));
this._dynamicWorkspacesChangedId =
this._mutterSettings.connect('changed::dynamic-workspaces',
this._updateWorkspaceIndicatorVisibility.bind(this));
this._workspacesOnlyOnPrimaryChangedId = this._mutterSettings.connect(
'changed::workspaces-only-on-primary',
this._updateWorkspaceIndicatorVisibility.bind(this));
this._dynamicWorkspacesChangedId = this._mutterSettings.connect(
'changed::dynamic-workspaces',
this._updateWorkspaceIndicatorVisibility.bind(this));
this._updateWorkspaceIndicatorVisibility();
this._menuManager = new PopupMenu.PopupMenuManager(this);
@@ -835,59 +824,54 @@ class WindowList {
this._updatePosition();
this._appSystem = Shell.AppSystem.get_default();
this._appStateChangedId =
this._appSystem.connect('app-state-changed',
this._onAppStateChanged.bind(this));
this._appStateChangedId = this._appSystem.connect(
'app-state-changed', this._onAppStateChanged.bind(this));
this._keyboardVisiblechangedId =
Main.layoutManager.connect('keyboard-visible-changed',
(o, state) => {
Main.layoutManager.keyboardBox.visible = state;
let keyboardBox = Main.layoutManager.keyboardBox;
keyboardBox.visible = state;
if (state)
Main.uiGroup.set_child_above_sibling(this.actor, keyboardBox);
else
Main.uiGroup.set_child_above_sibling(this.actor,
Main.layoutManager.panelBox);
this._updateKeyboardAnchor();
});
this._keyboardVisiblechangedId = Main.layoutManager.connect(
'keyboard-visible-changed',
(o, state) => {
Main.layoutManager.keyboardBox.visible = state;
let keyboardBox = Main.layoutManager.keyboardBox;
keyboardBox.visible = state;
if (state) {
Main.uiGroup.set_child_above_sibling(
this.actor, keyboardBox);
} else {
Main.uiGroup.set_child_above_sibling(
this.actor, Main.layoutManager.panelBox);
}
this._updateKeyboardAnchor();
});
let workspaceManager = global.workspace_manager;
this._workspaceSignals = new Map();
this._nWorkspacesChangedId =
workspaceManager.connect('notify::n-workspaces',
this._onWorkspacesChanged.bind(this));
this._nWorkspacesChangedId = workspaceManager.connect(
'notify::n-workspaces', this._onWorkspacesChanged.bind(this));
this._onWorkspacesChanged();
this._switchWorkspaceId =
global.window_manager.connect('switch-workspace',
this._checkGrouping.bind(this));
this._switchWorkspaceId = global.window_manager.connect(
'switch-workspace', this._checkGrouping.bind(this));
this._overviewShowingId =
Main.overview.connect('showing', () => {
this.actor.hide();
this._updateKeyboardAnchor();
});
this._overviewShowingId = Main.overview.connect('showing', () => {
this.actor.hide();
this._updateKeyboardAnchor();
});
this._overviewHidingId =
Main.overview.connect('hiding', () => {
this.actor.visible = !Main.layoutManager.primaryMonitor.inFullscreen;
this._updateKeyboardAnchor();
});
this._overviewHidingId = Main.overview.connect('hiding', () => {
this.actor.visible = !Main.layoutManager.primaryMonitor.inFullscreen;
this._updateKeyboardAnchor();
});
this._fullscreenChangedId =
global.display.connect('in-fullscreen-changed', () => {
this._updateKeyboardAnchor();
});
this._dragBeginId =
Main.xdndHandler.connect('drag-begin',
this._onDragBegin.bind(this));
this._dragEndId =
Main.xdndHandler.connect('drag-end',
this._onDragEnd.bind(this));
this._dragBeginId = Main.xdndHandler.connect('drag-begin',
this._onDragBegin.bind(this));
this._dragEndId = Main.xdndHandler.connect('drag-end',
this._onDragEnd.bind(this));
this._dragMonitor = {
dragMotion: this._onDragMotion.bind(this)
};
@@ -896,9 +880,8 @@ class WindowList {
this._dndWindow = null;
this._settings = ExtensionUtils.getSettings();
this._groupingModeChangedId =
this._settings.connect('changed::grouping-mode',
this._groupingModeChanged.bind(this));
this._groupingModeChangedId = this._settings.connect(
'changed::grouping-mode', this._groupingModeChanged.bind(this));
this._grouped = undefined;
this._groupingModeChanged();
}
@@ -922,8 +905,9 @@ class WindowList {
}
_updatePosition() {
this.actor.set_position(this._monitor.x,
this._monitor.y + this._monitor.height - this.actor.height);
this.actor.set_position(
this._monitor.x,
this._monitor.y + this._monitor.height - this.actor.height);
}
_updateWorkspaceIndicatorVisibility() {
@@ -1009,8 +993,8 @@ class WindowList {
if (!Main.keyboard.actor)
return;
let anchorY = Main.overview.visible ? 0 : this.actor.height;
Main.keyboard.actor.anchor_y = anchorY;
let translationY = Main.overview.visible ? 0 : this.actor.height;
Main.keyboard.actor.translation_y = -translationY;
}
_onAppStateChanged(appSys, app) {
@@ -1026,9 +1010,9 @@ class WindowList {
_addApp(app) {
let button = new AppButton(app, this._perMonitor, this._monitor.index);
this._windowList.layout_manager.pack(button.actor,
true, true, true,
Clutter.BoxAlignment.START,
Clutter.BoxAlignment.START);
true, true, true,
Clutter.BoxAlignment.START,
Clutter.BoxAlignment.START);
}
_removeApp(app) {
@@ -1054,9 +1038,9 @@ class WindowList {
let button = new WindowButton(win, this._perMonitor, this._monitor.index);
this._windowList.layout_manager.pack(button.actor,
true, true, true,
Clutter.BoxAlignment.START,
Clutter.BoxAlignment.START);
true, true, true,
Clutter.BoxAlignment.START,
Clutter.BoxAlignment.START);
}
_onWindowRemoved(ws, win) {
@@ -1085,12 +1069,10 @@ class WindowList {
continue;
let signals = { windowAddedId: 0, windowRemovedId: 0 };
signals._windowAddedId =
workspace.connect_after('window-added',
this._onWindowAdded.bind(this));
signals._windowRemovedId =
workspace.connect('window-removed',
this._onWindowRemoved.bind(this));
signals._windowAddedId = workspace.connect_after(
'window-added', this._onWindowAdded.bind(this));
signals._windowRemovedId = workspace.connect(
'window-removed', this._onWindowRemoved.bind(this));
this._workspaceSignals.set(workspace, signals);
}
@@ -1138,8 +1120,7 @@ class WindowList {
this._dndWindow = hoveredWindow;
this._dndTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT,
DND_ACTIVATE_TIMEOUT,
this._activateWindow.bind(this));
DND_ACTIVATE_TIMEOUT, this._activateWindow.bind(this));
return DND.DragMotionResult.CONTINUE;
}
@@ -1213,13 +1194,11 @@ class Extension {
this._windowLists = [];
this._settings = ExtensionUtils.getSettings();
this._showOnAllMonitorsChangedId =
this._settings.connect('changed::show-on-all-monitors',
this._buildWindowLists.bind(this));
this._showOnAllMonitorsChangedId = this._settings.connect(
'changed::show-on-all-monitors', this._buildWindowLists.bind(this));
this._monitorsChangedId =
Main.layoutManager.connect('monitors-changed',
this._buildWindowLists.bind(this));
this._monitorsChangedId = Main.layoutManager.connect(
'monitors-changed', this._buildWindowLists.bind(this));
this._buildWindowLists();
}

View File

@@ -1,50 +1,65 @@
/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
/* exported enable disable */
/* exported init */
const { Clutter, St } = imports.gi;
const Main = imports.ui.main;
const Workspace = imports.ui.workspace;
const WorkspacesView = imports.ui.workspacesView;
function injectToFunction(parent, name, func) {
let origin = parent[name];
parent[name] = function() {
let ret;
ret = origin.apply(this, arguments);
if (ret === undefined)
ret = func.apply(this, arguments);
return ret;
};
return origin;
}
var MyWindowOverlay = class extends Workspace.WindowOverlay {
constructor(windowClone, parentActor) {
super(windowClone, parentActor);
let winInjections, workspaceInjections, workViewInjections, createdActors, connectedSignals;
this._id = null;
this._text = new St.Label({
style_class: 'extension-windowsNavigator-window-tooltip',
visible: false
});
parentActor.add_actor(this._text);
}
function resetState() {
winInjections = {};
workspaceInjections = {};
workViewInjections = {};
createdActors = [];
connectedSignals = [];
}
function enable() {
resetState();
Workspace.WindowOverlay.prototype.showTooltip = function() {
showTooltip() {
this._text.raise_top();
this._text.show();
this._text.text = (this._windowClone.slotId + 1).toString();
};
winInjections['showTooltip'] = undefined;
}
Workspace.WindowOverlay.prototype.hideTooltip = function() {
hideTooltip() {
if (this._text && this._text.visible)
this._text.hide();
};
winInjections['hideTooltip'] = undefined;
}
Workspace.Workspace.prototype.showTooltip = function() {
relayout(animate) {
super.relayout(animate);
let [cloneX, cloneY, cloneWidth_, cloneHeight_] = this._windowClone.slot;
let textX = cloneX - 2;
let textY = cloneY - 2;
this._text.set_position(Math.floor(textX) + 5, Math.floor(textY) + 5);
this._text.raise_top();
}
};
var MyWorkspace = class extends Workspace.Workspace {
constructor(metaWorkspace, monitorIndex) {
super(metaWorkspace, monitorIndex);
if (metaWorkspace && metaWorkspace.index() < 9) {
this._tip = new St.Label({
style_class: 'extension-windowsNavigator-window-tooltip',
visible: false
});
this.actor.add_actor(this._tip);
this.actor.connect('notify::scale-x', () => {
this._tip.set_scale(1 / this.actor.scale_x, 1 / this.actor.scale_x);
});
} else
this._tip = null;
}
showTooltip() {
if (this._tip == null || this._actualGeometry == null)
return;
this._tip.text = (this.metaWorkspace.index() + 1).toString();
@@ -64,61 +79,74 @@ function enable() {
this._tip.y = area.y;
this._tip.show();
this._tip.raise_top();
};
workspaceInjections['showTooltip'] = undefined;
}
Workspace.Workspace.prototype.hideTooltip = function() {
hideTooltip() {
if (this._tip == null)
return;
if (!this._tip.get_parent())
return;
this._tip.hide();
};
workspaceInjections['hideTooltip'] = undefined;
}
Workspace.Workspace.prototype.getWindowWithTooltip = function(id) {
getWindowWithTooltip(id) {
for (let i = 0; i < this._windows.length; i++) {
if ((this._windows[i].slotId + 1) == id)
return this._windows[i].metaWindow;
}
return null;
};
workspaceInjections['getWindowWithTooltip'] = undefined;
}
Workspace.Workspace.prototype.showWindowsTooltips = function() {
showWindowsTooltips() {
for (let i in this._windowOverlays) {
if (this._windowOverlays[i] != null)
this._windowOverlays[i].showTooltip();
}
};
workspaceInjections['showWindowsTooltips'] = undefined;
}
Workspace.Workspace.prototype.hideWindowsTooltips = function() {
hideWindowsTooltips() {
for (let i in this._windowOverlays) {
if (this._windowOverlays[i] != null)
this._windowOverlays[i].hideTooltip();
}
};
workspaceInjections['hideWindowsTooltips'] = undefined;
}
};
WorkspacesView.WorkspacesView.prototype._hideTooltips = function() {
var MyWorkspacesView = class extends WorkspacesView.WorkspacesView {
constructor(width, height, x, y, workspaces) {
super(width, height, x, y, workspaces);
this._pickWorkspace = false;
this._pickWindow = false;
this._keyPressEventId =
global.stage.connect('key-press-event', this._onKeyPress.bind(this));
this._keyReleaseEventId =
global.stage.connect('key-release-event', this._onKeyRelease.bind(this));
}
_onDestroy() {
super._onDestroy();
global.stage.disconnect(this._keyPressEventId);
global.stage.disconnect(this._keyReleaseEventId);
}
_hideTooltips() {
if (global.stage.get_key_focus() == global.stage)
global.stage.set_key_focus(this._prevFocusActor);
this._pickWindow = false;
for (let i = 0; i < this._workspaces.length; i++)
this._workspaces[i].hideWindowsTooltips();
};
workViewInjections['_hideTooltips'] = undefined;
}
WorkspacesView.WorkspacesView.prototype._hideWorkspacesTooltips = function() {
_hideWorkspacesTooltips() {
global.stage.set_key_focus(this._prevFocusActor);
this._pickWorkspace = false;
for (let i = 0; i < this._workspaces.length; i++)
this._workspaces[i].hideTooltip();
};
workViewInjections['_hideWorkspacesTooltips'] = undefined;
}
WorkspacesView.WorkspacesView.prototype._onKeyRelease = function(s, o) {
_onKeyRelease(s, o) {
if (this._pickWindow &&
(o.get_key_symbol() == Clutter.KEY_Alt_L ||
o.get_key_symbol() == Clutter.KEY_Alt_R))
@@ -127,11 +155,11 @@ function enable() {
(o.get_key_symbol() == Clutter.KEY_Control_L ||
o.get_key_symbol() == Clutter.KEY_Control_R))
this._hideWorkspacesTooltips();
};
workViewInjections['_onKeyRelease'] = undefined;
}
WorkspacesView.WorkspacesView.prototype._onKeyPress = function(s, o) {
if (Main.overview.viewSelector._activePage != Main.overview.viewSelector._workspacesPage)
_onKeyPress(s, o) {
let viewSelector = Main.overview.viewSelector;
if (viewSelector._activePage != viewSelector._workspacesPage)
return false;
let workspaceManager = global.workspace_manager;
@@ -208,81 +236,29 @@ function enable() {
return true;
}
return false;
};
workViewInjections['_onKeyPress'] = undefined;
}
};
winInjections['_init'] = injectToFunction(Workspace.WindowOverlay.prototype, '_init', function(windowClone, parentActor) {
this._id = null;
createdActors.push(this._text = new St.Label({ style_class: 'extension-windowsNavigator-window-tooltip' }));
this._text.hide();
parentActor.add_actor(this._text);
});
class Extension {
constructor() {
this._origWindowOverlay = Workspace.WindowOverlay;
this._origWorkspace = Workspace.Workspace;
this._origWorkspacesView = WorkspacesView.WorkspacesView;
}
winInjections['relayout'] = injectToFunction(Workspace.WindowOverlay.prototype, 'relayout', function(_animate) {
let [cloneX, cloneY, cloneWidth_, cloneHeight_] = this._windowClone.slot;
enable() {
Workspace.WindowOverlay = MyWindowOverlay;
Workspace.Workspace = MyWorkspace;
WorkspacesView.WorkspacesView = MyWorkspacesView;
}
let textX = cloneX - 2;
let textY = cloneY - 2;
this._text.set_position(Math.floor(textX) + 5, Math.floor(textY) + 5);
this._text.raise_top();
});
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
}));
this.actor.add_actor(this._tip);
let signalId = this.actor.connect('notify::scale-x', () => {
this._tip.set_scale(1 / this.actor.scale_x, 1 / this.actor.scale_x);
});
connectedSignals.push({ obj: this.actor, id: signalId });
} else
this._tip = null;
});
workViewInjections['_init'] = injectToFunction(WorkspacesView.WorkspacesView.prototype, '_init', function(_width, _height, _x, _y, _workspaces) {
this._pickWorkspace = false;
this._pickWindow = false;
this._keyPressEventId =
global.stage.connect('key-press-event', this._onKeyPress.bind(this));
this._keyReleaseEventId =
global.stage.connect('key-release-event', this._onKeyRelease.bind(this));
connectedSignals.push({ obj: global.stage, id: this._keyPressEventId });
connectedSignals.push({ obj: global.stage, id: this._keyReleaseEventId });
});
workViewInjections['_onDestroy'] = injectToFunction(WorkspacesView.WorkspacesView.prototype, '_onDestroy', function() {
global.stage.disconnect(this._keyPressEventId);
global.stage.disconnect(this._keyReleaseEventId);
connectedSignals = [];
});
disable() {
Workspace.WindowOverlay = this._origWindowOverlay;
Workspace.Workspace = this._origWorkspace;
WorkspacesView.WorkspacesView = this._origWorkspacesView;
}
}
function removeInjection(object, injection, name) {
if (injection[name] === undefined)
delete object[name];
else
object[name] = injection[name];
}
function disable() {
let i;
for (i in workspaceInjections)
removeInjection(Workspace.Workspace.prototype, workspaceInjections, i);
for (i in winInjections)
removeInjection(Workspace.WindowOverlay.prototype, winInjections, i);
for (i in workViewInjections)
removeInjection(WorkspacesView.WorkspacesView.prototype, workViewInjections, i);
for (i of connectedSignals)
i.obj.disconnect(i.id);
for (i of createdActors)
i.destroy();
resetState();
function init() {
return new Extension();
}

View File

@@ -34,13 +34,14 @@ class WorkspaceIndicator extends PanelMenu.Button {
this._workspaceSection = new PopupMenu.PopupMenuSection();
this.menu.addMenuItem(this._workspaceSection);
this._workspaceManagerSignals = [];
this._workspaceManagerSignals.push(workspaceManager.connect_after('workspace-added',
this._createWorkspacesSection.bind(this)));
this._workspaceManagerSignals.push(workspaceManager.connect_after('workspace-removed',
this._createWorkspacesSection.bind(this)));
this._workspaceManagerSignals.push(workspaceManager.connect_after('workspace-switched',
this._updateIndicator.bind(this)));
this._workspaceManagerSignals = [
workspaceManager.connect_after('workspace-added',
this._createWorkspacesSection.bind(this)),
workspaceManager.connect_after('workspace-removed',
this._createWorkspacesSection.bind(this)),
workspaceManager.connect_after('workspace-switched',
this._updateIndicator.bind(this))
];
this.connect('scroll-event', this._onScrollEvent.bind(this));
this._createWorkspacesSection();
@@ -49,9 +50,9 @@ class WorkspaceIndicator extends PanelMenu.Button {
this.statusLabel.add_style_class_name('panel-workspace-indicator');
this._settings = new Gio.Settings({ schema_id: WORKSPACE_SCHEMA });
this._settingsChangedId =
this._settings.connect(`changed::${WORKSPACE_KEY}`,
this._createWorkspacesSection.bind(this));
this._settingsChangedId = this._settings.connect(
`changed::${WORKSPACE_KEY}`,
this._createWorkspacesSection.bind(this));
}
_onDestroy() {

View File

@@ -1,16 +0,0 @@
{
"rules": {
"indent": [
"error",
4,
{
"ignoredNodes": [
"CallExpression > ArrowFunctionExpression",
"CallExpression[callee.object.name=GObject][callee.property.name=registerClass] > ClassExpression:first-child"
],
"CallExpression": { "arguments": "first" },
"MemberExpression": "off"
}
]
}
}

View File

@@ -1,61 +0,0 @@
#!/bin/sh
SEP=`printf '\t'`
OUTPUT=/dev/stderr
CWD=`pwd`
SRCDIR=`dirname $0`
run_lint() {
eslint -f unix "$@" .
}
parse_opts() {
tmp=`getopt -l output: o: "$@"`
[ $? -ne 0 ] && exit 1
eval set -- $tmp
while true
do
case $1 in
--output|-o)
OUTPUT=`realpath $2`; shift 2; continue ;;
--)
shift; break ;;
esac
done
}
# delete lines that don't start with '/',
# replace the first space with tab, sort
process_for_join() {
sed -E "/\//!d; s|(\S+)\s|\1$SEP|" | sort -k 1b,1
}
# re-replace tab with space
process_post_join() {
sed -E "s|$SEP| |"
}
create_report() {
tmp1=`mktemp --tmpdir lint-XXXX`
run_lint | process_for_join > $tmp1
tmp2=`mktemp --tmpdir lint-XXXX`
run_lint -c lint/eslintrc-legacy.json | process_for_join > $tmp2
join -t"$SEP" -o '0,1.2' $tmp1 $tmp2 | process_post_join
rm $tmp1 $tmp2
}
parse_opts "$@"
cd $SRCDIR/..
create_report | tee $OUTPUT | grep -q .
rv=$(( $? == 0 ))
cd $CWD
[ $rv -eq 0 -a -f $OUTPUT ] && rm $OUTPUT
exit $rv

View File

@@ -1,5 +1,5 @@
project('gnome-shell-extensions',
version: '3.32.0',
version: '3.33.2',
meson_version: '>= 0.44.0',
license: 'GPL2+'
)