diff --git a/common/fragments/graphical/bspwm.nix b/common/fragments/graphical/bspwm.nix index a518687..8e9fd98 100644 --- a/common/fragments/graphical/bspwm.nix +++ b/common/fragments/graphical/bspwm.nix @@ -86,6 +86,9 @@ "XF86AudioMute" = "pamixer -t"; "XF86Audio{Prev,Next}" = "playerctl {previous,next}"; "XF86AudioPlay" = "playerctl play-pause"; + # Switch outputs + "super + o" = '' + dunstify -r 112119 "Sound output switched to $(${pkgs.pads}/bin/pads next && ${pkgs.pads}/bin/pads list | rg '^\*' | choose 1:)"''; # Screenshot "Print" = "flameshot gui && bspc desktop --focus focused"; "shift + Print" = diff --git a/common/pkgs/pads.nix b/common/pkgs/pads.nix new file mode 100644 index 0000000..7a4a4eb --- /dev/null +++ b/common/pkgs/pads.nix @@ -0,0 +1,24 @@ +{ rustPlatform, fetchFromGitHub, libpulseaudio, pkg-config }: + +rustPlatform.buildRustPackage rec { + pname = "pads"; + version = "89d69d4b9b199e08671c947120d5b2e1b6295d68"; + + src = fetchFromGitHub { + owner = "dogue"; + repo = pname; + rev = version; + sha256 = "sha256-vVmEKvRSBiHv4skh2/B6cl17jVsgRI0IJeSgpSpPPTE="; + }; + + cargoLock = { lockFile = "${src}/Cargo.lock"; }; + + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ libpulseaudio ]; + + meta = { + description = + "A simple CLI tool for swtiching the default/active output device for PulseAudio."; + homepage = "https://github.com/dogue/pads"; + }; +} diff --git a/hosts/ritual/configuration.nix b/hosts/ritual/configuration.nix index b6b5272..0815425 100644 --- a/hosts/ritual/configuration.nix +++ b/hosts/ritual/configuration.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: { +{ imports = [ ./hardware-configuration.nix ../../common/fragments/graphical @@ -6,6 +6,10 @@ ../../common/home_manager/common.nix ]; + nixpkgs.overlays = [ + (final: prev: { pads = final.callPackage ../../common/pkgs/pads.nix { }; }) + ]; + # Bootloader. boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true;