refactor: complete rewrite
This commit is contained in:
parent
19a4bbda3c
commit
8e81943cf9
399 changed files with 3396 additions and 8042 deletions
48
modules/home/workstation/tools/ookvolume.nix
Normal file
48
modules/home/workstation/tools/ookvolume.nix
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
osConfig,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf;
|
||||
inherit (builtins) elem;
|
||||
inherit (osConfig.ooknet.hardware) features;
|
||||
ookvolume = pkgs.writeShellApplication {
|
||||
name = "ookvolume";
|
||||
runtimeInputs = with pkgs; [pamixer libnotify];
|
||||
text = ''
|
||||
notify() {
|
||||
volume=$(pamixer --get-volume-human)
|
||||
notify-send --app-name="system-notify" -h string:x-canonical-private-synchronous:sys-notify " $volume"
|
||||
}
|
||||
option() {
|
||||
case "$1" in
|
||||
up)
|
||||
pamixer --increase 5
|
||||
;;
|
||||
down)
|
||||
pamixer --decrease 5
|
||||
;;
|
||||
mute)
|
||||
pamixer --toggle-mute
|
||||
;;
|
||||
*) echo "Invalid option" ;;
|
||||
esac
|
||||
}
|
||||
main() {
|
||||
option "$@"
|
||||
notify
|
||||
}
|
||||
main "$@"
|
||||
'';
|
||||
};
|
||||
in {
|
||||
config = mkIf (elem "audio" features) {
|
||||
home.packages = [ookvolume];
|
||||
ooknet.binds.volume = {
|
||||
up = "ookvolume up";
|
||||
down = "ookvolume down";
|
||||
mute = "ookvolume mute";
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue