diff options
| author | Danilo M. <danix@danix.xyz> | 2026-11-09 19:33:54 +0100 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-11-09 19:33:54 +0100 |
| commit | 05b01ce3ec09302fe1a47ff71540c91a92d1cab6 (patch) | |
| tree | b41205290dc134504243fcd81a69ebdd4246a223 | |
| parent | 33060a4aab87a79d222b10d088e01acf6ac8be29 (diff) | |
| download | deck-it-05b01ce3ec09302fe1a47ff71540c91a92d1cab6.tar.gz deck-it-05b01ce3ec09302fe1a47ff71540c91a92d1cab6.zip | |
feat: move Windows to its own tab
| -rw-r--r-- | static/app.js | 14 | ||||
| -rw-r--r-- | static/deck.css | 1 | ||||
| -rw-r--r-- | static/modules/windows.js | 7 | ||||
| -rw-r--r-- | tests/test_frontend.py | 1 |
4 files changed, 20 insertions, 3 deletions
diff --git a/static/app.js b/static/app.js index 54d4b26..ce3ec62 100644 --- a/static/app.js +++ b/static/app.js @@ -47,6 +47,19 @@ function ensureTab(name) { return tabs[name]; } +const TAB_ORDER = ["Dashboard", "Windows", "OBS"]; + +function sortTabs() { + const rank = (name) => { + const at = TAB_ORDER.indexOf(name); + return at === -1 ? TAB_ORDER.length : at; + }; + for (const name of Object.keys(tabs).sort((a, b) => rank(a) - rank(b))) { + tabBar.append(tabs[name].button); + tabBody.append(tabs[name].section); + } +} + function showTab(name) { for (const [n, tab] of Object.entries(tabs)) { tab.section.hidden = n !== name; @@ -168,6 +181,7 @@ async function boot() { } } ready = true; + sortTabs(); const saved = localStorage.getItem(TAB_KEY); showTab(tabs[saved] ? saved : "Dashboard"); } diff --git a/static/deck.css b/static/deck.css index 6f9e49a..90500ba 100644 --- a/static/deck.css +++ b/static/deck.css @@ -225,6 +225,7 @@ select { .msub { font-size: 12px; color: var(--udt-subtext0); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .mfoot { margin-top: 10px; font-size: 12px; color: var(--udt-overlay0); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } +.windows { display: flex; flex-direction: column; gap: 14px; } .windows .ws { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; } .wtile { min-width: 56px; diff --git a/static/modules/windows.js b/static/modules/windows.js index a92d9e4..7d2d8c8 100644 --- a/static/modules/windows.js +++ b/static/modules/windows.js @@ -20,13 +20,14 @@ function tile(label, onclick) { export default { title: "Windows", + tab: "Windows", interval: 1, mount(el) { el.innerHTML = `<div class="windows"> - <div class="ws"></div> - <div class="winlist"></div> - <div class="launches"></div> + <section class="deck-block"><h3>Workspaces</h3><div class="ws"></div></section> + <section class="deck-block"><h3>Launches</h3><div class="launches"></div></section> + <section class="deck-block"><h3>Windows</h3><div class="winlist"></div></section> </div>`; }, diff --git a/tests/test_frontend.py b/tests/test_frontend.py index 517c674..8c8fdb8 100644 --- a/tests/test_frontend.py +++ b/tests/test_frontend.py @@ -89,6 +89,7 @@ class Frontend(unittest.TestCase): for part in (b"deckit.tab", b"ensureTab", b"showTab"): self.assertIn(part, app) self.assertIn(b'tab: "OBS"', self.get("/modules/obs.js")[1]) + self.assertIn(b'tab: "Windows"', self.get("/modules/windows.js")[1]) def test_layout_is_browser_local(self): status, body = self.get("/app.js") |
