Investigate possibility of implementing of Auto Profile functionality for Wayland
pktiuk opened this issue · 11 comments
LInked with: #301
Check whether Autoprofile Functionality is doable with wayland API.
If yes then implement it, if no make visible note about it in app.
UPDATE
This functionality will be broken until flatpak/wayland will implement any way of getting info about active windows:
You can track the progress of this task here flatpak/xdg-desktop-portal#304 (but there is a very low chance of getting it anytime soon)
Upvote & Fund
- If you find this issue important, mark it with 👍. It lets us see which fixes and features are demanded by the most users.
- We're using Polar.sh so you can upvote and help fund this issue. It may incentivize some developers to contribute to this project and fix some bugs.
- Funded developer receives the funding once the issue is completed & confirmed by you.
- Thank you in advance for helping prioritize & fund our backlog.
It should be possible. At least in wlroots (the Sway Compositor) matching windows is a little difference than from X. We usually use 3 windows properties:
app_id
: Window's name. For Wayland native Windows.
class
: Window's class name. For X windows running on Xwayland.
title
: Window's public title. For both Wayland and X windows, generally used as a secondary matching option.
I will probably be able to implement the functionally on my machine using Sway + AntiMicroX CLI
I will probably be able to implement the functionally on my machine using Sway + AntiMicroX CLI
Really? That would be great.
Are there any (popular) DE-s which will not be compatible with your implementation?
My initial implementation was proven faulty. I could get the profile to change when my target window is created but not when it is switched out or into focus. I will give it a look and try create a more complex script.
Are there any (popular) DE-s which will not be compatible with your implementation?
Unfortunately I am not capable to answer that question in its full. Sway is a i3 like windows manager so we get a lot of mid level configuration easily available.
For other popular desktop environment things would be different. But, for example, Gnome based desktops are using Mutter, which is the same for X and Wayland, so I would imagine that whatever you guys are currently doing for X should work for Wayland with some tweaks.
which is the same for X and Wayland, so I would imagine that whatever you guys are currently doing for X should work for Wayland with some tweaks.
I was not aware of that, maybe there are some universal ways of obtaining info about currently opened windows.
My initial implementation was proven faulty. I could get the profile to change when my target window is created but not when it is switched out or into focus. I will give it a look and try create a more complex script.
I am not sure whether is it worth your effort to work with solution making this feature available for only small fraction of users. I will try to look for something more universal.
My initial implementation was proven faulty. I could get the profile to change when my target window is created but not when it is switched out or into focus. I will give it a look and try create a more complex script.
I am not sure whether is it worth your effort to work with solution making this feature available for only small fraction of users. I will try to look for something more universal.
I understand. I do not intend to send a pull request. It is more of a personal project while you guys can implement the feature.
Sorry for not being able to be of greater help.
At first glance this seems to be not implementable (at least not easily because of security reasons: https://stackoverflow.com/questions/45465016/how-do-i-get-the-active-window-on-gnome-wayland)
At first glance this seems to be not implementable (at least not easily because of security reasons: https://stackoverflow.com/questions/45465016/how-do-i-get-the-active-window-on-gnome-wayland)
A shame that mutter hasn't implemented the protocol. Although, from what I understood, it is possible through some other (possibly unreliable) Gnome API.
I did manage to get it working on my machine using a python script, I will keep it here in case somewhere else is interested and stumble in this thread:
My python daemon:
https://pastebin.com/raw/2stA0hBv
The configuration file (Maps windows to profiles):
https://pastebin.com/raw/Jas1KYL6
It is still a naive implementation. I am not experience in writing this type of software and I haven't tested it extensively but it seems to be working fine for my needs.
This script is a good workaround for sway users.
Unluckily, other users can't use it.
I am closing because it is not implementable (at least for now) 😞 .
This functionality will be broken until flatpak/wayland will implement any way of getting info about active windows: