Skip to content

Commit 87389d8

Browse files
committed
Bug fixes
1 parent 1fcc279 commit 87389d8

7 files changed

Lines changed: 3107 additions & 2258 deletions

File tree

src/gui/config_dialog.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ def auto_position(self, sorted_windows: list[str]) -> None:
671671

672672

673673
def _calculate_offsets(self, x: int, y: int, w: int, h: int, title: str) -> tuple[int, int, int, int, str]:
674-
pure_title = clean_window_title(title)[0].lower()
674+
pure_title = clean_window_title(title)[0]
675675
if pure_title in self.auto_align_offsets:
676676
new_x = x + self.auto_align_offsets[pure_title][0]
677677
new_y = y + self.auto_align_offsets[pure_title][1]

src/gui/pyside_gui_manager.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,10 @@ def __init__(
112112
self.details,
113113
self.hotkey,
114114
self.layouts,
115-
self.overrides) = self.cfg_man.load_settings()
115+
self.overrides,
116+
self.ignored_windows) = self.cfg_man.load_settings()
117+
118+
self.win_man.ignored_windows = self.ignored_windows
116119

117120
self._init_screen()
118121
self._init_ui_containers()
@@ -684,6 +687,7 @@ def _save_settings(self) -> None:
684687
hotkey=self.hotkey,
685688
layouts=self.layouts,
686689
overrides=self.overrides,
690+
ignored_windows=self.ignored_windows,
687691
)
688692

689693
def reapply_timer(self) -> None:
@@ -938,9 +942,6 @@ def toggle_compact(self, startup: int = 0) -> None:
938942
self.compact_mode = not self.compact_mode
939943
self._save_settings()
940944

941-
font_size = text_small.pointSize() if self.compact_mode else text_normal.pointSize()
942-
self.setStyleSheet(f"QWidget {{ font-size: {font_size}pt; }}")
943-
944945
if self.compact_mode:
945946
self.toggle_compact_button.setText("Full mode")
946947
self.aot_button.setText("AOT")
@@ -955,6 +956,8 @@ def toggle_compact(self, startup: int = 0) -> None:
955956
self.setMinimumSize(min_width, min_height)
956957
self._position_app_window()
957958
self.on_config_select()
959+
self._apply_theme()
960+
958961

959962
def _position_app_window(self) -> None:
960963
width, height, _, _ = self.get_geometry_and_minsize()
@@ -1094,7 +1097,7 @@ def _apply_settings_logic(self, *, reapply: bool) -> None:
10941097
hwnd = window["hwnd"]
10951098
self.win_man.add_managed_window(hwnd)
10961099

1097-
settings = self.win_man.get_window_metrics(hwnd)
1100+
settings = config_to_metrics(self.applied_config, window["short_name"])
10981101
if settings:
10991102
self.win_man.apply_window_config(settings, hwnd)
11001103
else:
@@ -1145,7 +1148,7 @@ def _reapply_worker_logic(self) -> None:
11451148
win_match_config = self.verify_window_data(self.applied_config, matching)
11461149
for win in win_match_config:
11471150
if not win["identical"]:
1148-
settings = self.win_man.get_window_metrics(win["hwnd"])
1151+
settings = config_to_metrics(self.applied_config, win["short_name"])
11491152
if settings:
11501153
self.win_man.apply_window_config(settings, win["hwnd"])
11511154
else:

src/uwp_config.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from configparser import ConfigParser
1010
from pathlib import Path
1111

12-
from uwp_constants import AOT_HOTKEY, LayoutDefaults
12+
from uwp_constants import AOT_HOTKEY, IGNORED_WINDOWS, LayoutDefaults
1313

1414
# Local imports
1515
from uwp_utils import clean_window_title, format_coords, match_titles, parse_coords
@@ -143,9 +143,9 @@ def load_config(self, config_path:str)-> ConfigParser | None:
143143
return None
144144

145145

146-
def load_settings(self)-> tuple[bool,bool,int,bool, str, dict, dict]:
146+
def load_settings(self)-> tuple[bool,bool,int,bool, str, dict, dict, list]:
147147
"""Load application settings, layouts, and overrides."""
148-
defaults = False, False, 0, False, AOT_HOTKEY, self.default_layouts, self.layout_overrides
148+
defaults = False, False, 0, False, AOT_HOTKEY, self.default_layouts, self.layout_overrides, IGNORED_WINDOWS
149149
if Path.exists(self.settings_file):
150150
with Path.open(self.settings_file) as f:
151151
try:
@@ -159,9 +159,12 @@ def load_settings(self)-> tuple[bool,bool,int,bool, str, dict, dict]:
159159

160160
layouts = settings.get("layouts", self.default_layouts)
161161
overrides = settings.get("overrides", self.layout_overrides)
162+
ignored_windows = settings.get("ignored_windows", [])
163+
162164
except (json.decoder.JSONDecodeError, AttributeError):
163165
return defaults
164-
return compact, use_images, snap, details, hotkey, layouts, overrides
166+
return compact, use_images, snap, details, hotkey, layouts, overrides, ignored_windows
167+
165168
return defaults
166169

167170

@@ -173,6 +176,7 @@ def save_settings(self, *, # noqa: PLR0913
173176
hotkey:str=AOT_HOTKEY,
174177
layouts:dict | None=None,
175178
overrides:dict | None=None,
179+
ignored_windows:list | None=None,
176180
)->bool:
177181
"""Save application settings, optionally including layouts and overrides."""
178182
settings = {
@@ -187,6 +191,7 @@ def save_settings(self, *, # noqa: PLR0913
187191

188192
settings["layouts"] = layouts or self.default_layouts
189193
settings["overrides"] = overrides or self.layout_overrides
194+
settings["ignored_windows"] = ignored_windows or []
190195

191196
with Path.open(self.settings_file, "w") as f:
192197
json.dump(settings, f, indent=4)

src/uwp_constants.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
AOT_HOTKEY = "alt+home"
44

5+
IGNORED_WINDOWS = [
6+
"ultrawide window positioner",
7+
"program manager",
8+
"windows input experience",
9+
"microsoft text input application",
10+
"settings",
11+
"windows shell experience host",
12+
]
13+
14+
515
class LayoutDefaults:
616
"""Default layouts."""
717

@@ -206,3 +216,4 @@ class Fonts:
206216

207217
TEXT_NORMAL = ("Consolas", 10, "normal")
208218
TEXT_SMALL = ("Consolas", 8, "normal")
219+

0 commit comments

Comments
 (0)