From 875238430655af6e8ef1a78c1ba8ef376edc1ecb Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Sat, 8 Jun 2024 20:20:50 +0700 Subject: [PATCH] bar: add "nothing" mode (#544) --- .config/ags/modules/bar/main.js | 7 ++++++- .config/ags/scss/_bar.scss | 5 +++++ .config/ags/variables.js | 8 ++++++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.config/ags/modules/bar/main.js b/.config/ags/modules/bar/main.js index 0a0d8f42..952fb3fb 100644 --- a/.config/ags/modules/bar/main.js +++ b/.config/ags/modules/bar/main.js @@ -77,11 +77,14 @@ export const Bar = async (monitor = 0) => { endWidget: Widget.Box({}), setup: (self) => { self.hook(Battery, (self) => { - if(!Battery.available) return; + if (!Battery.available) return; self.toggleClassName('bar-bg-focus-batterylow', Battery.percent <= userOptions.battery.low); }) } }); + const nothingContent = Widget.Box({ + className: 'bar-bg-nothing', + }) return Widget.Window({ monitor, name: `bar${monitor}`, @@ -95,9 +98,11 @@ export const Bar = async (monitor = 0) => { children: { 'normal': normalBarContent, 'focus': focusedBarContent, + 'nothing': nothingContent, }, setup: (self) => self.hook(currentShellMode, (self) => { self.shown = currentShellMode.value; + }) }), }); diff --git a/.config/ags/scss/_bar.scss b/.config/ags/scss/_bar.scss index 31e2161a..b12123d9 100644 --- a/.config/ags/scss/_bar.scss +++ b/.config/ags/scss/_bar.scss @@ -22,6 +22,11 @@ $bar_ws_width_focus_active: 2.045rem; min-height: 1.364rem; } +.bar-bg-nothing { + background-color: $layer0; + min-height: 2px; +} + .bar-bg-focus-batterylow { background-color: mix($layer0, $errorContainer, 80%); } diff --git a/.config/ags/variables.js b/.config/ags/variables.js index 948311f9..c9aa243d 100644 --- a/.config/ags/variables.js +++ b/.config/ags/variables.js @@ -21,12 +21,16 @@ globalThis['currentMode'] = currentShellMode; globalThis['cycleMode'] = () => { if (currentShellMode.value === 'normal') { currentShellMode.value = 'focus'; - } else { + } + else if (currentShellMode.value === 'focus') { + currentShellMode.value = 'nothing'; + } + else { currentShellMode.value = 'normal'; } } -// // Window controls +// Window controls const range = (length, start = 1) => Array.from({ length }, (_, i) => i + start); globalThis['toggleWindowOnAllMonitors'] = (name) => { range(Gdk.Display.get_default()?.get_n_monitors() || 1, 0).forEach(id => {