mirror of
https://github.com/nix-community/home-manager
synced 2024-11-20 01:59:45 +01:00
swayosd: add module
This commit is contained in:
parent
069d450b6d
commit
98282a481d
6 changed files with 104 additions and 0 deletions
|
@ -1157,6 +1157,14 @@ in
|
||||||
A new module is available: 'programs.pyenv'.
|
A new module is available: 'programs.pyenv'.
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
time = "2023-07-08T09:44:56+00:00";
|
||||||
|
condition = hostPlatform.isLinux;
|
||||||
|
message = ''
|
||||||
|
A new module is available: 'services.swayosd'
|
||||||
|
'';
|
||||||
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -312,6 +312,7 @@ let
|
||||||
./services/stalonetray.nix
|
./services/stalonetray.nix
|
||||||
./services/status-notifier-watcher.nix
|
./services/status-notifier-watcher.nix
|
||||||
./services/swayidle.nix
|
./services/swayidle.nix
|
||||||
|
./services/swayosd.nix
|
||||||
./services/sxhkd.nix
|
./services/sxhkd.nix
|
||||||
./services/syncthing.nix
|
./services/syncthing.nix
|
||||||
./services/systembus-notify.nix
|
./services/systembus-notify.nix
|
||||||
|
|
58
modules/services/swayosd.nix
Normal file
58
modules/services/swayosd.nix
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
cfg = config.services.swayosd;
|
||||||
|
|
||||||
|
in {
|
||||||
|
meta.maintainers = [ hm.maintainers.pltanton ];
|
||||||
|
|
||||||
|
options.services.swayosd = {
|
||||||
|
enable = mkEnableOption ''
|
||||||
|
swayosd, a GTK based on screen display for keyboard shortcuts like
|
||||||
|
caps-lock and volume'';
|
||||||
|
|
||||||
|
package = mkPackageOption pkgs "swayosd" { };
|
||||||
|
|
||||||
|
maxVolume = mkOption {
|
||||||
|
type = types.nullOr types.ints.unsigned;
|
||||||
|
default = null;
|
||||||
|
example = 120;
|
||||||
|
description = ''
|
||||||
|
Sets the maximum volume.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
assertions = [
|
||||||
|
(hm.assertions.assertPlatform "services.swayosd" pkgs platforms.linux)
|
||||||
|
];
|
||||||
|
|
||||||
|
home.packages = [ cfg.package ];
|
||||||
|
|
||||||
|
systemd.user = {
|
||||||
|
services.swayosd = {
|
||||||
|
Unit = {
|
||||||
|
Description = "Volume/backlight OSD indicator";
|
||||||
|
PartOf = [ "graphical-session.target" ];
|
||||||
|
After = [ "graphical-session.target" ];
|
||||||
|
ConditionEnvironment = "WAYLAND_DISPLAY";
|
||||||
|
Documentation = "man:swayosd(1)";
|
||||||
|
};
|
||||||
|
|
||||||
|
Service = {
|
||||||
|
Type = "simple";
|
||||||
|
ExecStart = "${cfg.package}/bin/swayosd"
|
||||||
|
+ (optionalString (cfg.maxVolume != null)
|
||||||
|
" --max-volume ${toString cfg.maxVolume}");
|
||||||
|
Restart = "always";
|
||||||
|
};
|
||||||
|
|
||||||
|
Install = { WantedBy = [ "graphical-session.target" ]; };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -222,6 +222,7 @@ import nmt {
|
||||||
./modules/services/redshift-gammastep
|
./modules/services/redshift-gammastep
|
||||||
./modules/services/screen-locker
|
./modules/services/screen-locker
|
||||||
./modules/services/swayidle
|
./modules/services/swayidle
|
||||||
|
./modules/services/swayosd
|
||||||
./modules/services/sxhkd
|
./modules/services/sxhkd
|
||||||
./modules/services/syncthing/linux
|
./modules/services/syncthing/linux
|
||||||
./modules/services/trayer
|
./modules/services/trayer
|
||||||
|
|
1
tests/modules/services/swayosd/default.nix
Normal file
1
tests/modules/services/swayosd/default.nix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{ swayosd = ./swayosd.nix; }
|
35
tests/modules/services/swayosd/swayosd.nix
Normal file
35
tests/modules/services/swayosd/swayosd.nix
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
{ config, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
services.swayosd = {
|
||||||
|
enable = true;
|
||||||
|
package = config.lib.test.mkStubPackage {
|
||||||
|
name = "swayosd";
|
||||||
|
outPath = "@swayosd@";
|
||||||
|
};
|
||||||
|
maxVolume = 10;
|
||||||
|
};
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
assertFileContent \
|
||||||
|
home-files/.config/systemd/user/swayosd.service \
|
||||||
|
${
|
||||||
|
builtins.toFile "swayosd.service" ''
|
||||||
|
[Install]
|
||||||
|
WantedBy=graphical-session.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=@swayosd@/bin/swayosd --max-volume 10
|
||||||
|
Restart=always
|
||||||
|
Type=simple
|
||||||
|
|
||||||
|
[Unit]
|
||||||
|
After=graphical-session.target
|
||||||
|
ConditionEnvironment=WAYLAND_DISPLAY
|
||||||
|
Description=Volume/backlight OSD indicator
|
||||||
|
Documentation=man:swayosd(1)
|
||||||
|
PartOf=graphical-session.target
|
||||||
|
''
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
}
|
Loading…
Reference in a new issue