graphical: various improvements

* Use mako home-manager module
* Use nextcloud-client home-manager module
* Urgent notifications go above fullscreen apps
* Add battery check with libnotify
* Increase waybar text sizing
This commit is contained in:
Benjamin Yule Bädorf 2024-03-26 23:58:04 +01:00
parent 4bc5fd8ef2
commit 52bbd13a24
Signed by: b12f
GPG key ID: 729956E1124F8F26
19 changed files with 206 additions and 288 deletions

View file

@ -15,9 +15,9 @@
self.nixosModules.desktop-extended self.nixosModules.desktop-extended
self.nixosModules.docker self.nixosModules.docker
self.nixosModules.graphical self.nixosModules.graphical
self.nixosModules.nextcloud
self.nixosModules.office self.nixosModules.office
self.nixosModules.persistence self.nixosModules.persistence
self.nixosModules.portable
self.nixosModules.printing self.nixosModules.printing
]; ];
}; };
@ -33,8 +33,8 @@
self.nixosModules.desktop-extended self.nixosModules.desktop-extended
self.nixosModules.docker self.nixosModules.docker
self.nixosModules.graphical self.nixosModules.graphical
self.nixosModules.nextcloud
self.nixosModules.office self.nixosModules.office
self.nixosModules.portable
self.nixosModules.printing self.nixosModules.printing
]; ];
}; };
@ -51,7 +51,6 @@
self.nixosModules.docker self.nixosModules.docker
self.nixosModules.gaming self.nixosModules.gaming
self.nixosModules.graphical self.nixosModules.graphical
self.nixosModules.nextcloud
self.nixosModules.office self.nixosModules.office
self.nixosModules.printing self.nixosModules.printing
self.nixosModules.virtualisation self.nixosModules.virtualisation

View file

@ -18,9 +18,9 @@
graphical = import ./graphical; graphical = import ./graphical;
invoiceplane = import ./invoiceplane; invoiceplane = import ./invoiceplane;
nix = import ./nix; nix = import ./nix;
nextcloud = import ./nextcloud;
office = import ./office; office = import ./office;
persistence = import ./persistence; persistence = import ./persistence;
portable = import ./portable;
printing = import ./printing; printing = import ./printing;
terminal-life = import ./terminal-life; terminal-life = import ./terminal-life;
user = import ./user; user = import ./user;

View file

@ -1,22 +0,0 @@
padding=10
margin=5,5,0
default-timeout=5000
## Base16 Burn
# Author: Benjamin Bädorf
#
# You can use these variables anywhere in the mako configuration file.
background-color=#1a181a
text-color=#e3e1e4
border-color=#ff5f5f
[urgency=low]
background-color=#1a181a
text-color=#e3e1e4
border-color=#ff5f5f
[urgency=high]
background-color=#ff5f5f
text-color=#1a181a
border-color=#1a181a

View file

@ -1,23 +0,0 @@
/*
*
* Base16 Burn
* Author: Benjamin Bädorf
*
*/
@define-color base00 #1a181a;
@define-color base01 #2d2a2e;
@define-color base02 #303030;
@define-color base03 #949494;
@define-color base04 #d3d1d4;
@define-color base05 #e3e1e4;
@define-color base06 #303030;
@define-color base07 #ff5f5f;
@define-color base08 #f85e84;
@define-color base09 #df5923;
@define-color base0A #e5c463;
@define-color base0B #9ecd6f;
@define-color base0C #ef9062;
@define-color base0D #7accd7;
@define-color base0E #ab9df2;
@define-color base0F #d70000;

View file

@ -1,116 +0,0 @@
{
"layer": "top", // Waybar at top layer
// "position": "bottom", // Waybar position (top|bottom|left|right)
"height": 26, // Waybar height
"modules-left": ["sway/workspaces", "sway/mode"],
//"modules-center": ["mpd"],
"modules-right": ["sway/language", "pulseaudio", "network", "idle_inhibitor", "battery", "clock", "tray"],
"sway/workspaces": {
"disable-scroll": true
},
"sway/mode": {
"tooltip": false,
"format": "{}"
},
"sway/window": {
"tooltip": false,
"max-length": 96
},
"sway/language": {
"format": "{}",
"max-length": 50
},
"tray": {
"icon-size": 21,
"spacing": 10
},
"clock": {
"tooltip-format": "<tt><small>{calendar}</small></tt>",
"format-alt": "{:%a %d. %h %H:%M}",
//"on-scroll": {
// "calendar": 1
//}
"calendar": {
"mode-mon-col" : 3,
"on-scroll": -1,
"on-click-right": "mode",
"format": {
"months": "<span color='#ffead3'><b>{}</b></span>",
"days": "<span color='#ecc6d9'><b>{}</b></span>",
"weekdays": "<span color='#ffcc66'><b>{}</b></span>",
"today": "<span color='#ff6699'><b><u>{}</u></b></span>"
},
},
},
"backlight": {
// "device": "acpi_video1",
"tooltip": true,
"tooltip-format": "Brightness: <big>{percent}%</big>",
"format": "<span font='10'>{icon}</span>",
"format-icons": ["", ""]
},
"cpu": {
"format": "{}% "
},
"memory": {
"format": "{}% "
},
"idle_inhibitor": {
"format": "<span font='10'>{icon} </span>",
"format-icons": {
"activated": "",
"deactivated": ""
}
},
"battery": {
"tooltip": false,
"states": {
"critical": 25
},
"full-at": 84,
"format": "<span font='10'>{icon}</span> {capacity}%",
"format-full": "<span font='10'>{icon}</span>",
"format-icons": ["", "", "", "", ""],
},
"network": {
"interval": 3,
"tooltip": true,
//"interface": "wlp4s0", // (Optional) To force the use of this interface   \uF2E7,
"format-wifi": "<span font='10'></span> \uf062 {bandwidthUpBits} | \uf063 {bandwidthDownBits}",
"format-ethernet": "<span font='10'></span> \uf062 {bandwidthUpBits} | \uf063 {bandwidthDownBits}",
"format-disconnected": "",
"tooltip-format-wifi": "{essid} ({signalStrength}%)  {ipaddr}",
"tooltip-format-ethernet": "{ifname}  {ipaddr}"
},
//\ue04f{volume}%
"pulseaudio": {
"tooltip": false,
"format": "{volume}% <span font='10'>{icon}</span>",
"format-bluetooth": "{volume}% <span font='10'>{icon}</span>",
"format-muted": "",
"on-click": "pavucontrol",
"format-alt": "{volume}% <span font='10'>{icon}</span>",
"format-icons": {
"headphones": "",
"handsfree": "",
"headset": "",
"phone": "",
"portable": "",
"car": "",
"default": ["","", ""]
}
},
"mpd": {
"format": "{artist} - {title} <span color=\"#999999\">[<span color=\"#ffffff\">{elapsedTime:%M:%S}</span> / {totalTime:%M:%S}]</span>",
"format-disconnected": "",
"format-stopped": "",
"interval": 1,
"state-icons": {
"paused": "",
"playing": ""
},
"tooltip-format": "MPD (connected)",
"tooltip-format-disconnected": "MPD (disconnected)"
}
}

View file

@ -1,4 +1,19 @@
@import "./colorscheme.css"; @define-color base00 #1a181a;
@define-color base01 #2d2a2e;
@define-color base02 #303030;
@define-color base03 #949494;
@define-color base04 #d3d1d4;
@define-color base05 #e3e1e4;
@define-color base06 #303030;
@define-color base07 #ff5f5f;
@define-color base08 #f85e84;
@define-color base09 #df5923;
@define-color base0A #e5c463;
@define-color base0B #9ecd6f;
@define-color base0C #ef9062;
@define-color base0D #7accd7;
@define-color base0E #ab9df2;
@define-color base0F #d70000;
* { * {
min-height: 0; min-height: 0;
@ -8,7 +23,7 @@
window#waybar { window#waybar {
font-family: Hack, FontAwesome; font-family: Hack, FontAwesome;
font-weight: 500; font-weight: 500;
font-size: 14px; font-size: 16px;
background: rgba(11, 12, 13, 0.90); background: rgba(11, 12, 13, 0.90);
border-bottom: 1px solid rgba(0, 0, 2, 0.53); border-bottom: 1px solid rgba(0, 0, 2, 0.53);
color: @base04; color: @base04;
@ -16,7 +31,7 @@ window#waybar {
#workspaces button { #workspaces button {
font-size: 14px; font-size: 16px;
box-shadow: none; box-shadow: none;
text-shadow: none; text-shadow: none;
padding: 0px 3px 0px 3px; padding: 0px 3px 0px 3px;
@ -36,18 +51,16 @@ window#waybar {
} }
#clock, #backlight, #battery, #cpu, #memory, #network, #pulseaudio, #custom-spotify, #tray, #mode { #clock, #backlight, #battery, #cpu, #memory, #network, #pulseaudio, #custom-spotify, #tray, #mode {
font-size: 14px; font-size: 16px;
margin: 0px 10px 0px 5px;
} }
#pulseaudio { #pulseaudio {
/* border-top: 1px solid transparent; */ /* border-top: 1px solid transparent; */
font-size: 12px; font-size: 16px;
margin-left: 15px;
} }
#battery { #battery {
font-size: 12px; font-size: 16px;
} }
#battery.critical { #battery.critical {
@ -65,13 +78,11 @@ window#waybar {
border-top: 1px solid transparent; border-top: 1px solid transparent;
} }
#network.disconnected { #network.disconnected {
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;
color: rgba(75, 81, 98, 0); color: rgba(75, 81, 98, 0);
} }

View file

@ -19,6 +19,8 @@ with lib; let
in { in {
imports = [ imports = [
./sway ./sway
./waybar.nix
./mako.nix
]; ];
options.pub-solar.graphical = { options.pub-solar.graphical = {
@ -108,11 +110,7 @@ in {
xdg.configFile."user-dirs.dirs".source = ./.config/user-dirs.dirs; xdg.configFile."user-dirs.dirs".source = ./.config/user-dirs.dirs;
xdg.configFile."user-dirs.locale".source = ./.config/user-dirs.locale; xdg.configFile."user-dirs.locale".source = ./.config/user-dirs.locale;
xdg.configFile."xsettingsd/xsettingsd.conf".source = ./.config/xsettingsd/xsettingsd.conf; xdg.configFile."xsettingsd/xsettingsd.conf".source = ./.config/xsettingsd/xsettingsd.conf;
xdg.configFile."mako/config".source = ./.config/mako/config;
xdg.configFile."libinput-gestures.conf".source = ./.config/libinput-gestures.conf; xdg.configFile."libinput-gestures.conf".source = ./.config/libinput-gestures.conf;
xdg.configFile."waybar/config".source = ./.config/waybar/config;
xdg.configFile."waybar/style.css".source = ./.config/waybar/style.css;
xdg.configFile."waybar/colorscheme.css".source = ./.config/waybar/colorscheme.css;
xdg.configFile."wallpaper.jpg".source = ./assets/wallpaper.jpg; xdg.configFile."wallpaper.jpg".source = ./assets/wallpaper.jpg;
gtk = { gtk = {

View file

@ -0,0 +1,32 @@
{
lib,
config,
pkgs,
...
}:
with lib; let
psCfg = config.pub-solar;
in {
home-manager.users."${psCfg.user.name}" = {
services.mako = {
enable = true;
extraConfig = ''
padding=10
margin=5,5,0
default-timeout=5000
background-color=#1a181a
text-color=#e3e1e4
border-color=#ff5f5f
font=Hack 14
[urgency=high]
background-color=#ff5f5f
text-color=#1a181a
border-color=#1a181a
layer=overlay
font=Hack 14
'';
};
};
}

View file

@ -51,9 +51,7 @@ in {
sway sway
grim grim
kanshi kanshi
mako
slurp slurp
swayidle
swaybg swaybg
xwayland xwayland
@ -75,14 +73,8 @@ in {
]; ];
home-manager.users."${psCfg.user.name}" = { home-manager.users."${psCfg.user.name}" = {
programs.waybar.enable = true;
#programs.waybar.systemd.enable = true;
systemd.user.services.mako = import ./mako.service.nix {inherit pkgs psCfg;};
systemd.user.services.sway = import ./sway.service.nix {inherit pkgs psCfg;}; systemd.user.services.sway = import ./sway.service.nix {inherit pkgs psCfg;};
systemd.user.services.swayidle = import ./swayidle.service.nix {inherit pkgs psCfg;};
systemd.user.services.xsettingsd = import ./xsettingsd.service.nix {inherit pkgs psCfg;}; systemd.user.services.xsettingsd = import ./xsettingsd.service.nix {inherit pkgs psCfg;};
systemd.user.services.waybar = import ./waybar.service.nix {inherit pkgs psCfg;};
systemd.user.targets.sway-session = import ./sway-session.target.nix {inherit pkgs psCfg;}; systemd.user.targets.sway-session = import ./sway-session.target.nix {inherit pkgs psCfg;};
xdg.configFile."sway/config".text = import ./config/config.nix {inherit config pkgs;}; xdg.configFile."sway/config".text = import ./config/config.nix {inherit config pkgs;};
@ -93,6 +85,32 @@ in {
xdg.configFile."sway/config.d/mode_system.conf".text = import ./config/config.d/mode_system.conf.nix {inherit pkgs psCfg;}; xdg.configFile."sway/config.d/mode_system.conf".text = import ./config/config.d/mode_system.conf.nix {inherit pkgs psCfg;};
xdg.configFile."sway/config.d/applications.conf".source = ./config/config.d/applications.conf; xdg.configFile."sway/config.d/applications.conf".source = ./config/config.d/applications.conf;
xdg.configFile."sway/config.d/systemd.conf".source = ./config/config.d/systemd.conf; xdg.configFile."sway/config.d/systemd.conf".source = ./config/config.d/systemd.conf;
services.swayidle = with pkgs; {
enable = true;
events = [
{
event = "before-sleep";
command = "${systemd}/bin/systemctl hibernate";
}
];
timeouts = [
{
timeout = 120;
command = "${swaylock-bg}/bin/swaylock-bg";
}
{
timeout = 130;
command = "${sway}/bin/swaymsg \"output * dpms off\"";
resumeCommand = "${sway}/bin/swaymsg \"output * dpms on\"";
}
{
timeout = 300;
command = "${systemd}/bin/systemctl hibernate";
}
];
systemdTarget = "sway-session.target";
};
}; };
}; };
} }

View file

@ -1,18 +0,0 @@
{pkgs, ...}: {
Unit = {
Description = "Lightweight Wayland notification daemon";
Documentation = ["man:mako(1)"];
BindsTo = ["sway-session.target"];
After = ["sway-session.target"];
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

@ -1,28 +0,0 @@
{
pkgs,
psCfg,
...
}: {
Unit = {
Description = "Idle manager for Wayland";
Documentation = ["man:swayidle(1)"];
BindsTo = ["graphical-session.target"];
Wants = ["graphical-session-pre.target"];
After = ["graphical-session-pre.target"];
};
Service = {
Type = "simple";
Environment = "PATH=/run/current-system/sw/bin:${pkgs.sway}/bin:${pkgs.swayidle}/bin";
ExecStart = with pkgs; ''
swayidle -w \
before-sleep '${systemd}/bin/systemctl hibernate' \
timeout 120 '${swaylock-bg}/bin/swaylock-bg' \
timeout 130 '${sway}/bin/swaymsg "output * dpms off"' \
resume '${sway}/bin/swaymsg "output * dpms on"' \
timeout 300 '${systemd}/bin/systemctl hibernate'
'';
};
Install = {
WantedBy = ["sway-session.target"];
};
}

View file

@ -1,21 +0,0 @@
{pkgs, ...}: {
Unit = {
Description = "Highly customizable Wayland bar for Sway and Wlroots based compositors.";
Documentation = "https://github.com/Alexays/Waybar/wiki/";
BindsTo = ["sway-session.target"];
After = ["sway-session.target" "network-online.target"];
Wants = ["graphical-session-pre.target" "network-online.target" "blueman-applet.service"];
ConditionEnvironment = ["WAYLAND_DISPLAY"];
};
Service = {
Type = "dbus";
Environment = "PATH=${pkgs.bash}/bin:${pkgs.pavucontrol}/bin";
BusName = "fr.arouillard.waybar";
ExecStart = "${pkgs.waybar}/bin/waybar";
};
Install = {
WantedBy = ["sway-session.target"];
};
}

View file

@ -0,0 +1,96 @@
{
lib,
config,
pkgs,
...
}:
with lib; let
psCfg = config.pub-solar;
in {
home-manager.users."${psCfg.user.name}" = {
programs.waybar = {
enable = true;
settings.main = {
layer = "top";
position = "top";
height = 32;
spacing = 12;
modules-left = ["sway/workspaces"];
modules-center = ["sway/mode"];
modules-right = ["network" "tray" "sway/language" "pulseaudio" "battery" "clock"];
"sway/workspaces".disable-scroll = true;
"sway/mode" = {
tooltip = false;
format = "{}";
};
"sway/window" = {
tooltip = false;
max-length = 96;
};
"sway/language" = {
format = "{}";
max-length = 2;
on-click = "${pkgs.toggle-kbd-layout}/bin/toggle-kbd-layout";
};
tray = {
icon-size = 16;
spacing = 12;
};
clock = {
tooltip-format = "<tt><small>{calendar}</small></tt>";
format-alt = "{:%a %d. %h %H:%M}";
calendar = {
mode-mon-col = "3";
on-scroll = "-1";
on-click-right = "mode";
format = {
months = "<span color='#ffead3'><b>{}</b></span>";
days = "<span color='#ecc6d9'><b>{}</b></span>";
weekdays = "<span color='#ffcc66'><b>{}</b></span>";
today = "<span color='#ff6699'><b><u>{}</u></b></span>";
};
};
};
battery = {
tooltip = false;
states = {
critical = 25;
};
full-at = 90;
format = "<span font='12'>{icon}</span> {capacity}%";
format-icons = ["" "" "" "" ""];
};
network = {
interval = 3;
tooltip = true;
format-wifi = "{bandwidthUpBits} up | {bandwidthDownBits} down";
format-ethernet = "{bandwidthUpBits} up | {bandwidthDownBits} down";
format-disconnected = "no network";
tooltip-format-wifi = "{essid} ({signalStrength}%) {ipaddr}";
tooltip-format-ethernet = "{ifname} {ipaddr}";
};
pulseaudio = {
tooltip = false;
format = "<span font='12'>{icon}</span> {volume}%";
format-bluetooth = "<span font='12'>{icon}</span> {volume}%";
format-muted = "<span font='12'>{icon}x</span>";
on-click = "pavucontrol";
format-icons = {
headphones = "";
handsfree = "";
headset = "";
phone = "";
portable = "";
car = "";
default = ["" "" ""];
};
};
};
style = builtins.readFile ./.config/waybar/style.css;
systemd.enable = true;
systemd.target = "sway-session.target";
};
};
}

View file

@ -1,13 +0,0 @@
{
lib,
config,
pkgs,
...
}:
with lib; let
psCfg = config.pub-solar;
in {
home-manager.users."${psCfg.user.name}" = {
systemd.user.services.nextcloud-client = import ./nextcloud.service.nix pkgs;
};
}

View file

@ -1,20 +0,0 @@
pkgs: {
Unit = {
Description = "Nextcloud Client";
BindsTo = ["sway-session.target"];
Wants = ["graphical-session-pre.target"];
After = ["graphical-session-pre.target"];
# ConditionEnvironment requires systemd v247 to work correctly
ConditionEnvironment = ["WAYLAND_DISPLAY"];
};
Service = {
Type = "simple";
ExecStart = "${pkgs.nextcloud-client}/bin/nextcloud --background";
ExecReload = "/run/current-system/sw/bin/kill -HUP $MAINPID";
KillMode = "process";
Restart = "on-failure";
};
Install = {
WantedBy = ["sway-session.target"];
};
}

View file

@ -0,0 +1,9 @@
{ pkgs, ... }:
{
services.cron = {
enable = true;
systemCronJobs = [
"*/5 * * * * root ${pkgs.check-battery}/bin/check-battery"
];
};
}

12
pkgs/check-battery.nix Normal file
View file

@ -0,0 +1,12 @@
self:
with self; ''
status=$(cat /sys/class/power_supply/BAT0/status)
if [ $status != "Discharging" ]; then
exit 0
fi
capacity=$(cat /sys/class/power_supply/BAT0/capacity)
if [ $capacity -lt 15 ]; then
${libnotify}/bin/notify-send -u critical "Battery ''${capacity}%"
fi
''

View file

@ -4,6 +4,7 @@ with prev; {
sources = callPackage (import ./_sources/generated.nix) {}; sources = callPackage (import ./_sources/generated.nix) {};
# then, call packages with `final.callPackage` # then, call packages with `final.callPackage`
# caddy = callPackage (import ./caddy) {}; # caddy = callPackage (import ./caddy) {};
check-battery = writeShellScriptBin "check-battery" (import ./check-battery.nix final);
concourse = import ./concourse.nix final; concourse = import ./concourse.nix final;
fetch-hostingde-invoices = import ./fetch-hostingde-invoices final; fetch-hostingde-invoices = import ./fetch-hostingde-invoices final;
import-gtk-settings = writeShellScriptBin "import-gtk-settings" (import ./import-gtk-settings.nix final); import-gtk-settings = writeShellScriptBin "import-gtk-settings" (import ./import-gtk-settings.nix final);

View file

@ -11,11 +11,14 @@ with lib; let
in { in {
home-manager.users."${psCfg.user.name}" = { home-manager.users."${psCfg.user.name}" = {
home.packages = [ home.packages = [
pkgs.zoom-us # pkgs.zoom-us
]; ];
programs.bash.initExtra = '' programs.bash.initExtra = ''
source ${config.age.secrets.b12f-env-secrets.path} source ${config.age.secrets.b12f-env-secrets.path}
''; '';
services.nextcloud-client.enable = true;
services.nextcloud-client.startInBackground = true;
}; };
} }