sxmo: exit fullscreen on screen rotation

This commit is contained in:
Colin 2023-09-27 21:42:55 +00:00
parent 48971bb237
commit 10c7fc8e91
2 changed files with 27 additions and 5 deletions

View File

@ -73,15 +73,20 @@ let
src = ./hooks;
pkgs = [ "coreutils" ];
};
postwake = pkgs.static-nix-shell.mkBash {
pname = "sxmo_hook_postwake.sh";
src = ./hooks;
};
rotate = pkgs.static-nix-shell.mkBash {
pname = "sxmo_hook_rotate.sh";
src = ./hooks;
pkgs = [ "sway" ];
};
start = pkgs.static-nix-shell.mkBash {
pname = "sxmo_hook_start.sh";
src = ./hooks;
pkgs = [ "superd" "xdg-user-dirs" ];
};
postwake = pkgs.static-nix-shell.mkBash {
pname = "sxmo_hook_postwake.sh";
src = ./hooks;
};
};
in
{
@ -123,9 +128,10 @@ in
sane.gui.sxmo.hooks = mkOption {
type = types.attrsOf types.path;
default = {
"sxmo_hook_start.sh" = "${hookPkgs.start}/bin/sxmo_hook_start.sh";
"sxmo_hook_inputhandler.sh" = "${hookPkgs.inputhandler}/bin/sxmo_hook_inputhandler.sh";
"sxmo_hook_postwake.sh" = "${hookPkgs.postwake}/bin/sxmo_hook_postwake.sh";
"sxmo_hook_rotate.sh" = "${hookPkgs.rotate}/bin/sxmo_hook_rotate.sh";
"sxmo_hook_start.sh" = "${hookPkgs.start}/bin/sxmo_hook_start.sh";
};
description = ''
extra hooks to add with higher priority than the builtins

View File

@ -0,0 +1,16 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p sway
# called whenever sxmo_rotate.sh is invoked.
# i.e. whenever the screen is rotated manually, or automatically if autorotate is enabled.
# $1 = the new orientation
# possible values are "normal", "invert", "left" and "right"
# exit fullscreen, if any app is in FS.
# this benefits UX because:
# - most of my FS use is in landscape mode
# - when i toggle apps or desktops i always do so in portrait mode
# - therefore when i rotate landscape -> portrait mode, i almost never want fullscreen anymore.
if "$1" == "normal" || "$1" == "invert"; then
swaymsg fullscreen disable
fi