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
NEWS
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
======
* Adjust to gnome-settings-daemon plugin removals [Xiaoguang; !94]

View File

@@ -22,9 +22,8 @@ const Columns = {
ADJUSTMENT: 4,
};
const Widget = GObject.registerClass({
GTypeName: 'AutoMoveWindowsPrefsWidget',
}, class Widget extends Gtk.Grid {
const Widget = GObject.registerClass(
class Widget extends Gtk.Grid {
_init(params) {
super._init(params);
this.set_orientation(Gtk.Orientation.VERTICAL);

View File

@@ -82,7 +82,8 @@ function cycleScreenshotSizes(display, window, binding) {
// Double both axes if on a hidpi display
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
let nearestIndex;
@@ -105,10 +106,7 @@ function cycleScreenshotSizes(display, window, binding) {
// get the next size up or down from ideal
let newIndex = (nearestIndex + (backwards ? -1 : 1)) % scaledSizes.length;
let newWidth, newHeight;
[newWidth, newHeight] = scaledSizes[newIndex];
if (newWidth > workArea.width || newHeight > workArea.height)
[newWidth, newHeight] = scaledSizes[0];
let [newWidth, newHeight] = scaledSizes[newIndex];
// Push the window onscreen if it would be resized offscreen
let newX = outerRect.x;

View File

@@ -132,9 +132,8 @@ class WindowContextMenu extends PopupMenu.PopupMenu {
}
}
const WindowTitle = GObject.registerClass({
GTypeName: 'WindowListWindowTitle',
}, class WindowTitle extends St.BoxLayout {
const WindowTitle = GObject.registerClass(
class WindowTitle extends St.BoxLayout {
_init(metaWindow) {
this._metaWindow = metaWindow;
@@ -205,7 +204,6 @@ const WindowTitle = GObject.registerClass({
const BaseButton = GObject.registerClass({
GTypeName: 'WindowListBaseButton',
GTypeFlags: GObject.TypeFlags.ABSTRACT,
Properties: {
'ignore-workspace': GObject.ParamSpec.boolean(
@@ -348,9 +346,8 @@ const BaseButton = GObject.registerClass({
});
const WindowButton = GObject.registerClass({
GTypeName: 'WindowListWindowButton',
}, class WindowButton extends BaseButton {
const WindowButton = GObject.registerClass(
class WindowButton extends BaseButton {
_init(metaWindow, perMonitor, monitorIndex) {
super._init(perMonitor, monitorIndex);
@@ -480,9 +477,8 @@ class AppContextMenu extends PopupMenu.PopupMenu {
}
}
const AppButton = GObject.registerClass({
GTypeName: 'WindowListAppButton',
}, class AppButton extends BaseButton {
const AppButton = GObject.registerClass(
class AppButton extends BaseButton {
_init(app, perMonitor, monitorIndex) {
super._init(perMonitor, monitorIndex);
@@ -672,9 +668,8 @@ const AppButton = GObject.registerClass({
});
const WindowList = GObject.registerClass({
GTypeName: 'WindowListWindowList',
}, class WindowList extends St.Widget {
const WindowList = GObject.registerClass(
class WindowList extends St.Widget {
_init(perMonitor, monitor) {
this._perMonitor = perMonitor;
this._monitor = monitor;
@@ -923,11 +918,11 @@ const WindowList = GObject.registerClass({
}
_updateKeyboardAnchor() {
if (!Main.keyboard.actor)
if (!Main.keyboard.keyboardActor)
return;
let translationY = Main.overview.visible ? 0 : this.height;
Main.keyboard.actor.translation_y = -translationY;
Main.keyboard.keyboardActor.translation_y = -translationY;
}
_onAppStateChanged(appSys, app) {

View File

@@ -6,18 +6,17 @@ const Main = imports.ui.main;
const Overview = imports.ui.overview;
const { WorkspacesDisplay } = imports.ui.workspacesView;
let MyWorkspacesDisplay = class extends WorkspacesDisplay {
constructor() {
super();
let MyWorkspacesDisplay = GObject.registerClass(
class MyWorkspacesDisplay extends WorkspacesDisplay {
_init() {
super._init();
this.actor.add_constraint(
this.add_constraint(
new Layout.MonitorConstraint({
primary: true,
work_area: true,
}));
this.actor.connect('destroy', this._onDestroy.bind(this));
this._workareasChangedId = global.display.connect('workareas-changed',
this._onWorkAreasChanged.bind(this));
this._onWorkAreasChanged();
@@ -50,8 +49,8 @@ let MyWorkspacesDisplay = class extends WorkspacesDisplay {
super._updateWorkspacesViews();
this._workspacesViews.forEach(v => {
Main.layoutManager.overviewGroup.remove_actor(v.actor);
Main.windowPicker.add_actor(v.actor);
Main.layoutManager.overviewGroup.remove_actor(v);
Main.windowPicker.add_actor(v);
});
}
@@ -59,11 +58,12 @@ let MyWorkspacesDisplay = class extends WorkspacesDisplay {
if (this._workareasChangedId)
global.display.disconnect(this._workareasChangedId);
this._workareasChangedId = 0;
super._onDestroy();
}
};
});
var WindowPicker = GObject.registerClass({
GTypeName: 'WindowListWindowPicker',
Signals: {
'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);
this._workspacesDisplay = new MyWorkspacesDisplay();
this.add_child(this._workspacesDisplay.actor);
this.add_child(this._workspacesDisplay);
Main.overview.addAction = addActionOrig;
@@ -174,12 +174,12 @@ var WindowPicker = GObject.registerClass({
}
_fakeOverviewAnimation(onComplete) {
Main.overview.animationInProgress = true;
Main.overview._animationInProgress = true;
GLib.timeout_add(
GLib.PRIORITY_DEFAULT,
Overview.ANIMATION_TIME,
() => {
Main.overview.animationInProgress = false;
Main.overview._animationInProgress = false;
if (onComplete)
onComplete();
});
@@ -187,7 +187,7 @@ var WindowPicker = GObject.registerClass({
_fakeOverviewVisible(visible) {
// Fake overview state for WorkspacesDisplay
Main.overview.visible = visible;
Main.overview._visible = visible;
// Hide real windows
Main.layoutManager._inOverview = visible;

View File

@@ -9,9 +9,8 @@ const PopupMenu = imports.ui.popupMenu;
const Gettext = imports.gettext.domain('gnome-shell-extensions');
const _ = Gettext.gettext;
let WindowPreview = GObject.registerClass({
GTypeName: 'WindowListWindowPreview',
}, class WindowPreview extends St.Button {
let WindowPreview = GObject.registerClass(
class WindowPreview extends St.Button {
_init(window) {
super._init({
style_class: 'window-list-window-preview',
@@ -78,6 +77,7 @@ let WindowPreview = GObject.registerClass({
_relayout() {
let monitor = Main.layoutManager.findIndexForActor(this);
this.visible = monitor === this._window.get_monitor() &&
this._window.window_type !== Meta.WindowType.DESKTOP &&
this._window.showing_on_its_workspace();
if (!this.visible)
@@ -97,9 +97,8 @@ let WindowPreview = GObject.registerClass({
}
});
let WorkspaceThumbnail = GObject.registerClass({
GTypeName: 'WindowListWorkspaceThumbnail',
}, class WorkspaceThumbnail extends St.Button {
let WorkspaceThumbnail = GObject.registerClass(
class WorkspaceThumbnail extends St.Button {
_init(index) {
super._init({
style_class: 'workspace',
@@ -204,9 +203,8 @@ let WorkspaceThumbnail = GObject.registerClass({
}
});
var WorkspaceIndicator = GObject.registerClass({
GTypeName: 'WindowListWorkspaceIndicator',
}, class WorkspaceIndicator extends PanelMenu.Button {
var WorkspaceIndicator = GObject.registerClass(
class WorkspaceIndicator extends PanelMenu.Button {
_init() {
super._init(0.0, _('Workspace Indicator'), true);
this.setMenu(new PopupMenu.PopupMenu(this, 0.0, St.Side.BOTTOM));

View File

@@ -6,9 +6,10 @@ const Main = imports.ui.main;
const Workspace = imports.ui.workspace;
const WorkspacesView = imports.ui.workspacesView;
var MyWindowOverlay = class extends Workspace.WindowOverlay {
constructor(windowClone, parentActor) {
super(windowClone, parentActor);
var MyWindowOverlay = GObject.registerClass(
class MyWindowOverlay extends Workspace.WindowOverlay {
_init(windowClone, parentActor) {
super._init(windowClone, parentActor);
this._id = null;
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.raise_top();
}
};
});
var MyWorkspace = class extends Workspace.Workspace {
constructor(metaWorkspace, monitorIndex) {
super(metaWorkspace, monitorIndex);
var MyWorkspace = GObject.registerClass(
class MyWorkspace extends Workspace.Workspace {
_init(metaWorkspace, monitorIndex) {
super._init(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.add_actor(this._tip);
this.actor.connect('notify::scale-x', () => {
this._tip.set_scale(1 / this.actor.scale_x, 1 / this.actor.scale_x);
this.connect('notify::scale-x', () => {
this._tip.set_scale(1 / this.scale_x, 1 / this.scale_x);
});
} else {
this._tip = null;
@@ -67,7 +69,7 @@ var MyWorkspace = class extends Workspace.Workspace {
// Hand code this instead of using _getSpacingAndPadding
// because that fails on empty workspaces
let node = this.actor.get_theme_node();
let node = this.get_theme_node();
let padding = {
left: node.get_padding(St.Side.LEFT),
top: node.get_padding(St.Side.TOP),
@@ -111,11 +113,12 @@ var MyWorkspace = class extends Workspace.Workspace {
this._windowOverlays[i].hideTooltip();
}
}
};
});
var MyWorkspacesView = class extends WorkspacesView.WorkspacesView {
constructor(width, height, x, y, workspaces) {
super(width, height, x, y, workspaces);
var MyWorkspacesView = GObject.registerClass(
class MyWorkspacesView extends WorkspacesView.WorkspacesView {
_init(width, height, x, y, workspaces) {
super._init(width, height, x, y, workspaces);
this._pickWorkspace = false;
this._pickWindow = false;
@@ -238,7 +241,7 @@ var MyWorkspacesView = class extends WorkspacesView.WorkspacesView {
}
return false;
}
};
});
class Extension {
constructor() {

View File

@@ -15,9 +15,8 @@ const _ = Gettext.gettext;
const WORKSPACE_SCHEMA = 'org.gnome.desktop.wm.preferences';
const WORKSPACE_KEY = 'workspace-names';
let WindowPreview = GObject.registerClass({
GTypeName: 'WorkspaceIndicatorWindowPreview',
}, class WindowPreview extends St.Button {
let WindowPreview = GObject.registerClass(
class WindowPreview extends St.Button {
_init(window) {
super._init({
style_class: 'workspace-indicator-window-preview',
@@ -84,6 +83,7 @@ let WindowPreview = GObject.registerClass({
_relayout() {
let monitor = Main.layoutManager.findIndexForActor(this);
this.visible = monitor === this._window.get_monitor() &&
this._window.window_type !== Meta.WindowType.DESKTOP &&
this._window.showing_on_its_workspace();
if (!this.visible)
@@ -103,9 +103,8 @@ let WindowPreview = GObject.registerClass({
}
});
let WorkspaceThumbnail = GObject.registerClass({
GTypeName: 'WorkspaceIndicatorWorkspaceThumbnail',
}, class WorkspaceThumbnail extends St.Button {
let WorkspaceThumbnail = GObject.registerClass(
class WorkspaceThumbnail extends St.Button {
_init(index) {
super._init({
style_class: 'workspace',

View File

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