forked from colonelpanic/dotfiles
[Linux] Use pulsemixer for volume control
This commit is contained in:
parent
f5525df0bc
commit
4538ff4c6b
@ -461,7 +461,6 @@ myReplaceWindow =
|
|||||||
|
|
||||||
-- Workspace Names for EWMH
|
-- Workspace Names for EWMH
|
||||||
|
|
||||||
|
|
||||||
setWorkspaceNames :: X ()
|
setWorkspaceNames :: X ()
|
||||||
setWorkspaceNames = withWindowSet $ \s -> withDisplay $ \dpy -> do
|
setWorkspaceNames = withWindowSet $ \s -> withDisplay $ \dpy -> do
|
||||||
sort' <- getSortByIndex
|
sort' <- getSortByIndex
|
||||||
@ -865,6 +864,10 @@ goToNextScreenX = windows goToNextScreen
|
|||||||
|
|
||||||
-- Key bindings
|
-- Key bindings
|
||||||
|
|
||||||
|
volumeUp = spawn "set_volume.sh --unmute --change-volume +5"
|
||||||
|
volumeDown = spawn "set_volume.sh --unmute --change-volume -5"
|
||||||
|
mute = spawn "set_volume.sh --toggle-mute"
|
||||||
|
|
||||||
shiftToEmptyOnScreen direction =
|
shiftToEmptyOnScreen direction =
|
||||||
followingWindow (windowToScreen direction True) >> shiftToEmptyAndView
|
followingWindow (windowToScreen direction True) >> shiftToEmptyAndView
|
||||||
|
|
||||||
@ -907,7 +910,7 @@ addKeys conf@XConfig { modMask = modm } =
|
|||||||
, ((modalt, xK_Return), deactivateFullAnd restoreAllMinimized)
|
, ((modalt, xK_Return), deactivateFullAnd restoreAllMinimized)
|
||||||
, ((modm .|. controlMask, xK_t),
|
, ((modm .|. controlMask, xK_t),
|
||||||
setReplaceTarget >> spawn "chromix-too open chrome://newtab")
|
setReplaceTarget >> spawn "chromix-too open chrome://newtab")
|
||||||
, ((mod .|. controlMask, xK_c), chromeReplaceKill)
|
, ((modm .|. controlMask, xK_c), chromeReplaceKill)
|
||||||
, ((hyper, xK_g), gatherThisClass)
|
, ((hyper, xK_g), gatherThisClass)
|
||||||
|
|
||||||
-- Directional navigation
|
-- Directional navigation
|
||||||
@ -1005,12 +1008,12 @@ addKeys conf@XConfig { modMask = modm } =
|
|||||||
, ((0, xF86XK_AudioPrev), spawn "playerctl previous")
|
, ((0, xF86XK_AudioPrev), spawn "playerctl previous")
|
||||||
|
|
||||||
-- Volume control
|
-- Volume control
|
||||||
, ((0, xF86XK_AudioRaiseVolume), spawn "set_volume.sh up")
|
, ((0, xF86XK_AudioRaiseVolume), volumeUp)
|
||||||
, ((0, xF86XK_AudioLowerVolume), spawn "set_volume.sh down")
|
, ((0, xF86XK_AudioLowerVolume), volumeDown)
|
||||||
, ((0, xF86XK_AudioMute), spawn "set_volume.sh mute")
|
, ((0, xF86XK_AudioMute), mute)
|
||||||
, ((modm, xK_i), spawn "set_volume.sh up")
|
, ((modm, xK_i), volumeUp)
|
||||||
, ((modm, xK_k), spawn "set_volume.sh down")
|
, ((modm, xK_k), volumeDown)
|
||||||
, ((modm, xK_u), spawn "set_volume.sh mute")
|
, ((modm, xK_u), mute)
|
||||||
, ((hyper .|. shiftMask, xK_q), spawn "toggle_mute_current_window.sh")
|
, ((hyper .|. shiftMask, xK_q), spawn "toggle_mute_current_window.sh")
|
||||||
, ((hctrl, xK_q), spawn "toggle_mute_current_window.sh only")
|
, ((hctrl, xK_q), spawn "toggle_mute_current_window.sh only")
|
||||||
|
|
||||||
|
@ -10,7 +10,8 @@ function switch_sink_applications()
|
|||||||
}
|
}
|
||||||
|
|
||||||
current_default=$(pahelper.sh list | grep '*' | all_after_char ":" | xargs)
|
current_default=$(pahelper.sh list | grep '*' | all_after_char ":" | xargs)
|
||||||
environment_variable_exists USE_ONLY_ONE_PASINK && pahelper.sh "$current_default"
|
environment_variable_exists USE_ONLY_O_PASINK && pahelper.sh "$current_default"
|
||||||
|
|
||||||
pulseaudio-ctl "$@"
|
# XXX: this does not prevent volumes higher than 100
|
||||||
|
pulsemixer "$@"
|
||||||
pashowvolume
|
pashowvolume
|
||||||
|
@ -60,7 +60,6 @@ function get_linux_distro {
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function is_osx() {
|
function is_osx() {
|
||||||
if command_exists uname; then
|
if command_exists uname; then
|
||||||
case `uname` in
|
case `uname` in
|
||||||
@ -82,3 +81,7 @@ function source_directory_files {
|
|||||||
source "$filename"
|
source "$filename"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function min {
|
||||||
|
[ $1 -le $2 ] && echo "$1" || echo "$2"
|
||||||
|
}
|
||||||
|
@ -13,7 +13,7 @@ pasink() {
|
|||||||
pavolume () {
|
pavolume () {
|
||||||
pacmd list-sinks |
|
pacmd list-sinks |
|
||||||
awk '/^\s+name: /{indefault = $2 == "<'"$(pasink)"'>"}
|
awk '/^\s+name: /{indefault = $2 == "<'"$(pasink)"'>"}
|
||||||
/^\s+volume: / && indefault {print $5; exit}'
|
/^\s+volume: / && indefault {print $5; exit}' | grep -Eo "[0-9]*"
|
||||||
}
|
}
|
||||||
|
|
||||||
paismuted () {
|
paismuted () {
|
||||||
@ -24,7 +24,7 @@ pashowvolume () {
|
|||||||
if paismuted; then
|
if paismuted; then
|
||||||
volnoti-show -m
|
volnoti-show -m
|
||||||
else
|
else
|
||||||
volnoti-show "$(pavolume)"
|
volnoti-show "$(min $(pavolume) 100)"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user