diff --git a/homeManagerModules/apps/waybar/default.nix b/homeManagerModules/apps/waybar/default.nix index 2e6c70c9..11d46143 100644 --- a/homeManagerModules/apps/waybar/default.nix +++ b/homeManagerModules/apps/waybar/default.nix @@ -85,6 +85,7 @@ #clock, #custom-menu, #custom-sway-close, + #custom-hyprland-close, #hardware { border-radius: 10; background: rgba ${ @@ -96,7 +97,7 @@ padding: 0px 10px 0px 10px; } - #clock, #custom-menu, #custom-sway-close { + #clock, #custom-menu, #custom-sway-close, #custom-hyprland-close { padding: 0px 20px 0px 20px; } @@ -165,6 +166,10 @@ "on-click" = ''${lib.getExe' config.wayland.windowManager.sway.package "swaymsg"} kill''; "format" = "󰅗"; }; + "custom/hyprland-close" = { + "on-click" = ''${lib.getExe' config.wayland.windowManager.hyprland.package "hyprctl"} dispatch killactive''; + "format" = "󰅗"; + }; "river/window" = { "max-length" = 100; }; diff --git a/homeManagerModules/desktop/hyprland/default.nix b/homeManagerModules/desktop/hyprland/default.nix index b020cc12..b793bd10 100644 --- a/homeManagerModules/desktop/hyprland/default.nix +++ b/homeManagerModules/desktop/hyprland/default.nix @@ -6,7 +6,7 @@ inputs, ... }: { - imports = [./randomWallpaper.nix ./redShift.nix]; + imports = [./randomWallpaper.nix ./redShift.nix ./virtKeyboard.nix]; options = { alyraffauf.desktop.hyprland.enable = @@ -26,6 +26,24 @@ default = true; type = lib.types.bool; }; + alyraffauf.desktop.hyprland.tabletMode = { + enable = lib.mkEnableOption "Tablet mode for Hyprland."; + autoRotate = lib.mkOption { + description = "Whether to autorotate screen."; + default = config.alyraffauf.desktop.hyprland.tabletMode.enable; + type = lib.types.bool; + }; + menuButton = lib.mkOption { + description = "Whether to add menu button for waybar."; + default = config.alyraffauf.desktop.hyprland.tabletMode.enable; + type = lib.types.bool; + }; + virtKeyboard = lib.mkOption { + description = "Whether to enable dynamic virtual keyboard."; + default = config.alyraffauf.desktop.hyprland.tabletMode.enable; + type = lib.types.bool; + }; + }; }; config = lib.mkIf config.alyraffauf.desktop.hyprland.enable { @@ -57,9 +75,14 @@ extraPortals = [inputs.nixpkgsUnstable.legacyPackages."${pkgs.system}".xdg-desktop-portal-hyprland]; }; - programs.waybar.settings = { - mainBar = { - modules-left = ["hyprland/workspaces" "hyprland/submap"]; + programs.waybar = { + settings = { + mainBar = { + modules-left = + if config.alyraffauf.desktop.hyprland.tabletMode.menuButton + then ["hyprland/workspaces" "custom/menu" "custom/hyprland-close" "hyprland/submap"] + else ["hyprland/workspaces" "hyprland/submap"]; + }; }; }; diff --git a/homeManagerModules/desktop/hyprland/virtKeyboard.nix b/homeManagerModules/desktop/hyprland/virtKeyboard.nix new file mode 100644 index 00000000..1a13c173 --- /dev/null +++ b/homeManagerModules/desktop/hyprland/virtKeyboard.nix @@ -0,0 +1,16 @@ +{ + pkgs, + lib, + config, + ... +}: { + config = lib.mkIf config.alyraffauf.desktop.hyprland.tabletMode.virtKeyboard { + home.packages = with pkgs; [squeekboard]; + + wayland.windowManager.hyprland.extraConfig = '' + exec-once = ${lib.getExe' pkgs.squeekboard "squeekboard"} + bindl=,switch:on:Lenovo Yoga Tablet Mode Control switch,exec,${lib.getExe pkgs.dconf} write /org/gnome/desktop/a11y/applications/screen-keyboard-enabled true + bindl=,switch:off:Lenovo Yoga Tablet Mode Control switch,exec,${lib.getExe pkgs.dconf} write /org/gnome/desktop/a11y/applications/screen-keyboard-enabled false + ''; + }; +}