Hacky hack to make rofi-rbw typing less insane
There is some unknown interaction between `wtype` and `fcitx5` that prevents the keyboard from being usable after wtype exits, until fcitx5 restarts. Therefore a workaround is to use `ydotool` to type the secrets instead. However `ydotool` assumes an ANSI layout, which we cannot specifically set up with niri just yet. So instead we set up a hack, to temporarily disable fcitx & set Niri layout to ANSI right before invoking ydotool, and reverting once it's complete.
This commit is contained in:
parent
3e905fbf8f
commit
1de42e1a89
3 changed files with 28 additions and 8 deletions
|
@ -84,15 +84,22 @@ let
|
||||||
"${pkgs.kdePackages.plasma-workspace}/share/dbus-1/services/org.kde.plasma.Notifications.service";
|
"${pkgs.kdePackages.plasma-workspace}/share/dbus-1/services/org.kde.plasma.Notifications.service";
|
||||||
};
|
};
|
||||||
|
|
||||||
rofi-rbw-script = pkgs.writeShellApplication {
|
rofi-rbw-script = pkgs.writeTextFile rec {
|
||||||
name = "rofi-rbw-script";
|
name = "rofi-rbw-script";
|
||||||
runtimeInputs = with pkgs; [
|
text = ''
|
||||||
config.programs.rofi.package
|
#!/usr/bin/env fish
|
||||||
wtype
|
set -a PATH ${
|
||||||
|
lib.concatMapStringsSep " " (p: "${lib.getBin p}/bin") [
|
||||||
|
config.programs.rofi.package
|
||||||
|
pkgs.ydotool
|
||||||
|
pkgs.rofi-rbw
|
||||||
|
]
|
||||||
|
}
|
||||||
rofi-rbw
|
rofi-rbw
|
||||||
];
|
'';
|
||||||
text = "rofi-rbw";
|
executable = true;
|
||||||
meta.mainProgram = "rofi-rbw-script";
|
destination = "/bin/${name}";
|
||||||
|
meta.mainProgram = name;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
with lib;
|
with lib;
|
||||||
|
|
|
@ -18,6 +18,14 @@ let
|
||||||
|
|
||||||
xwayland-display = ":0";
|
xwayland-display = ":0";
|
||||||
|
|
||||||
|
# Override for lack of per-keyboard layout
|
||||||
|
ydotool-en = pkgs.writeScriptBin "ydotool" ''
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
niri msg action switch-layout 1 && fcitx5-remote -c # us
|
||||||
|
${lib.getExe pkgs.ydotool} "$@"
|
||||||
|
niri msg action switch-layout 0 # ja
|
||||||
|
'';
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.programs.my-niri = {
|
options.programs.my-niri = {
|
||||||
|
@ -77,6 +85,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
|
home.packages = [ ydotool-en ];
|
||||||
programs.my-niri.workspaces = {
|
programs.my-niri.workspaces = {
|
||||||
# Default workspaces, always there
|
# Default workspaces, always there
|
||||||
"01" = {
|
"01" = {
|
||||||
|
@ -158,7 +167,7 @@ in
|
||||||
XDG_MENU_PREFIX = "plasma-";
|
XDG_MENU_PREFIX = "plasma-";
|
||||||
};
|
};
|
||||||
input.keyboard.xkb = {
|
input.keyboard.xkb = {
|
||||||
layout = "jp";
|
layout = "jp,us";
|
||||||
};
|
};
|
||||||
input.touchpad = lib.mkIf cfg.enableLaptop {
|
input.touchpad = lib.mkIf cfg.enableLaptop {
|
||||||
tap = true;
|
tap = true;
|
||||||
|
|
|
@ -79,6 +79,10 @@ let
|
||||||
programs.niri.package = pkgs.niri-stable;
|
programs.niri.package = pkgs.niri-stable;
|
||||||
# Override gnome-keyring disabling
|
# Override gnome-keyring disabling
|
||||||
services.gnome.gnome-keyring.enable = lib.mkForce false;
|
services.gnome.gnome-keyring.enable = lib.mkForce false;
|
||||||
|
# ydotool
|
||||||
|
programs.ydotool.enable = true;
|
||||||
|
users.extraGroups.${config.programs.ydotool.group}.members = [ cfg.username ];
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
logitech =
|
logitech =
|
||||||
|
|
Loading…
Add table
Reference in a new issue