From 1a31d4d3e558e9f4ed123b85290deca1fa2fd67b Mon Sep 17 00:00:00 2001 From: Noah Masur <7386960+nmasur@users.noreply.github.com> Date: Sat, 14 May 2022 23:31:04 -0400 Subject: [PATCH] toggle polybar with keybinding --- modules/desktop/i3.nix | 8 ++++++++ modules/desktop/polybar.nix | 2 ++ 2 files changed, 10 insertions(+) diff --git a/modules/desktop/i3.nix b/modules/desktop/i3.nix index 827c68a..6780041 100644 --- a/modules/desktop/i3.nix +++ b/modules/desktop/i3.nix @@ -6,6 +6,13 @@ let in { + options = { + toggleBarCmd = lib.mkOption { + type = lib.types.str; + description = "Command to hide and show the status bar."; + }; + }; + config = lib.mkIf config.services.xserver.enable { services.xserver.windowManager = { @@ -125,6 +132,7 @@ in { # Window options "${modifier}+q" = "kill"; + "${modifier}+b" = "exec ${config.toggleBarCmd}"; "${modifier}+f" = "fullscreen toggle"; "${modifier}+h" = "focus left"; "${modifier}+j" = "focus down"; diff --git a/modules/desktop/polybar.nix b/modules/desktop/polybar.nix index cfba90e..87d5c8b 100644 --- a/modules/desktop/polybar.nix +++ b/modules/desktop/polybar.nix @@ -2,6 +2,8 @@ config = lib.mkIf config.services.xserver.enable { + toggleBarCmd = "polybar-msg cmd toggle"; + home-manager.users.${config.user} = { services.polybar = {