Is it possible to run a script when a specific window is focused?

I want to change brightness based on which window is running, if its an IDE in dark mode increase, if it is a browser window decrease. The command itself is fairly easy to run even on wayland

qdbus local.org_kde_powerdevil /org/kde/Solid/PowerManagement/Actions/BrightnessControl setBrightness 5000   
qdbus local.org_kde_powerdevil /org/kde/Solid/PowerManagement/Actions/BrightnessControl setBrightness 10000   

how can I do it on a per app/window basis?

18 points · 1 comments · view on lemmy.world

1 Comments

ikidd@lemmy.world · 5 pts · 1y

This is probably where I would start.

You might be looking for workspace:windowActivated event or window:activeChanged and fire your script on that.