xkb-switch-i3 icon indicating copy to clipboard operation
xkb-switch-i3 copied to clipboard

New feature proposal: optional argument to `--i3` command line option

Open mrplumber opened this issue 2 years ago • 0 comments

Hello, I would like to politely suggest a feature in the form of additional optional argument to --i3 command line option as follows:

xkb-switch --i3 [command]

where command is optional character string argument to pass to i3 IPC send_command() function for execution on i3 window focus event.

Possible real world use case: I am using i3blocks as a text based status bar for i3 which has an option of updating configured status line output upon receiving a real-time signal. Particularly I configured i3 status line to show current keyboard language layout indicator from an output of xkb-switch command and update itself on receiving a real-time signal SIGRTMIN+11:

[language]
command=xkb-switch
signal=11
interval=once
min_width=gb

My relevant i3 configuration part for generating such a signal is as follows:

exec_always --no-startup-id xkb-switch --i3 | awk '/Window layout:/ {system("pkill -SIGRTMIN+11 i3blocks")}'

This way my i3 status line keyboard language indicator is showing current language layout for every window. As you can see I configured to pipe output of xkb-switch --i3 to awk which 'listens' for 'Window layout:' string in the output and executes pkill command with relevant parameters to generate a real-time signal SIGRTMIN+11.

The suggested feature would eliminate a need to pipe the output of xkb-switch --i3 to awk thus freeing some computing resources.

Thank you for your considerations.

mrplumber avatar Jun 08 '22 14:06 mrplumber