Skip to content

Commit

Permalink
waybar: use config.wayland.systemd.target
Browse files Browse the repository at this point in the history
Also add `ConditionEnvironment`.
  • Loading branch information
thiagokokada authored and rycee committed Jan 3, 2025
1 parent 89fe48b commit 8587c2f
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 19 deletions.
8 changes: 5 additions & 3 deletions modules/programs/waybar.nix
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ in {

systemd.target = mkOption {
type = str;
default = "graphical-session.target";
default = config.wayland.systemd.target;
defaultText = literalExpression "config.wayland.systemd.target";
example = "sway-session.target";
description = ''
The systemd target that will automatically start the Waybar service.
Expand Down Expand Up @@ -309,8 +310,9 @@ in {
Description =
"Highly customizable Wayland bar for Sway and Wlroots based compositors.";
Documentation = "https://github.com/Alexays/Waybar/wiki";
PartOf = [ "graphical-session.target" ];
After = [ "graphical-session-pre.target" ];
PartOf = [ cfg.systemd.target ];
After = [ cfg.systemd.target ];
ConditionEnvironment = "WAYLAND_DISPLAY";
X-Restart-Triggers = optional (settings != [ ])
"${config.xdg.configFile."waybar/config".source}"
++ optional (cfg.style != null)
Expand Down
4 changes: 1 addition & 3 deletions tests/modules/programs/waybar/deprecated-modules-option.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{ config, lib, pkgs, ... }:

with lib;
{ config, ... }:

{
config = {
Expand Down
4 changes: 1 addition & 3 deletions tests/modules/programs/waybar/settings-complex.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{ config, lib, pkgs, ... }:

with lib;
{ config, ... }:

{
config = {
Expand Down
2 changes: 0 additions & 2 deletions tests/modules/programs/waybar/settings-with-attrs.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{ config, lib, pkgs, ... }:

with lib;

{
config = {
home.stateVersion = "21.11";
Expand Down
4 changes: 1 addition & 3 deletions tests/modules/programs/waybar/styling.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{ config, lib, pkgs, ... }:

with lib;
{ config, ... }:

{
config = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{ config, lib, pkgs, ... }:

with lib;
{ config, ... }:

{
config = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ KillMode=mixed
Restart=on-failure

[Unit]
After=graphical-session-pre.target
After=sway-session.target
ConditionEnvironment=WAYLAND_DISPLAY
Description=Highly customizable Wayland bar for Sway and Wlroots based compositors.
Documentation=https://github.com/Alexays/Waybar/wiki
PartOf=graphical-session.target
PartOf=sway-session.target

0 comments on commit 8587c2f

Please sign in to comment.