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

wayland: create tray.target if xsession is not enabled #6332

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

onemoresuza
Copy link
Contributor

Description

As it current stands, the tray target is only created if xsession is
enabled. This causes services that depend on it to fail on wayland
sessions on configurations that do not have services.xsession.enable = true; or the workaround as the following:

{config, lib, ...}: {
  systemd.user.targets.tray = lib.mkIf (!config.xsession.enable) {
    Unit = {
      Description = "Home Manager System Tray";
      Requires = [ "graphical-session-pre.target" ];
    };
  };
}

This PR addresses #6329 and
#2064,
albeit I do not think it is the greatest solution, since it allows the
targets defined by the xsession and wayland modules to be kept out of
sync.

I'd recommend defining tray.target independently from either one of
those modules, since virtually every graphical session that requires a
system tray would need such target.

Checklist

  • Change is backwards compatible. May break config of non xsession enabled
    users that do not use mkForce for the tray target definition.

  • Code formatted with ./format.

  • Code tested through nix-shell --pure tests -A run.all or nix develop --ignore-environment .#all using Flakes.

  • Test cases updated/added. See example.

  • Commit messages are formatted like

    {component}: {description}
    
    {long description}
    

    See CONTRIBUTING for more information and recent commit messages for examples.

  • If this PR adds a new module

    • Added myself as module maintainer. See example.

Maintainer CC

@teto
Copy link
Collaborator

teto commented Jan 20, 2025

the target looks defined in several modules like modules/services/window-managers/wayfire.nix. / river /hyperland/sway. shouldn't the tray.target be removed from there as well ?

I'd recommend defining tray.target independently from either one of
those modules, since virtually every graphical session that requires a
system tray would need such target.

fine by me. We could also merge the current approach as a first step.

As it current stands, the tray target is only created if xsession is
enabled. This causes services that depend on it to fail on wayland
sessions on configurations that do not have `services.xsession.enable =
true;` or the workaround as the following:

```nix
{config, lib, ...}: {
  systemd.user.targets.tray = lib.mkIf (!config.xsession.enable) {
    Unit = {
      Description = "Home Manager System Tray";
      Requires = [ "graphical-session-pre.target" ];
    };
  };
}
```

This PR addresses [nix-community#6329](nix-community#6329) and
[nix-community#2064](nix-community#2064),
albeit I do not think it is the greatest solution, since it allows the
targets defined by the xsession and wayland modules to be kept out of
sync.

I'd recommend defining `tray.target` independently from either one of
those modules, since virtually every graphical session that requires a
system tray would need such target.
@onemoresuza
Copy link
Contributor Author

@teto, you're right. I've added some commits removing them to be squashed if this is to be merged.

Regarding setting tray.target independently from either the xsession or a window manager, systemd.user.targets.tray could be a read-only/internal option from either xsession or wayland so that it would not, as my current implementation, allow the tray targets to get out of sync, since there'd be only one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants