Compare commits

...

7 Commits

Author SHA1 Message Date
Florian Müllner 35746251fd Bump version to 3.35.2
Update NEWS.
2019-12-11 18:59:03 +01:00
Willy Stadnick a2b014ccbf screenshot-window-sizer: Fix cycling through all valid sizes
When cycling through window sizes, we should skip any sizes that are
bigger than the available area. We do that, but the current code
assumes that the possible sizes are sorted, which is no longer the
case since the addition of "phone" sizes in commit 5b43d4733c.

As a result, we may now skip sizes that would fit perfectly fine.
Address this by filtering out invalid sizes beforehand instead of
assuming a certain order (wich no longer work due to the addition
of a portrait format).

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/97
2019-11-26 00:49:08 +01:00
Florian Müllner 95131dc252 workspace-indicator: Exclude DESKTOP windows from window previews
While nautilus removed its desktop support a while ago in favor of an
extension, it's still possible that some external X11 desktop icon app
is used. As DESKTOP windows cannot be moved between workspaces or stacked,
and aren't perceived as regular windows, it doesn't make sense to show
them as previews in the workspace switcher.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/93
2019-11-21 21:42:16 +00:00
Florian Müllner f3acb27d61 window-list: Exclude DESKTOP windows from window previews
While nautilus removed its desktop support a while ago in favor of an
extension, it's still possible that some external X11 desktop icon app
is used. As DESKTOP windows cannot be moved between workspaces or stacked,
and aren't perceived as regular windows, it doesn't make sense to show
them as previews in the workspace switcher.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/93
2019-11-21 21:42:16 +00:00
Florian Müllner a904d51cf7 window-list: Fix faking overview
The public overview properties are now read-only, so switch to the
private properties which back them to fake the overview visibility.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/96
2019-11-21 22:38:50 +01:00
Florian Müllner 30ad3d670f extensions: Stop setting GTypeName
The type name generated by gjs now includes the filename, so we
don't have to set it ourselves to make sure it's unique.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/95
2019-11-21 22:25:43 +01:00
Marco Trevisan (Treviño) 63615cb657 cleanup: Use inheritance for Actor classes instead of composition
Use GObject types when inheriting from native actor classes.

Related to https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/559

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/89
2019-11-21 21:22:26 +00:00
9 changed files with 71 additions and 69 deletions
+10
View File
@@ -1,3 +1,13 @@
3.35.2
======
* Adjust to gnome-shell changes [Marco, Florian; !89, !95, !96]
* window-list, workspace-indicator: Exclude DESKTOP windows from previews
[Florian; !93]
* screenshot-window-sizer: Fix cycling through all valid sizes [Willy; !97]
Contributors:
Marco Trevisan (Treviño), Florian Müllner, Willy Stadnick
3.34.1 3.34.1
====== ======
* Adjust to gnome-settings-daemon plugin removals [Xiaoguang; !94] * Adjust to gnome-settings-daemon plugin removals [Xiaoguang; !94]
+2 -3
View File
@@ -22,9 +22,8 @@ const Columns = {
ADJUSTMENT: 4, ADJUSTMENT: 4,
}; };
const Widget = GObject.registerClass({ const Widget = GObject.registerClass(
GTypeName: 'AutoMoveWindowsPrefsWidget', class Widget extends Gtk.Grid {
}, class Widget extends Gtk.Grid {
_init(params) { _init(params) {
super._init(params); super._init(params);
this.set_orientation(Gtk.Orientation.VERTICAL); this.set_orientation(Gtk.Orientation.VERTICAL);
@@ -82,7 +82,8 @@ function cycleScreenshotSizes(display, window, binding) {
// Double both axes if on a hidpi display // Double both axes if on a hidpi display
let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor; let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
let scaledSizes = SIZES.map(size => size.map(wh => wh * scaleFactor)); let scaledSizes = SIZES.map(size => size.map(wh => wh * scaleFactor))
.filter(([w, h]) => w <= workArea.width && h <= workArea.height);
// Find the nearest 16:9 size for the current window size // Find the nearest 16:9 size for the current window size
let nearestIndex; let nearestIndex;
@@ -105,10 +106,7 @@ function cycleScreenshotSizes(display, window, binding) {
// get the next size up or down from ideal // get the next size up or down from ideal
let newIndex = (nearestIndex + (backwards ? -1 : 1)) % scaledSizes.length; let newIndex = (nearestIndex + (backwards ? -1 : 1)) % scaledSizes.length;
let newWidth, newHeight; let [newWidth, newHeight] = scaledSizes[newIndex];
[newWidth, newHeight] = scaledSizes[newIndex];
if (newWidth > workArea.width || newHeight > workArea.height)
[newWidth, newHeight] = scaledSizes[0];
// Push the window onscreen if it would be resized offscreen // Push the window onscreen if it would be resized offscreen
let newX = outerRect.x; let newX = outerRect.x;
+10 -15
View File
@@ -132,9 +132,8 @@ class WindowContextMenu extends PopupMenu.PopupMenu {
} }
} }
const WindowTitle = GObject.registerClass({ const WindowTitle = GObject.registerClass(
GTypeName: 'WindowListWindowTitle', class WindowTitle extends St.BoxLayout {
}, class WindowTitle extends St.BoxLayout {
_init(metaWindow) { _init(metaWindow) {
this._metaWindow = metaWindow; this._metaWindow = metaWindow;
@@ -205,7 +204,6 @@ const WindowTitle = GObject.registerClass({
const BaseButton = GObject.registerClass({ const BaseButton = GObject.registerClass({
GTypeName: 'WindowListBaseButton',
GTypeFlags: GObject.TypeFlags.ABSTRACT, GTypeFlags: GObject.TypeFlags.ABSTRACT,
Properties: { Properties: {
'ignore-workspace': GObject.ParamSpec.boolean( 'ignore-workspace': GObject.ParamSpec.boolean(
@@ -348,9 +346,8 @@ const BaseButton = GObject.registerClass({
}); });
const WindowButton = GObject.registerClass({ const WindowButton = GObject.registerClass(
GTypeName: 'WindowListWindowButton', class WindowButton extends BaseButton {
}, class WindowButton extends BaseButton {
_init(metaWindow, perMonitor, monitorIndex) { _init(metaWindow, perMonitor, monitorIndex) {
super._init(perMonitor, monitorIndex); super._init(perMonitor, monitorIndex);
@@ -480,9 +477,8 @@ class AppContextMenu extends PopupMenu.PopupMenu {
} }
} }
const AppButton = GObject.registerClass({ const AppButton = GObject.registerClass(
GTypeName: 'WindowListAppButton', class AppButton extends BaseButton {
}, class AppButton extends BaseButton {
_init(app, perMonitor, monitorIndex) { _init(app, perMonitor, monitorIndex) {
super._init(perMonitor, monitorIndex); super._init(perMonitor, monitorIndex);
@@ -672,9 +668,8 @@ const AppButton = GObject.registerClass({
}); });
const WindowList = GObject.registerClass({ const WindowList = GObject.registerClass(
GTypeName: 'WindowListWindowList', class WindowList extends St.Widget {
}, class WindowList extends St.Widget {
_init(perMonitor, monitor) { _init(perMonitor, monitor) {
this._perMonitor = perMonitor; this._perMonitor = perMonitor;
this._monitor = monitor; this._monitor = monitor;
@@ -923,11 +918,11 @@ const WindowList = GObject.registerClass({
} }
_updateKeyboardAnchor() { _updateKeyboardAnchor() {
if (!Main.keyboard.actor) if (!Main.keyboard.keyboardActor)
return; return;
let translationY = Main.overview.visible ? 0 : this.height; let translationY = Main.overview.visible ? 0 : this.height;
Main.keyboard.actor.translation_y = -translationY; Main.keyboard.keyboardActor.translation_y = -translationY;
} }
_onAppStateChanged(appSys, app) { _onAppStateChanged(appSys, app) {
+14 -14
View File
@@ -6,18 +6,17 @@ const Main = imports.ui.main;
const Overview = imports.ui.overview; const Overview = imports.ui.overview;
const { WorkspacesDisplay } = imports.ui.workspacesView; const { WorkspacesDisplay } = imports.ui.workspacesView;
let MyWorkspacesDisplay = class extends WorkspacesDisplay { let MyWorkspacesDisplay = GObject.registerClass(
constructor() { class MyWorkspacesDisplay extends WorkspacesDisplay {
super(); _init() {
super._init();
this.actor.add_constraint( this.add_constraint(
new Layout.MonitorConstraint({ new Layout.MonitorConstraint({
primary: true, primary: true,
work_area: true, work_area: true,
})); }));
this.actor.connect('destroy', this._onDestroy.bind(this));
this._workareasChangedId = global.display.connect('workareas-changed', this._workareasChangedId = global.display.connect('workareas-changed',
this._onWorkAreasChanged.bind(this)); this._onWorkAreasChanged.bind(this));
this._onWorkAreasChanged(); this._onWorkAreasChanged();
@@ -50,8 +49,8 @@ let MyWorkspacesDisplay = class extends WorkspacesDisplay {
super._updateWorkspacesViews(); super._updateWorkspacesViews();
this._workspacesViews.forEach(v => { this._workspacesViews.forEach(v => {
Main.layoutManager.overviewGroup.remove_actor(v.actor); Main.layoutManager.overviewGroup.remove_actor(v);
Main.windowPicker.add_actor(v.actor); Main.windowPicker.add_actor(v);
}); });
} }
@@ -59,11 +58,12 @@ let MyWorkspacesDisplay = class extends WorkspacesDisplay {
if (this._workareasChangedId) if (this._workareasChangedId)
global.display.disconnect(this._workareasChangedId); global.display.disconnect(this._workareasChangedId);
this._workareasChangedId = 0; this._workareasChangedId = 0;
super._onDestroy();
} }
}; });
var WindowPicker = GObject.registerClass({ var WindowPicker = GObject.registerClass({
GTypeName: 'WindowListWindowPicker',
Signals: { Signals: {
'open-state-changed': { param_types: [GObject.TYPE_BOOLEAN] }, 'open-state-changed': { param_types: [GObject.TYPE_BOOLEAN] },
}, },
@@ -98,7 +98,7 @@ var WindowPicker = GObject.registerClass({
Main.overview.addAction = a => this._backgroundGroup.add_action(a); Main.overview.addAction = a => this._backgroundGroup.add_action(a);
this._workspacesDisplay = new MyWorkspacesDisplay(); this._workspacesDisplay = new MyWorkspacesDisplay();
this.add_child(this._workspacesDisplay.actor); this.add_child(this._workspacesDisplay);
Main.overview.addAction = addActionOrig; Main.overview.addAction = addActionOrig;
@@ -174,12 +174,12 @@ var WindowPicker = GObject.registerClass({
} }
_fakeOverviewAnimation(onComplete) { _fakeOverviewAnimation(onComplete) {
Main.overview.animationInProgress = true; Main.overview._animationInProgress = true;
GLib.timeout_add( GLib.timeout_add(
GLib.PRIORITY_DEFAULT, GLib.PRIORITY_DEFAULT,
Overview.ANIMATION_TIME, Overview.ANIMATION_TIME,
() => { () => {
Main.overview.animationInProgress = false; Main.overview._animationInProgress = false;
if (onComplete) if (onComplete)
onComplete(); onComplete();
}); });
@@ -187,7 +187,7 @@ var WindowPicker = GObject.registerClass({
_fakeOverviewVisible(visible) { _fakeOverviewVisible(visible) {
// Fake overview state for WorkspacesDisplay // Fake overview state for WorkspacesDisplay
Main.overview.visible = visible; Main.overview._visible = visible;
// Hide real windows // Hide real windows
Main.layoutManager._inOverview = visible; Main.layoutManager._inOverview = visible;
+7 -9
View File
@@ -9,9 +9,8 @@ const PopupMenu = imports.ui.popupMenu;
const Gettext = imports.gettext.domain('gnome-shell-extensions'); const Gettext = imports.gettext.domain('gnome-shell-extensions');
const _ = Gettext.gettext; const _ = Gettext.gettext;
let WindowPreview = GObject.registerClass({ let WindowPreview = GObject.registerClass(
GTypeName: 'WindowListWindowPreview', class WindowPreview extends St.Button {
}, class WindowPreview extends St.Button {
_init(window) { _init(window) {
super._init({ super._init({
style_class: 'window-list-window-preview', style_class: 'window-list-window-preview',
@@ -78,6 +77,7 @@ let WindowPreview = GObject.registerClass({
_relayout() { _relayout() {
let monitor = Main.layoutManager.findIndexForActor(this); let monitor = Main.layoutManager.findIndexForActor(this);
this.visible = monitor === this._window.get_monitor() && this.visible = monitor === this._window.get_monitor() &&
this._window.window_type !== Meta.WindowType.DESKTOP &&
this._window.showing_on_its_workspace(); this._window.showing_on_its_workspace();
if (!this.visible) if (!this.visible)
@@ -97,9 +97,8 @@ let WindowPreview = GObject.registerClass({
} }
}); });
let WorkspaceThumbnail = GObject.registerClass({ let WorkspaceThumbnail = GObject.registerClass(
GTypeName: 'WindowListWorkspaceThumbnail', class WorkspaceThumbnail extends St.Button {
}, class WorkspaceThumbnail extends St.Button {
_init(index) { _init(index) {
super._init({ super._init({
style_class: 'workspace', style_class: 'workspace',
@@ -204,9 +203,8 @@ let WorkspaceThumbnail = GObject.registerClass({
} }
}); });
var WorkspaceIndicator = GObject.registerClass({ var WorkspaceIndicator = GObject.registerClass(
GTypeName: 'WindowListWorkspaceIndicator', class WorkspaceIndicator extends PanelMenu.Button {
}, class WorkspaceIndicator extends PanelMenu.Button {
_init() { _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.setMenu(new PopupMenu.PopupMenu(this, 0.0, St.Side.BOTTOM));
+19 -16
View File
@@ -6,9 +6,10 @@ const Main = imports.ui.main;
const Workspace = imports.ui.workspace; const Workspace = imports.ui.workspace;
const WorkspacesView = imports.ui.workspacesView; const WorkspacesView = imports.ui.workspacesView;
var MyWindowOverlay = class extends Workspace.WindowOverlay { var MyWindowOverlay = GObject.registerClass(
constructor(windowClone, parentActor) { class MyWindowOverlay extends Workspace.WindowOverlay {
super(windowClone, parentActor); _init(windowClone, parentActor) {
super._init(windowClone, parentActor);
this._id = null; this._id = null;
this._text = new St.Label({ this._text = new St.Label({
@@ -39,21 +40,22 @@ var MyWindowOverlay = class extends Workspace.WindowOverlay {
this._text.set_position(Math.floor(textX) + 5, Math.floor(textY) + 5); this._text.set_position(Math.floor(textX) + 5, Math.floor(textY) + 5);
this._text.raise_top(); this._text.raise_top();
} }
}; });
var MyWorkspace = class extends Workspace.Workspace { var MyWorkspace = GObject.registerClass(
constructor(metaWorkspace, monitorIndex) { class MyWorkspace extends Workspace.Workspace {
super(metaWorkspace, monitorIndex); _init(metaWorkspace, monitorIndex) {
super._init(metaWorkspace, monitorIndex);
if (metaWorkspace && metaWorkspace.index() < 9) { if (metaWorkspace && metaWorkspace.index() < 9) {
this._tip = new St.Label({ this._tip = new St.Label({
style_class: 'extension-windowsNavigator-window-tooltip', style_class: 'extension-windowsNavigator-window-tooltip',
visible: false, visible: false,
}); });
this.actor.add_actor(this._tip); this.add_actor(this._tip);
this.actor.connect('notify::scale-x', () => { this.connect('notify::scale-x', () => {
this._tip.set_scale(1 / this.actor.scale_x, 1 / this.actor.scale_x); this._tip.set_scale(1 / this.scale_x, 1 / this.scale_x);
}); });
} else { } else {
this._tip = null; this._tip = null;
@@ -67,7 +69,7 @@ var MyWorkspace = class extends Workspace.Workspace {
// Hand code this instead of using _getSpacingAndPadding // Hand code this instead of using _getSpacingAndPadding
// because that fails on empty workspaces // because that fails on empty workspaces
let node = this.actor.get_theme_node(); let node = this.get_theme_node();
let padding = { let padding = {
left: node.get_padding(St.Side.LEFT), left: node.get_padding(St.Side.LEFT),
top: node.get_padding(St.Side.TOP), top: node.get_padding(St.Side.TOP),
@@ -111,11 +113,12 @@ var MyWorkspace = class extends Workspace.Workspace {
this._windowOverlays[i].hideTooltip(); this._windowOverlays[i].hideTooltip();
} }
} }
}; });
var MyWorkspacesView = class extends WorkspacesView.WorkspacesView { var MyWorkspacesView = GObject.registerClass(
constructor(width, height, x, y, workspaces) { class MyWorkspacesView extends WorkspacesView.WorkspacesView {
super(width, height, x, y, workspaces); _init(width, height, x, y, workspaces) {
super._init(width, height, x, y, workspaces);
this._pickWorkspace = false; this._pickWorkspace = false;
this._pickWindow = false; this._pickWindow = false;
@@ -238,7 +241,7 @@ var MyWorkspacesView = class extends WorkspacesView.WorkspacesView {
} }
return false; return false;
} }
}; });
class Extension { class Extension {
constructor() { constructor() {
+5 -6
View File
@@ -15,9 +15,8 @@ const _ = Gettext.gettext;
const WORKSPACE_SCHEMA = 'org.gnome.desktop.wm.preferences'; const WORKSPACE_SCHEMA = 'org.gnome.desktop.wm.preferences';
const WORKSPACE_KEY = 'workspace-names'; const WORKSPACE_KEY = 'workspace-names';
let WindowPreview = GObject.registerClass({ let WindowPreview = GObject.registerClass(
GTypeName: 'WorkspaceIndicatorWindowPreview', class WindowPreview extends St.Button {
}, class WindowPreview extends St.Button {
_init(window) { _init(window) {
super._init({ super._init({
style_class: 'workspace-indicator-window-preview', style_class: 'workspace-indicator-window-preview',
@@ -84,6 +83,7 @@ let WindowPreview = GObject.registerClass({
_relayout() { _relayout() {
let monitor = Main.layoutManager.findIndexForActor(this); let monitor = Main.layoutManager.findIndexForActor(this);
this.visible = monitor === this._window.get_monitor() && this.visible = monitor === this._window.get_monitor() &&
this._window.window_type !== Meta.WindowType.DESKTOP &&
this._window.showing_on_its_workspace(); this._window.showing_on_its_workspace();
if (!this.visible) if (!this.visible)
@@ -103,9 +103,8 @@ let WindowPreview = GObject.registerClass({
} }
}); });
let WorkspaceThumbnail = GObject.registerClass({ let WorkspaceThumbnail = GObject.registerClass(
GTypeName: 'WorkspaceIndicatorWorkspaceThumbnail', class WorkspaceThumbnail extends St.Button {
}, class WorkspaceThumbnail extends St.Button {
_init(index) { _init(index) {
super._init({ super._init({
style_class: 'workspace', style_class: 'workspace',
+1 -1
View File
@@ -1,5 +1,5 @@
project('gnome-shell-extensions', project('gnome-shell-extensions',
version: '3.34.1', version: '3.35.2',
meson_version: '>= 0.44.0', meson_version: '>= 0.44.0',
license: 'GPL2+' license: 'GPL2+'
) )