1
0
forked from colin/nix-files

sysvol: integrate as a service (sane.programs)

This commit is contained in:
Colin 2024-03-08 11:43:44 +00:00
parent e45d4d6ae7
commit df98ef30e0
3 changed files with 89 additions and 1 deletions

View File

@ -104,6 +104,7 @@
./swayidle.nix
./swaylock.nix
./swaynotificationcenter.nix
./sysvol.nix
./tangram.nix
./tor-browser.nix
./tuba.nix

View File

@ -116,12 +116,13 @@ in
"swayidle" # enable if you need it
"swaylock" # used by sway config
"swaynotificationcenter" # notification daemon
"sysvol" # volume notifier
"unl0kr" # greeter
"waybar" # used by sway config
"wdisplays" # like xrandr
"wireplumber" # used by sway config
"wl-clipboard"
"wob" # render volume changes on-screen
# "wob" # render volume changes on-screen
"xdg-desktop-portal"
# xdg-desktop-portal-gtk provides portals for:
# - org.freedesktop.impl.portal.Access

View File

@ -0,0 +1,86 @@
{ config, lib, ... }:
let
cfg = config.sane.programs.sysvol;
in
{
sane.programs.sysvol = {
configOption = with lib; mkOption {
default = {};
type = types.submodule {
options.autostart = mkOption {
type = types.bool;
default = true;
};
};
};
sandbox.method = "bwrap";
sandbox.whitelistAudio = true;
sandbox.whitelistWayland = true;
fs.".config/sys64/volume.css".symlink.text = ''
window {
background: #000000B4;
border-radius: 19px;
}
label {
color: #FFFFFF;
}
image {
margin-left: 9px;
color: #FFFFFFD0;
}
/* optionally, replace with `scale.horizontal` and `scale.vertical` for specialization */
scale {
margin: 0px;
padding: 0px;
margin-right: 7px;
}
scale trough {
border-radius: 12px;
background: #00000000;
border: none;
margin-left: 12px;
margin-right: 12px;
}
scale highlight {
margin-bottom: 3px;
margin-top: 3px;
border-radius: 12px;
background: #e1f0efdc;
}
scale slider {
margin: 0px;
margin-left: -12px;
margin-right: -12px;
padding: 0px;
/* background: #e1f0efFF; */
background: #f9fffc;
box-shadow: none;
min-height: 25px;
min-width: 25px;
}
'';
services."sysvol" = {
description = "sysvol: volume monitor/notifier";
after = [ "graphical-session.target" ];
wantedBy = lib.mkIf cfg.config.autostart [ "graphical-session.target" ];
serviceConfig = {
# options:
# -p {0,1,2,3} to attach to top/right/bottom/left screen edge
# -t N for the notifier to be dismissed after N seconds (integer only)
# -m N to set the indicator this many pixels in from the edge
# -{H,W} N to set the height/width of the notifier, in px.
# -i N to set the size of the volume icon
# -P to hide percentage text
ExecStart = "${cfg.package}/bin/sysvol -p 0 -t 1 -m 32 -H 39 -W 256 -i 32 -P";
Type = "simple";
Restart = "always";
RestartSec = "10s";
};
};
};
}