Skip to content

Commit

Permalink
fix(launcher): Empty window list with Spotify Flatpak
Browse files Browse the repository at this point in the history
Spotify Flatpak returns `null` for `meta.get_title()`. Use window name instead.
  • Loading branch information
mmstick committed Oct 12, 2021
1 parent 7a80d8b commit e7f3024
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,8 @@ export class Ext extends Ecs.System<ExtEvent> {
for (const window of this.tab_list(Meta.TabList.NORMAL, null)) {
wins.push([
window.entity,
window.meta.get_title(),
window.name(this),
window.title(),
window.name(this)
])
}

Expand Down Expand Up @@ -501,7 +501,7 @@ export class Ext extends Ecs.System<ExtEvent> {
let wmclass = win.meta.get_wm_class();
if (wmclass) this.conf.add_window_exception(
wmclass,
win.meta.get_title()
win.title()
);
this.exception_dialog()
},
Expand Down
2 changes: 1 addition & 1 deletion src/mod.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ declare namespace Meta {
get_pid(): number;
get_role(): null | string;
get_stable_sequence(): number;
get_title(): string;
get_title(): null | string;
get_transient_for(): Window | null;
get_user_time(): number;
get_wm_class(): string | null;
Expand Down
6 changes: 3 additions & 3 deletions src/stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export class Stack {
if (!this.widgets) return;

const entity = window.entity;
const label = window.meta.get_title();
const label = window.title()
const active = Ecs.entity_eq(entity, this.active);

const button: St.Button = new St.Button({
Expand Down Expand Up @@ -421,7 +421,7 @@ export class Stack {
}

this.watch_signals(this.active_id, c.button, window);
this.buttons.get(c.button)?.set_label(window.meta.get_title());
this.buttons.get(c.button)?.set_label(window.title());
this.activate(window.entity);
}
}
Expand Down Expand Up @@ -576,7 +576,7 @@ export class Stack {
this.tabs[comp].signals = [
window.meta.connect('notify::title', () => {
this.window_exec(comp, entity, (window) => {
this.buttons.get(button)?.set_label(window.meta.get_title())
this.buttons.get(button)?.set_label(window.title())
});
}),

Expand Down
7 changes: 6 additions & 1 deletion src/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ export class ShellWindow {
// If a window lacks a class, it's probably a web browser dialog
&& wm_class !== null
// Blacklist any windows that happen to leak through our filter
&& !ext.conf.window_shall_float(wm_class, this.meta.get_title());
&& !ext.conf.window_shall_float(wm_class, this.title());
};

return !ext.contains_tag(this.entity, Tags.Floating)
Expand Down Expand Up @@ -402,6 +402,11 @@ export class ShellWindow {
this.move(ext, br, () => place_pointer_on(this.ext.conf.default_pointer_position, this.meta));
}

title(): string {
const title = this.meta.get_title();
return title ? title : this.name(this.ext)
}


wm_role(): string | null {
return this.extra.wm_role_.get_or_init(() => {
Expand Down

0 comments on commit e7f3024

Please sign in to comment.