graphical: set volume settings via window manager
sound.mediaKeys doesn't work with pulseaudio enabled, but some programs e.g. Firefox require it.
This commit is contained in:
parent
51ef800af6
commit
77a635348f
5 changed files with 19 additions and 10 deletions
|
@ -5,7 +5,7 @@ in {
|
||||||
|
|
||||||
hardware.opengl.enable = true;
|
hardware.opengl.enable = true;
|
||||||
hardware.opengl.driSupport = true;
|
hardware.opengl.driSupport = true;
|
||||||
hardware.pulseaudio.enable = false;
|
hardware.pulseaudio.enable = true;
|
||||||
|
|
||||||
environment = {
|
environment = {
|
||||||
etc = {
|
etc = {
|
||||||
|
@ -37,6 +37,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
systemPackages = with pkgs; [
|
systemPackages = with pkgs; [
|
||||||
|
pulsemixer
|
||||||
adapta-gtk-theme
|
adapta-gtk-theme
|
||||||
cursor
|
cursor
|
||||||
dzen2
|
dzen2
|
||||||
|
|
|
@ -96,9 +96,9 @@ for_window [app_id=".*"] inhibit_idle fullscreen
|
||||||
bindsym $mod+f fullscreen
|
bindsym $mod+f fullscreen
|
||||||
|
|
||||||
# display volume level when pushed
|
# display volume level when pushed
|
||||||
bindsym XF86AudioRaiseVolume exec $volume
|
bindsym XF86AudioRaiseVolume exec $volume; $mixer 2%+ unmute
|
||||||
bindsym XF86AudioLowerVolume exec $volume
|
bindsym XF86AudioLowerVolume exec $volume; $mixer 2%- unmute
|
||||||
bindsym XF86AudioMute exec $volume
|
bindsym XF86AudioMute exec $volume; $mixer toggle
|
||||||
|
|
||||||
# Drag floating windows by holding down $mod and left mouse button.
|
# Drag floating windows by holding down $mod and left mouse button.
|
||||||
# Resize them with right mouse button + $mod.
|
# Resize them with right mouse button + $mod.
|
||||||
|
|
|
@ -40,6 +40,7 @@ in {
|
||||||
let volnoti = import ../misc/volnoti.nix { inherit pkgs; };
|
let volnoti = import ../misc/volnoti.nix { inherit pkgs; };
|
||||||
in ''
|
in ''
|
||||||
set $volume ${volnoti}
|
set $volume ${volnoti}
|
||||||
|
set $mixer "${pkgs.alsaUtils}/bin/amixer -q set Master"
|
||||||
|
|
||||||
# set background
|
# set background
|
||||||
output * bg ${pkgs.adapta-backgrounds}/share/backgrounds/adapta/tri-fadeno.jpg fill
|
output * bg ${pkgs.adapta-backgrounds}/share/backgrounds/adapta/tri-fadeno.jpg fill
|
||||||
|
|
|
@ -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
|
-- Function for fullscreen toggle
|
||||||
fullToggle :: X ()
|
fullToggle :: X ()
|
||||||
fullToggle = do
|
fullToggle = do
|
||||||
|
@ -6,6 +8,11 @@
|
||||||
sendMessage $ Toggle NBFULL
|
sendMessage $ Toggle NBFULL
|
||||||
sendMessage $ SetStruts [] [minBound .. maxBound]
|
sendMessage $ SetStruts [] [minBound .. maxBound]
|
||||||
|
|
||||||
|
setVolume :: String -> X ()
|
||||||
|
setVolume options = do
|
||||||
|
spawn ("${alsaUtils}/bin/amixer -q set Master " ++ options)
|
||||||
|
spawn "${volnoti}"
|
||||||
|
|
||||||
myAutostart :: X ()
|
myAutostart :: X ()
|
||||||
myAutostart = do
|
myAutostart = do
|
||||||
spawn "${autostart}"
|
spawn "${autostart}"
|
||||||
|
@ -41,15 +48,15 @@
|
||||||
)
|
)
|
||||||
-- lower volume
|
-- lower volume
|
||||||
, ( ( 0 , xF86XK_AudioLowerVolume )
|
, ( ( 0 , xF86XK_AudioLowerVolume )
|
||||||
, spawn "${volnoti}"
|
, setVolume "2%- unmute"
|
||||||
)
|
)
|
||||||
-- raise volume
|
-- raise volume
|
||||||
, ( ( 0 , xF86XK_AudioRaiseVolume )
|
, ( ( 0 , xF86XK_AudioRaiseVolume )
|
||||||
, spawn "${volnoti}"
|
, setVolume "2%+ unmute"
|
||||||
)
|
)
|
||||||
-- mute volume
|
-- mute volume
|
||||||
, ( ( 0 , xF86XK_AudioMute )
|
, ( ( 0 , xF86XK_AudioMute )
|
||||||
, spawn "${volnoti}"
|
, setVolume "toggle"
|
||||||
)
|
)
|
||||||
-- start qutebrowser
|
-- start qutebrowser
|
||||||
, ( ( myModKey , xK_b )
|
, ( ( myModKey , xK_b )
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ pkgs, ... }: {
|
{ config, pkgs, lib, ... }: {
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
acpi
|
acpi
|
||||||
lm_sensors
|
lm_sensors
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
sound.mediaKeys = {
|
sound.mediaKeys = lib.mkIf (!config.hardware.pulseaudio.enable) {
|
||||||
enable = true;
|
enable = true;
|
||||||
volumeStep = "1dB";
|
volumeStep = "1dB";
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue