Skip to content

Commit 1a813a4

Browse files
LinuxHekiLinuxHeki
LinuxHeki
authored andcommitted
Undo fix(tiling) pop-os#1171
1 parent 5220303 commit 1a813a4

10 files changed

+114
-41
lines changed

dark.css

-4
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,3 @@
6060
.pop-shell-tab-urgent {
6161
background: #D00;
6262
}
63-
64-
.pop-shell-entry:indeterminate {
65-
font-style: italic
66-
}

highcontrast.css

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
.pop-shell-active-hint {
2+
border-style: solid;
3+
border-color: #FBB86C;
4+
border-radius: 5px;
5+
box-shadow: inset 0 0 0 1px rgba(24, 23, 23, 0)
6+
}
7+
8+
.pop-shell-overlay {
9+
background-color: rgba(53, 132, 228, 0.3);
10+
}
11+
12+
.pop-shell-border-normal {
13+
border-width: 3px;
14+
}
15+
16+
.pop-shell-border-maximize {
17+
border-width: 3px;
18+
}
19+
20+
.pop-shell-search-element:select{
21+
background: #fff;
22+
border-radius: 5px;
23+
color: #000;
24+
}
25+
26+
.pop-shell-search-icon {
27+
margin-right: 10px;
28+
}
29+
30+
.pop-shell-search-cat {
31+
margin-right: 10px;
32+
}
33+
34+
.pop-shell-search-element {
35+
padding-left: 10px;
36+
padding-right: 2px;
37+
padding-top: 6px;
38+
padding-bottom: 6px;
39+
}
40+
41+
.pop-shell-gaps-entry {
42+
/* Seems to get the width just right to fit 3 digits */
43+
width: 75px;
44+
}
45+
46+
.pop-shell-tab {
47+
border: 1px solid #333;
48+
color: #000;
49+
padding: 0 1em;
50+
}
51+
52+
.pop-shell-tab-active {
53+
background: #FBB86C;
54+
}
55+
56+
.pop-shell-tab-inactive {
57+
background: #9B8E8A;
58+
}
59+
60+
.pop-shell-tab-urgent {
61+
background: #D00;
62+
}
63+
64+
.pop-shell-entry:indeterminate {
65+
font-style: italic
66+
}

light.css

-4
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,3 @@
6060
.pop-shell-tab-urgent {
6161
background: #D00;
6262
}
63-
64-
.pop-shell-entry:indeterminate {
65-
font-style: italic
66-
}

src/auto_tiler.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -685,9 +685,9 @@ export class AutoTiler {
685685
return Err('focused window is not attached');
686686
}
687687

688-
return onto.workspace_id() == win.workspace_id()
688+
return onto.meta.get_monitor() == win.meta.get_monitor() && onto.workspace_id() == win.workspace_id()
689689
? Ok(onto)
690-
: Err('window is not on the same workspace');
690+
: Err('window is not on the same monitor or workspace');
691691
}
692692

693693
private toggle_orientation_(ext: Ext, focused: ShellWindow): Result<void, string> {

src/config.ts

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export const DEFAULT_FLOAT_RULES: Array<FloatRule> = [
3838
{ class: "KotatogramDesktop", title: "Media viewer" },
3939
{ class: "Steam", title: "^((?!Steam).)*$" },
4040
{ class: "TelegramDesktop", title: "Media viewer" },
41+
{ class: "tilda", },
4142
{ class: "Solaar", },
4243
{ class: "system76-driver", },
4344
{ class: "zoom", },

src/extension.ts

+18-9
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ const { Workspace } = imports.ui.workspace;
5252
const { WorkspaceThumbnail } = imports.ui.workspaceThumbnail;
5353
const Tags = Me.imports.tags;
5454

55-
const STYLESHEET_PATHS = ['light', 'dark'].map(stylesheet_path);
55+
const STYLESHEET_PATHS = ['light', 'dark', 'highcontrast'].map(stylesheet_path);
5656
const STYLESHEETS = STYLESHEET_PATHS.map((path) => Gio.File.new_for_path(path));
5757
const GNOME_VERSION = imports.misc.config.PACKAGE_VERSION;
5858

59-
enum Style { Light, Dark }
59+
enum Style { Light, Dark, HighContrast }
6060

6161
interface Display {
6262
area: Rectangle;
@@ -108,7 +108,7 @@ export class Ext extends Ecs.System<ExtEvent> {
108108
column_size: number = 32;
109109

110110
/** The currently-loaded theme variant */
111-
current_style: Style = this.settings.is_dark_shell() ? Style.Dark : Style.Light;
111+
current_style: Style = Style.Dark;
112112

113113
/** Set when the display configuration has been triggered for execution */
114114
displays_updating: SignalID | null = null;
@@ -215,6 +215,7 @@ export class Ext extends Ecs.System<ExtEvent> {
215215
super(new Executor.GLibExecutor());
216216

217217
this.load_settings();
218+
this.reload_theme()
218219

219220
this.register_fn(() => load_theme(this.current_style));
220221

@@ -249,8 +250,8 @@ export class Ext extends Ecs.System<ExtEvent> {
249250
for (const window of this.tab_list(Meta.TabList.NORMAL, null)) {
250251
wins.push([
251252
window.entity,
252-
window.meta.get_title(),
253-
window.name(this),
253+
window.title(),
254+
window.name(this)
254255
])
255256
}
256257

@@ -500,7 +501,7 @@ export class Ext extends Ecs.System<ExtEvent> {
500501
let wmclass = win.meta.get_wm_class();
501502
if (wmclass) this.conf.add_window_exception(
502503
wmclass,
503-
win.meta.get_title()
504+
win.title()
504505
);
505506
this.exception_dialog()
506507
},
@@ -1379,11 +1380,19 @@ export class Ext extends Ecs.System<ExtEvent> {
13791380
}
13801381

13811382
on_gtk_shell_changed() {
1382-
load_theme(this.settings.is_dark_shell() ? Style.Dark : Style.Light);
1383+
this.reload_theme();
1384+
load_theme(this.current_style)
13831385
}
13841386

13851387
on_gtk_theme_change() {
1386-
load_theme(this.settings.is_dark_shell() ? Style.Dark : Style.Light);
1388+
this.reload_theme()
1389+
load_theme(this.current_style)
1390+
}
1391+
1392+
reload_theme() {
1393+
this.current_style = this.settings.is_dark()
1394+
? Style.Dark
1395+
: this.settings.is_high_contrast() ? Style.HighContrast : Style.Light
13871396
}
13881397

13891398
/** Handle window maximization notifications */
@@ -2048,7 +2057,7 @@ export class Ext extends Ecs.System<ExtEvent> {
20482057
let actor = window.meta.get_compositor_private();
20492058
if (actor) {
20502059
if (!window.meta.minimized) {
2051-
tiler.auto_tile(this, window, true);
2060+
tiler.auto_tile(this, window, false);
20522061
}
20532062
}
20542063
}

src/mod.d.ts

+1-1
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/settings.ts

+17-17
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
const ExtensionUtils = imports.misc.extensionUtils;
2-
const extension = ExtensionUtils.getCurrentExtension();
1+
const Me = imports.misc.extensionUtils.getCurrentExtension();
2+
33
const { Gio, Gdk } = imports.gi;
44

55
const DARK = ["dark", "adapta", "plata", "dracula"]
@@ -31,7 +31,7 @@ function settings_new_id(schema_id: string): Settings | null {
3131

3232
function settings_new_schema(schema: string): Settings {
3333
const GioSSS = Gio.SettingsSchemaSource;
34-
const schemaDir = extension.dir.get_child("schemas");
34+
const schemaDir = Me.dir.get_child("schemas");
3535

3636
let schemaSource = schemaDir.query_exists(null) ?
3737
GioSSS.new_from_directory(schemaDir.get_path(), GioSSS.get_default(), false) :
@@ -41,7 +41,7 @@ function settings_new_schema(schema: string): Settings {
4141

4242
if (!schemaObj) {
4343
throw new Error("Schema " + schema + " could not be found for extension "
44-
+ extension.metadata.uuid + ". Please check your installation.")
44+
+ Me.metadata.uuid + ". Please check your installation.")
4545
}
4646

4747
return new Gio.Settings({ settings_schema: schemaObj });
@@ -62,7 +62,7 @@ const LOG_LEVEL = "log-level";
6262
const SHOW_SKIPTASKBAR = "show-skip-taskbar";
6363

6464
export class ExtensionSettings {
65-
ext: Settings = settings_new_schema(extension.metadata["settings-schema"]);
65+
ext: Settings = settings_new_schema(Me.metadata["settings-schema"]);
6666
int: Settings | null = settings_new_id("org.gnome.desktop.interface");
6767
mutter: Settings | null = settings_new_id("org.gnome.mutter");
6868
shell: Settings | null = settings_new_id("org.gnome.shell.extensions.user-theme");
@@ -100,21 +100,21 @@ export class ExtensionSettings {
100100
return rgba;
101101
}
102102

103-
is_dark(): boolean {
104-
if (this.int) {
105-
let theme = this.int.get_string("gtk-theme").toLowerCase();
106-
return DARK.some(dark => theme.includes(dark))
107-
}
103+
theme(): string {
104+
return this.shell
105+
? this.shell.get_string("name")
106+
: this.int
107+
? this.int.get_string("gtk-theme")
108+
: "Adwaita"
109+
}
108110

109-
return false
111+
is_dark(): boolean {
112+
const theme = this.theme().toLowerCase()
113+
return DARK.some(dark => theme.includes(dark))
110114
}
111115

112-
is_dark_shell(): boolean {
113-
if (this.shell) {
114-
let theme = this.shell.get_string("name").toLowerCase()
115-
return DARK.some(dark => theme.includes(dark) || theme.length === 0)
116-
}
117-
return this.is_dark();
116+
is_high_contrast(): boolean {
117+
return this.theme().toLowerCase() === "highcontrast"
118118
}
119119

120120
row_size(): number {

src/stack.ts

+3-3
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

+6-1
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)