hyprland: add tablet mode with virtkeyboard and menu/close waybar buttons

This commit is contained in:
Aly Raffauf 2024-05-26 21:24:00 -04:00
parent 5f8fcbd29b
commit 2b5353c455
3 changed files with 49 additions and 5 deletions

View file

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

View file

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

View file

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