Artificial intelligent assistant

Maximizing a window (Keepassx2) from command line I'm using `i3wm` and Keepassx2 on an Arch-Linux installation. I configured `i3` to automatically move a window with the window class `"Keepassx2"` to a certain workspace `$WSKP`. I also configured `$mod+P` to execute `Keepassx2`. Now I would like to write a custom script that is executed by `$mod+P` instead. This script should: * launch `Keepassx2` when no other instance of it is currently running * maximize `Keepassx2` and move focus to the specific workspace `$WSKP` when there already is a running instance I want this because I don't need the Keepass-Workspace to be open all the time and it takes another unnecessary keypress when tabbing through the workspaces. Checking whether there already is a running instance is easy: if [ $(pidof keepassx2) ]; then # maximize the running instance and move focus with i3-msg fi; But how do I accomplish maximizing the running instance?

i3 has no 'maximize' function, you want to focus your window and you might want to make the window fullscreen.

You can use this snipped:


winid="$(printf "%u\
" $windowid 2>/dev/null)
i3-msg "[id=\"$winid\"] "focus; fullscreen"


How you get the `windowid` from the pid is described in this question.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 6545214a5f2d1bd8dc42235809f74294