hyprland: toggleable switch for tablet mode

This commit is contained in:
Aly Raffauf 2024-06-04 15:55:01 -04:00
parent bd1b97a191
commit b8a7477b5b

View file

@ -141,11 +141,6 @@
(lib.getExe pkgs.gammastep) (lib.getExe pkgs.gammastep)
] ]
else [] else []
)
++ (
if config.alyraffauf.desktop.hyprland.tabletMode.virtKeyboard
then [(defaultApps.virtKeyboard)]
else []
); );
screenshot = rec { screenshot = rec {
@ -189,6 +184,19 @@
fi fi
''; '';
tablet = pkgs.writeShellScript "hyprland-tablet" ''
STATE=`${lib.getExe pkgs.dconf} read /org/gnome/desktop/a11y/applications/screen-keyboard-enabled`
if [ $STATE -z ] || [ $STATE == "false" ]; then
if ! [ `pgrep -f ${defaultApps.virtKeyboard}` ]; then
${defaultApps.virtKeyboard} &
fi
${lib.getExe pkgs.dconf} write /org/gnome/desktop/a11y/applications/screen-keyboard-enabled true
elif [ $STATE == "true" ]; then
${lib.getExe pkgs.dconf} write /org/gnome/desktop/a11y/applications/screen-keyboard-enabled false
fi
'';
# Media/hardware commands # Media/hardware commands
brightness = rec { brightness = rec {
bin = lib.getExe' pkgs.swayosd "swayosd-client"; bin = lib.getExe' pkgs.swayosd "swayosd-client";
@ -242,8 +250,7 @@
bindl=,switch:off:Lid Switch,exec,${clamshell} off bindl=,switch:off:Lid Switch,exec,${clamshell} off
# Enable virtual keyboard in tablet mode # Enable virtual keyboard in tablet mode
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:Lenovo Yoga Tablet Mode Control switch,exec,${tablet}
bindl=,switch:off:Lenovo Yoga Tablet Mode Control switch,exec,${lib.getExe pkgs.dconf} write /org/gnome/desktop/a11y/applications/screen-keyboard-enabled false
# unscale XWayland apps # unscale XWayland apps
xwayland { xwayland {