xmobar -> own Module 2
This commit is contained in:
@@ -12,5 +12,12 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
home.packages = with pkgs; [ xmobar maim xdotool xorg.xmessage ghc ];
|
home.packages = with pkgs; [
|
||||||
|
xmobar
|
||||||
|
maim
|
||||||
|
xdotool
|
||||||
|
xorg.xmessage
|
||||||
|
ghc
|
||||||
|
cabal-install
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,24 @@
|
|||||||
module Plugins.Audio where
|
module Plugins.Audio where
|
||||||
|
|
||||||
import Xmobar
|
import Xmobar
|
||||||
|
import Xmobar.Run.Timer (doEveryTenthSeconds)
|
||||||
|
import System.Process
|
||||||
|
import System.Exit
|
||||||
|
import System.IO (hClose, hGetLine)
|
||||||
|
|
||||||
data Audio = Audio String Int deriving (Read, Show)
|
data Audio = Audio String Int deriving (Read, Show)
|
||||||
|
|
||||||
instance Exec Audio where
|
instance Exec Audio where
|
||||||
alias (Audio _ _) = "audio"
|
alias (Audio _ _) = "audio"
|
||||||
run (Audio f _) = audio f
|
start (Audio f r) cb = if r > 0 then (doEveryTenthSeconds r (audio f cb)) else audio f cb
|
||||||
rate (Audio _ r) = r
|
|
||||||
|
|
||||||
audio :: String -> IO String
|
audio :: String -> (String -> IO ()) -> IO ()
|
||||||
audio format = do
|
audio format cb = do
|
||||||
return $ show (format)
|
(i,o,e,p) <- runInteractiveProcess "pulseaudio-ctl full-status" [] Nothing Nothing
|
||||||
|
exit <- waitForProcess p
|
||||||
|
let closeHandles = hClose o >> hClose i >> hClose e
|
||||||
|
getL = hGetLine o
|
||||||
|
str <- getL
|
||||||
|
closeHandles
|
||||||
|
cb str
|
||||||
|
--readProcess "pulseaudio-ctl full-status" []
|
||||||
|
|||||||
6
home/programs/xmonad/src/xmobar/cabal.project
Normal file
6
home/programs/xmonad/src/xmobar/cabal.project
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
packages: .
|
||||||
|
|
||||||
|
with-compiler: ghc-9.2.4
|
||||||
|
|
||||||
|
package xmobar
|
||||||
|
flags: +all_extensions
|
||||||
@@ -44,7 +44,8 @@ executable xmobar
|
|||||||
|
|
||||||
-- Other library packages from which modules are imported.
|
-- Other library packages from which modules are imported.
|
||||||
build-depends: base ^>=4.17.2.1,
|
build-depends: base ^>=4.17.2.1,
|
||||||
xmobar ^>=0.47.1
|
xmobar ^>=0.47.1,
|
||||||
|
process
|
||||||
|
|
||||||
-- Directories containing source files.
|
-- Directories containing source files.
|
||||||
hs-source-dirs: .
|
hs-source-dirs: .
|
||||||
|
|||||||
Reference in New Issue
Block a user