sway: Manage waybar with systemd

This commit is contained in:
Simon Bruder 2021-03-02 09:31:22 +01:00
parent c7349c4939
commit d8f75f167a
Signed by: simon
GPG key ID: 8D3C82F9F309F8EC

View file

@ -164,9 +164,7 @@ lib.mkIf nixosConfig.sbruder.gui.enable {
"--locked ${cfg.modifier}+q" = ''exec 'test $(swaymsg -t get_outputs | ${pkgs.jq}/bin/jq "[.[].dpms] | any") = "true" && swaymsg "output * dpms off" || swaymsg "output * dpms on"''; "--locked ${cfg.modifier}+q" = ''exec 'test $(swaymsg -t get_outputs | ${pkgs.jq}/bin/jq "[.[].dpms] | any") = "true" && swaymsg "output * dpms off" || swaymsg "output * dpms on"'';
}; };
bars = [ bars = [ ]; # managed as systemd user unit
{ command = "waybar"; }
];
assigns = { assigns = {
"2" = [ "2" = [
@ -253,7 +251,6 @@ lib.mkIf nixosConfig.sbruder.gui.enable {
alacritty # terminal alacritty # terminal
brightnessctl # control screen brightness brightnessctl # control screen brightness
sway-contrib.grimshot # screenshots sway-contrib.grimshot # screenshots
(waybar.override { pulseSupport = true; }) # better status bar FIXME: Remove override with 21.03 (https://github.com/NixOS/nixpkgs/pull/98490)
wdisplays # graphical output manager wdisplays # graphical output manager
]; ];
@ -460,6 +457,26 @@ lib.mkIf nixosConfig.sbruder.gui.enable {
''; '';
}; };
systemd.user.services.waybar = {
Unit = {
Description = "Highly customizable Wayland bar for Sway and Wlroots based compositors.";
Documentation = "https://github.com/Alexays/Waybar/wiki/";
PartOf = [ "sway-session.target" ];
};
Install.WantedBy = [ "sway-session.target" ];
Service = {
# ensure sway is already started, otherwise workspaces will not work
ExecStartPre = "${config.wayland.windowManager.sway.package}/bin/swaymsg";
# FIXME: Remove override with 21.05 (https://github.com/NixOS/nixpkgs/pull/98490)
ExecStart = "${pkgs.waybar.override { pulseSupport = true; }}/bin/waybar";
ExecReload = "${pkgs.utillinux}/bin/kill -SIGUSR2 $MAINPID";
Restart = "on-failure";
RestartSec = "1s";
};
};
programs.mako = { programs.mako = {
enable = true; enable = true;