From 3a2e9b70ce5fe9dd09cfa375e39c21c01e5090ec Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Fri, 17 May 2024 23:16:43 -0400 Subject: [PATCH] waybar/sway: added tablet mode toggle for virtkeyboard, autorotate, and waybar menu button --- homeManagerModules/apps/waybar/default.nix | 8 +++- .../desktop/sway/autoRotate.nix | 2 +- homeManagerModules/desktop/sway/default.nix | 37 ++++++++++++------- .../desktop/sway/virtKeyboard.nix | 2 +- hosts/petalburg/home.nix | 3 +- 5 files changed, 34 insertions(+), 18 deletions(-) diff --git a/homeManagerModules/apps/waybar/default.nix b/homeManagerModules/apps/waybar/default.nix index 91296d21..e355f68b 100644 --- a/homeManagerModules/apps/waybar/default.nix +++ b/homeManagerModules/apps/waybar/default.nix @@ -64,6 +64,7 @@ #wireplumber, #inhibitor, #custom-logout, + #custom-menu, #tray { padding: 0 7.5px; margin: 0 5px; @@ -87,6 +88,7 @@ #scratchpad, #tray, #clock, + #custom-menu, #hardware { border-radius: 10; background: rgba ${ @@ -98,7 +100,7 @@ padding: 0px 10px 0px 10px; } - #clock { + #clock, #custom-menu { padding: 0px 20px 0px 20px; } @@ -232,6 +234,10 @@ "on-click" = "${lib.getExe pkgs.wlogout}"; "format" = "󰗽"; }; + "custom/menu" = { + "on-click" = "${lib.getExe pkgs.nwg-drawer} -mt 5"; + "format" = "󰀻"; + }; "power-profiles-daemon" = { "format" = "{icon}"; "tooltip-format" = '' diff --git a/homeManagerModules/desktop/sway/autoRotate.nix b/homeManagerModules/desktop/sway/autoRotate.nix index 7eefe41a..3e7550f3 100644 --- a/homeManagerModules/desktop/sway/autoRotate.nix +++ b/homeManagerModules/desktop/sway/autoRotate.nix @@ -4,7 +4,7 @@ config, ... }: { - config = lib.mkIf config.alyraffauf.desktop.sway.autoRotate { + config = lib.mkIf config.alyraffauf.desktop.sway.tabletMode.autoRotate { home.packages = with pkgs; [rot8]; wayland.windowManager.sway.config.startup = [ {command = "${lib.getExe pkgs.rot8}";} diff --git a/homeManagerModules/desktop/sway/default.nix b/homeManagerModules/desktop/sway/default.nix index d4d037a3..e93dd73b 100644 --- a/homeManagerModules/desktop/sway/default.nix +++ b/homeManagerModules/desktop/sway/default.nix @@ -8,9 +8,9 @@ imports = [./autoRotate.nix ./randomWallpaper.nix ./virtKeyboard.nix]; options = { alyraffauf.desktop.sway.enable = lib.mkEnableOption "Sway with extra apps."; - alyraffauf.desktop.sway.autoRotate = lib.mkOption { - description = "Whether to autorotate screen."; - default = false; + alyraffauf.desktop.sway.randomWallpaper = lib.mkOption { + description = "Whether to enable random wallpaper script."; + default = true; type = lib.types.bool; }; alyraffauf.desktop.sway.autoSuspend = lib.mkOption { @@ -18,15 +18,23 @@ default = true; type = lib.types.bool; }; - alyraffauf.desktop.sway.randomWallpaper = lib.mkOption { - description = "Whether to enable random wallpaper script."; - default = true; - type = lib.types.bool; - }; - alyraffauf.desktop.sway.virtKeyboard = lib.mkOption { - description = "Whether to enable dynamic virtual keyboard for convertibles."; - default = false; - type = lib.types.bool; + alyraffauf.desktop.sway.tabletMode = { + enable = lib.mkEnableOption "Tablet mode for Sway."; + autoRotate = lib.mkOption { + description = "Whether to autorotate screen."; + default = config.alyraffauf.desktop.sway.tabletMode.enable; + type = lib.types.bool; + }; + menuButton = lib.mkOption { + description = "Whether to add menu button for waybar."; + default = config.alyraffauf.desktop.sway.tabletMode.enable; + type = lib.types.bool; + }; + virtKeyboard = lib.mkOption { + description = "Whether to enable dynamic virtual keyboard."; + default = config.alyraffauf.desktop.sway.tabletMode.enable; + type = lib.types.bool; + }; }; }; @@ -54,7 +62,10 @@ programs.waybar = { settings = { mainBar = { - modules-left = ["sway/workspaces" "sway/scratchpad" "sway/mode"]; + modules-left = + if config.alyraffauf.desktop.sway.tabletMode.menuButton + then ["custom/menu" "sway/workspaces" "sway/scratchpad" "sway/mode"] + else ["sway/workspaces" "sway/scratchpad" "sway/mode"]; }; }; }; diff --git a/homeManagerModules/desktop/sway/virtKeyboard.nix b/homeManagerModules/desktop/sway/virtKeyboard.nix index df191989..df1be3ab 100644 --- a/homeManagerModules/desktop/sway/virtKeyboard.nix +++ b/homeManagerModules/desktop/sway/virtKeyboard.nix @@ -4,7 +4,7 @@ config, ... }: { - config = lib.mkIf config.alyraffauf.desktop.sway.virtKeyboard { + config = lib.mkIf config.alyraffauf.desktop.sway.tabletMode.virtKeyboard { home.packages = with pkgs; [squeekboard]; wayland.windowManager.sway.config.startup = [ {command = "${lib.getExe' pkgs.squeekboard "squeekboard"}";} diff --git a/hosts/petalburg/home.nix b/hosts/petalburg/home.nix index 447c3604..2f739b09 100644 --- a/hosts/petalburg/home.nix +++ b/hosts/petalburg/home.nix @@ -8,8 +8,7 @@ home-manager.users.aly = { imports = [../../homeManagerModules ../../aly.nix]; alyraffauf.desktop.sway = { - autoRotate = true; - virtKeyboard = true; + tabletMode.enable = true; }; }; }