Move from dunst to swaync and some overall changes for sway
This commit is contained in:
parent
3b569a08e5
commit
2964471723
9
common.nix
Normal file
9
common.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
# Common stuff
|
||||
{ lib, pkgs, config, ... }:
|
||||
with lib; {
|
||||
# swaync disable notifications on screencast
|
||||
xdg.portal.wlr.settings.screencast = {
|
||||
exec_before = ''which swaync-client && swaync-client --inhibitor-add "xdg-desktop-portal-wlr" || true'';
|
||||
exec_after = ''which swaync-client && swaync-client --inhibitor-remove "xdg-desktop-portal-wlr" || true'';
|
||||
};
|
||||
}
|
|
@ -110,6 +110,7 @@
|
|||
system = "x86_64-linux";
|
||||
pkgs = pkgs' system;
|
||||
modules = [
|
||||
./common.nix
|
||||
./modules/my-tinc
|
||||
sops-nix.nixosModules.sops
|
||||
./nki-home/configuration.nix
|
||||
|
|
|
@ -42,14 +42,14 @@
|
|||
top_y = builtins.ceil (((2160 / scale) - 1080) / 2);
|
||||
in
|
||||
{
|
||||
"Unknown U28G2G6B PPYM9JA001554" = {
|
||||
"AOC U28G2G6B PPYM9JA001554" = {
|
||||
mode = "3840x2160@60Hz";
|
||||
scale = toString scale;
|
||||
adaptive_sync = "on";
|
||||
# render_bit_depth = "10";
|
||||
position = "0 0";
|
||||
};
|
||||
"Unknown 24G2W1G4 ATNN21A005410" = {
|
||||
"AOC 24G2W1G4 ATNN21A005410" = {
|
||||
mode = "1920x1080@144Hz";
|
||||
adaptive_sync = "on";
|
||||
position = "${toString top_x} ${toString top_y}";
|
||||
|
@ -61,6 +61,7 @@
|
|||
};
|
||||
};
|
||||
nki.programs.kitty.enable = true;
|
||||
nki.programs.kitty.package = pkgs.unstable.kitty; # 0.27 fixes crash on sway 1.8
|
||||
nki.programs.kitty.fontSize = 14;
|
||||
|
||||
# Yellow light!
|
||||
|
|
323
home/modules/linux/graphical/swaync.css
Normal file
323
home/modules/linux/graphical/swaync.css
Normal file
|
@ -0,0 +1,323 @@
|
|||
/*
|
||||
* vim: ft=less
|
||||
*/
|
||||
|
||||
@define-color cc-bg rgba(0, 0, 0, 0.7);
|
||||
|
||||
@define-color noti-border-color rgba(255, 255, 255, 0.15);
|
||||
@define-color noti-bg rgb(48, 48, 48);
|
||||
@define-color noti-bg-hover rgb(56, 56, 56);
|
||||
@define-color noti-bg-focus rgba(68, 68, 68, 0.6);
|
||||
@define-color noti-close-bg rgba(255, 255, 255, 0.1);
|
||||
@define-color noti-close-bg-hover rgba(255, 255, 255, 0.15);
|
||||
|
||||
@define-color bg-selected rgb(0, 128, 255);
|
||||
|
||||
.notification-row {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.notification-row:focus,
|
||||
.notification-row:hover {
|
||||
background: @noti-bg-focus;
|
||||
}
|
||||
|
||||
.notification {
|
||||
border-radius: 12px;
|
||||
margin: 6px 12px;
|
||||
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3), 0 1px 3px 1px rgba(0, 0, 0, 0.7),
|
||||
0 2px 6px 2px rgba(0, 0, 0, 0.3);
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* Uncomment to enable specific urgency colors
|
||||
.low {
|
||||
background: yellow;
|
||||
padding: 6px;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.normal {
|
||||
background: green;
|
||||
padding: 6px;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.critical {
|
||||
background: red;
|
||||
padding: 6px;
|
||||
border-radius: 12px;
|
||||
}
|
||||
*/
|
||||
|
||||
.notification-content {
|
||||
background: transparent;
|
||||
padding: 6px;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.close-button {
|
||||
background: @noti-close-bg;
|
||||
color: white;
|
||||
text-shadow: none;
|
||||
padding: 0;
|
||||
border-radius: 100%;
|
||||
margin-top: 10px;
|
||||
margin-right: 16px;
|
||||
box-shadow: none;
|
||||
border: none;
|
||||
min-width: 24px;
|
||||
min-height: 24px;
|
||||
}
|
||||
|
||||
.close-button:hover {
|
||||
box-shadow: none;
|
||||
background: @noti-close-bg-hover;
|
||||
transition: all 0.15s ease-in-out;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.notification-default-action,
|
||||
.notification-action {
|
||||
padding: 4px;
|
||||
margin: 0;
|
||||
box-shadow: none;
|
||||
background: @noti-bg;
|
||||
border: 1px solid @noti-border-color;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.notification-default-action:hover,
|
||||
.notification-action:hover {
|
||||
-gtk-icon-effect: none;
|
||||
background: @noti-bg-hover;
|
||||
}
|
||||
|
||||
.notification-default-action {
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
/* 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 @noti-border-color;
|
||||
}
|
||||
|
||||
.image {
|
||||
}
|
||||
|
||||
.body-image {
|
||||
margin-top: 6px;
|
||||
background-color: white;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.summary {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
background: transparent;
|
||||
color: white;
|
||||
text-shadow: none;
|
||||
}
|
||||
|
||||
.time {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
background: transparent;
|
||||
color: white;
|
||||
text-shadow: none;
|
||||
margin-right: 18px;
|
||||
}
|
||||
|
||||
.body {
|
||||
font-size: 15px;
|
||||
font-weight: normal;
|
||||
background: transparent;
|
||||
color: white;
|
||||
text-shadow: none;
|
||||
}
|
||||
|
||||
.control-center {
|
||||
background: @cc-bg;
|
||||
}
|
||||
|
||||
.control-center-list {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.control-center-list-placeholder {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.floating-notifications {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
/* Window behind control center and on all other monitors */
|
||||
.blank-window {
|
||||
background: alpha(black, 0.25);
|
||||
}
|
||||
|
||||
/*** Widgets ***/
|
||||
|
||||
/* Title widget */
|
||||
.widget-title {
|
||||
margin: 8px;
|
||||
font-size: 1.5rem;
|
||||
color: white;
|
||||
}
|
||||
.widget-title > button {
|
||||
font-size: initial;
|
||||
color: white;
|
||||
text-shadow: none;
|
||||
background: @noti-bg;
|
||||
border: 1px solid @noti-border-color;
|
||||
box-shadow: none;
|
||||
border-radius: 12px;
|
||||
}
|
||||
.widget-title > button:hover {
|
||||
background: @noti-bg-hover;
|
||||
}
|
||||
|
||||
/* DND widget */
|
||||
.widget-dnd {
|
||||
margin: 8px;
|
||||
font-size: 1.1rem;
|
||||
color: white;
|
||||
}
|
||||
.widget-dnd > switch {
|
||||
font-size: initial;
|
||||
border-radius: 12px;
|
||||
background: @noti-bg;
|
||||
border: 1px solid @noti-border-color;
|
||||
box-shadow: none;
|
||||
}
|
||||
.widget-dnd > switch:checked {
|
||||
background: @bg-selected;
|
||||
}
|
||||
.widget-dnd > switch slider {
|
||||
background: @noti-bg-hover;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
/* Label widget */
|
||||
.widget-label {
|
||||
margin: 8px;
|
||||
}
|
||||
.widget-label > label {
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
|
||||
/* Mpris widget */
|
||||
.widget-mpris {
|
||||
/* The parent to all players */
|
||||
color: white;
|
||||
}
|
||||
.widget-mpris-player {
|
||||
padding: 8px;
|
||||
margin: 8px;
|
||||
}
|
||||
.widget-mpris-title {
|
||||
font-weight: bold;
|
||||
font-size: 1.25rem;
|
||||
}
|
||||
.widget-mpris-subtitle {
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
|
||||
/* Buttons widget */
|
||||
.widget-buttons-grid {
|
||||
padding: 8px;
|
||||
margin: 8px;
|
||||
border-radius: 12px;
|
||||
background-color: @noti-bg;
|
||||
}
|
||||
|
||||
.widget-buttons-grid>flowbox>flowboxchild>button{
|
||||
background: @noti-bg;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.widget-buttons-grid>flowbox>flowboxchild>button:hover {
|
||||
background: @noti-bg-hover;
|
||||
}
|
||||
|
||||
/* Menubar widget */
|
||||
.widget-menubar>box>.menu-button-bar>button {
|
||||
border: none;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
/* .AnyName { Name defined in config after #
|
||||
background-color: @noti-bg;
|
||||
padding: 8px;
|
||||
margin: 8px;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.AnyName>button {
|
||||
background: transparent;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.AnyName>button:hover {
|
||||
background-color: @noti-bg-hover;
|
||||
} */
|
||||
|
||||
.topbar-buttons>button { /* Name defined in config after # */
|
||||
border: none;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
/* Volume widget */
|
||||
|
||||
.widget-volume {
|
||||
background-color: @noti-bg;
|
||||
padding: 8px;
|
||||
margin: 8px;
|
||||
border-radius: 12px;
|
||||
color: white;
|
||||
}
|
||||
|
||||
/* Backlight widget */
|
||||
.widget-backlight {
|
||||
background-color: @noti-bg;
|
||||
padding: 8px;
|
||||
margin: 8px;
|
||||
border-radius: 12px;
|
||||
color: white;
|
||||
}
|
||||
|
||||
/* Title widget */
|
||||
.widget-inhibitors {
|
||||
margin: 8px;
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
.widget-inhibitors > button {
|
||||
font-size: initial;
|
||||
color: white;
|
||||
text-shadow: none;
|
||||
background: @noti-bg;
|
||||
border: 1px solid @noti-border-color;
|
||||
box-shadow: none;
|
||||
border-radius: 12px;
|
||||
}
|
||||
.widget-inhibitors > button:hover {
|
||||
background: @noti-bg-hover;
|
||||
}
|
|
@ -1,6 +1,68 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
let
|
||||
notificationModule = { config, pkgs, lib, ... }:
|
||||
let
|
||||
swaync = pkgs.unstable.swaynotificationcenter;
|
||||
in
|
||||
with lib; mkIf (config.linux.graphical.type == "wayland") {
|
||||
home.packages = [ swaync ];
|
||||
wayland.windowManager.sway.config = {
|
||||
startup = [
|
||||
{ command = "swaync"; }
|
||||
];
|
||||
};
|
||||
xdg.configFile = {
|
||||
"swaync/config.json" = {
|
||||
text = builtins.toJSON {
|
||||
widgets = [ "inhibitors" "title" "dnd" "mpris" "notifications" ];
|
||||
scripts = { };
|
||||
};
|
||||
onChange = "swaync-client -R";
|
||||
};
|
||||
"swaync/style.css" = {
|
||||
source = ./swaync.css;
|
||||
onChange = "swaync-client -rs";
|
||||
};
|
||||
};
|
||||
|
||||
programs.my-sway.waybar = {
|
||||
extraSettings = {
|
||||
modules-right = mkAfter [ "custom/swaync" ];
|
||||
modules."custom/swaync" = {
|
||||
tooltip = false;
|
||||
format = "{icon} {}";
|
||||
format-icons = {
|
||||
notification = "<span foreground='red'><sup></sup></span>";
|
||||
none = "";
|
||||
dnd-notification = "<span foreground='red'><sup></sup></span>";
|
||||
dnd-none = "";
|
||||
inhibited-notification = "<span foreground='red'><sup></sup></span>";
|
||||
inhibited-none = "";
|
||||
dnd-inhibited-notification = "<span foreground='red'><sup></sup></span>";
|
||||
dnd-inhibited-none = "";
|
||||
};
|
||||
return-type = "json";
|
||||
# exec-if = "which swaync-client";
|
||||
exec = "${swaync}/bin/swaync-client -swb";
|
||||
on-click = "${swaync}/bin/swaync-client -t -sw";
|
||||
on-click-right = "${swaync}/bin/swaync-client -d -sw";
|
||||
escape = true;
|
||||
};
|
||||
};
|
||||
extraStyle = mkAfter ''
|
||||
#custom-swaync {
|
||||
padding: 0 10px;
|
||||
margin: 0 5px;
|
||||
background: #F0FFFF;
|
||||
color: #000000;
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
in
|
||||
with lib;
|
||||
{
|
||||
imports = [ notificationModule ];
|
||||
config = mkIf (config.linux.graphical.type == "wayland") {
|
||||
# Additional packages
|
||||
home.packages = with pkgs; [
|
||||
|
@ -16,24 +78,24 @@ with lib;
|
|||
];
|
||||
|
||||
# Notification system
|
||||
services.dunst = {
|
||||
enable = true;
|
||||
settings.global.follow = "keyboard";
|
||||
# services.dunst = {
|
||||
# enable = true;
|
||||
# settings.global.follow = "keyboard";
|
||||
|
||||
settings.global.width = "(400, 800)";
|
||||
settings.global.notification_limit = 5;
|
||||
# settings.global.width = "(400, 800)";
|
||||
# settings.global.notification_limit = 5;
|
||||
|
||||
settings.global.font = "Monospace 12";
|
||||
# settings.global.font = "Monospace 12";
|
||||
|
||||
settings.global.dmenu = "${pkgs.bemenu}/bin/bemenu";
|
||||
settings.global.browser = "${pkgs.firefox-wayland}/bin/firefox";
|
||||
# settings.global.dmenu = "${pkgs.bemenu}/bin/bemenu";
|
||||
# settings.global.browser = "${pkgs.firefox-wayland}/bin/firefox";
|
||||
|
||||
settings.global.mouse_left_click = "do_action, close_current";
|
||||
settings.global.mouse_right_click = "close_current";
|
||||
settings.global.mouse_middle_click = "close_all";
|
||||
# settings.global.mouse_left_click = "do_action, close_current";
|
||||
# settings.global.mouse_right_click = "close_current";
|
||||
# settings.global.mouse_middle_click = "close_all";
|
||||
|
||||
settings.experimental.per_monitor_dpi = "true";
|
||||
};
|
||||
# settings.experimental.per_monitor_dpi = "true";
|
||||
# };
|
||||
|
||||
# Forward wallpaper settings to sway
|
||||
programs.my-sway.wallpaper = config.linux.graphical.wallpaper;
|
||||
|
|
|
@ -7,16 +7,16 @@ let
|
|||
mod = "Mod4";
|
||||
# List of workspaces
|
||||
workspaces = [
|
||||
"1: web"
|
||||
"2: chat"
|
||||
"3: code"
|
||||
"4: music"
|
||||
"5: extra"
|
||||
"6: 6"
|
||||
"7: 7"
|
||||
"8: 8"
|
||||
"9: 9"
|
||||
"10: 10"
|
||||
"1:🌏 web"
|
||||
"2:💬 chat"
|
||||
"3:⚙️ code"
|
||||
"4:🎶 music"
|
||||
"5:🔧 extra"
|
||||
"6:🧰 6"
|
||||
"7:🔩 7"
|
||||
"8:🛠️ 8"
|
||||
"9:🔨 9"
|
||||
"10:🎲 misc"
|
||||
];
|
||||
wsAttrs = builtins.listToAttrs (
|
||||
map
|
||||
|
@ -92,10 +92,25 @@ in
|
|||
description = "Whether to enable mpd on waybar";
|
||||
default = false;
|
||||
};
|
||||
|
||||
waybar = {
|
||||
extraSettings = mkOption {
|
||||
type = types.attrs;
|
||||
description = "Additional settings for the default waybar";
|
||||
default = { };
|
||||
};
|
||||
extraStyle = mkOption {
|
||||
type = types.str;
|
||||
description = "Additional style for the default waybar";
|
||||
default = "";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config.wayland.windowManager.sway = mkIf cfg.enable {
|
||||
enable = true;
|
||||
package = pkgs.unstable.sway;
|
||||
systemdIntegration = true;
|
||||
|
||||
config = {
|
||||
### Inputs
|
||||
|
@ -261,6 +276,11 @@ in
|
|||
{ class = "^(d|D)iscord$"; }
|
||||
];
|
||||
};
|
||||
# Commands
|
||||
window.commands = [
|
||||
{ criteria = { title = ".*"; }; command = "inhibit_idle fullscreen"; }
|
||||
];
|
||||
# Focus
|
||||
focus.followMouse = true;
|
||||
focus.mouseWarping = true;
|
||||
focus.newWindow = "urgent";
|
||||
|
@ -271,12 +291,8 @@ in
|
|||
gaps.smartGaps = true;
|
||||
|
||||
### Bars
|
||||
#
|
||||
# Enable top bar, as waybar
|
||||
bars = [{
|
||||
command = config.programs.waybar.package + "/bin/waybar";
|
||||
position = "top";
|
||||
}];
|
||||
# Let systemd manage it
|
||||
bars = [ ];
|
||||
};
|
||||
### Misc
|
||||
#
|
||||
|
@ -303,24 +319,7 @@ in
|
|||
(if cfg.enableLaptopBars then ''
|
||||
# Lock screen on lid close
|
||||
bindswitch lid:off exec ${cfg.lockCmd}
|
||||
'' else "") +
|
||||
''
|
||||
# Fix D-Bus starting up
|
||||
exec systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK && \
|
||||
hash dbus-update-activation-environment 2>/dev/null && \
|
||||
dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK && \
|
||||
systemctl --user start sway-session.target
|
||||
'';
|
||||
};
|
||||
|
||||
config.systemd.user.targets.sway-session = mkIf cfg.enable {
|
||||
Unit = {
|
||||
Description = "sway compositor session";
|
||||
Documentation = [ "man:systemd.special(7)" ];
|
||||
BindsTo = [ "graphical-session.target" ];
|
||||
Wants = [ "graphical-session-pre.target" ];
|
||||
After = [ "graphical-session-pre.target" ];
|
||||
};
|
||||
'' else "");
|
||||
};
|
||||
|
||||
config.services.swayidle = mkIf cfg.enable {
|
||||
|
@ -333,9 +332,10 @@ in
|
|||
|
||||
config.programs.waybar = mkIf cfg.enable {
|
||||
enable = true;
|
||||
systemd.enable = true;
|
||||
settings = [
|
||||
# Top bar
|
||||
{
|
||||
(mkMerge [{
|
||||
position = "top";
|
||||
modules-left = [
|
||||
"sway/workspaces"
|
||||
|
@ -363,6 +363,9 @@ in
|
|||
];
|
||||
|
||||
modules = {
|
||||
"sway/workspaces" = {
|
||||
format = "{name}";
|
||||
};
|
||||
"sway/mode" = {
|
||||
format = "<span style=\"italic\">{}</span>";
|
||||
};
|
||||
|
@ -436,6 +439,7 @@ in
|
|||
tooltip-format-connected = "{controller_alias}\t{controller_address}\n\n{num_connections} connected\n\n{device_enumerate}";
|
||||
tooltip-format-enumerate-connected = "{device_alias}\t{device_address}";
|
||||
tooltip-format-enumerate-connected-battery = "{device_alias}\t{device_address}\t{device_battery_percentage}%";
|
||||
on-click = "${pkgs.blueman}/bin/blueman-manager";
|
||||
};
|
||||
"pulseaudio" = {
|
||||
# scroll-step = 1;
|
||||
|
@ -477,6 +481,8 @@ in
|
|||
};
|
||||
"tooltip-format" = "MPD (connected)";
|
||||
"tooltip-format-disconnected" = "MPD (disconnected)";
|
||||
"on-click" = "${pkgs.mpc_cli}/bin/mpc toggle";
|
||||
"on-click-right" = "${pkgs.mpc_cli}/bin/mpc stop";
|
||||
};
|
||||
"custom/media" = {
|
||||
"format" = "{icon}{}";
|
||||
|
@ -491,6 +497,7 @@ in
|
|||
};
|
||||
};
|
||||
}
|
||||
cfg.waybar.extraSettings])
|
||||
];
|
||||
style = ''
|
||||
* {
|
||||
|
@ -645,7 +652,7 @@ in
|
|||
background-color: teal;
|
||||
color: white;
|
||||
}
|
||||
'';
|
||||
'' + cfg.waybar.extraStyle;
|
||||
};
|
||||
config.home.packages = mkIf cfg.enable (with pkgs; [
|
||||
# Needed for QT_QPA_PLATFORM
|
||||
|
|
Loading…
Reference in a new issue