xmonad-extras-0.15.1: Third party extensions for xmonad with wacky dependencies

Copyright | (c) daniel@wagner-home.com
License | BSD3-style (see LICENSE)
Maintainer | daniel@wagner-home.com
Stability | unstable
Portability | unportable
Safe Haskell | None
Language | Haskell98

XMonad.Actions.Volume

Contents

- Usage
- Common functions
- Low-level interface
- Variants that take a list of channels

Description

A minimal interface to the "amixer" command-line utility.

Synopsis

- toggleMute :: MonadIO m => m Bool
- raiseVolume :: MonadIO m => Double -> m Double
- lowerVolume :: MonadIO m => Double -> m Double
- getVolume :: MonadIO m => m Double
- getMute :: MonadIO m => m Bool
- getVolumeMute :: MonadIO m => m (Double, Bool)
- setVolume :: MonadIO m => Double -> m ()
- setMute :: MonadIO m => Bool -> m ()
- setVolumeMute :: MonadIO m => Double -> Bool -> m ()
- modifyVolume :: MonadIO m => (Double -> Double) -> m Double
- modifyMute :: MonadIO m => (Bool -> Bool) -> m Bool
- modifyVolumeMute :: MonadIO m => (Double -> Bool -> (Double, Bool)) -> m (Double, Bool)
- defaultChannels :: [String]
- toggleMuteChannels :: MonadIO m => [String] -> m Bool
- raiseVolumeChannels :: MonadIO m => [String] -> Double -> m Double
- lowerVolumeChannels :: MonadIO m => [String] -> Double -> m Double
- getVolumeChannels :: MonadIO m => [String] -> m Double
- getMuteChannels :: MonadIO m => [String] -> m Bool
- getVolumeMuteChannels :: MonadIO m => [String] -> m (Double, Bool)
- setVolumeChannels :: MonadIO m => [String] -> Double -> m ()
- setMuteChannels :: MonadIO m => [String] -> Bool -> m ()
- setVolumeMuteChannels :: MonadIO m => [String] -> Double -> Bool -> m ()
- modifyVolumeChannels :: MonadIO m => [String] -> (Double -> Double) -> m Double
- modifyMuteChannels :: MonadIO m => [String] -> (Bool -> Bool) -> m Bool
- modifyVolumeMuteChannels :: MonadIO m => [String] -> (Double -> Bool -> (Double, Bool)) -> m (Double, Bool)
- defaultOSDOpts :: Bool -> String
- osdCat :: MonadIO m => Double -> (Bool -> String) -> m ()

# Usage

You can use this module with the following in your `~/.xmonad/xmonad.hs`:

    import XMonad.Actions.Volume

then add appropriate keybinds to adjust the volume; for example:

    , ((modMask x, xK_F8 ), lowerVolume 3 >> return ())
    , ((modMask x, xK_F9 ), raiseVolume 3 >> return ())
    , ((modMask x, xK_F10), toggleMute    >> return ())

For detailed instructions on editing your key bindings, see XMonad.Doc.Extending.

# Common functions

toggleMute :: MonadIO m => m Bool Source #

Toggle mutedness on the default channels. Returns `True` when this attempts to mute the speakers and `False` when this attempts to unmute the speakers.

raiseVolume :: MonadIO m => Double -> m Double Source #

Raise the volume on the default channels the given number of percentage points. Returns the volume it attempts to set.

lowerVolume :: MonadIO m => Double -> m Double Source #

Lower the volume on the default channels the given number of percentage points. Returns the volume it attempts to set.

# Low-level interface

getVolume :: MonadIO m => m Double Source #

Get the geometric mean of the volumes on the default channels.

getMute :: MonadIO m => m Bool Source #

Get the mutedness of the default channels. Returns `True` if any of the channels are muted, and `False` otherwise.

getVolumeMute :: MonadIO m => m (Double, Bool) Source #

Get both the volume and the mutedness of the default channels.

setVolume :: MonadIO m => Double -> m () Source #

Attempt to set the default channels to a volume given in percentage of maximum.

setMute :: MonadIO m => Bool -> m () Source #

Attempt to set the muting on the default channels.

setVolumeMute :: MonadIO m => Double -> Bool -> m () Source #

Attempt to set both the volume in percent and the muting on the default channels.

modifyVolume :: MonadIO m => (Double -> Double) -> m Double Source #

Apply a function to the volume of the default channels, and return the modified value.

modifyMute :: MonadIO m => (Bool -> Bool) -> m Bool Source #

Apply a function to the muting on the default channels, and return the modified value.

modifyVolumeMute :: MonadIO m => (Double -> Bool -> (Double, Bool)) -> m (Double, Bool) Source #

Apply a function to both the volume and the muting of the default channels, and return the modified values.

# Variants that take a list of channels

defaultChannels :: [String] Source #

Channels are what amixer calls "simple controls". The most common ones are "Master", "Wave", and "PCM", so these are included in `defaultChannels`. It is guaranteed to be safe to pass channel names that don't exist on the default sound device to the *Channels family of functions.

toggleMuteChannels :: MonadIO m => [String] -> m Bool Source #

raiseVolumeChannels :: MonadIO m => [String] -> Double -> m Double Source #

lowerVolumeChannels :: MonadIO m => [String] -> Double -> m Double Source #

getVolumeChannels :: MonadIO m => [String] -> m Double Source #

getMuteChannels :: MonadIO m => [String] -> m Bool Source #

getVolumeMuteChannels :: MonadIO m => [String] -> m (Double, Bool) Source #

setVolumeChannels :: MonadIO m => [String] -> Double -> m () Source #

setMuteChannels :: MonadIO m => [String] -> Bool -> m () Source #

setVolumeMuteChannels :: MonadIO m => [String] -> Double -> Bool -> m () Source #

modifyVolumeChannels :: MonadIO m => [String] -> (Double -> Double) -> m Double Source #

modifyMuteChannels :: MonadIO m => [String] -> (Bool -> Bool) -> m Bool Source #

modifyVolumeMuteChannels :: MonadIO m => [String] -> (Double -> Bool -> (Double, Bool)) -> m (Double, Bool) Source #

defaultOSDOpts :: Bool -> String Source #

Default options for displaying the volume.

osdCat :: MonadIO m => Double -> (Bool -> String) -> m () Source #

Helper function to output current volume via osd_cat. (Needs the osd_cat executable). The second parameter is passed True when the speakers are muted and should return the options to pass to osd_cat.