waybar/sway: added tablet mode toggle for virtkeyboard, autorotate, and waybar menu button

This commit is contained in:
Aly Raffauf 2024-05-17 23:16:43 -04:00
parent 59b758355c
commit 3a2e9b70ce
5 changed files with 34 additions and 18 deletions

View file

@ -64,6 +64,7 @@
#wireplumber, #wireplumber,
#inhibitor, #inhibitor,
#custom-logout, #custom-logout,
#custom-menu,
#tray { #tray {
padding: 0 7.5px; padding: 0 7.5px;
margin: 0 5px; margin: 0 5px;
@ -87,6 +88,7 @@
#scratchpad, #scratchpad,
#tray, #tray,
#clock, #clock,
#custom-menu,
#hardware { #hardware {
border-radius: 10; border-radius: 10;
background: rgba ${ background: rgba ${
@ -98,7 +100,7 @@
padding: 0px 10px 0px 10px; padding: 0px 10px 0px 10px;
} }
#clock { #clock, #custom-menu {
padding: 0px 20px 0px 20px; padding: 0px 20px 0px 20px;
} }
@ -232,6 +234,10 @@
"on-click" = "${lib.getExe pkgs.wlogout}"; "on-click" = "${lib.getExe pkgs.wlogout}";
"format" = "󰗽"; "format" = "󰗽";
}; };
"custom/menu" = {
"on-click" = "${lib.getExe pkgs.nwg-drawer} -mt 5";
"format" = "󰀻";
};
"power-profiles-daemon" = { "power-profiles-daemon" = {
"format" = "{icon}"; "format" = "{icon}";
"tooltip-format" = '' "tooltip-format" = ''

View file

@ -4,7 +4,7 @@
config, config,
... ...
}: { }: {
config = lib.mkIf config.alyraffauf.desktop.sway.autoRotate { config = lib.mkIf config.alyraffauf.desktop.sway.tabletMode.autoRotate {
home.packages = with pkgs; [rot8]; home.packages = with pkgs; [rot8];
wayland.windowManager.sway.config.startup = [ wayland.windowManager.sway.config.startup = [
{command = "${lib.getExe pkgs.rot8}";} {command = "${lib.getExe pkgs.rot8}";}

View file

@ -8,9 +8,9 @@
imports = [./autoRotate.nix ./randomWallpaper.nix ./virtKeyboard.nix]; imports = [./autoRotate.nix ./randomWallpaper.nix ./virtKeyboard.nix];
options = { options = {
alyraffauf.desktop.sway.enable = lib.mkEnableOption "Sway with extra apps."; alyraffauf.desktop.sway.enable = lib.mkEnableOption "Sway with extra apps.";
alyraffauf.desktop.sway.autoRotate = lib.mkOption { alyraffauf.desktop.sway.randomWallpaper = lib.mkOption {
description = "Whether to autorotate screen."; description = "Whether to enable random wallpaper script.";
default = false; default = true;
type = lib.types.bool; type = lib.types.bool;
}; };
alyraffauf.desktop.sway.autoSuspend = lib.mkOption { alyraffauf.desktop.sway.autoSuspend = lib.mkOption {
@ -18,16 +18,24 @@
default = true; default = true;
type = lib.types.bool; type = lib.types.bool;
}; };
alyraffauf.desktop.sway.randomWallpaper = lib.mkOption { alyraffauf.desktop.sway.tabletMode = {
description = "Whether to enable random wallpaper script."; enable = lib.mkEnableOption "Tablet mode for Sway.";
default = true; autoRotate = lib.mkOption {
description = "Whether to autorotate screen.";
default = config.alyraffauf.desktop.sway.tabletMode.enable;
type = lib.types.bool; type = lib.types.bool;
}; };
alyraffauf.desktop.sway.virtKeyboard = lib.mkOption { menuButton = lib.mkOption {
description = "Whether to enable dynamic virtual keyboard for convertibles."; description = "Whether to add menu button for waybar.";
default = false; default = config.alyraffauf.desktop.sway.tabletMode.enable;
type = lib.types.bool; 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;
};
};
}; };
config = lib.mkIf config.alyraffauf.desktop.sway.enable { config = lib.mkIf config.alyraffauf.desktop.sway.enable {
@ -54,7 +62,10 @@
programs.waybar = { programs.waybar = {
settings = { settings = {
mainBar = { 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"];
}; };
}; };
}; };

View file

@ -4,7 +4,7 @@
config, config,
... ...
}: { }: {
config = lib.mkIf config.alyraffauf.desktop.sway.virtKeyboard { config = lib.mkIf config.alyraffauf.desktop.sway.tabletMode.virtKeyboard {
home.packages = with pkgs; [squeekboard]; home.packages = with pkgs; [squeekboard];
wayland.windowManager.sway.config.startup = [ wayland.windowManager.sway.config.startup = [
{command = "${lib.getExe' pkgs.squeekboard "squeekboard"}";} {command = "${lib.getExe' pkgs.squeekboard "squeekboard"}";}

View file

@ -8,8 +8,7 @@
home-manager.users.aly = { home-manager.users.aly = {
imports = [../../homeManagerModules ../../aly.nix]; imports = [../../homeManagerModules ../../aly.nix];
alyraffauf.desktop.sway = { alyraffauf.desktop.sway = {
autoRotate = true; tabletMode.enable = true;
virtKeyboard = true;
}; };
}; };
} }