xmonad-spotify 0.1.1.0 → 0.1.2.0
raw patch · 5 files changed
+78/−42 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ XMonad.Util.Spotify: audioNextWith :: MonadIO m => Client -> m ()
+ XMonad.Util.Spotify: audioPlayPauseWith :: MonadIO m => Client -> m ()
+ XMonad.Util.Spotify: audioPrevWith :: MonadIO m => Client -> m ()
+ XMonad.Util.Spotify: audioStopWith :: MonadIO m => Client -> m ()
+ XMonad.Util.Spotify: mediaKeysWith :: MonadIO m => Client -> Map (KeyMask, KeySym) (m ()) -> Map (KeyMask, KeySym) (m ())
Files
- CHANGELOG.md +4/−0
- LICENSE +1/−1
- cabal.project.local +1/−3
- src/XMonad/Util/Spotify.hs +45/−8
- xmonad-spotify.cabal +27/−30
CHANGELOG.md view
@@ -1,5 +1,9 @@ # xmonad-spotify +## 0.1.2.0++ * Add `audioStopWith` etc., `mediaKeysWith`+ ## 0.1.1.0 * Add `audioStop` and add appropriate keybindings
LICENSE view
@@ -1,4 +1,4 @@-Copyright Vanessa McHale (c) 2018+Copyright Vanessa McHale (c) 2018-2019 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
cabal.project.local view
@@ -1,4 +1,2 @@ constraints: xmonad-spotify +development-allow-newer:- base- Cabal+max-backjumps: 40000
src/XMonad/Util/Spotify.hs view
@@ -1,13 +1,19 @@ -- | Bind media keys for Spotify using @dbus@. module XMonad.Util.Spotify ( -- * default keybindings mediaKeys- -- * media control in the 'X' monad+ , mediaKeysWith+ -- * Media control in the 'X' monad , audioPrev , audioNext , audioPlayPause , audioStop+ , audioNextWith+ , audioPrevWith+ , audioPlayPauseWith+ , audioStopWith ) where +import Control.Monad (void) import Control.Monad.IO.Class import qualified Data.Map as M import DBus@@ -15,8 +21,7 @@ import Graphics.X11.ExtraTypes.XF86 import Graphics.X11.Types --- | Given your keymaps, add the media keybindings. Currently they are set up--- for Spotify.+-- | @since 0.1.2.0 mediaKeys :: MonadIO m => M.Map (KeyMask, KeySym) (m ()) -> M.Map (KeyMask, KeySym) (m ()) mediaKeys = M.union mediaKeyMap where mediaKeyMap = M.fromList mediaKeyList@@ -28,13 +33,45 @@ , ((0, xF86XK_AudioStop), audioStop) ] +-- | Given your keymaps, add the media keybindings. Currently they are set up+-- for Spotify.+mediaKeysWith :: MonadIO m => Client -> M.Map (KeyMask, KeySym) (m ()) -> M.Map (KeyMask, KeySym) (m ())+mediaKeysWith client = M.union mediaKeyMap+ where mediaKeyMap = M.fromList (mediaKeyListWith client)++mediaKeyListWith :: MonadIO m => Client -> [((KeyMask, KeySym), m ())]+mediaKeyListWith client = [ ((0, xF86XK_AudioNext), audioNextWith client)+ , ((0, xF86XK_AudioPrev), audioPrevWith client)+ , ((0, xF86XK_AudioPlay), audioPlayPauseWith client)+ , ((0, xF86XK_AudioStop), audioStopWith client)+ ]++spWith :: MonadIO m => Client -> String -> m ()+spWith client str = void $ liftIO $+ call_ client (methodCall (objectPath_ "/org/mpris/MediaPlayer2") (interfaceName_ "org.mpris.MediaPlayer2.Player") (memberName_ str))+ -- FIXME: don't connect one session each time? sp :: MonadIO m => String -> m ()-sp str = liftIO $ do- client <- connectSession- _ <- call_ client (methodCall (objectPath_ "/org/mpris/MediaPlayer2") (interfaceName_ "org.mpris.MediaPlayer2.Player") (memberName_ str))- { methodCallDestination = Just (busName_ "org.mpris.MediaPlayer2.spotify") }- disconnect client+sp str = do+ client <- liftIO connectSession+ spWith client str+ liftIO $ disconnect client++-- | @since 0.1.2.0+audioNextWith :: MonadIO m => Client -> m ()+audioNextWith = flip spWith "Next"++-- | @since 0.1.2.0+audioPrevWith :: MonadIO m => Client -> m ()+audioPrevWith = flip spWith "Previous"++-- | @since 0.1.2.0+audioPlayPauseWith :: MonadIO m => Client -> m ()+audioPlayPauseWith = flip spWith "PlayPause"++-- | @since 0.1.2.0+audioStopWith :: MonadIO m => Client -> m ()+audioStopWith = flip spWith "Stop" -- | Action in the 'X' monad to go to next audioNext :: MonadIO m => m ()
xmonad-spotify.cabal view
@@ -1,37 +1,34 @@-cabal-version: 1.18-name: xmonad-spotify-version: 0.1.1.0-license: BSD3-license-file: LICENSE-copyright: Copyright: (c) 2018 Vanessa McHale-maintainer: vanessa.mchale@iohk.io-author: Vanessa McHale-synopsis: Bind media keys to work with Spotify-description:- Bind media keys to work with Spotify using dbus.-category: XMonad-build-type: Simple-extra-source-files:- cabal.project.local-extra-doc-files: README.md- CHANGELOG.md+cabal-version: 1.18+name: xmonad-spotify+version: 0.1.2.0+license: BSD3+license-file: LICENSE+copyright: Copyright: (c) 2018-2019 Vanessa McHale+maintainer: vamchale@gmail.com+author: Vanessa McHale+synopsis: Bind media keys to work with Spotify+description: Bind media keys to work with Spotify using dbus.+category: XMonad+build-type: Simple+extra-source-files: cabal.project.local+extra-doc-files:+ README.md+ CHANGELOG.md source-repository head- type: darcs+ type: darcs location: https://hub.darcs.net/vmchale/xmonad-spotify flag development- description:- Enable `-Werror`- default: False- manual: True+ description: Enable `-Werror`+ default: False+ manual: True library- exposed-modules:- XMonad.Util.Spotify- hs-source-dirs: src+ exposed-modules: XMonad.Util.Spotify+ hs-source-dirs: src default-language: Haskell98- ghc-options: -Wall+ ghc-options: -Wall build-depends: base >=4.8 && <5, dbus -any,@@ -42,12 +39,12 @@ ghc-options: -Werror if !impl(ghc >=8.0)- build-depends:- transformers -any+ build-depends: transformers -any if impl(ghc >=8.0)- ghc-options: -Wincomplete-uni-patterns -Wincomplete-record-updates- -Wredundant-constraints -Widentities+ ghc-options:+ -Wincomplete-uni-patterns -Wincomplete-record-updates+ -Wredundant-constraints -Widentities if impl(ghc >=8.4) ghc-options: -Wmissing-export-lists