ADD sound for volume controls

This commit is contained in:
Nathan Dwarshuis 2020-05-31 20:56:57 -04:00
parent c65f14902b
commit cb44b17d72
3 changed files with 21 additions and 4 deletions

View File

@ -88,14 +88,17 @@ runNextTrack = spawnCmd myMultimediaCtl ["next"]
runStopPlay :: X ()
runStopPlay = spawnCmd myMultimediaCtl ["stop"]
volumeChangeSound :: FilePath
volumeChangeSound = "smb_fireball.wav"
runVolumeDown :: X ()
runVolumeDown = void (lowerVolume 2)
runVolumeDown = void (lowerVolume 2) >> spawnSound volumeChangeSound
runVolumeUp :: X ()
runVolumeUp = void (raiseVolume 2)
runVolumeUp = void (raiseVolume 2) >> spawnSound volumeChangeSound
runVolumeMute :: X ()
runVolumeMute = void toggleMute
runVolumeMute = void toggleMute >> spawnSound volumeChangeSound
--------------------------------------------------------------------------------
-- | System commands

View File

@ -4,12 +4,15 @@
module XMonad.Internal.Shell
( fmtCmd
, spawnCmd
, spawnSound
, (#!&&)
, (#!||)
, (#!>>)
) where
import XMonad.Core (X)
import System.FilePath.Posix
import XMonad.Core (X, getXMonadDir)
import XMonad.Internal.Process
--------------------------------------------------------------------------------
@ -18,6 +21,17 @@ import XMonad.Internal.Process
spawnCmd :: String -> [String] -> X ()
spawnCmd cmd args = spawn $ fmtCmd cmd args
--------------------------------------------------------------------------------
-- | Playing sound
soundDir :: FilePath
soundDir = "sound"
spawnSound :: FilePath -> X ()
spawnSound file = do
path <- (</> soundDir </> file) <$> getXMonadDir
spawnCmd "aplay" [path]
--------------------------------------------------------------------------------
-- | Formatting commands

BIN
sound/smb_fireball.wav Normal file

Binary file not shown.