17
submitted 5 months ago by JTskulk@lemmy.world to c/kde@lemmy.kde.social

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.

you are viewing a single comment's thread
view the rest of the comments
[-] JTskulk@lemmy.world 2 points 5 months ago* (last edited 5 months ago)

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

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 TeamViewer`"
    if [ -n "$class" ]; then
        if xprop -id "$id" | grep -q 'WM_NAME(STRING) = "TeamViewer Authentication"'; then
            echo "key Tab
            key space
            key shift+Tab
            key shift+Tab
            key Down
            key Tab
            type {my.username}
            key Tab
            key ctrl+u"| xdotool -
            # wait for the window to be closed
            xprop -spy -id $id > /dev/null 2>&1
            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!

Edit: changed the script to be much smaller and not show errors.

@JTskulk
Put it in a pastebin please. The spacing is all messed up, requiring lots of work to fix.

[-] JTskulk@lemmy.world 1 points 5 months ago

The spacing looks fine here, I copied and pasted it into Kate and it worked fine, maybe you're on a phone or something. Here's a link to my latest version:

this post was submitted on 21 May 2024
17 points (90.5% liked)

KDE

5207 readers
97 users here now

KDE is an international technology team creating user-friendly free and open source software for desktop and portable computing. KDE’s software runs on GNU/Linux, BSD and other operating systems, including Windows.

Plasma 6 Bugs

If you encounter a bug, proceed to https://bugs.kde.org, check whether it has been reported.

If it hasn't, report it yourself.

PLEASE THINK CAREFULLY BEFORE POSTING HERE.

Developers do not look for reports on social media, so they will not see it and all it does is clutter up the feed.

founded 1 year ago
MODERATORS