nwg-piotr / nwg-hello

GTK3-based greeter for greetd written in python
MIT License
26 stars 4 forks source link

Feature Request: Last session per User #11

Closed loaidheach closed 1 month ago

loaidheach commented 1 month ago

It would be nice if the last session could be stored on a per user basis. I haven't looked at the code in detail, but in looks like it should be relatively easy to implement. Apart from changing the session when the user select is changed (via notify::selected), the cache.json would need a different format, e.g.

{
  "user": "someguy",
  "sessions": {
    "someguy": "Hyprland",
    "otherguy": "sway"
  }
}
BluishHumility commented 1 month ago

I agree that the last-used session being stored as the default on the login screen would be a nice feature. As it is, it appears to default to whatever session file is alphabetically first in the session_dirs directories. Users who do not use the alphabetically first session need to manually change it every time they log in.

loaidheach commented 1 month ago

Currently it should already store the last user and the last session, but the session is not stored on a per user basis. That said, ensure that /var/cache/nwg-hello/cache.json exists. It should be created during installation. For me using the (unofficial) NixOS package it was not.

BluishHumility commented 1 month ago

Ah, I see. Thank you for the clarification; I do see that file and after looking at it I understand what is happening.

{
  "session": "sway",
  "user": "jeremy"
}

I was testing something unrelated, and had multiple .desktop files in /usr/share/wayland-sessions/ with identical Exec lines. The cache.json file appears to use this line for differentiating between sessions, so all of those test .desktop files would rightly appear to be exactly the same.

Since this kind of setup would never have a practical reason to exist on an actual user's system, this seems like a non-issue in my case.

Apologies for hijacking your issue @loaidheach, at first glance I thought you had made the same observation that I had, but now I see my thing is totally unrelated. Thanks again for the tip on /var/cache/nwg-hello/cache.json.

nwg-piotr commented 1 month ago

Due to an influx of real life job, I haven't had much time lately. I'll try to get down to it soon.

loaidheach commented 1 month ago

No worries and thanks for creating nwg-hello at all!

I should have some time to look at it tomorrow. I will implement it tomorrow and create a pull request.