Is there a window rule for ‘close’ to be applied when an application starts, instead of ‘Minimized’?
Why would anyone want to close an application at launch? Well, the appimage for Viber doesn’t let you set Minimize to Tray at start-up. So, for now I use a window rule to minimize the window at least. ‘Close’ would send it to the tray, but I can’t find such a rule.
There used to be a thing in KDE where you could execute actions and macros based on window titles, but it’s since been removed. I’ve had to recreate this behavior with a shell script, here’s a modified version you can use if you use Xorg:
#!/bin/bash xprop -spy -root _NET_ACTIVE_WINDOW | grep --line-buffered -o '0[xX][a-zA-Z0-9]\{7\}' | while read -r id; do class="`xprop -id $id WM_CLASS 2> /dev/null | grep Viber`" if [ -n "$class" ]; then if xprop -id "$id" | grep -q 'WM_NAME(STRING) = "Viber Window Name"'; then echo "key alt+f4" | xdotool - # wait for the window to be closed xprop -spy -id $id > /dev/null 2>&1 fi fi doneThe first Viber is is looking for the Viber in the application name, replace “Viber Window Name” with the actual window title you want to be closed. If you don’t use Xorg, you’ll have to find a replacement for both xprop and xdotool.
You may use kdotool (and it works on X and Wayland)


