sway: Replace mako with swaync
It provides a notification centre and a do not disturb mode.
This commit is contained in:
parent
532ebfb7b9
commit
b1353a34da
|
@ -20,6 +20,20 @@ in
|
|||
withBDplus = true;
|
||||
};
|
||||
|
||||
# TODO: Remove when swaynotificationcenter ≥ 0.5 is in nixpkgs
|
||||
swaynotificationcenter = prev.swaynotificationcenter.overrideAttrs (o: o // rec {
|
||||
version = "0.5";
|
||||
|
||||
src = prev.fetchFromGitHub {
|
||||
owner = "ErikReider";
|
||||
repo = "SwayNotificationCenter";
|
||||
rev = "v${version}";
|
||||
sha256 = "sha256-Jjbr6GJ0MHlO+T/simPNYQnB5b7Cr85j4GRjRGa5B6s=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = o.nativeBuildInputs ++ [ prev.scdoc ];
|
||||
});
|
||||
|
||||
# adapted from https://github.com/NixOS/nixpkgs/pull/85790
|
||||
# TODO: Remove when memtest86+ ≥ 5.31b is in nixpkgs
|
||||
memtest86plus = prev.memtest86plus.overrideAttrs (o: o // rec {
|
||||
|
|
|
@ -31,7 +31,7 @@ in
|
|||
imports = lib.optionals nixosConfig.sbruder.gui.enable [
|
||||
./gammastep.nix
|
||||
./kanshi.nix
|
||||
./mako.nix
|
||||
./swaync.nix
|
||||
./waybar.nix
|
||||
./xdg-desktop-portal.nix
|
||||
];
|
||||
|
@ -168,6 +168,9 @@ in
|
|||
# Locking and DPMS
|
||||
"${cfg.modifier}+y" = "exec ${pkgs.swaylock}/bin/swaylock -f -i ${wallpaper}";
|
||||
"--no-repeat --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"'';
|
||||
|
||||
# Notifications
|
||||
"${cfg.modifier}+n" = "exec ${pkgs.unstable.swaynotificationcenter}/bin/swaync-client -t";
|
||||
};
|
||||
|
||||
bars = [ ]; # managed as systemd user unit
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
{ pkgs, ... }:
|
||||
let
|
||||
inherit ((import ../common.nix).colorschemes) solarized;
|
||||
in
|
||||
{
|
||||
programs.mako = {
|
||||
enable = true;
|
||||
|
||||
backgroundColor = solarized.base03;
|
||||
borderColor = solarized.base02;
|
||||
textColor = solarized.base0;
|
||||
progressColor = "over ${solarized.base02}";
|
||||
|
||||
groupBy = "app-name";
|
||||
|
||||
defaultTimeout = 5000;
|
||||
|
||||
extraConfig = /* ini */ ''
|
||||
[urgency=critical]
|
||||
text-color=#dc322f
|
||||
ignore-timeout=true
|
||||
default-timeout=0
|
||||
'';
|
||||
};
|
||||
|
||||
systemd.user.services.mako = {
|
||||
Unit.PartOf = [ "sway-session.target" ];
|
||||
Install.WantedBy = [ "sway-session.target" ];
|
||||
|
||||
Service = {
|
||||
ExecStart = "${pkgs.mako}/bin/mako";
|
||||
Restart = "on-failure";
|
||||
};
|
||||
};
|
||||
}
|
145
users/simon/modules/sway/swaync.nix
Normal file
145
users/simon/modules/sway/swaync.nix
Normal file
|
@ -0,0 +1,145 @@
|
|||
{ lib, pkgs, ... }:
|
||||
let
|
||||
inherit ((import ../common.nix).colorschemes) solarized;
|
||||
in
|
||||
{
|
||||
systemd.user.services.swaync = {
|
||||
Unit.PartOf = [ "sway-session.target" ];
|
||||
Install.WantedBy = [ "sway-session.target" ];
|
||||
|
||||
Service = {
|
||||
ExecStart = "${pkgs.unstable.swaynotificationcenter}/bin/swaync";
|
||||
Restart = "on-failure";
|
||||
};
|
||||
};
|
||||
|
||||
xdg.configFile = {
|
||||
"swaync/config.json".text = lib.generators.toJSON { } {
|
||||
positionX = "right";
|
||||
positionY = "top";
|
||||
timeout = 10;
|
||||
timeout-low = 5;
|
||||
timeout-critical = 0;
|
||||
notification-window-width = 480;
|
||||
fit-to-screen = false;
|
||||
keyboard-shortcuts = true;
|
||||
image-visibility = "when-available";
|
||||
transition-time = 0;
|
||||
hide-on-clear = true;
|
||||
hide-on-action = true;
|
||||
};
|
||||
"swaync/style.css".text = lib.concatStrings (lib.attrsets.mapAttrsToList (k: v: "@define-color ${k} ${v};\n") solarized) + /* less */ ''
|
||||
.control-center {
|
||||
background-color: @base03;
|
||||
color: #839496;
|
||||
}
|
||||
/* if the font is only set for .control-center, notifications do not use it */
|
||||
window {
|
||||
font-family: "monospace";
|
||||
}
|
||||
|
||||
.control-center-list {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.control-center-clear-all {
|
||||
color: @base0;
|
||||
text-shadow: none;
|
||||
background: @base03;
|
||||
box-shadow: none;
|
||||
border-radius: 0px;
|
||||
border: 2px solid @base02;
|
||||
}
|
||||
|
||||
.control-center-dnd {
|
||||
border-radius: 0px;
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
background-color: @base02;
|
||||
}
|
||||
.control-center-dnd:checked {
|
||||
background: @green;
|
||||
}
|
||||
.control-center-dnd slider {
|
||||
background: @base0;
|
||||
border-radius: 0px;
|
||||
border: 2px solid @base02;
|
||||
box-shadow: none;
|
||||
}
|
||||
.control-center-dnd slider:checked {
|
||||
background: @green;
|
||||
}
|
||||
|
||||
.floating-notifications {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.notification-row {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.notification {
|
||||
border-radius: 0px;
|
||||
box-shadow: none;
|
||||
margin: 3px 6px;
|
||||
padding: 0;
|
||||
}
|
||||
.notification:first-child {
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
.low .summary {
|
||||
color: @base00;
|
||||
}
|
||||
|
||||
.critical .summary {
|
||||
color: @red;
|
||||
}
|
||||
|
||||
.notification-content {
|
||||
padding: 6px;
|
||||
border-radius: 0px;
|
||||
}
|
||||
|
||||
/* hide close button (clicking on the notification does the same) */
|
||||
.close-button {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.notification-default-action,
|
||||
.notification-action {
|
||||
padding: 4px;
|
||||
margin: 0;
|
||||
box-shadow: none;
|
||||
background: @base03;
|
||||
border: 2px solid @base02;
|
||||
border-radius: 0px;
|
||||
}
|
||||
|
||||
.notification-action {
|
||||
color: @base0;
|
||||
box-shadow: none;
|
||||
text-shadow: none;
|
||||
border-right: none;
|
||||
border-top: none;
|
||||
}
|
||||
/* re-add right border to last action */
|
||||
.notification-action:last-child {
|
||||
border-right: 2px solid @base02;
|
||||
}
|
||||
|
||||
.body-image {
|
||||
margin-top: 6px;
|
||||
background-color: @base0;
|
||||
}
|
||||
|
||||
.summary,
|
||||
.time,
|
||||
.body,
|
||||
.top-action-title {
|
||||
color: @base0;
|
||||
text-shadow: none;
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -167,3 +167,8 @@ window#waybar {
|
|||
background-color: @base3@;
|
||||
color: @base00@;
|
||||
}
|
||||
|
||||
#custom-notification.notification {
|
||||
background-color: @base3@;
|
||||
color: @base00@;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
{ config, lib, nixosConfig, pkgs, ... }:
|
||||
let
|
||||
inherit ((import ../common.nix).colorschemes) solarized;
|
||||
|
||||
watchUserUnitState = unit: started: stopped: pkgs.writeShellScript "watch-user-unit-${unit}-state" ''
|
||||
${pkgs.systemd}/bin/journalctl --user -u ${unit} -t systemd -o cat -f \
|
||||
| ${pkgs.gnugrep}/bin/grep --line-buffered -Eo '^(Started|Stopped)' \
|
||||
|
@ -49,6 +51,7 @@ in
|
|||
"battery"
|
||||
"clock"
|
||||
"custom/calendar"
|
||||
"custom/notification"
|
||||
];
|
||||
|
||||
"sway/workspaces" = {
|
||||
|
@ -272,10 +275,25 @@ in
|
|||
return-type = "json";
|
||||
format = "{}";
|
||||
};
|
||||
"custom/notification" = {
|
||||
tooltip = false;
|
||||
format = "{icon}";
|
||||
format-icons = {
|
||||
notification = "${thinsp}";
|
||||
none = "${thinsp}";
|
||||
dnd-notification = "${thinsp}";
|
||||
dnd-none = "${thinsp}";
|
||||
};
|
||||
return-type = "json";
|
||||
exec = "${pkgs.unstable.swaynotificationcenter}/bin/swaync-client -swb";
|
||||
on-click = "${pkgs.unstable.swaynotificationcenter}/bin/swaync-client -t -sw";
|
||||
on-click-right = "${pkgs.unstable.swaynotificationcenter}/bin/swaync-client -d -sw";
|
||||
escape = true;
|
||||
};
|
||||
};
|
||||
xdg.configFile."waybar/style.css".source = pkgs.substituteAll ({
|
||||
src = ./waybar.css;
|
||||
} // (import ../common.nix).colorschemes.solarized);
|
||||
} // solarized);
|
||||
|
||||
systemd.user.services.waybar = {
|
||||
Unit = {
|
||||
|
|
Loading…
Reference in a new issue