sway: switch from mako to swaynotificationcenter

https://github.com/ErikReider/SwayNotificationCenter brings a fresh look
don't disturbe mode and a control panel to our notifications
This commit is contained in:
teutat3s 2022-05-06 01:43:31 +02:00
parent b751593368
commit d0a7b58aac
Signed by: teutat3s
GPG key ID: 4FA1D3FA524F22C1
14 changed files with 252 additions and 30 deletions

View file

@ -395,6 +395,22 @@
"type": "github" "type": "github"
} }
}, },
"master": {
"locked": {
"lastModified": 1651837199,
"narHash": "sha256-odvwvHfXQDYFtwtywISSS6EDlSN4AfcFZOon4LK9zX8=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "defb285c96a521555d48e8757bc482f71e8dd12f",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "master",
"repo": "nixpkgs",
"type": "github"
}
},
"naersk": { "naersk": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -620,6 +636,7 @@
"digga": "digga", "digga": "digga",
"home": "home", "home": "home",
"latest": "latest_2", "latest": "latest_2",
"master": "master",
"naersk": "naersk", "naersk": "naersk",
"nix-dram": "nix-dram", "nix-dram": "nix-dram",
"nixos": "nixos", "nixos": "nixos",

View file

@ -10,6 +10,7 @@
# Track channels with commits tested and built by hydra # Track channels with commits tested and built by hydra
nixos.url = "github:nixos/nixpkgs/nixos-21.11"; nixos.url = "github:nixos/nixpkgs/nixos-21.11";
latest.url = "github:nixos/nixpkgs/nixos-unstable"; latest.url = "github:nixos/nixpkgs/nixos-unstable";
master.url = "github:nixos/nixpkgs/master";
digga.url = "github:divnix/digga"; digga.url = "github:divnix/digga";
digga.inputs.nixpkgs.follows = "nixos"; digga.inputs.nixpkgs.follows = "nixos";
@ -81,6 +82,7 @@
]; ];
}; };
latest = { }; latest = { };
master = { };
}; };
lib = import ./lib { lib = digga.lib // nixos.lib; }; lib = import ./lib { lib = digga.lib // nixos.lib; };

View file

@ -23,7 +23,11 @@ bindsym $mod+F5 exec $term -e 'mocp -C $XDG_CONFIG_DIR/mocp/config'
bindsym $mod+Shift+m exec mu bindsym $mod+Shift+m exec mu
bindsym $mod+Shift+h exec xdg-open /usr/share/doc/manjaro/i3_help.pdf bindsym $mod+Shift+h exec xdg-open /usr/share/doc/manjaro/i3_help.pdf
# Screenshofts # Notifications with swaynotificationcenter
# Toggle control center
bindsym $mod+Shift+n exec swaync-client -t -sw
# Screenshots
bindsym $mod+Ctrl+p exec grim -g "$(slurp -d -b \#ffffff11)" ~/Pictures/Screenshots/$(date +%Y%m%d_%Hh%Mm%Ss)_grim.png bindsym $mod+Ctrl+p exec grim -g "$(slurp -d -b \#ffffff11)" ~/Pictures/Screenshots/$(date +%Y%m%d_%Hh%Mm%Ss)_grim.png
bindsym $mod+Shift+p exec grim ~/Pictures/Screenshots/$(date +%Y%m%d_%Hh%Mm%Ss)_grim.png bindsym $mod+Shift+p exec grim ~/Pictures/Screenshots/$(date +%Y%m%d_%Hh%Mm%Ss)_grim.png
bindsym $mod+Ctrl+f exec "( pkill flameshot || true && flameshot & ) && ( sleep 0.5s && flameshot gui )" bindsym $mod+Ctrl+f exec "( pkill flameshot || true && flameshot & ) && ( sleep 0.5s && flameshot gui )"

View file

@ -60,6 +60,7 @@ in
kanshi kanshi
mako mako
slurp slurp
swaynotificationcenter
swayidle swayidle
swaylock swaylock
swaybg swaybg
@ -85,7 +86,7 @@ in
programs.waybar.enable = true; programs.waybar.enable = true;
#programs.waybar.systemd.enable = true; #programs.waybar.systemd.enable = true;
systemd.user.services.mako = import ./mako.service.nix pkgs; systemd.user.services.swaynotificationcenter = import ./swaynotificationcenter.service.nix pkgs;
systemd.user.services.sway = import ./sway.service.nix pkgs; systemd.user.services.sway = import ./sway.service.nix pkgs;
systemd.user.services.swayidle = import ./swayidle.service.nix pkgs; systemd.user.services.swayidle = import ./swayidle.service.nix pkgs;
systemd.user.services.xsettingsd = import ./xsettingsd.service.nix pkgs; systemd.user.services.xsettingsd = import ./xsettingsd.service.nix pkgs;

View file

@ -1,20 +0,0 @@
pkgs:
{
Unit = {
Description = "Lightweight Wayland notification daemon";
Documentation = [ "man:mako(1)" ];
BindsTo = [ "sway-session.target" ];
After = [ "sway-session.target" ];
# ConditionEnvironment requires systemd v247 to work correctly
ConditionEnvironment = [ "WAYLAND_DISPLAY" ];
};
Service = {
Type = "dbus";
BusName = "org.freedesktop.Notifications";
ExecStart = "${pkgs.mako}/bin/mako";
ExecReload = "${pkgs.mako}/bin/makoctl reload";
};
Install = {
WantedBy = [ "sway-session.target" ];
};
}

View file

@ -0,0 +1,22 @@
pkgs:
{
Unit = {
Description = "Swaync notification daemon";
Documentation = "https://github.com/ErikReider/SwayNotificationCenter";
BindsTo = [ "sway-session.target" ];
After = [ "sway-session.target" ];
Requisite = [ "graphical-session.target" ];
# ConditionEnvironment requires systemd v247 to work correctly
ConditionEnvironment = [ "WAYLAND_DISPLAY" ];
};
Service = {
Type = "dbus";
BusName = "org.freedesktop.Notifications";
ExecStart = "${pkgs.swaynotificationcenter}/bin/swaync";
ExecReload = "${pkgs.swaynotificationcenter}/bin/swaync-client --reload-config ; ${pkgs.swaynotificationcenter}/bin/swaync-client --reload-css";
Restart = "on-failure";
};
Install = {
WantedBy = [ "sway-session.target" ];
};
}

View file

@ -10,7 +10,7 @@ pkgs:
Service = { Service = {
Type = "dbus"; Type = "dbus";
Environment = "PATH=${pkgs.bash}/bin:${pkgs.pavucontrol}/bin"; Environment = "PATH=${pkgs.bash}/bin:${pkgs.pavucontrol}/bin:${pkgs.swaynotificationcenter}/bin";
BusName = "fr.arouillard.waybar"; BusName = "fr.arouillard.waybar";
ExecStart = "${pkgs.waybar}/bin/waybar"; ExecStart = "${pkgs.waybar}/bin/waybar";
}; };

View file

@ -27,6 +27,9 @@ channels: final: prev: {
vimPlugins vimPlugins
; ;
inherit (channels.master)
swaynotificationcenter
;
haskellPackages = prev.haskellPackages.override haskellPackages = prev.haskellPackages.override
(old: { (old: {

View file

@ -0,0 +1,12 @@
{
"positionX": "right",
"positionY": "top",
"timeout": 10,
"timeout-low": 5,
"timeout-critical": 0,
"notification-window-width": 500,
"keyboard-shortcuts": true,
"image-visibility": "always",
"transition-time": 200,
"hide-on-clear": false
}

View file

@ -0,0 +1,149 @@
/*
* vim: ft=less
*/
@define-color border-color rgb(7, 7, 7);
@define-color bg rgb(58, 58, 58);
@define-color bg-hover rgb(68, 68, 68);
@define-color bg-focus rgba(68, 68, 68, 0.6);
@define-color bg-selected rgb(0, 128, 255);
.notification-row {
outline: none;
}
.notification-row:focus,
.notification-row:hover {
background: @bg-focus;
}
.notification {
border-radius: 10px;
margin: 6px 12px;
box-shadow: 0px 2px 4px 2px rgba(0, 0, 0, 0.3);
padding: 0;
}
.notification-content {
background: transparent;
padding: 6px;
border-radius: 10px;
}
.close-button {
background: black;
color: white;
text-shadow: none;
padding: 0 2px;
box-shadow: 0px 2px 4px 2px rgba(0, 0, 0, 0.3);
border-radius: 100%;
}
.close-button:hover {
background: rgb(30, 30, 30);
transition: all 0.15s ease-in-out;
}
.notification-default-action,
.notification-action {
padding: 4px;
margin: 0;
box-shadow: none;
background: @bg;
border: 1px solid @border-color;
}
.notification-default-action:hover,
.notification-action:hover {
background: @bg-hover;
}
.notification-default-action {
border-radius: 10px;
}
/* When alternative actions are visible */
.notification-default-action:not(:only-child) {
border-bottom-left-radius: 0px;
border-bottom-right-radius: 0px;
}
.notification-action {
border-radius: 0px;
border-top: none;
border-right: none;
}
/* add bottom border radius to eliminate clipping */
.notification-action:first-child {
border-bottom-left-radius: 10px;
}
.notification-action:last-child {
border-bottom-right-radius: 10px;
border-right: 1px solid @border-color;
}
.image {
}
.body-image {
margin-top: 6px;
background-color: white;
border-radius: 10px;
}
.summary {
color: white;
text-shadow: none;
}
.time {
color: white;
text-shadow: none;
}
.body {
background: transparent;
color: white;
text-shadow: none;
}
.top-action-title {
color: white;
text-shadow: none;
}
.control-center-clear-all {
color: white;
text-shadow: none;
background: @bg;
border: 1px solid @border-color;
box-shadow: none;
border-radius: 10px;
}
.control-center-clear-all:hover {
background: @bg-hover;
}
.control-center-dnd {
border-radius: 10px;
background: @bg;
border: 1px solid @border-color;
box-shadow: none;
}
.control-center-dnd:checked {
background: @bg-selected;
}
.control-center-dnd slider {
background: @bg-hover;
}
.control-center {
background: rgba(0, 0, 0, 0.7);
}
.control-center-list {
background: transparent;
}
.floating-notifications {
background: transparent;
}

View file

@ -5,7 +5,16 @@
"height": 26, // Waybar height "height": 26, // Waybar height
"modules-left": ["sway/workspaces", "sway/mode"], "modules-left": ["sway/workspaces", "sway/mode"],
//"modules-center": ["mpd"], //"modules-center": ["mpd"],
"modules-right": ["sway/language", "pulseaudio", "network", "idle_inhibitor", "battery", "clock", "tray"], "modules-right": [
"sway/language",
"custom/notification",
"pulseaudio",
"network",
"idle_inhibitor",
"battery",
"clock",
"tray"
],
"sway/workspaces": { "sway/workspaces": {
"disable-scroll": true "disable-scroll": true
}, },
@ -98,5 +107,21 @@
}, },
"tooltip-format": "MPD (connected)", "tooltip-format": "MPD (connected)",
"tooltip-format-disconnected": "MPD (disconnected)" "tooltip-format-disconnected": "MPD (disconnected)"
} },
"custom/notification": {
"tooltip": false,
"format": " {icon}",
"format-icons": {
"notification": "<span foreground='red'><sup></sup></span>",
"none": "",
"dnd-notification": "<span foreground='red'><sup></sup></span>",
"dnd-none": ""
},
"return-type": "json",
"exec-if": "which swaync-client",
"exec": "swaync-client -swb",
"on-click": "swaync-client -t -sw",
"on-click-right": "swaync-client -d -sw",
"escape": true
},
} }

View file

@ -14,7 +14,6 @@ window#waybar {
color: @base04; color: @base04;
} }
#workspaces button { #workspaces button {
font-size: 14px; font-size: 14px;
box-shadow: none; box-shadow: none;
@ -23,7 +22,6 @@ window#waybar {
color: @base04; color: @base04;
} }
#workspaces button.focused { #workspaces button.focused {
color: #f85e84; color: #f85e84;
color: @base07; color: @base07;
@ -53,26 +51,29 @@ window#waybar {
#battery.critical { #battery.critical {
color: @base07; color: @base07;
} }
#battery.charging { #battery.charging {
color: @base0B; color: @base0B;
} }
#battery.full { #battery.full {
margin: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;
} }
#network { #network {
border-top: 1px solid transparent; border-top: 1px solid transparent;
} }
#network.disconnected { #network.disconnected {
margin: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;
color: rgba(75, 81, 98, 0); color: rgba(75, 81, 98, 0);
} }
#pulseaudio.muted { #pulseaudio.muted {
margin: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;
color: rgba(75, 81, 98, 0); color: rgba(75, 81, 98, 0);
} }
#custom-notification {
font-family: "NotoSansMono Nerd Font";
}

View file

@ -81,6 +81,10 @@
!/.config/waybar/config !/.config/waybar/config
!/.config/waybar/style.css !/.config/waybar/style.css
!/.config/swaync
!/.config/swaync/config.json
!/.config/swaync/style.css
!/.config/mutt !/.config/mutt
!/.config/mutt/muttrc !/.config/mutt/muttrc
!/.config/mutt/base16.muttrc !/.config/mutt/base16.muttrc

View file

@ -43,6 +43,8 @@ in
xdg.configFile."vifm/vifmrc".source = ./.config/vifm/vifmrc; xdg.configFile."vifm/vifmrc".source = ./.config/vifm/vifmrc;
xdg.configFile."vifm/colors/base16.vifm".source = ./.config/vifm/colors/base16.vifm; xdg.configFile."vifm/colors/base16.vifm".source = ./.config/vifm/colors/base16.vifm;
xdg.configFile."libinput-gestures.conf".source = ./.config/libinput-gestures.conf; xdg.configFile."libinput-gestures.conf".source = ./.config/libinput-gestures.conf;
xdg.configFile."swaync/config.json".source = ./.config/swaync/config.json;
xdg.configFile."swaync/style.css".source = ./.config/swaync/style.css;
xdg.configFile."waybar/config".source = ./.config/waybar/config; xdg.configFile."waybar/config".source = ./.config/waybar/config;
xdg.configFile."waybar/style.css".source = ./.config/waybar/style.css; xdg.configFile."waybar/style.css".source = ./.config/waybar/style.css;
xdg.configFile."waybar/colorscheme.css".source = ./.config/waybar/colorscheme.css; xdg.configFile."waybar/colorscheme.css".source = ./.config/waybar/colorscheme.css;