diff --git a/home/modules/linux/graphical/alacritty.nix b/home/modules/linux/graphical/alacritty.nix index 4a3371f..63f59f3 100644 --- a/home/modules/linux/graphical/alacritty.nix +++ b/home/modules/linux/graphical/alacritty.nix @@ -7,7 +7,7 @@ with lib; package = pkgs.unstable.alacritty; settings = { - window.opacity = 0.95; + window.opacity = 0.8; font = { size = 14.0; normal.family = "Fantasque Sans Mono Nerd Font"; diff --git a/home/modules/programs/my-sway/default.nix b/home/modules/programs/my-sway/default.nix index 604551b..f41a2bd 100644 --- a/home/modules/programs/my-sway/default.nix +++ b/home/modules/programs/my-sway/default.nix @@ -31,6 +31,8 @@ let in { + imports = [ ./ibus.nix ]; + options.programs.my-sway = { enable = mkEnableOption "Enable the sway configuration"; fontSize = mkOption { diff --git a/home/modules/programs/my-sway/ibus.nix b/home/modules/programs/my-sway/ibus.nix new file mode 100644 index 0000000..c23ab10 --- /dev/null +++ b/home/modules/programs/my-sway/ibus.nix @@ -0,0 +1,49 @@ +{ pkgs, config, lib, ... }: +with lib; +let + cfg = config.programs.my-sway; + + # Set up an ibus script + ibusNext = ( + let + input-methods = [ "xkb:us::eng" "mozc-jp" "Bamboo" ]; + next = m: + let + nextRec = l: + if (length l == 1) + then head input-methods + else if (m == head l) + then (head (tail l)) + else nextRec (tail l); + in + nextRec input-methods; + inputCase = m: '' + if test $current = "${m}" + ${pkgs.libnotify}/bin/notify-send \ + -a ibus \ + -u low \ + -t 3000 \ + "${next m}" \ + "Input engine changed" + ${pkgs.ibus}/bin/ibus engine ${next m} + end + ''; + in + pkgs.writeScriptBin "ibus-next-engine" '' + #! ${pkgs.fish}/bin/fish + + set current (${pkgs.ibus}/bin/ibus engine) + + ${strings.concatMapStrings inputCase input-methods} + '' + ); + +in +{ + config = mkIf cfg.enable { + wayland.windowManager.sway.config.keybindings = mkOptionDefault { + "${config.wayland.windowManager.sway.config.modifier}+z" = "exec ${ibusNext}/bin/ibus-next-engine"; + }; + }; +} +