From cbf613e42c10d6e2c207074d1bec7d7a3d67b490 Mon Sep 17 00:00:00 2001
From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>
Date: Fri, 11 Apr 2025 22:25:27 +1000
Subject: navbar: config show labels
Hide labels by default
---
src/config/defaults.ts | 1 +
src/config/types.ts | 1 +
src/modules/navbar.tsx | 59 ++++++++++++++++++++++++++++++--------------------
3 files changed, 38 insertions(+), 23 deletions(-)
diff --git a/src/config/defaults.ts b/src/config/defaults.ts
index 9b4bf1c..21ba436 100644
--- a/src/config/defaults.ts
+++ b/src/config/defaults.ts
@@ -120,6 +120,7 @@ export default {
navbar: {
persistent: false, // Whether to show all the time or only on hover
appearWidth: 10, // The width in pixels of the hover area for the navbar to show up
+ showLabels: false, // Whether to show labels for active buttons
},
// Services
math: {
diff --git a/src/config/types.ts b/src/config/types.ts
index 6127e6f..5e7415a 100644
--- a/src/config/types.ts
+++ b/src/config/types.ts
@@ -61,6 +61,7 @@ export default {
// Navbar
"navbar.persistent": BOOL,
"navbar.appearWidth": NUM,
+ "navbar.showLabels": BOOL,
// Services
"math.maxHistory": NUM,
"updates.interval": NUM,
diff --git a/src/modules/navbar.tsx b/src/modules/navbar.tsx
index 3ad94f6..3e2b1c9 100644
--- a/src/modules/navbar.tsx
+++ b/src/modules/navbar.tsx
@@ -61,7 +61,14 @@ const PaneButton = ({
hookIsCurrent(self, sidebar, name, c => self.set_reveal_child(c))}
+ setup={self => {
+ let isCurrent = false;
+ hookIsCurrent(self, sidebar, name, c => {
+ isCurrent = c;
+ self.set_reveal_child(config.showLabels.get() && c);
+ });
+ self.hook(config.showLabels, (_, v) => self.set_reveal_child(v && isCurrent));
+ }}
>
@@ -69,28 +76,34 @@ const PaneButton = ({
);
-const SpecialWsButton = ({ name }: { name: SpecialWsName }) => (
-
-);
+const SpecialWsButton = ({ name }: { name: SpecialWsName }) => {
+ const revealChild = Variable.derive(
+ [config.showLabels, bind(AstalHyprland.get_default(), "focusedClient")],
+ (l, c) => l && c?.get_workspace().get_name() === `special:${name}`
+ );
+
+ return (
+
+ );
+};
export default ({ monitor }: { monitor: Monitor }) => {
const sidebar = Variable(null);
--
cgit v1.2.3-freya