diff --git a/modules/home-manager/sway.nix b/modules/home-manager/sway.nix index 25371c7..94bba53 100644 --- a/modules/home-manager/sway.nix +++ b/modules/home-manager/sway.nix @@ -3,7 +3,38 @@ pkgs, lib, ... -}: { +}: let + schema = "org.gnome.desktop.a11y.applications"; + key = "screen-keyboard-enabled"; + squeekboard_toggle = pkgs.writeTextFile { + name = "squeekboard_toggle"; + destination = "/bin/toggle_squeekboard"; + executable = true; + text = '' + #!${pkgs.dash}/bin/dash + if ["$(gsettings get ${schema} ${key})" == "'true'"]; then + gsettings set ${schema} ${key} false + else + gsettings set ${schema} ${key} true + fi + ''; + }; + squeekboard_format = pkgs.writeTextFile { + name = "squeekboard_format"; + destination = "/bin/queekboard_format"; + executable = true; + text = '' + #!${pkgs.dash}/bin/dash + if ["$(gsettings get ${schema} ${key})" == "'true'"]; then + echo 󰌌 + echo enabled + else + echo 󰌐 + echo disabled + fi + ''; + }; +in { home.packages = with pkgs; [ waybar # status bar swaylock # screen locking @@ -266,17 +297,11 @@ }; "custom/squeekboard" = let - schema = "org.gnome.desktop.a11y.applications"; - key = "screen-keyboard-enabled"; in { - format = "󰌌"; - on-click = '' - if ["$(gsettings get ${schema} ${key})" == "'true'"]; then - gsettings set ${schema} ${key} false - else - gsettings set ${schema} ${key} true - fi - ''; + format = "{}"; + exec = "${squeekboard_format}/bin/squeekboard_format"; + exec-on-event = true; + on-click = "${squeekboard_toggle}/bin/toggle_squeekboard"; }; "sway/language" = {