Open simanga-dev opened 3 years ago
It's possible to implement I think. I'll have a look into it!
Thank you, I am new to dwm, and I would love to contribute where I can, but I don't understand the code base. If the is something specific that you can ask me to do. I am happy to help.
You are very welcome to! Just fork the project and mess around with it then make a pull request here afterwards. I will probably try giving it a shot next week.
In terms of how you would go about doing it it would involve the following I think:
Adding a function call from inside the view function underneath this line here: https://github.com/NlGHT/dwm-default-tag-apps/blob/c4ef3c2e5204a3edc97a200baae4b4c766740170/dwm.c#L2078
This function then checks the windows on the current tag (using lastchosentag[ui->selmon]
for if they have matching window classes (xprop | grep WM_CLASS) or maybe their original command run (but idk if that's something you can get yet because I haven't looked into it yet). Then if there is none open it runs the spawndefault() function: https://github.com/NlGHT/dwm-default-tag-apps/blob/c4ef3c2e5204a3edc97a200baae4b4c766740170/dwm.c#L1680
If you wanna give it a shot go right on ahead! It's probably a good idea to have this as an option if it does make it in (so a variable you set in config.h).
So i've attempted this and I don't think it's possible. It would be very difficult and very likely conflict with the swallow patch that walks the process tree. Walking the process tree is the only probable way of doing it I think as I can't see any other method for checking the specific app being opened.
HOWEVER, it is probably doable to check if there is no windows open (not just checking for the specific app) on that tag. So what do we say to having the app open simply if there is no app open on that tag at all (doesn't have to be the default app)? @h3ndry
I have implemented this, please give it a test when you next can in the eager branch https://github.com/NlGHT/dwm-default-tag-apps/tree/eager. :smile: @h3ndry
Is it possible to automatically open the app when you switch to that tag. and if at least one instance of the App is already opened do nothing.