From d9a176d4ec8dec5cc4acc0fad97a8bb2e66fa22f Mon Sep 17 00:00:00 2001 From: Makesesama Date: Mon, 29 Sep 2025 11:02:48 +0200 Subject: [PATCH] window title option --- bar/config.py | 3 ++- bar/modules/bar.py | 8 ++++++-- example.yaml | 2 ++ flake.nix | 12 ++++++++++-- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/bar/config.py b/bar/config.py index 1545f57..55fc9c5 100644 --- a/bar/config.py +++ b/bar/config.py @@ -51,4 +51,5 @@ if app_config is None: VINYL = app_config.get("vinyl", {"enable": False}) BATTERY = app_config.get("battery", {"enable": False}) -BAR_HEIGHT = app_config.get("bar_height", 40) +WINDOW_TITLE = app_config.get("window_title", {"enable": True}) +BAR_HEIGHT = app_config.get("height", 40) diff --git a/bar/modules/bar.py b/bar/modules/bar.py index f29b20f..f7acf92 100644 --- a/bar/modules/bar.py +++ b/bar/modules/bar.py @@ -20,7 +20,7 @@ from fabric.utils import ( ) from fabric.widgets.circularprogressbar import CircularProgressBar -from bar.config import VINYL, BATTERY, BAR_HEIGHT +from bar.config import VINYL, BATTERY, BAR_HEIGHT, WINDOW_TITLE class StatusBar(Window): @@ -105,6 +105,10 @@ class StatusBar(Window): end_container_children.append(self.date_time) + center_children = [] + if WINDOW_TITLE["enable"]: + center_children.append(self.active_window) + self.children = CenterBox( name="bar-inner", start_children=Box( @@ -120,7 +124,7 @@ class StatusBar(Window): name="center-container", spacing=4, orientation="h", - children=[self.active_window], + children=center_children, ), end_children=Box( name="end-container", diff --git a/example.yaml b/example.yaml index c3a07a7..d61728c 100644 --- a/example.yaml +++ b/example.yaml @@ -1,4 +1,6 @@ bar_height: 42 +window_title: + enable: false vinyl: enable: true battery: diff --git a/flake.nix b/flake.nix index 4d51c05..8c2c00d 100644 --- a/flake.nix +++ b/flake.nix @@ -82,17 +82,25 @@ default = false; }; }; - bar_height = lib.mkOption { + height = lib.mkOption { type = lib.types.int; default = 40; description = "Height of the status bar in pixels"; }; + window_title = { + enable = lib.mkOption { + type = lib.types.bool; + default = true; + description = "Whether to show the window title in the center of the bar"; + }; + }; }; }; default = { vinyl.enable = false; battery.enable = false; - bar_height = 40; + height = 40; + window_title.enable = true; }; }; };