KDE 5 had a feature in the keyboard shortcuts in settings where you could set a Window Action as a trigger instead of a keyboard shortcut (Documentation in the link). This means that KDE would do something every time a certain window appeared. This was very useful, my use case was changing the TeamViewer authorization prompt to NT logon as I don’t use the normal TeamViewer password. I think there should be a workaround if it’s truly gone, but for the life of me I can’t remember or search for the name of this software that does something every time a certain window is created.
I was not aware of this feature, but it sounds very useful. Why don’t you submit a request to reinstate it to https://bugs.kde.org ?
I did a workaround by editing a script I found and don’t understand using xprop, xwininfo, and xdotool. I probably should have mentioned that I’m using X, most of this stuff doesn’t work on Wayland. Here’s my script so far:
#!/bin/bash # The script is looking for a window with a given WM_CLASS property. The window # will be attached to the root node (R in the graph below), the root note is # what you get from 'xprop -root'. There are two different types of windows with # the same WM_CLASS (Q and W) but their tree structures are different. However, # the tree structure of the two windows are different as seen in the graph # below. # # R # / \ # A Y # /\ \ # B C X # \ \ # Q W # # To run the script 'xprop' and 'xwininfo' must be installed. # # NOTE: This script will not work if a window is not brought to top when it is # created. class_name=TeamViewer # regex for extracting hex id's grep_id='0[xX][a-zA-Z0-9]\{7\}' function grep_parent_id { local result="`xwininfo -tree -id $1 | grep 'Parent window id:' | grep -o $grep_id`" echo "$result" } # for every change in the root window's _NET_ACTIVE_WINDOW property, which # is supposed to hold the currently active window (I believe this depends on the WM) # note that the _NET_ACTIVE_WINDOW event will be triggered if a window that is already # open is brought to top. xprop -spy -root _NET_ACTIVE_WINDOW | grep --line-buffered -o $grep_id | while read -r id; do class="`xprop -id $id WM_CLASS | grep $class_name`" if [ -n "$class" ]; then parent_id=$(grep_parent_id $id) grand_parent_id=$(grep_parent_id $parent_id) grand_parent_tree="`xwininfo -id $grand_parent_id -tree`" # If the the grand_parent has two children we have found window Q tree_check="`grep -o '2 children:' <<< $grand_parent_tree`" if [ -z "$tree_check" ]; then if xprop -id "$id" | grep -q 'WM_NAME(STRING) = "TeamViewer Authentication"'; then echo "Found window (W), it has ID: $id" echo "key Tab key space key shift+Tab key shift+Tab key Down key Tab type {my-username} key Tab" | xdotool - # wait for the window to be closed xprop -spy -id $id > /dev/null 2>&1 fi fi fi done
It spits out errors after the window closes because I think it’s trying to get windows properties from the now closed window, but it gets the job done!
DevilsPie is the name of the software I couldn’t remember.