home/i3status-rust: add kbd cycle script on click
This commit is contained in:
parent
79289167b1
commit
101f58720c
@ -1,4 +1,14 @@
|
||||
{ ... }:
|
||||
{ pkgs, ... }:
|
||||
let
|
||||
kbd_switch = pkgs.writeShellScriptBin "kbd_switch" ''
|
||||
declare -A -r KBD_CYCLE_MAP=(
|
||||
["English (US)"]="de"
|
||||
["German"]="ba"
|
||||
)
|
||||
LAYOUT="$(${pkgs.sway}/bin/swaymsg -t get_inputs -r | ${pkgs.jq}/bin/jq -r 'map(select(.type == "keyboard")).[0].xkb_layout_names.[]')"
|
||||
swaymsg input "*" xkb_layout ''${KBD_CYCLE_MAP["$LAYOUT"]:-"us"}
|
||||
'';
|
||||
in
|
||||
{
|
||||
programs.i3status-rust = {
|
||||
bars.top = {
|
||||
@ -15,6 +25,12 @@
|
||||
{
|
||||
block = "keyboard_layout";
|
||||
driver = "sway";
|
||||
click = [
|
||||
{
|
||||
cmd = "${kbd_switch}/bin/kbd_switch";
|
||||
button = "left";
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
block = "battery";
|
||||
|
Loading…
Reference in New Issue
Block a user