Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate possibility of implementing of Auto Profile functionality for Wayland #303

Closed
pktiuk opened this issue Nov 28, 2021 · 11 comments
Labels
enhancement New feature or request wontfix This will not be worked on

Comments

@pktiuk
Copy link
Member

pktiuk commented Nov 28, 2021

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.
Fund with Polar
@pktiuk pktiuk added enhancement New feature or request good first issue Good for newcomers labels Nov 28, 2021
@pktiuk pktiuk mentioned this issue Nov 28, 2021
1 task
@Figuera
Copy link

Figuera commented Nov 28, 2021

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

@pktiuk
Copy link
Member Author

pktiuk commented Nov 28, 2021

I will probably be able to implement the functionally on my machine using Sway + AntiMicroX CLI

Really? That would be great.

@pktiuk
Copy link
Member Author

pktiuk commented Nov 28, 2021

Are there any (popular) DE-s which will not be compatible with your implementation?

@Figuera
Copy link

Figuera commented Nov 28, 2021

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.

@pktiuk
Copy link
Member Author

pktiuk commented Nov 28, 2021

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.

@pktiuk
Copy link
Member Author

pktiuk commented Nov 28, 2021

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.

@Figuera
Copy link

Figuera commented Nov 28, 2021

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.

@pktiuk
Copy link
Member Author

pktiuk commented Nov 28, 2021

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)

@Figuera
Copy link

Figuera commented Nov 29, 2021

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.

@pktiuk pktiuk added wontfix This will not be worked on and removed good first issue Good for newcomers labels Dec 18, 2021
@pktiuk
Copy link
Member Author

pktiuk commented Dec 18, 2021

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) 😞 .

@pktiuk
Copy link
Member Author

pktiuk commented Apr 6, 2022

This functionality will be broken until flatpak/wayland will implement any way of getting info about active windows:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants