sway: add virtual keyboard support for tablets

This commit is contained in:
Aly Raffauf 2024-05-17 19:09:22 -04:00
parent d0e9385946
commit 59b758355c
3 changed files with 33 additions and 7 deletions

View file

@ -5,24 +5,29 @@
osConfig, osConfig,
... ...
}: { }: {
imports = [./autoRotate.nix ./randomWallpaper.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.autoSuspend = lib.mkOption {
description = "Whether to autosuspend on idle.";
default = true;
type = lib.types.bool;
};
alyraffauf.desktop.sway.autoRotate = lib.mkOption { alyraffauf.desktop.sway.autoRotate = lib.mkOption {
description = "Whether to autorotate screen."; description = "Whether to autorotate screen.";
default = false; default = false;
type = lib.types.bool; type = lib.types.bool;
}; };
alyraffauf.desktop.sway.autoSuspend = lib.mkOption {
description = "Whether to autosuspend on idle.";
default = true;
type = lib.types.bool;
};
alyraffauf.desktop.sway.randomWallpaper = lib.mkOption { alyraffauf.desktop.sway.randomWallpaper = lib.mkOption {
description = "Whether to enable random wallpaper script."; description = "Whether to enable random wallpaper script.";
default = true; default = true;
type = lib.types.bool; 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;
};
}; };
config = lib.mkIf config.alyraffauf.desktop.sway.enable { config = lib.mkIf config.alyraffauf.desktop.sway.enable {

View file

@ -0,0 +1,18 @@
{
pkgs,
lib,
config,
...
}: {
config = lib.mkIf config.alyraffauf.desktop.sway.virtKeyboard {
home.packages = with pkgs; [squeekboard];
wayland.windowManager.sway.config.startup = [
{command = "${lib.getExe' pkgs.squeekboard "squeekboard"}";}
];
wayland.windowManager.sway.extraConfig = ''
bindswitch --reload --locked tablet:on exec ${lib.getExe pkgs.dconf} write /org/gnome/desktop/a11y/applications/screen-keyboard-enabled true
bindswitch --reload --locked tablet:off exec ${lib.getExe pkgs.dconf} write /org/gnome/desktop/a11y/applications/screen-keyboard-enabled false
'';
};
}

View file

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