From 7e815d4a51bd5fad897734d4fda42244ab279027 Mon Sep 17 00:00:00 2001 From: Sho Date: Sun, 2 Aug 2026 15:03:56 +0900 Subject: [PATCH] fix: restore Feishin window dimension persistence and default to 1280x800 --- install.sh | 10 +++++++++- quickshell/services/python/theme_sync.py | 17 ++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 1cbea88..de7c412 100755 --- a/install.sh +++ b/install.sh @@ -440,17 +440,25 @@ if os.path.exists(var_app): for td in target_dirs: if os.path.exists(td): - # Clean up / sanitize invalid Electron theme strings in config.json, preferences.json, settings.json + # Clean up / sanitize invalid Electron theme strings and ensure comfortable window bounds for fn in ['config.json', 'preferences.json', 'settings.json']: fp = os.path.join(td, fn) if os.path.exists(fp): try: with open(fp, 'r', encoding='utf-8') as f: data = json.load(f) if isinstance(data, dict): + mod = False if list(data.keys()) == ['theme'] and data['theme'] not in ['dark', 'light', 'system', 'defaultDark', 'defaultLight']: os.remove(fp) + continue elif 'theme' in data and data['theme'] not in ['dark', 'light', 'system', 'defaultDark', 'defaultLight']: data['theme'] = 'dark' + mod = True + bounds = data.get('bounds', {}) + if isinstance(bounds, dict) and (bounds.get('width', 0) < 1000 or bounds.get('height', 0) < 700): + data['bounds'] = {'x': bounds.get('x', 50), 'y': bounds.get('y', 50), 'width': 1280, 'height': 800} + mod = True + if mod: with open(fp, 'w', encoding='utf-8') as f: json.dump(data, f, indent=2) except Exception: pass " 2>/dev/null || true diff --git a/quickshell/services/python/theme_sync.py b/quickshell/services/python/theme_sync.py index 02f0c23..be25b5a 100644 --- a/quickshell/services/python/theme_sync.py +++ b/quickshell/services/python/theme_sync.py @@ -1298,7 +1298,7 @@ def sync_feishin(bg, surface, current_line, fg, accent, sub_accent, is_dark, var with open(os.path.join(themes_dir, "quickshell.json"), 'w', encoding='utf-8') as f: json.dump(qs_json, f, indent=2) - # Ensure config.json, preferences.json, and settings.json maintain valid Electron themeSource ("dark" or "light") + # Ensure config.json, preferences.json, and settings.json maintain valid Electron themeSource ("dark" or "light") and comfortable window bounds valid_electron_theme = "dark" if is_dark else "light" for conf_file_name in ['config.json', 'preferences.json', 'settings.json']: conf_path = os.path.join(base_dir, conf_file_name) @@ -1307,10 +1307,25 @@ def sync_feishin(bg, surface, current_line, fg, accent, sub_accent, is_dark, var with open(conf_path, 'r', encoding='utf-8') as f: cdata = json.load(f) if isinstance(cdata, dict): + modified = False if list(cdata.keys()) == ['theme'] and cdata['theme'] not in ['dark', 'light', 'system', 'defaultDark', 'defaultLight']: os.remove(conf_path) + continue elif 'theme' in cdata and cdata['theme'] not in ['dark', 'light', 'system', 'defaultDark', 'defaultLight']: cdata['theme'] = valid_electron_theme + modified = True + + bounds = cdata.get('bounds', {}) + if isinstance(bounds, dict) and (bounds.get('width', 0) < 1000 or bounds.get('height', 0) < 700): + cdata['bounds'] = { + 'x': bounds.get('x', 50), + 'y': bounds.get('y', 50), + 'width': 1280, + 'height': 800 + } + modified = True + + if modified: with open(conf_path, 'w', encoding='utf-8') as f: json.dump(cdata, f, indent=2) except Exception: