Skip to content

Commit e7f3024

Browse files
committed
fix(launcher): Empty window list with Spotify Flatpak
Spotify Flatpak returns `null` for `meta.get_title()`. Use window name instead.
1 parent 7a80d8b commit e7f3024

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

src/extension.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,8 @@ export class Ext extends Ecs.System<ExtEvent> {
250250
for (const window of this.tab_list(Meta.TabList.NORMAL, null)) {
251251
wins.push([
252252
window.entity,
253-
window.meta.get_title(),
254-
window.name(this),
253+
window.title(),
254+
window.name(this)
255255
])
256256
}
257257

@@ -501,7 +501,7 @@ export class Ext extends Ecs.System<ExtEvent> {
501501
let wmclass = win.meta.get_wm_class();
502502
if (wmclass) this.conf.add_window_exception(
503503
wmclass,
504-
win.meta.get_title()
504+
win.title()
505505
);
506506
this.exception_dialog()
507507
},

src/mod.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ declare namespace Meta {
195195
get_pid(): number;
196196
get_role(): null | string;
197197
get_stable_sequence(): number;
198-
get_title(): string;
198+
get_title(): null | string;
199199
get_transient_for(): Window | null;
200200
get_user_time(): number;
201201
get_wm_class(): string | null;

src/stack.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export class Stack {
9292
if (!this.widgets) return;
9393

9494
const entity = window.entity;
95-
const label = window.meta.get_title();
95+
const label = window.title()
9696
const active = Ecs.entity_eq(entity, this.active);
9797

9898
const button: St.Button = new St.Button({
@@ -421,7 +421,7 @@ export class Stack {
421421
}
422422

423423
this.watch_signals(this.active_id, c.button, window);
424-
this.buttons.get(c.button)?.set_label(window.meta.get_title());
424+
this.buttons.get(c.button)?.set_label(window.title());
425425
this.activate(window.entity);
426426
}
427427
}
@@ -576,7 +576,7 @@ export class Stack {
576576
this.tabs[comp].signals = [
577577
window.meta.connect('notify::title', () => {
578578
this.window_exec(comp, entity, (window) => {
579-
this.buttons.get(button)?.set_label(window.meta.get_title())
579+
this.buttons.get(button)?.set_label(window.title())
580580
});
581581
}),
582582

src/window.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ export class ShellWindow {
298298
// If a window lacks a class, it's probably a web browser dialog
299299
&& wm_class !== null
300300
// Blacklist any windows that happen to leak through our filter
301-
&& !ext.conf.window_shall_float(wm_class, this.meta.get_title());
301+
&& !ext.conf.window_shall_float(wm_class, this.title());
302302
};
303303

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

405+
title(): string {
406+
const title = this.meta.get_title();
407+
return title ? title : this.name(this.ext)
408+
}
409+
405410

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

0 commit comments

Comments
 (0)