REF rearranged library to be more sane
This commit is contained in:
parent
45799ae512
commit
43c68924a5
|
@ -1,21 +1,19 @@
|
||||||
|
module Main (main) where
|
||||||
|
|
||||||
|
import Data.List
|
||||||
|
|
||||||
import Xmobar.Plugins.Bluetooth
|
import Xmobar.Plugins.Bluetooth
|
||||||
import Xmobar.Plugins.IntelBacklight
|
import Xmobar.Plugins.IntelBacklight
|
||||||
import Xmobar.Plugins.Screensaver
|
import Xmobar.Plugins.Screensaver
|
||||||
import Xmobar.Plugins.VPN
|
import Xmobar.Plugins.VPN
|
||||||
|
|
||||||
import qualified Theme as T
|
|
||||||
|
|
||||||
import Data.List
|
|
||||||
|
|
||||||
import Xmobar
|
import Xmobar
|
||||||
import Xmobar.Common
|
|
||||||
import XMonad (getXMonadDir)
|
import XMonad (getXMonadDir)
|
||||||
|
import XMonad.Hooks.DynamicLog (xmobarColor)
|
||||||
-- wrapColor :: String -> String -> String
|
import qualified XMonad.Internal.Theme as T
|
||||||
-- wrapColor c s = "<fc=" ++ c ++ ">" ++ s ++ "</fc>"
|
|
||||||
|
|
||||||
sep :: String
|
sep :: String
|
||||||
sep = wrapColor T.backdropFgColor " : "
|
sep = xmobarColor T.backdropFgColor "" " : "
|
||||||
|
|
||||||
myTemplate :: String
|
myTemplate :: String
|
||||||
myTemplate = formatTemplate left right
|
myTemplate = formatTemplate left right
|
||||||
|
@ -125,9 +123,9 @@ config confDir = defaultConfig
|
||||||
|
|
||||||
, Run $ Locks
|
, Run $ Locks
|
||||||
[ "-N", "<fn=3>\x1f13d</fn>"
|
[ "-N", "<fn=3>\x1f13d</fn>"
|
||||||
, "-n", wrapColor T.backdropFgColor "<fn=3>\x1f13d</fn>"
|
, "-n", xmobarColor T.backdropFgColor "" "<fn=3>\x1f13d</fn>"
|
||||||
, "-C", "<fn=3>\x1f132</fn>"
|
, "-C", "<fn=3>\x1f132</fn>"
|
||||||
, "-c", wrapColor T.backdropFgColor "<fn=3>\x1f132</fn>"
|
, "-c", xmobarColor T.backdropFgColor "" "<fn=3>\x1f132</fn>"
|
||||||
, "-s", ""
|
, "-s", ""
|
||||||
, "-S", ""
|
, "-S", ""
|
||||||
, "-d", "<fn=3> </fn>"
|
, "-d", "<fn=3> </fn>"
|
||||||
|
|
|
@ -4,24 +4,15 @@
|
||||||
|
|
||||||
module Main (main) where
|
module Main (main) where
|
||||||
|
|
||||||
import Capture
|
|
||||||
import General
|
|
||||||
import Internal.DMenu
|
|
||||||
import Power
|
|
||||||
|
|
||||||
import ACPI
|
|
||||||
import DBus.Common
|
|
||||||
import Process
|
|
||||||
import SendXMsg
|
|
||||||
import Shell
|
|
||||||
import qualified Theme as T
|
|
||||||
import WorkspaceMon
|
|
||||||
|
|
||||||
import Control.Concurrent
|
import Control.Concurrent
|
||||||
|
|
||||||
import Data.List (isPrefixOf, sortBy, sortOn)
|
import Data.List
|
||||||
import Data.Maybe (isJust)
|
( isPrefixOf
|
||||||
import Data.Monoid (All (..))
|
, sortBy
|
||||||
|
, sortOn
|
||||||
|
)
|
||||||
|
import Data.Maybe (isJust)
|
||||||
|
import Data.Monoid (All (..))
|
||||||
|
|
||||||
import Graphics.X11.Types
|
import Graphics.X11.Types
|
||||||
import Graphics.X11.Xlib.Atom
|
import Graphics.X11.Xlib.Atom
|
||||||
|
@ -30,23 +21,36 @@ import Graphics.X11.Xlib.Extras
|
||||||
import System.IO
|
import System.IO
|
||||||
import System.Process
|
import System.Process
|
||||||
|
|
||||||
import Xmobar.Common
|
|
||||||
|
|
||||||
import XMonad
|
import XMonad
|
||||||
import XMonad.Actions.CopyWindow
|
import XMonad.Actions.CopyWindow
|
||||||
import XMonad.Actions.CycleWS
|
import XMonad.Actions.CycleWS
|
||||||
import XMonad.Actions.PhysicalScreens
|
import XMonad.Actions.PhysicalScreens
|
||||||
import XMonad.Actions.Warp
|
import XMonad.Actions.Warp
|
||||||
|
import XMonad.Hooks.DynamicLog
|
||||||
|
( pad
|
||||||
|
, wrap
|
||||||
|
, xmobarColor
|
||||||
|
)
|
||||||
import XMonad.Hooks.EwmhDesktops
|
import XMonad.Hooks.EwmhDesktops
|
||||||
import XMonad.Hooks.ManageDocks
|
import XMonad.Hooks.ManageDocks
|
||||||
import XMonad.Hooks.ManageHelpers
|
import XMonad.Hooks.ManageHelpers
|
||||||
|
import XMonad.Internal.Command.Desktop
|
||||||
|
import XMonad.Internal.Command.DMenu
|
||||||
|
import XMonad.Internal.Command.Power
|
||||||
|
import XMonad.Internal.Concurrent.ACPIEvent
|
||||||
|
import XMonad.Internal.Concurrent.ClientMessage
|
||||||
|
import XMonad.Internal.Concurrent.DynamicWorkspaces
|
||||||
|
import XMonad.Internal.DBus.Control
|
||||||
|
import XMonad.Internal.Process
|
||||||
|
import XMonad.Internal.Shell
|
||||||
|
import qualified XMonad.Internal.Theme as T
|
||||||
import XMonad.Layout.MultiToggle
|
import XMonad.Layout.MultiToggle
|
||||||
import XMonad.Layout.NoBorders
|
import XMonad.Layout.NoBorders
|
||||||
import XMonad.Layout.NoFrillsDecoration
|
import XMonad.Layout.NoFrillsDecoration
|
||||||
import XMonad.Layout.PerWorkspace
|
import XMonad.Layout.PerWorkspace
|
||||||
import XMonad.Layout.Renamed
|
import XMonad.Layout.Renamed
|
||||||
import XMonad.Layout.Tabbed
|
import XMonad.Layout.Tabbed
|
||||||
import qualified XMonad.StackSet as W
|
import qualified XMonad.StackSet as W
|
||||||
import XMonad.Util.EZConfig
|
import XMonad.Util.EZConfig
|
||||||
import XMonad.Util.NamedActions
|
import XMonad.Util.NamedActions
|
||||||
|
|
||||||
|
@ -231,21 +235,21 @@ myWindowSetXinerama
|
||||||
W.StackSet String (layout a1) a2 ScreenId ScreenDetail -> String
|
W.StackSet String (layout a1) a2 ScreenId ScreenDetail -> String
|
||||||
myWindowSetXinerama ws = unwords [onScreen, offScreen, sep, layout, nWindows]
|
myWindowSetXinerama ws = unwords [onScreen, offScreen, sep, layout, nWindows]
|
||||||
where
|
where
|
||||||
onScreen = wrapColorBg hilightFgColor hilightBgColor
|
onScreen = xmobarColor hilightFgColor hilightBgColor
|
||||||
$ (\s -> " " ++ s ++ " ")
|
$ pad
|
||||||
$ unwords
|
$ unwords
|
||||||
$ map (fmtTags . W.tag . W.workspace)
|
$ map (fmtTags . W.tag . W.workspace)
|
||||||
$ sortBy compareXCoord
|
$ sortBy compareXCoord
|
||||||
$ W.current ws : W.visible ws
|
$ W.current ws : W.visible ws
|
||||||
offScreen = wrapColor T.backdropFgColor
|
offScreen = xmobarColor T.backdropFgColor ""
|
||||||
$ unwords
|
$ unwords
|
||||||
$ map W.tag
|
$ map W.tag
|
||||||
$ filter (isJust . W.stack)
|
$ filter (isJust . W.stack)
|
||||||
$ sortOn W.tag
|
$ sortOn W.tag
|
||||||
$ W.hidden ws
|
$ W.hidden ws
|
||||||
sep = wrapColor T.backdropFgColor ":"
|
sep = xmobarColor T.backdropFgColor "" ":"
|
||||||
layout = description $ W.layout $ W.workspace $ W.current ws
|
layout = description $ W.layout $ W.workspace $ W.current ws
|
||||||
nWindows = (\s -> "(" ++ s ++ ")")
|
nWindows = wrap "(" ")"
|
||||||
$ show
|
$ show
|
||||||
$ length
|
$ length
|
||||||
$ W.integrate'
|
$ W.integrate'
|
||||||
|
@ -255,7 +259,7 @@ myWindowSetXinerama ws = unwords [onScreen, offScreen, sep, layout, nWindows]
|
||||||
hilightBgColor = "#8fc7ff"
|
hilightBgColor = "#8fc7ff"
|
||||||
hilightFgColor = T.blend' 0.5 hilightBgColor T.fgColor
|
hilightFgColor = T.blend' 0.5 hilightBgColor T.fgColor
|
||||||
fmtTags t = if t == W.currentTag ws
|
fmtTags t = if t == W.currentTag ws
|
||||||
then wrapColorBg T.fgColor hilightBgColor t
|
then xmobarColor T.fgColor hilightBgColor t
|
||||||
else t
|
else t
|
||||||
|
|
||||||
compareXCoord
|
compareXCoord
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
module Capture
|
|
||||||
( runAreaCapture
|
|
||||||
, runDesktopCapture
|
|
||||||
, runScreenCapture
|
|
||||||
)
|
|
||||||
where
|
|
||||||
|
|
||||||
import Shell
|
|
||||||
|
|
||||||
import System.Directory
|
|
||||||
|
|
||||||
import XMonad.Core
|
|
||||||
|
|
||||||
getScreenshotDir :: IO FilePath
|
|
||||||
getScreenshotDir = do
|
|
||||||
h <- getHomeDirectory
|
|
||||||
return $ h ++ "/Pictures/screenshots"
|
|
||||||
|
|
||||||
runFlameshot :: String -> X ()
|
|
||||||
runFlameshot mode = do
|
|
||||||
ssDir <- io getScreenshotDir
|
|
||||||
spawnCmd "flameshot" $ mode : ["-p", ssDir]
|
|
||||||
|
|
||||||
-- TODO this will steal focus from the current window (and puts it
|
|
||||||
-- in the root window?) ...need to fix
|
|
||||||
runAreaCapture :: X ()
|
|
||||||
runAreaCapture = runFlameshot "gui"
|
|
||||||
|
|
||||||
-- myWindowCap = "screencap -w" --external script
|
|
||||||
|
|
||||||
runScreenCapture :: X ()
|
|
||||||
runScreenCapture = runFlameshot "screen"
|
|
||||||
|
|
||||||
runDesktopCapture :: X ()
|
|
||||||
runDesktopCapture = runFlameshot "full"
|
|
|
@ -1,6 +1,12 @@
|
||||||
module Internal.DMenu where
|
module XMonad.Internal.Command.DMenu
|
||||||
|
( runCmdMenu
|
||||||
import Shell
|
, runAppMenu
|
||||||
|
, runClipMenu
|
||||||
|
, runWinMenu
|
||||||
|
, runNetMenu
|
||||||
|
, runDevMenu
|
||||||
|
, runShowKeys
|
||||||
|
) where
|
||||||
|
|
||||||
import Control.Monad.Reader
|
import Control.Monad.Reader
|
||||||
|
|
||||||
|
@ -14,6 +20,7 @@ import Graphics.X11.Xrandr
|
||||||
import System.IO
|
import System.IO
|
||||||
|
|
||||||
import XMonad.Core
|
import XMonad.Core
|
||||||
|
import XMonad.Internal.Shell
|
||||||
import XMonad.StackSet
|
import XMonad.StackSet
|
||||||
import XMonad.Util.NamedActions
|
import XMonad.Util.NamedActions
|
||||||
import XMonad.Util.Run
|
import XMonad.Util.Run
|
||||||
|
@ -77,10 +84,8 @@ runShowKeys x = addName "Show Keybindings" $ do
|
||||||
Nothing -> io $ putStrLn "fail"
|
Nothing -> io $ putStrLn "fail"
|
||||||
where cmd name = fmtCmd myDmenuCmd
|
where cmd name = fmtCmd myDmenuCmd
|
||||||
[ "-dmenu"
|
[ "-dmenu"
|
||||||
, "-m"
|
, "-m", name
|
||||||
, name
|
, "-p", "commands"
|
||||||
, "-p"
|
|
||||||
, "commands"
|
|
||||||
, "-theme-str"
|
, "-theme-str"
|
||||||
, "'#element.selected.normal { background-color: #a200ff; }'"
|
, "'#element.selected.normal { background-color: #a200ff; }'"
|
||||||
]
|
]
|
|
@ -1,23 +1,51 @@
|
||||||
module General where
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
-- | General commands
|
-- | General commands
|
||||||
|
|
||||||
import Notify
|
module XMonad.Internal.Command.Desktop
|
||||||
import Shell
|
( myTerm
|
||||||
|
, runTerm
|
||||||
|
, runCalc
|
||||||
|
, runBrowser
|
||||||
|
, runEditor
|
||||||
|
, runFileManager
|
||||||
|
, runTogglePlay
|
||||||
|
, runPrevTrack
|
||||||
|
, runNextTrack
|
||||||
|
, runStopPlay
|
||||||
|
, runVolumeDown
|
||||||
|
, runVolumeUp
|
||||||
|
, runVolumeMute
|
||||||
|
, runToggleBluetooth
|
||||||
|
, runIncBacklight
|
||||||
|
, runDecBacklight
|
||||||
|
, runMinBacklight
|
||||||
|
, runMaxBacklight
|
||||||
|
, runToggleDPMS
|
||||||
|
, runRestart
|
||||||
|
, runRecompile
|
||||||
|
, runAreaCapture
|
||||||
|
, runScreenCapture
|
||||||
|
, runDesktopCapture
|
||||||
|
) where
|
||||||
|
|
||||||
import DBus.IntelBacklight
|
import Control.Monad (void)
|
||||||
import DBus.Screensaver
|
|
||||||
|
|
||||||
import Control.Monad (void)
|
import System.Directory (getHomeDirectory)
|
||||||
|
|
||||||
import XMonad.Actions.Volume
|
import XMonad.Actions.Volume
|
||||||
import XMonad.Core
|
import XMonad.Core
|
||||||
|
import XMonad.Internal.DBus.IntelBacklight
|
||||||
|
import XMonad.Internal.DBus.Screensaver
|
||||||
|
import XMonad.Internal.Notify
|
||||||
|
import XMonad.Internal.Shell
|
||||||
import XMonad.Operations
|
import XMonad.Operations
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
-- | Some nice apps
|
-- | Some nice apps
|
||||||
|
|
||||||
|
myTerm :: String
|
||||||
|
myTerm = "urxvt"
|
||||||
|
|
||||||
runTerm :: X ()
|
runTerm :: X ()
|
||||||
runTerm = spawn myTerm
|
runTerm = spawn myTerm
|
||||||
|
|
||||||
|
@ -104,3 +132,29 @@ runRecompile = do
|
||||||
#!&& fmtCmd "stack" ["install", ":xmonad"]
|
#!&& fmtCmd "stack" ["install", ":xmonad"]
|
||||||
#!&& fmtNotifyCmd defNoteInfo { body = Just $ Text "compilation succeeded" }
|
#!&& fmtNotifyCmd defNoteInfo { body = Just $ Text "compilation succeeded" }
|
||||||
#!|| fmtNotifyCmd defNoteError { body = Just $ Text "compilation failed" }
|
#!|| fmtNotifyCmd defNoteError { body = Just $ Text "compilation failed" }
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
-- | Screen capture commands
|
||||||
|
|
||||||
|
getScreenshotDir :: IO FilePath
|
||||||
|
getScreenshotDir = do
|
||||||
|
h <- getHomeDirectory
|
||||||
|
return $ h ++ "/Pictures/screenshots"
|
||||||
|
|
||||||
|
runFlameshot :: String -> X ()
|
||||||
|
runFlameshot mode = do
|
||||||
|
ssDir <- io getScreenshotDir
|
||||||
|
spawnCmd "flameshot" $ mode : ["-p", ssDir]
|
||||||
|
|
||||||
|
-- TODO this will steal focus from the current window (and puts it
|
||||||
|
-- in the root window?) ...need to fix
|
||||||
|
runAreaCapture :: X ()
|
||||||
|
runAreaCapture = runFlameshot "gui"
|
||||||
|
|
||||||
|
-- myWindowCap = "screencap -w" --external script
|
||||||
|
|
||||||
|
runScreenCapture :: X ()
|
||||||
|
runScreenCapture = runFlameshot "screen"
|
||||||
|
|
||||||
|
runDesktopCapture :: X ()
|
||||||
|
runDesktopCapture = runFlameshot "full"
|
|
@ -1,4 +1,7 @@
|
||||||
module Power
|
--------------------------------------------------------------------------------
|
||||||
|
-- | Commands for controlling power
|
||||||
|
|
||||||
|
module XMonad.Internal.Command.Power
|
||||||
( runHibernate
|
( runHibernate
|
||||||
, runOptimusPrompt
|
, runOptimusPrompt
|
||||||
, runPowerOff
|
, runPowerOff
|
||||||
|
@ -8,14 +11,7 @@ module Power
|
||||||
, runSuspend
|
, runSuspend
|
||||||
, runSuspendPrompt
|
, runSuspendPrompt
|
||||||
, runQuitPrompt
|
, runQuitPrompt
|
||||||
)
|
) where
|
||||||
where
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
-- | Commands for controlling power
|
|
||||||
|
|
||||||
import Shell
|
|
||||||
import qualified Theme as T
|
|
||||||
|
|
||||||
import Control.Arrow (first)
|
import Control.Arrow (first)
|
||||||
|
|
||||||
|
@ -23,13 +19,15 @@ import qualified Data.Map as M
|
||||||
|
|
||||||
import Graphics.X11.Types
|
import Graphics.X11.Types
|
||||||
|
|
||||||
import XMonad.Core
|
|
||||||
import XMonad.Prompt
|
|
||||||
import XMonad.Prompt.ConfirmPrompt
|
|
||||||
|
|
||||||
import System.Directory
|
import System.Directory
|
||||||
import System.Exit
|
import System.Exit
|
||||||
|
|
||||||
|
import XMonad.Core
|
||||||
|
import XMonad.Internal.Shell
|
||||||
|
import qualified XMonad.Internal.Theme as T
|
||||||
|
import XMonad.Prompt
|
||||||
|
import XMonad.Prompt.ConfirmPrompt
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
-- | Core commands
|
-- | Core commands
|
||||||
|
|
|
@ -1,29 +1,28 @@
|
||||||
{-# LANGUAGE LambdaCase #-}
|
{-# LANGUAGE LambdaCase #-}
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
|
||||||
module ACPI
|
module XMonad.Internal.Concurrent.ACPIEvent
|
||||||
( ACPIEvent(..)
|
( ACPIEvent(..)
|
||||||
, isDischarging
|
, isDischarging
|
||||||
, runPowermon
|
, runPowermon
|
||||||
, handleACPI
|
, handleACPI
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Power
|
|
||||||
import SendXMsg
|
|
||||||
|
|
||||||
import Control.Exception
|
import Control.Exception
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
|
|
||||||
import Data.ByteString hiding (readFile)
|
import Data.ByteString hiding (readFile)
|
||||||
import Data.ByteString.Char8 as C hiding (readFile)
|
import Data.ByteString.Char8 as C hiding (readFile)
|
||||||
import Data.Connection
|
import Data.Connection
|
||||||
|
|
||||||
import System.IO.Streams.Internal as S (read)
|
import Text.Read (readMaybe)
|
||||||
|
|
||||||
|
import System.IO.Streams.Internal as S (read)
|
||||||
import System.IO.Streams.UnixSocket
|
import System.IO.Streams.UnixSocket
|
||||||
|
|
||||||
import Text.Read (readMaybe)
|
|
||||||
|
|
||||||
import XMonad.Core
|
import XMonad.Core
|
||||||
|
import XMonad.Internal.Command.Power
|
||||||
|
import XMonad.Internal.Concurrent.ClientMessage
|
||||||
|
|
||||||
data ACPIEvent = Power
|
data ACPIEvent = Power
|
||||||
| Sleep
|
| Sleep
|
|
@ -1,4 +1,8 @@
|
||||||
module SendXMsg (XMsgType(..), sendXMsg, splitXMsg) where
|
module XMonad.Internal.Concurrent.ClientMessage
|
||||||
|
( XMsgType(..)
|
||||||
|
, sendXMsg
|
||||||
|
, splitXMsg
|
||||||
|
) where
|
||||||
|
|
||||||
import Data.Char
|
import Data.Char
|
||||||
|
|
|
@ -25,20 +25,16 @@
|
||||||
-- 2) Xsane (see Gimp)
|
-- 2) Xsane (see Gimp)
|
||||||
-- 3) Virtualbox (should always be by itself anyways)
|
-- 3) Virtualbox (should always be by itself anyways)
|
||||||
|
|
||||||
module WorkspaceMon
|
module XMonad.Internal.Concurrent.DynamicWorkspaces
|
||||||
( DynWorkspace(..)
|
( DynWorkspace(..)
|
||||||
, appendViewShift
|
, appendViewShift
|
||||||
, removeDynamicWorkspace
|
, removeDynamicWorkspace
|
||||||
, runWorkspaceMon
|
, runWorkspaceMon
|
||||||
, spawnOrSwitch
|
, spawnOrSwitch
|
||||||
, doSink
|
, doSink
|
||||||
)
|
) where
|
||||||
where
|
|
||||||
|
|
||||||
import Process
|
import qualified Data.Map as M
|
||||||
import SendXMsg
|
|
||||||
|
|
||||||
import qualified Data.Map as M
|
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
|
|
||||||
import Control.Concurrent
|
import Control.Concurrent
|
||||||
|
@ -54,7 +50,7 @@ import Graphics.X11.Xlib.Extras
|
||||||
import Graphics.X11.Xlib.Misc
|
import Graphics.X11.Xlib.Misc
|
||||||
import Graphics.X11.Xlib.Types
|
import Graphics.X11.Xlib.Types
|
||||||
|
|
||||||
import System.Process (Pid)
|
import System.Process (Pid)
|
||||||
|
|
||||||
import XMonad.Actions.DynamicWorkspaces
|
import XMonad.Actions.DynamicWorkspaces
|
||||||
import XMonad.Core
|
import XMonad.Core
|
||||||
|
@ -63,10 +59,13 @@ import XMonad.Core
|
||||||
, X
|
, X
|
||||||
, withWindowSet
|
, withWindowSet
|
||||||
)
|
)
|
||||||
import XMonad.Hooks.ManageHelpers (MaybeManageHook)
|
import XMonad.Hooks.ManageHelpers (MaybeManageHook)
|
||||||
|
import XMonad.Internal.Concurrent.ClientMessage
|
||||||
|
import XMonad.Internal.Process
|
||||||
import XMonad.ManageHook
|
import XMonad.ManageHook
|
||||||
import XMonad.Operations
|
import XMonad.Operations
|
||||||
import qualified XMonad.StackSet as W
|
import qualified XMonad.StackSet as W
|
||||||
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
-- | Dynamic Workspace datatype
|
-- | Dynamic Workspace datatype
|
|
@ -1,9 +1,14 @@
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
|
||||||
module DBus.Internal where
|
module XMonad.Internal.DBus.Common
|
||||||
|
( callMethod
|
||||||
|
, addMatchCallback
|
||||||
|
) where
|
||||||
|
|
||||||
import DBus
|
import DBus
|
||||||
import DBus.Client
|
import DBus.Client
|
||||||
|
|
||||||
|
-- TODO export the bus name (org.xmonad)
|
||||||
|
|
||||||
-- TODO not all methods warrent that we wait for a reply?
|
-- TODO not all methods warrent that we wait for a reply?
|
||||||
callMethod :: MethodCall -> IO (Maybe [Variant])
|
callMethod :: MethodCall -> IO (Maybe [Variant])
|
|
@ -1,16 +1,16 @@
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
|
||||||
module DBus.Common
|
module XMonad.Internal.DBus.Control
|
||||||
( Client
|
( Client
|
||||||
, startXMonadService
|
, startXMonadService
|
||||||
, stopXMonadService)
|
, stopXMonadService
|
||||||
where
|
) where
|
||||||
|
|
||||||
import DBus.IntelBacklight
|
|
||||||
import DBus.Screensaver
|
|
||||||
|
|
||||||
import DBus.Client
|
import DBus.Client
|
||||||
|
|
||||||
|
import XMonad.Internal.DBus.IntelBacklight
|
||||||
|
import XMonad.Internal.DBus.Screensaver
|
||||||
|
|
||||||
startXMonadService :: IO Client
|
startXMonadService :: IO Client
|
||||||
startXMonadService = do
|
startXMonadService = do
|
||||||
client <- connectSession
|
client <- connectSession
|
|
@ -3,7 +3,7 @@
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
-- | DBus module for Intel Backlight control
|
-- | DBus module for Intel Backlight control
|
||||||
|
|
||||||
module DBus.IntelBacklight
|
module XMonad.Internal.DBus.IntelBacklight
|
||||||
( callDecBrightness
|
( callDecBrightness
|
||||||
, callGetBrightness
|
, callGetBrightness
|
||||||
, callIncBrightness
|
, callIncBrightness
|
||||||
|
@ -13,19 +13,17 @@ module DBus.IntelBacklight
|
||||||
, matchSignal
|
, matchSignal
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Control.Monad (void)
|
import Control.Monad (void)
|
||||||
|
|
||||||
import Data.Char
|
import Data.Char
|
||||||
|
import Data.Int (Int16, Int32)
|
||||||
|
import Data.Text (pack, unpack)
|
||||||
|
import Data.Text.IO as T (readFile, writeFile)
|
||||||
|
|
||||||
import Data.Int (Int16, Int32)
|
import DBus
|
||||||
|
import DBus.Client
|
||||||
|
|
||||||
-- use strict IO here, the data in these files is literally 1-10 bytes
|
import XMonad.Internal.DBus.Common
|
||||||
import Data.Text (pack, unpack)
|
|
||||||
import Data.Text.IO as T (readFile, writeFile)
|
|
||||||
|
|
||||||
import DBus
|
|
||||||
import DBus.Client
|
|
||||||
import DBus.Internal
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
-- | Low level sysfs functions
|
-- | Low level sysfs functions
|
||||||
|
@ -36,6 +34,8 @@ import DBus.Internal
|
||||||
-- of 0 turn the monitor off). The latter is the raw brightness scaled from 0 to
|
-- of 0 turn the monitor off). The latter is the raw brightness scaled from 0 to
|
||||||
-- 10000 (which can easily be converted to a percent).
|
-- 10000 (which can easily be converted to a percent).
|
||||||
|
|
||||||
|
-- use strict IO here, the data in these files is literally 1-10 bytes
|
||||||
|
|
||||||
-- TODO this is hacky but not sure if there is a cleaner way to enforce type
|
-- TODO this is hacky but not sure if there is a cleaner way to enforce type
|
||||||
-- checking between these without making two new types and adding Integral
|
-- checking between these without making two new types and adding Integral
|
||||||
-- instances to both of them
|
-- instances to both of them
|
|
@ -3,25 +3,24 @@
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
-- | DBus module for X11 screensave/DPMS control
|
-- | DBus module for X11 screensave/DPMS control
|
||||||
|
|
||||||
module DBus.Screensaver
|
module XMonad.Internal.DBus.Screensaver
|
||||||
( exportScreensaver
|
( exportScreensaver
|
||||||
, callToggle
|
, callToggle
|
||||||
, callQuery
|
, callQuery
|
||||||
, matchSignal
|
, matchSignal
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Control.Monad (void)
|
import Control.Monad (void)
|
||||||
|
|
||||||
import DBus
|
import DBus
|
||||||
import DBus.Client
|
import DBus.Client
|
||||||
import DBus.Internal
|
|
||||||
|
|
||||||
import Graphics.X11.Xlib.Display
|
import Graphics.X11.Xlib.Display
|
||||||
import Graphics.X11.XScreenSaver
|
import Graphics.X11.XScreenSaver
|
||||||
|
|
||||||
import Shell
|
|
||||||
|
|
||||||
import XMonad
|
import XMonad
|
||||||
|
import XMonad.Internal.DBus.Common
|
||||||
|
import XMonad.Internal.Shell
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
-- | Low-level functions
|
-- | Low-level functions
|
||||||
|
@ -88,6 +87,7 @@ bodyGetCurrentState :: [Variant] -> Maybe SSState
|
||||||
bodyGetCurrentState [b] = fromVariant b :: Maybe SSState
|
bodyGetCurrentState [b] = fromVariant b :: Maybe SSState
|
||||||
bodyGetCurrentState _ = Nothing
|
bodyGetCurrentState _ = Nothing
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
-- | Exported haskell API
|
-- | Exported haskell API
|
||||||
|
|
||||||
exportScreensaver :: Client -> IO ()
|
exportScreensaver :: Client -> IO ()
|
|
@ -1,32 +1,32 @@
|
||||||
{-# LANGUAGE LambdaCase #-}
|
module XMonad.Internal.Notify
|
||||||
|
|
||||||
module Notify
|
|
||||||
( Note(..)
|
( Note(..)
|
||||||
, Body(..)
|
, Body(..)
|
||||||
, defNote
|
, defNote
|
||||||
, defNoteInfo
|
, defNoteInfo
|
||||||
, defNoteError
|
, defNoteError
|
||||||
, fmtNotifyCmd
|
, fmtNotifyCmd
|
||||||
)
|
) where
|
||||||
where
|
|
||||||
|
|
||||||
import Shell
|
import Data.Maybe
|
||||||
|
|
||||||
import Data.Maybe
|
import DBus.Notify
|
||||||
|
|
||||||
import DBus.Notify
|
import XMonad.Internal.Shell
|
||||||
|
|
||||||
|
defNote :: Note
|
||||||
defNote = blankNote { summary = "\"xmonad\"" }
|
defNote = blankNote { summary = "\"xmonad\"" }
|
||||||
|
|
||||||
|
defNoteInfo :: Note
|
||||||
defNoteInfo = defNote
|
defNoteInfo = defNote
|
||||||
{ appImage = Just $ Icon "dialog-information-symbolic" }
|
{ appImage = Just $ Icon "dialog-information-symbolic" }
|
||||||
|
|
||||||
|
defNoteError :: Note
|
||||||
defNoteError = defNote
|
defNoteError = defNote
|
||||||
{ appImage = Just $ Icon "dialog-error-symbolic" }
|
{ appImage = Just $ Icon "dialog-error-symbolic" }
|
||||||
|
|
||||||
parseBody :: Body -> Maybe String
|
parseBody :: Body -> Maybe String
|
||||||
parseBody (Text s) = Just s
|
parseBody (Text s) = Just s
|
||||||
parseBody _ = Nothing
|
parseBody _ = Nothing
|
||||||
|
|
||||||
fmtNotifyCmd :: Note -> String
|
fmtNotifyCmd :: Note -> String
|
||||||
fmtNotifyCmd note =
|
fmtNotifyCmd note =
|
|
@ -1,6 +1,10 @@
|
||||||
{-# LANGUAGE LambdaCase #-}
|
{-# LANGUAGE LambdaCase #-}
|
||||||
|
|
||||||
module Process where
|
module XMonad.Internal.Process
|
||||||
|
( waitUntilExit
|
||||||
|
, killPID
|
||||||
|
, spawnPipe'
|
||||||
|
) where
|
||||||
|
|
||||||
import Control.Concurrent
|
import Control.Concurrent
|
||||||
import Control.Exception
|
import Control.Exception
|
|
@ -1,10 +1,13 @@
|
||||||
module Shell where
|
module XMonad.Internal.Shell
|
||||||
|
( fmtCmd
|
||||||
|
, spawnCmd
|
||||||
|
, (#!&&)
|
||||||
|
, (#!||)
|
||||||
|
, (#!>>)
|
||||||
|
) where
|
||||||
|
|
||||||
import XMonad
|
import XMonad
|
||||||
|
|
||||||
myTerm :: String
|
|
||||||
myTerm = "urxvt"
|
|
||||||
|
|
||||||
fmtCmd :: String -> [String] -> String
|
fmtCmd :: String -> [String] -> String
|
||||||
fmtCmd cmd args = unwords $ cmd : args
|
fmtCmd cmd args = unwords $ cmd : args
|
||||||
|
|
|
@ -1,13 +1,35 @@
|
||||||
{-# LANGUAGE LambdaCase #-}
|
{-# LANGUAGE LambdaCase #-}
|
||||||
|
|
||||||
module Theme where
|
module XMonad.Internal.Theme
|
||||||
|
( baseColor
|
||||||
|
, bgColor
|
||||||
|
, fgColor
|
||||||
|
, bordersColor
|
||||||
|
, warningColor
|
||||||
|
, errorColor
|
||||||
|
, selectedFgColor
|
||||||
|
, selectedBgColor
|
||||||
|
, selectedBordersColor
|
||||||
|
, backdropBaseColor
|
||||||
|
, backdropFgColor
|
||||||
|
, backdropTextColor
|
||||||
|
, blend'
|
||||||
|
, darken'
|
||||||
|
, Slant(..)
|
||||||
|
, Weight(..)
|
||||||
|
, ThemeFont(..)
|
||||||
|
, fmtFontXFT
|
||||||
|
, font
|
||||||
|
, tabbedTheme
|
||||||
|
, promptTheme
|
||||||
|
) where
|
||||||
|
|
||||||
import Data.Char
|
import Data.Char
|
||||||
|
|
||||||
import Data.Colour
|
import Data.Colour
|
||||||
import Data.Colour.SRGB
|
import Data.Colour.SRGB
|
||||||
|
|
||||||
import Data.List
|
import Data.List
|
||||||
|
|
||||||
import qualified XMonad.Layout.Decoration as D
|
import qualified XMonad.Layout.Decoration as D
|
||||||
import qualified XMonad.Prompt as P
|
import qualified XMonad.Prompt as P
|
||||||
|
@ -60,6 +82,9 @@ darken' wt = sRGB24show . darken wt . sRGB24read
|
||||||
|
|
||||||
-- Fonts
|
-- Fonts
|
||||||
|
|
||||||
|
-- TODO use the font package from contrib
|
||||||
|
-- https://hackage.haskell.org/package/xmonad-contrib-0.16/docs/XMonad-Util-Font.html
|
||||||
|
|
||||||
data Slant = Roman
|
data Slant = Roman
|
||||||
| Italic
|
| Italic
|
||||||
| Oblique
|
| Oblique
|
||||||
|
@ -103,6 +128,7 @@ fmtFontXFT ThemeFont
|
||||||
Just d -> e ++ "=" ++ map toLower (show d)
|
Just d -> e ++ "=" ++ map toLower (show d)
|
||||||
Nothing -> ""
|
Nothing -> ""
|
||||||
|
|
||||||
|
font :: ThemeFont
|
||||||
font = ThemeFont
|
font = ThemeFont
|
||||||
{ family = "DejaVu Sans"
|
{ family = "DejaVu Sans"
|
||||||
, size = Just 10
|
, size = Just 10
|
||||||
|
@ -114,6 +140,7 @@ font = ThemeFont
|
||||||
|
|
||||||
-- Complete themes
|
-- Complete themes
|
||||||
|
|
||||||
|
tabbedTheme :: D.Theme
|
||||||
tabbedTheme = D.def
|
tabbedTheme = D.def
|
||||||
{ D.fontName = fmtFontXFT font { weight = Just Bold }
|
{ D.fontName = fmtFontXFT font { weight = Just Bold }
|
||||||
|
|
||||||
|
@ -139,6 +166,7 @@ tabbedTheme = D.def
|
||||||
, D.windowTitleIcons = []
|
, D.windowTitleIcons = []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
promptTheme :: P.XPConfig
|
||||||
promptTheme = P.def
|
promptTheme = P.def
|
||||||
{ P.font = fmtFontXFT font
|
{ P.font = fmtFontXFT font
|
||||||
, P.bgColor = bgColor
|
, P.bgColor = bgColor
|
|
@ -1,9 +0,0 @@
|
||||||
module Xmobar.Common where
|
|
||||||
|
|
||||||
import XMonad.Hooks.DynamicLog (xmobarColor)
|
|
||||||
|
|
||||||
wrapColor :: String -> String -> String
|
|
||||||
wrapColor fg = wrapColorBg fg ""
|
|
||||||
|
|
||||||
wrapColorBg :: String -> String -> String -> String
|
|
||||||
wrapColorBg = xmobarColor
|
|
|
@ -1,13 +1,13 @@
|
||||||
{-# LANGUAGE LambdaCase #-}
|
{-# LANGUAGE LambdaCase #-}
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
|
||||||
module Xmobar.Plugins.Bluetooth where
|
module Xmobar.Plugins.Bluetooth (Bluetooth(..)) where
|
||||||
|
|
||||||
import DBus
|
import DBus
|
||||||
import DBus.Client
|
import DBus.Client
|
||||||
|
|
||||||
import Xmobar
|
import Xmobar
|
||||||
import Xmobar.Common
|
import XMonad.Hooks.DynamicLog (xmobarColor)
|
||||||
|
|
||||||
data Bluetooth = Bluetooth (String, String, String) Int
|
data Bluetooth = Bluetooth (String, String, String) Int
|
||||||
deriving (Read, Show)
|
deriving (Read, Show)
|
||||||
|
@ -31,5 +31,5 @@ instance Exec Bluetooth where
|
||||||
Right r -> fromVariant r
|
Right r -> fromVariant r
|
||||||
Left _ -> Nothing
|
Left _ -> Nothing
|
||||||
fmtState = \case
|
fmtState = \case
|
||||||
Just s -> wrapColor (if s then colorOn else colorOff) text
|
Just s -> xmobarColor (if s then colorOn else colorOff) "" text
|
||||||
Nothing -> "N/A"
|
Nothing -> "N/A"
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
{-# LANGUAGE LambdaCase #-}
|
{-# LANGUAGE LambdaCase #-}
|
||||||
|
|
||||||
module Xmobar.Plugins.IntelBacklight where
|
module Xmobar.Plugins.IntelBacklight (IntelBacklight(..)) where
|
||||||
|
|
||||||
import Control.Concurrent
|
import Control.Concurrent
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
|
|
||||||
import DBus.IntelBacklight
|
import Xmobar
|
||||||
|
|
||||||
import Xmobar
|
import XMonad.Internal.DBus.IntelBacklight
|
||||||
|
|
||||||
newtype IntelBacklight = IntelBacklight String deriving (Read, Show)
|
newtype IntelBacklight = IntelBacklight String deriving (Read, Show)
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
{-# LANGUAGE LambdaCase #-}
|
{-# LANGUAGE LambdaCase #-}
|
||||||
|
|
||||||
module Xmobar.Plugins.Screensaver where
|
module Xmobar.Plugins.Screensaver (Screensaver(..)) where
|
||||||
|
|
||||||
import Control.Concurrent
|
import Control.Concurrent
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
|
|
||||||
import DBus.Screensaver
|
|
||||||
|
|
||||||
import Xmobar
|
import Xmobar
|
||||||
import Xmobar.Common
|
|
||||||
|
import XMonad.Hooks.DynamicLog (xmobarColor)
|
||||||
|
import XMonad.Internal.DBus.Screensaver
|
||||||
|
|
||||||
newtype Screensaver = Screensaver (String, String, String)
|
newtype Screensaver = Screensaver (String, String, String)
|
||||||
deriving (Read, Show)
|
deriving (Read, Show)
|
||||||
|
@ -21,6 +21,6 @@ instance Exec Screensaver where
|
||||||
forever (threadDelay 5000000)
|
forever (threadDelay 5000000)
|
||||||
where
|
where
|
||||||
fmtState = \case
|
fmtState = \case
|
||||||
Just s -> wrapColor (if s then colorOn else colorOff) text
|
Just s -> xmobarColor (if s then colorOn else colorOff) "" text
|
||||||
Nothing -> "N/A"
|
Nothing -> "N/A"
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
{-# LANGUAGE LambdaCase #-}
|
{-# LANGUAGE LambdaCase #-}
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
|
||||||
module Xmobar.Plugins.VPN where
|
module Xmobar.Plugins.VPN (VPN(..)) where
|
||||||
|
|
||||||
import DBus
|
import DBus
|
||||||
import DBus.Client
|
import DBus.Client
|
||||||
|
|
||||||
import Xmobar
|
import Xmobar
|
||||||
import Xmobar.Common
|
import XMonad.Hooks.DynamicLog (xmobarColor)
|
||||||
|
|
||||||
data VPN = VPN (String, String, String) Int
|
data VPN = VPN (String, String, String) Int
|
||||||
deriving (Read, Show)
|
deriving (Read, Show)
|
||||||
|
@ -31,5 +31,5 @@ instance Exec VPN where
|
||||||
Right r -> (fromVariant r :: Maybe String)
|
Right r -> (fromVariant r :: Maybe String)
|
||||||
Left _ -> Nothing
|
Left _ -> Nothing
|
||||||
fmtState = \case
|
fmtState = \case
|
||||||
Just s -> wrapColor (if s == "vpn" then colorOn else colorOff) text
|
Just s -> xmobarColor (if s == "vpn" then colorOn else colorOff) "" text
|
||||||
Nothing -> "N/A"
|
Nothing -> "N/A"
|
||||||
|
|
|
@ -5,22 +5,20 @@ cabal-version: >=1.10
|
||||||
|
|
||||||
library
|
library
|
||||||
hs-source-dirs: lib
|
hs-source-dirs: lib
|
||||||
exposed-modules: SendXMsg
|
exposed-modules: XMonad.Internal.Concurrent.ClientMessage
|
||||||
, ACPI
|
, XMonad.Internal.Concurrent.ACPIEvent
|
||||||
, Theme
|
, XMonad.Internal.Concurrent.DynamicWorkspaces
|
||||||
, Notify
|
, XMonad.Internal.Theme
|
||||||
, Shell
|
, XMonad.Internal.Notify
|
||||||
, Power
|
, XMonad.Internal.Shell
|
||||||
, WorkspaceMon
|
, XMonad.Internal.Command.Desktop
|
||||||
, Capture
|
, XMonad.Internal.Command.DMenu
|
||||||
, General
|
, XMonad.Internal.Command.Power
|
||||||
, Internal.DMenu
|
, XMonad.Internal.DBus.Common
|
||||||
, DBus.Common
|
, XMonad.Internal.DBus.IntelBacklight
|
||||||
, DBus.IntelBacklight
|
, XMonad.Internal.DBus.Control
|
||||||
, DBus.Internal
|
, XMonad.Internal.DBus.Screensaver
|
||||||
, DBus.Screensaver
|
, XMonad.Internal.Process
|
||||||
, Process
|
|
||||||
, Xmobar.Common
|
|
||||||
, Xmobar.Plugins.Bluetooth
|
, Xmobar.Plugins.Bluetooth
|
||||||
, Xmobar.Plugins.IntelBacklight
|
, Xmobar.Plugins.IntelBacklight
|
||||||
, Xmobar.Plugins.Screensaver
|
, Xmobar.Plugins.Screensaver
|
||||||
|
@ -54,7 +52,6 @@ executable xmonad
|
||||||
, directory >= 1.3.3.0
|
, directory >= 1.3.3.0
|
||||||
, process >= 1.6.5.0
|
, process >= 1.6.5.0
|
||||||
, my-xmonad
|
, my-xmonad
|
||||||
, unix >= 2.7.2.2
|
|
||||||
, xmonad >= 0.13
|
, xmonad >= 0.13
|
||||||
, xmonad-contrib >= 0.13
|
, xmonad-contrib >= 0.13
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
|
@ -67,5 +64,6 @@ executable xmobar
|
||||||
, my-xmonad
|
, my-xmonad
|
||||||
, xmobar
|
, xmobar
|
||||||
, xmonad >= 0.13
|
, xmonad >= 0.13
|
||||||
|
, xmonad-contrib >= 0.13
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
ghc-options: -Wall -Werror -fno-warn-missing-signatures -threaded
|
ghc-options: -Wall -Werror -fno-warn-missing-signatures -threaded
|
Loading…
Reference in New Issue