TyberiusPrime / i3-instant-layout

MIT License
35 stars 5 forks source link

Added option to show notification #11

Closed JarnoB closed 3 years ago

JarnoB commented 3 years ago

Added a function that allows the user to display a notification of the applied layout (uses notify-send). The notification can be shown by adding --notification to the command (i.e. i3-instant-layout --notification mc).

JarnoB commented 3 years ago

Some extra notes I just discovered after using it for a bit more: This code works fine, except when using rofi, as notify-send doesn't allow for showing piped input. I did find this simple bash workaround, which works fine for me, but I haven't implemented a proper python function to fix the issue as I found it to be minor. This is the bashfunction I used:

notifyLayout() {read notification; notify-send "layout" "$notification" "$@"}

which can be called like this:

i3-instant-layout --list | rofi -dmenu -i | i3-instant-layout - | awk '{print $2$3$4}' | notifyLayout

However, i found it to be way more simple to simple set the showNotification-variable to True at line 208, making it send a notification any time a layout gets applied (without the need for --notification).

TyberiusPrime commented 3 years ago

Thanks for your contribution, looks good to me.