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,
#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" = ''

View file

@ -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}";}

View file

@ -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,16 +18,24 @@
default = true;
type = lib.types.bool;
};
alyraffauf.desktop.sway.randomWallpaper = lib.mkOption {
description = "Whether to enable random wallpaper script.";
default = true;
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;
};
alyraffauf.desktop.sway.virtKeyboard = lib.mkOption {
description = "Whether to enable dynamic virtual keyboard for convertibles.";
default = false;
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;
};
};
};
config = lib.mkIf config.alyraffauf.desktop.sway.enable {
@ -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"];
};
};
};

View file

@ -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"}";}

View file

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