diff --git a/profiles/graphical/default.nix b/profiles/graphical/default.nix index 986e93a..2912ea2 100644 --- a/profiles/graphical/default.nix +++ b/profiles/graphical/default.nix @@ -5,7 +5,7 @@ in { hardware.opengl.enable = true; hardware.opengl.driSupport = true; - hardware.pulseaudio.enable = false; + hardware.pulseaudio.enable = true; environment = { etc = { @@ -37,6 +37,7 @@ in { }; systemPackages = with pkgs; [ + pulsemixer adapta-gtk-theme cursor dzen2 diff --git a/profiles/graphical/sway/config b/profiles/graphical/sway/config index 9b8bdae..b1c41cc 100644 --- a/profiles/graphical/sway/config +++ b/profiles/graphical/sway/config @@ -96,9 +96,9 @@ for_window [app_id=".*"] inhibit_idle fullscreen bindsym $mod+f fullscreen # display volume level when pushed - bindsym XF86AudioRaiseVolume exec $volume - bindsym XF86AudioLowerVolume exec $volume - bindsym XF86AudioMute exec $volume + bindsym XF86AudioRaiseVolume exec $volume; $mixer 2%+ unmute + bindsym XF86AudioLowerVolume exec $volume; $mixer 2%- unmute + bindsym XF86AudioMute exec $volume; $mixer toggle # Drag floating windows by holding down $mod and left mouse button. # Resize them with right mouse button + $mod. diff --git a/profiles/graphical/sway/default.nix b/profiles/graphical/sway/default.nix index e1826ca..a8ee13e 100644 --- a/profiles/graphical/sway/default.nix +++ b/profiles/graphical/sway/default.nix @@ -40,6 +40,7 @@ in { let volnoti = import ../misc/volnoti.nix { inherit pkgs; }; in '' set $volume ${volnoti} + set $mixer "${pkgs.alsaUtils}/bin/amixer -q set Master" # set background output * bg ${pkgs.adapta-backgrounds}/share/backgrounds/adapta/tri-fadeno.jpg fill diff --git a/profiles/graphical/xmonad/_xmonad.nix b/profiles/graphical/xmonad/_xmonad.nix index 34c5d60..7d6ab1a 100644 --- a/profiles/graphical/xmonad/_xmonad.nix +++ b/profiles/graphical/xmonad/_xmonad.nix @@ -1,4 +1,6 @@ -{ autostart, screenshots, touchtoggle, pkgs, stoggle, volnoti }: '' +{ autostart, screenshots, touchtoggle, pkgs, stoggle, volnoti }: +let inherit (pkgs) alsaUtils; +in '' -- Function for fullscreen toggle fullToggle :: X () fullToggle = do @@ -6,6 +8,11 @@ sendMessage $ Toggle NBFULL sendMessage $ SetStruts [] [minBound .. maxBound] + setVolume :: String -> X () + setVolume options = do + spawn ("${alsaUtils}/bin/amixer -q set Master " ++ options) + spawn "${volnoti}" + myAutostart :: X () myAutostart = do spawn "${autostart}" @@ -41,15 +48,15 @@ ) -- lower volume , ( ( 0 , xF86XK_AudioLowerVolume ) - , spawn "${volnoti}" + , setVolume "2%- unmute" ) -- raise volume , ( ( 0 , xF86XK_AudioRaiseVolume ) - , spawn "${volnoti}" + , setVolume "2%+ unmute" ) -- mute volume , ( ( 0 , xF86XK_AudioMute ) - , spawn "${volnoti}" + , setVolume "toggle" ) -- start qutebrowser , ( ( myModKey , xK_b ) diff --git a/profiles/laptop/default.nix b/profiles/laptop/default.nix index 81a2ec9..bc6d0e9 100644 --- a/profiles/laptop/default.nix +++ b/profiles/laptop/default.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: { +{ config, pkgs, lib, ... }: { environment.systemPackages = with pkgs; [ acpi lm_sensors @@ -27,7 +27,7 @@ ]; }; - sound.mediaKeys = { + sound.mediaKeys = lib.mkIf (!config.hardware.pulseaudio.enable) { enable = true; volumeStep = "1dB"; };