Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error 'metaWindow.get_title is not a function' #344

Merged
merged 3 commits into from
Feb 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 10 additions & 13 deletions lib/extension/window.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,8 @@ export class WindowManager extends GObject.Object {
Logger.info("forge initialized");
}

addFloatOverride(metaWindow, nonPersistent) {
addFloatOverride(metaWindow, withWmId) {
let overrides = this.windowProps.overrides;
let wmTitle = metaWindow.get_title();
let wmClass = metaWindow.get_wm_class();
let wmId = metaWindow.get_id();

Expand All @@ -89,26 +88,24 @@ export class WindowManager extends GObject.Object {
}
overrides.push({
wmClass: wmClass,
wmId: nonPersistent ? wmId : undefined,
wmId: withWmId ? wmId : undefined,
mode: "float",
});
this.windowProps.overrides = overrides;
this.ext.configMgr.windowProps = this.windowProps;
}

removeFloatOverride(metaWindow, nonPersistent) {
removeFloatOverride(metaWindow, withWmId) {
let overrides = this.windowProps.overrides;
let wmTitle = metaWindow.get_title();
let wmClass = metaWindow.get_wm_class();
let wmId = metaWindow.get_id();

overrides = overrides.filter(
(override) =>
!(
override.wmClass === wmClass &&
// rules with a Title are written by the user and peristent
!override.wmTitle &&
// persistent or tagged as tmp
(!nonPersistent || override.wmId === wmId)
(!withWmId || override.wmId === wmId)
)
);

Expand All @@ -121,18 +118,18 @@ export class WindowManager extends GObject.Object {
if (!nodeWindow || !(action || action.mode)) return;
if (nodeWindow.nodeType !== NODE_TYPES.WINDOW) return;

let nonPersistent = action.name === "FloatToggle";
let withWmId = action.name === "FloatToggle";
let floatingExempt = this.isFloatingExempt(metaWindow);

if (floatingExempt) {
this.removeFloatOverride(metaWindow, nonPersistent);
this.removeFloatOverride(metaWindow, withWmId);
if (!this.isActiveWindowWorkspaceTiled(metaWindow)) {
nodeWindow.mode = WINDOW_MODES.FLOAT;
} else {
nodeWindow.mode = WINDOW_MODES.TILE;
}
} else {
this.addFloatOverride(metaWindow, nonPersistent);
this.addFloatOverride(metaWindow, withWmId);
nodeWindow.mode = WINDOW_MODES.FLOAT;
}
}
Expand Down Expand Up @@ -1614,10 +1611,10 @@ export class WindowManager extends GObject.Object {
let nodeWindow;
nodeWindow = this.tree.findNodeByActor(actor);

if (nodeWindow) {
if (nodeWindow?.isWindow()) {
this.tree.removeNode(nodeWindow);
this.renderTree("window-destroy-quick", true);
this.removeFloatOverride(nodeWindow, false, true);
this.removeFloatOverride(nodeWindow.nodeValue, true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has the signature of this function changed it just the variable name?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The signature of removeFloatOverride has been changed in another patch and hasn't been changed here

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @bennypowers, do you have any concerns on the function signature change?

Hey @p1gp1g, I can update your role so you can merge. Just need someone to test looks OK or need evidence (screencap) that this is working fine.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No the signature change doesn't bother me; it's just not immediately clear from this PR why this change was made here

If OP wants bonus marks, split that line into a separate commit with a detailed message

But that's not something which should hold up the merge.

If other reviewers have run this and found it acceptable, I'm good with it

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, just found out that I can add per repository role maintain access to all of you in settings.

}

// find the next attachNode here
Expand Down