diff --git a/CHANGELOG.md b/CHANGELOG.md index c293b48..b3a9245 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -78,8 +78,10 @@ is missing or empty. default apps, kernels, installing and removing software, security setup and more. Docker's entries show once Docker is installed. - Focus shows as a bell in the status bar and on the lock screen while on. -- Title bars can be hidden on maximized windows (Settings > Behaviour); - floating windows keep theirs. +- Maximized windows have no title bar, as on a tablet; Settings > + Behaviour brings them back. Floating windows keep theirs. +- The control center's pages slide in smoothly: Wi-Fi no longer pauses + halfway while it looks for networks. - The notification center slides down from the top when the clock is clicked, as when it is pulled. - About shows an icon on its renderer line, as on every other. diff --git a/desktop/shell/bin/omarchy-labwc-window-rules b/desktop/shell/bin/omarchy-labwc-window-rules index 9ad60da..90eb931 100755 --- a/desktop/shell/bin/omarchy-labwc-window-rules +++ b/desktop/shell/bin/omarchy-labwc-window-rules @@ -9,8 +9,9 @@ # maximized; About (org.omarchy.about) and Omacalc keep their own size, # which fits what they show, except on a phone, where every window fills # the screen. -# Title bars when maximized (on unless window-titlebars-off): off, a -# maximized window has none; a floating one keeps its own, for a mouse. +# Title bars when maximized (off unless window-titlebars-on): off, a +# maximized window has none, as on a tablet; a floating one keeps its +# own, for a mouse. set -euo pipefail toggles=$HOME/.local/state/omarchy/toggles rules=$HOME/.local/state/omarchy/xdg-config/labwc/rc.xml @@ -51,7 +52,9 @@ if [[ ! -e $toggles/maximize-windows-off ]]; then fi fi bare= -[[ ! -e $toggles/window-titlebars-off ]] || bare=1 +# The flag for "off" from when title bars were on by default. +rm -f "$toggles/window-titlebars-off" +[[ -e $toggles/window-titlebars-on ]] || bare=1 if ((${#rows[@]} == 0)) && [[ -z $bare ]]; then rm -f "$rules" diff --git a/desktop/shell/bin/omarchy-toggle-window-titlebars b/desktop/shell/bin/omarchy-toggle-window-titlebars index 331b8fe..d602062 100755 --- a/desktop/shell/bin/omarchy-toggle-window-titlebars +++ b/desktop/shell/bin/omarchy-toggle-window-titlebars @@ -1,18 +1,19 @@ #!/bin/bash # omarchy:summary=Show title bars on maximized windows, or not -# On by default: a window's title bar holds its name and its buttons, for a -# mouse. Turned off, the window-titlebars-off flag says so and a maximized -# window has none (omarchy-labwc-window-rules); it then closes from the -# overview or with its app's own controls. A floating window keeps its own. +# Off by default, as on a tablet: a maximized window has no title bar +# (omarchy-labwc-window-rules) and closes from the overview or with its +# app's own controls. Turned on, the window-titlebars-on flag says so and +# maximized windows get their name and buttons back, for a mouse. A +# floating window always keeps its own. set -euo pipefail # Beside this command, as installed and in the source tree alike. rules=${BASH_SOURCE[0]%/*}/omarchy-labwc-window-rules [[ $# == 0 ]] || { echo 'Usage: omarchy-toggle-window-titlebars' >&2; exit 2; } toggles=$HOME/.local/state/omarchy/toggles -off=$toggles/window-titlebars-off +on=$toggles/window-titlebars-on mkdir -p "$toggles" -if [[ -e $off ]]; then rm -f "$off"; else : >"$off"; fi +if [[ -e $on ]]; then rm -f "$on"; else : >"$on"; fi "$rules" labwc=${LABWC_PID:-$(pgrep -u "$(id -u)" -x labwc | head -1 || true)} [[ -z $labwc ]] || kill -HUP "$labwc" diff --git a/desktop/shell/default/omarchy/omarchy-menu.jsonc b/desktop/shell/default/omarchy/omarchy-menu.jsonc index 22d2007..fff89ff 100644 --- a/desktop/shell/default/omarchy/omarchy-menu.jsonc +++ b/desktop/shell/default/omarchy/omarchy-menu.jsonc @@ -166,8 +166,8 @@ "trigger.toggle.maximize-windows-on": {"icon":"󰊓","label":"Maximize Windows On","when":"omarchy-toggle-enabled maximize-windows-off","action":"omarchy-toggle-maximize-windows"}, "trigger.toggle.maximize-windows-off": {"icon":"󰊓","label":"Maximize Windows Off","when":"! omarchy-toggle-enabled maximize-windows-off","action":"omarchy-toggle-maximize-windows"}, // Orchard: labwc's title bars on maximized windows; off, those have none (omarchy-labwc-window-rules). - "trigger.toggle.window-titlebars-on": {"icon":"󰖯","label":"Show Title Bars When Maximized","when":"omarchy-toggle-enabled window-titlebars-off","action":"omarchy-toggle-window-titlebars"}, - "trigger.toggle.window-titlebars-off": {"icon":"󰖯","label":"Hide Title Bars When Maximized","when":"! omarchy-toggle-enabled window-titlebars-off","action":"omarchy-toggle-window-titlebars"}, + "trigger.toggle.window-titlebars-on": {"icon":"󰖯","label":"Show Title Bars When Maximized","when":"! omarchy-toggle-enabled window-titlebars-on","action":"omarchy-toggle-window-titlebars"}, + "trigger.toggle.window-titlebars-off": {"icon":"󰖯","label":"Hide Title Bars When Maximized","when":"omarchy-toggle-enabled window-titlebars-on","action":"omarchy-toggle-window-titlebars"}, "trigger.toggle.idle-lock-on": {"icon":"","label":"Stay Awake","when":"[[ ! -f ~/.local/state/omarchy/indicators/stay-awake ]]","action":"omarchy-toggle-idle"}, "trigger.toggle.idle-lock-off": {"icon":"","label":"Allow Sleep","when":"[[ -f ~/.local/state/omarchy/indicators/stay-awake ]]","action":"omarchy-toggle-idle"}, "trigger.toggle.notifications-on": {"icon":"󰂛","label":"Notifications On","when":"[[ $(omarchy-shell notifications isDnd) == on ]]","action":"omarchy-toggle-notification-silencing"}, diff --git a/desktop/shell/shell/controlcenter/ControlCenter.qml b/desktop/shell/shell/controlcenter/ControlCenter.qml index 50bf1cb..f8a2f20 100644 --- a/desktop/shell/shell/controlcenter/ControlCenter.qml +++ b/desktop/shell/shell/controlcenter/ControlCenter.qml @@ -168,26 +168,50 @@ Item { property var page: null // 0 on the main view, 1 on the page; the push in between. property real pageShift: 0 + // The push owes nothing to the page: the page is built and drawn once + // before it starts, and is told it is shown (Wi-Fi's scan, the status + // reads) only once it is in place, so neither building it nor what it + // refreshes can hold up a frame of the slide. NumberAnimation { id: pageSlide target: root property: "pageShift" duration: Style.duration(300) easing.type: Easing.OutCubic - onFinished: if (root.pageShift === 0) root.dropPage() + onFinished: { + if (root.pageShift === 0) root.dropPage() + else if (root.page) root.page.hostShown = true + } + } + // Waits two frames (the one that builds the page, the one that draws it) + // before the push. + FrameAnimation { + id: pageBuilt + running: false + onTriggered: { + if (currentFrame < 2) return + stop() + pageSlide.to = 1 + pageSlide.restart() + } } function showPage(panelForPage) { if (!root.opened) root.open() if (root.page && root.page !== panelForPage) root.page.hostShown = false + var fresh = root.page !== panelForPage || root.pageShift === 0 root.page = panelForPage - panelForPage.hostShown = true - pageSlide.to = 1 - pageSlide.restart() + if (fresh && !pageSlide.running) { + pageBuilt.restart() + } else { + pageSlide.to = 1 + pageSlide.restart() + } Qt.callLater(function() { if (pageLoader.item) pageLoader.item.forceActiveFocus() }) } function leavePage(panelForPage) { if (root.page !== panelForPage) return + pageBuilt.stop() pageSlide.to = 0 pageSlide.restart() keyCatcher.forceActiveFocus() diff --git a/tests/test_menu_toggles.py b/tests/test_menu_toggles.py index 7de4765..9e8cf46 100644 --- a/tests/test_menu_toggles.py +++ b/tests/test_menu_toggles.py @@ -53,6 +53,12 @@ def assert_maximizes(self, rules, phone=False): kept = tree.findall("./windowRules/windowRule[@identifier='%s']/action[@name='UnMaximize']" % app) self.assertEqual(len(kept), 1, app) + def assert_no_maximize(self, rules): + # Only the title bar rule is left (title bars are off by default). + tree = ET.fromstring(rules.read_bytes()) + self.assertEqual(tree.findall('./windowRules'), []) + self.assertEqual(len(tree.findall("./theme/maximizedDecoration")), 1) + def test_maximize_windows_is_on_until_turned_off(self): off = self.home / '.local/state/omarchy/toggles/maximize-windows-off' rules = self.home / '.local/state/omarchy/xdg-config/labwc/rc.xml' @@ -69,13 +75,14 @@ def test_maximize_windows_is_on_until_turned_off(self): self.assertEqual(labwc.wait(5), -1) # SIGHUP self.assertEqual(off.exists(), not expect_on) self.assertEqual(self.toggle_enabled('maximize-windows-off'), 1 if expect_on else 0) - self.assertEqual(rules.exists(), expect_on) if expect_on: self.assert_maximizes(rules) + else: + self.assert_no_maximize(rules) # Turned off, a login keeps it off. self.run_bin('omarchy-toggle-maximize-windows') self.run_bin('omarchy-toggle-maximize-windows', '--apply') - self.assertFalse(rules.exists()) + self.assert_no_maximize(rules) self.assertFalse((self.home / '.config').exists()) def test_on_a_phone_about_and_omacalc_fill_the_screen_too(self): @@ -124,29 +131,30 @@ def test_session_merges_the_toggle_config_into_labwc(self): code = [line for line in toggle.splitlines() if not line.lstrip().startswith('#')] self.assertFalse([line for line in code if '.config/labwc' in line]) - def test_title_bars_are_on_until_turned_off(self): + def test_title_bars_are_off_until_turned_on(self): rules = self.home / '.local/state/omarchy/xdg-config/labwc/rc.xml' undecorated = "./theme/maximizedDecoration[.='none']" + # The old flag for "off" from when they were on by default goes. + old = self.home / '.local/state/omarchy/toggles/window-titlebars-off' + old.parent.mkdir(parents=True) + old.touch() self.run_bin('omarchy-toggle-maximize-windows', '--apply') - self.assertEqual(ET.fromstring(rules.read_bytes()).findall(undecorated), []) - labwc = subprocess.Popen(['sleep', '30']) - try: - result = self.run_bin('omarchy-toggle-window-titlebars', LABWC_PID=str(labwc.pid)) - self.assertEqual(result.returncode, 0, result.stderr) - tree = ET.fromstring(rules.read_bytes()) - self.assertEqual(len(tree.findall(undecorated)), 1) - # Both toggles' rules live in the one file. - self.assertEqual(len(tree.findall("./windowRules/windowRule[@identifier='*']/action[@name='Maximize']")), 1) - finally: - labwc.kill() - labwc.wait() - labwc = subprocess.Popen(['sleep', '30']) - try: - self.run_bin('omarchy-toggle-window-titlebars', LABWC_PID=str(labwc.pid)) - finally: - labwc.kill() - labwc.wait() - self.assertEqual(ET.fromstring(rules.read_bytes()).findall(undecorated), []) + self.assertFalse(old.exists()) + tree = ET.fromstring(rules.read_bytes()) + self.assertEqual(len(tree.findall(undecorated)), 1) + # Both toggles' rules live in the one file. + self.assertEqual(len(tree.findall("./windowRules/windowRule[@identifier='*']/action[@name='Maximize']")), 1) + for expect_bars in (True, False): + labwc = subprocess.Popen(['sleep', '30']) + try: + result = self.run_bin('omarchy-toggle-window-titlebars', LABWC_PID=str(labwc.pid)) + self.assertEqual(result.returncode, 0, result.stderr) + finally: + labwc.kill() + labwc.wait() + found = ET.fromstring(rules.read_bytes()).findall(undecorated) + self.assertEqual(len(found), 0 if expect_bars else 1) + self.assertEqual(self.toggle_enabled('window-titlebars-on'), 0 if expect_bars else 1) def test_menu_toggles_use_shipped_commands(self): menu = (PROJECT / 'desktop/shell/default/omarchy/omarchy-menu.jsonc').read_text()