fork/home-manager
git clone https://git.julia.blue/fork/home-manager
98282a48
master
1{ config , lib , pkgs , ...} : 2 3with lib ; 4 5let 6 7cfg = config . services . swayosd ; 8 9in { 10meta . maintainers = [ hm . maintainers . pltanton ]; 11 12options . services . swayosd = { 13enable = mkEnableOption '' 14swayosd, a GTK based on screen display for keyboard shortcuts like 15caps-lock and volume'' ; 16 17package = mkPackageOption pkgs "swayosd" { }; 18 19maxVolume = mkOption { 20type = types . nullOr types . ints . unsigned ; 21default = null ; 22example = 120 ; 23description = '' 24Sets the maximum volume. 25'' ; 26}; 27}; 28 29config = mkIf cfg . enable { 30assertions = [ 31( hm . assertions . assertPlatform "services.swayosd" pkgs platforms . linux ) 32]; 33 34home . packages = [ cfg . package ]; 35 36systemd . user = { 37services . swayosd = { 38Unit = { 39Description = "Volume/backlight OSD indicator" ; 40PartOf = [ "graphical-session.target" ]; 41After = [ "graphical-session.target" ]; 42ConditionEnvironment = "WAYLAND_DISPLAY" ; 43Documentation = "man:swayosd(1)" ; 44}; 45 46Service = { 47Type = "simple" ; 48ExecStart = " ${ cfg . package } /bin/swayosd" 49+ ( optionalString ( cfg . maxVolume != null ) 50" --max-volume ${ toString cfg . maxVolume } " ); 51Restart = "always" ; 52}; 53 54Install = { WantedBy = [ "graphical-session.target" ]; }; 55}; 56}; 57}; 58}