Toasty XMonad (scrot) (+4 likes)
komradtoast Apr 09, 2013 (wms/xmonad)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | import XMonad
import Data.Monoid
import System.Exit
-- Util
import XMonad.Util.EZConfig
import XMonad.Util.Run
import XMonad.Util.NamedScratchpad
import XMonad.Util.Scratchpad
-- Hooks
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.UrgencyHook
import XMonad.Hooks.EwmhDesktops
import XMonad.Hooks.FadeInactive
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.SetWMName
import XMonad.Hooks.DynamicHooks
import XMonad.Hooks.Minimize
-- Actions
import XMonad.Actions.DynamicWorkspaces
import XMonad.Actions.TopicSpace
import XMonad.Actions.WithAll
-- Layout
import XMonad.Layout.NoBorders
-- 'as' imports
import qualified XMonad.StackSet as W
import qualified Data.Map as M
import qualified Data.Set as S
-- Custom Modules
import Hooks
import Utils
import Config
import Themes
import Topics as T
import Scratch
import Layouts
------------------------------------------------------------------------------------
---- Keybindings
------------------------------------------------------------------------------------
myKeys :: [(String, X())]
myKeys =
-- | WM Keybindings
[ ("M-b" , sendMessage ToggleStruts ) -- Toggle Struts
, ("M-S-c" , kill ) -- Close focused window
, ("M-n" , refresh ) -- Tell focused window to re-draw itself
, ("M-<Space>" , sendMessage NextLayout ) -- Rotate to next available layout algorithm
, ("M-<Tab>" , windows W.focusDown ) -- Move focus to next window
, ("M-S-<Tab>" , windows W.focusUp ) -- Move focus to prev window
, ("M-m" , windows W.focusMaster ) -- Move focus to master window
, ("M-<Return>" , windows W.swapMaster ) -- Swap focused window with master window
, ("M-h" , sendMessage Shrink ) -- Shrink the master area
, ("M-l" , sendMessage Expand ) -- Expand the master area
, ("M-t" , withFocused $ windows . W.sink ) -- Push window back in to tiling
, ("M-," , sendMessage (IncMasterN 1) ) -- Increment number of windows in master area
, ("M-." , sendMessage (IncMasterN (-1)) ) -- Decrement number of windows in master area
, ("M-r" , spawn "xmonad --recompile" ) -- Recompile XMonad
, ("M-q" , restartXMonad ) -- Restart XMonad
, ("M-S-q" , io (exitWith ExitSuccess) ) -- Quit XMonad
-- | Workspace (TopicSpace, DynamicWorkspaces) Bindings
, ("M-w 1" , createOrGoto "dash" ) -- | Workspace bindings
, ("M-w w" , createOrGoto "web" ) -- | these bindings either
, ("M-w c" , createOrGoto "code" ) -- | create the workspace if
, ("M-w h" , createOrGoto "haskell" ) -- | it does not exist or
, ("M-w g" , createOrGoto "grfx" ) -- | goes to the workspace if
, ("M-w v" , createOrGoto "video" ) -- | it does exist.
, ("M-w f" , createOrGoto "file" ) -- |
, ("M-w x" , createOrGoto "xmonad" ) -- |
, ("M-w s" , createOrGoto "script" ) -- |
, ("M-w r" , createOrGoto "ruby" ) -- |
, ("M-w d" , createOrGoto "docs" ) -- |
, ("M-w p" , createOrGoto "pdf" ) -- |
, ("M-w m" , createOrGoto "music" ) -- |
, ("M-w q" , createOrGoto "scrots" ) -- |
, ("M-w <Backspace>" , killAll >> removeWorkspace >> createOrGoto "dash" ) -- | Removes the current workspace
-- | Program Launching Bindings
, ("M-S-<Return>" , spawnShell ) -- Launch a terminal in current workspace directory
, ("M-p" , spawn "dmenu_run" ) -- Launch dmenu
, ("M-S-p" , spawn "gmrun" ) -- Launch gmrun
, ("M-x w" , spawn "google-chrome" ) -- Google Chrome
, ("M-x e" , spawnSubl ) -- Sublime Text, in current directory
, ("M-x f" , spawnFile ) -- Launch file man in cureent ws directory
-- | Scratchpads
, ("M1-z" , scratchTerm ) -- ZSH Scratchpad
, ("M1-w" , scratchWeb )
, ("M1-r" , scratchIrb )
, ("M1-g" , scratchGhc )
, ("M1-v" , scratchVol )
, ("M1-m" , scratchMus )
-- | Media Keybindings
, ("<Print>" , spawn "scrot " )
, ("<XF86AudioNext>" , spawn "mpc next" )
, ("<XF86AudioPrev>" , spawn "mpc prev" )
, ("<XF86AudioStop>" , spawn "mpc stop" )
, ("<XF86AudioPlay>" , spawn "mpc toggle" )
, ("<XF86AudioLowerVolume>" , spawn (myScripts ++ "dvol -d 1") )
, ("<XF86AudioRaiseVolume>" , spawn (myScripts ++ "dvol -i 1") )
] where
scratchTerm = namedScratchpadAction myScratchPads "terminal"
scratchWeb = namedScratchpadAction myScratchPads "web"
scratchIrb = namedScratchpadAction myScratchPads "irb"
scratchGhc = namedScratchpadAction myScratchPads "ghc"
scratchVol = namedScratchpadAction myScratchPads "volume"
scratchMus = namedScratchpadAction myScratchPads "ncmpcpp"
------------------------------------------------------------------------------------
---- Main Function
------------------------------------------------------------------------------------
main = do
dzen <- spawnPipe myStatusBar
conky <- spawnPipe myConky
xmonad $ withUrgencyHook NoUrgencyHook $ ewmh defaultConfig
{ terminal = myTerminal
, focusFollowsMouse = myFocusFollowsMouse
, clickJustFocuses = myClickJustFocuses
, borderWidth = myBorderWidth
, modMask = myModMask
, workspaces = ["dash"]
, normalBorderColor = norBorder
, focusedBorderColor = focBorder
-- hooks, layouts
, layoutHook = smartBorders $ avoidStruts $ myLayoutHook
, manageHook = myManageHook <+> manageDocks
, handleEventHook = myHandleEventHook <+> ewmhDesktopsEventHook
, logHook = myLogHook dzen
, startupHook = ewmhDesktopsStartup <+> myStartupHook
} `additionalKeysP` myKeys
|
x
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | module Config
( homeDir
, myScripts
, myIconDir
, myNotesFile
, myWindowSpacing
, myStatusBar
, myConky
, username
, myFont
, myXPConfig
, defaultFG
, defaultBG
, colorBlk1
, colorBlk2
, colorRed1
, colorRed2
, colorGrn1
, colorGrn2
, colorYlw1
, colorYlw2
, colorBlu1
, colorBlu2
, colorMag1
, colorMag2
, colorCyn1
, colorCyn2
, colorWht1
, colorWht2
, norBorder
, focBorder
, myTerminal
, myFocusFollowsMouse
, myClickJustFocuses
, myBorderWidth
, myModMask ) where
import XMonad
import XMonad.Prompt
username = "tyler"
homeDir = "/home/" ++ username ++ "/"
myScripts = homeDir ++ "bin/"
myIconDir = homeDir ++ "images/icons"
myNotesFile = homeDir ++ "doc/txt/TODO"
myStatusBar = "dzen2 -x '0' -y '0' -w '960' -h '16' -ta 'l' -fn " ++ myFont ++ " -fg " ++ defaultFG ++ " -bg " ++ defaultBG
myConky = "conky --config=\"/home/tyler/.xmonad/conkyrc\" | dzen2 -x '960' -y '0' -w '960' -h '16' -ta 'r' -fn " ++ myFont ++ " -fg " ++ defaultFG ++ " -bg " ++ defaultBG
myTerminal = "urxvt"
myFocusFollowsMouse = True
myClickJustFocuses = True
myBorderWidth :: Dimension
myBorderWidth = 1
myWindowSpacing :: Int
myWindowSpacing = 2
myModMask = mod4Mask
myFont = "bitocra13"
----
--Color Values
----
norBorder = defaultBG -- Normal border
focBorder = colorWht1 -- Focused border
defaultFG = "#C6A57B" -- Default foreground
defaultBG = "#151515" -- Default background
colorBlk1 = "#252525" --Black
colorBlk2 = "#404040"
colorWht1 = "#dddddd" --White
colorWht2 = "#707070"
colorRed1 = "#953331" --Red
colorRed2 = "#8D4A48"
colorGrn1 = "#546A29" --Green
colorGrn2 = "#7E9960"
colorYlw1 = "#909737" --Yellow
colorYlw2 = "#9CA554"
colorBlu1 = "#385E6B" --Blue
colorBlu2 = "#5C737C"
colorMag1 = "#7F355E" --Magenta
colorMag2 = "#95618B"
colorCyn1 = "#34676F" --Cyan
colorCyn2 = "#5D858A"
myXPConfig =
defaultXPConfig
{ font = myFont
, fgColor = defaultFG
, bgColor = defaultBG
, fgHLight = colorRed1
, bgHLight = defaultBG
, borderColor = colorBlk1
, promptBorderWidth = 1
, height = 17
, position = Top
, historySize = 100
, historyFilter = deleteConsecutive
}
|
x
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | module Hooks
( myStartupHook
, myLogHook
, myManageHook
, myHandleEventHook ) where
import XMonad
import System.IO
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.DynamicHooks
import XMonad.Hooks.UrgencyHook
import XMonad.Hooks.EwmhDesktops
import XMonad.Hooks.FadeInactive
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.SetWMName
import XMonad.Hooks.Minimize
import XMonad.ManageHook
import XMonad.Actions.CopyWindow
import XMonad.Layout.LayoutModifier
import qualified XMonad.StackSet as W
import Themes
import Topics
import Scratch
-- Runs on WM startup
myStartupHook :: X ()
myStartupHook = do
ewmhDesktopsStartup
myHandleEventHook = minimizeEventHook
-- dzen, ewmh & fading windows
myLogHook :: Handle -> X ()
myLogHook h = do
myStatusBarLogHook h
--myFadeInactiveLogHook
ewmhDesktopsLogHook
return ()
-- dzen log hook
myStatusBarLogHook :: Handle -> X()
myStatusBarLogHook h = dynamicLogWithPP $ myPP
{ ppOutput = System.IO.hPutStrLn h }
-- 0 is transparent and 1 is fully opaque
-- Inactive windows are going to use this value to control their transparency
-- must have compton or similar running
myFadeInactiveLogHook :: X ()
myFadeInactiveLogHook = fadeInactiveLogHook fadeAmount
where
fadeAmount = 0.70
--------
----ManageHook Config
--------
myManageHook :: ManageHook
myManageHook =
(composeAll . concat $
[ [ className =? x --> doLayoutToGimp | x <- gimp ]
, [ className =? x --> doCenterFloat' | x <- floats ]
, [ appName =? "bash" --> doCenterFloat' ]
, [ title =? x --> doCenterFloatToAll | x <- urgent ]
, [ isDialog --> doCenterFloat' ]
, [ className =? "Zenity" --> ask >>= doF . W.sink ]
, [ className =? x --> doLayoutToGame | x <- games ]
, [ myNSManageHook myScratchPads ]
])
where
-- Important windows get floated to the center of ALL workspaces
urgent = []
-- Floats get floated to the center of the current workspace
floats = ["Xmessage"]
-- gimp gets layed out to the 'gimp' workspace''
gimp = ["Gimp", "gimp"]
-- games get layed out to game workspace
games = ["net-minecraft-LauncherFrame"]
doMaster = doF W.shiftMaster --append this to all floats so new windows always go on top, regardless of the current focus
doCenterFloat' = doCenterFloat <+> doMaster
doFloatAt' x y = doFloatAt x y <+> doMaster
doSideFloat' p = doSideFloat p <+> doMaster
doRectFloat' r = doRectFloat r <+> doMaster
doFullFloat' = doFullFloat <+> doMaster
doShiftAndGo ws = doF (W.greedyView ws) <+> doShift ws
doCopyToAll = ask >>= doF . \w -> (\ws -> foldr($) ws (map (copyWindow w) myTopics))
doCenterFloatToAll = doCopyToAll <+> doCenterFloat'
doLayoutToGimp = doShiftAndGo "GRFX" <+> (ask >>= doF . W.sink)
doLayoutToGame = doShiftAndGo "GAME"
|
x
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | module Layouts
( myLayoutHook ) where
import XMonad.Layout.ImageButtonDecoration
import XMonad.Layout.DecorationMadness
import XMonad.Layout.LayoutModifier
import XMonad.Layout.ThreeColumns
import XMonad.Layout.WorkspaceDir
import XMonad.Layout.PerWorkspace
import XMonad.Layout.SimpleFloat
import XMonad.Layout.Decoration
import XMonad.Layout.NoBorders
import XMonad.Layout.Minimize
import XMonad.Layout.Maximize
import XMonad.Layout.Renamed
import XMonad.Layout.Reflect
import XMonad.Layout.Spacing
import XMonad.Layout.Tabbed
import XMonad.Layout.Spiral
import XMonad.Layout.Grid
import XMonad.Layout.IM
import XMonad.Layout
import XMonad.Hooks.Minimize
import Themes
--------
----Layout Config
--------
myLayoutHook = onWorkspace "grfx" gimp
$ onWorkspace "dash" wide
$ onWorkspace "web" web
$ onWorkspace "scrots" scrots
$ def
where
nmaster = 1
ratio = 2/3
delta = 1/100
grid = spacing 5 $ Grid -- | Grid with default gaps
grid' = spacing 40 $ Grid -- | Grid with 10 pixel gaps
tiled = spacing 5 $ Tall nmaster delta ratio -- | Tiled with default gaps
tiled' = spacing 40 $ Tall nmaster delta ratio -- | Tiled with 10 pixel gaps
threeCol = spacing 5 $ ThreeColMid 1 (3/100) (1/2) -- | Three column layout, default gaps
threeCol' = spacing 40 $ ThreeColMid 1 (3/100) (1/2) -- | Three Column Layout, 10 pixel gaps
nbFull = noBorders $ Full -- | No Borders, Full
scrot = spacing 80 $ Tall nmaster delta ratio
decoScrot = decorateLayout scrot myTheme
-- Setting up some preferred layouts
decoGrid = decorateLayout grid myTheme
decoFloat = imageButtonDeco shrinkText myButtonTheme (maximize (minimize (floatDefault shrinkText myTheme {decoHeight = 0})))
decoStack = decorateLayout tiled myTheme
decoBottom = decorateLayout (Mirror tiled) myTheme
decoTabbed = tabbed shrinkText myTabTheme
decoThreeCol = decorateLayout threeCol myTheme
-- Wide border layouts
-- Setting up some preferred layouts
decoGrid' = decorateLayout grid' myTheme
decoStack' = decorateLayout tiled' myTheme
decoBottom' = decorateLayout (Mirror tiled') myTheme
decoThreeCol' = decorateLayout threeCol' myTheme
-- Layouts for "gimp" workspace, no gaps
gimpFloat = gimpLayout decoFloat
gimpTab = gimpLayout decoTabbed
gimpGrid = gimpLayout decoGrid
gimpTile = gimpLayout decoStack
gimpBottom = gimpLayout decoBottom
gimpCols = gimpLayout decoThreeCol
-- Spiral Layout
goldenRatio = toRational (2/(1 + sqrt 5 :: Double))
goldenSpiral = spacing 5 $ spiral goldenRatio
goldenSpiral' = spacing 40 $ spiral goldenRatio
fullGoldenSpiral = spiral goldenRatio
-- Layouts everywhere!!
def = decoStack ||| decoBottom ||| decoGrid ||| decoThreeCol ||| decoFloat
conf = decoStack ||| decoBottom ||| decoGrid ||| decoThreeCol ||| goldenSpiral ||| decoTabbed
wide = decoStack' ||| decoBottom' ||| decoGrid' ||| decoThreeCol' ||| goldenSpiral' ||| decoFloat
web = decoStack ||| decoTabbed ||| decoThreeCol
gimp = gimpTab ||| gimpGrid ||| gimpCols ||| gimpTile ||| gimpBottom ||| gimpFloat
scrots = decoScrot
-- Function to decorate layout 'l' with theme 't'
decorateLayout l t = decoration shrinkText t DefaultDecoration l
-- Function to "Gimp-ify" a layout, used for my "gimp" workspace
gimpLayout l = withIM (0.15) (Role "gimp-toolbox") $ reflectHoriz $ withIM (0.15) (Role "gimp-dock") $ reflectHoriz $ l
|
x
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | module Scratch
( myScratchPads
, myNSManageHook ) where
import XMonad
import XMonad.Hooks.FadeInactive
import XMonad.Hooks.ManageHelpers
import XMonad.Util.NamedScratchpad
import XMonad.Util.Scratchpad
import qualified XMonad.StackSet as W
import Utils
import Topics
--------
----Scratchpad Config
--------
myScratchPads :: [NamedScratchpad]
myScratchPads = [ NS "web" spawnWeb findWeb manageWeb -- | Google search
, NS "terminal" spawnTerm findTerm manageTerm -- | Terminal
, NS "irb" spawnIrb findIrb manageIrb -- | IRB
, NS "ghc" spawnGhc findGhc manageGhc -- | GHCi
, NS "volume" spawnVol findVol manageVol -- | Pavucontrol
, NS "ncmpcpp" spawnMus findMus manageMus -- | NCMPCPP
]
where
spawnTerm = "urxvt -name terminal -title terminal"
findTerm = resource =? "terminal"
manageTerm = customFloating $ W.RationalRect l t w h
where
h = 0.60 -- Height
w = 0.60 -- Width
t = (1-h)/2 -- Distance from top
l = (1-w)/2 -- Distance from left
spawnWeb = "google-chrome --app=\"http://www.google.com\""
findWeb = roleName =? "pop-up"
manageWeb = customFloating $ W.RationalRect l t w h
where
h = 0.60 -- Height
w = 0.60 -- Width
t = (1-h)/2 -- Distance from top
l = (1-w)/2 -- Distance from left
spawnIrb = "urxvt -name irb -title irb -e irb"
findIrb = resource =? "irb"
manageIrb = customFloating $ W.RationalRect l t w h
where
h = 0.60 -- Height
w = 0.60 -- Width
t = (1-h)/2 -- Distance from top
l = (1-w)/2 -- Distance from left
spawnGhc = "urxvt -name ghc -title ghc -e ghci"
findGhc = resource =? "ghc"
manageGhc = customFloating $ W.RationalRect l t w h
where
h = 0.60 -- Height
w = 0.60 -- Width
t = (1-h)/2 -- Distance from top
l = (1-w)/2 -- Distance from left
spawnVol = "pavucontrol"
findVol = className =? "Pavucontrol"
manageVol = customFloating $ W.RationalRect l t w h
where
h = 0.60 -- Height
w = 0.60 -- Width
t = (1-h)/2 -- Distance from top
l = (1-w)/2 -- Distance from left
spawnMus = "urxvt -name ncmpcpp -title ncmpcpp -e ncmpcpp"
findMus = resource =? "ncmpcpp"
manageMus = customFloating $ W.RationalRect l t w h
where
h = 0.60 -- Height
w = 0.60 -- Width
t = (1-h)/2 -- Distance from top
l = (1-w)/2 -- Distance from left
myNSManageHook :: NamedScratchpads -> ManageHook
myNSManageHook s =
namedScratchpadManageHook s
<+> composeOne
[ title =? "terminal" -?> (ask >>= \w -> liftX (setOpacity w 0.74) >> idHook)
, roleName =? "pop-up" -?> (ask >>= \w -> liftX (setOpacity w 0.74) >> idHook)
, title =? "terminal" -?> (ask >>= \w -> liftX (setOpacity w 0.74) >> idHook)
, className =? "Pavucontrol" -?> (ask >>= \w -> liftX (setOpacity w 0.74) >> idHook) ]
|
x
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | module Themes
( myTheme
, myPP
, myTabTheme
, myButtonTheme ) where
import XMonad.Layout.Decoration
import XMonad.Prompt
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.DynamicHooks
import XMonad.Util.Loggers
import XMonad.Layout.ImageButtonDecoration
import XMonad.Util.WorkspaceCompare
import XMonad.Util.Image
import Config
--------
----PrettyPrinter Config
--------
myPP :: PP
myPP =
defaultPP
{ ppHiddenNoWindows = dzenColor colorBlk1 defaultBG . (\ x -> wsRenamer x )
, ppHidden = dzenColor colorWht2 defaultBG . (\ x -> wsRenamer x )
, ppUrgent = dzenColor colorRed1 colorRed2 . (\ x -> wsRenamer x )
, ppCurrent = dzenColor colorCyn1 colorBlk1 . (\ x -> wsRenamer x)
, ppVisible = dzenColor colorWht2 defaultBG . (\ x -> wsRenamer x )
, ppTitle = dzenColor colorGrn1 defaultBG . shorten 50 . pad
, ppLayout = dzenColor colorGrn1 defaultBG . (\ x -> layoutRenamer x )
, ppWsSep = "^fg(" ++ colorBlk1 ++ ")^r(1x16)^fg()"
, ppSep = " ^fg(" ++ colorBlk1 ++ ")^r(2x2)^fg() "
, ppOutput = putStrLn
, ppSort = getSortByIndex
, ppExtras = []
, ppOrder = \(ws:l:t:xs) -> [ws,l,t] ++ xs
}
where
-- Replace some workspace names
wsRenamer name = case name of
"dash" -> "^ca(1,xdotool key super+w 1) ^i(/home/tyler/images/icons/8/arch_10x10.xbm) ^fg(" ++ colorBlk1 ++ ")^r(1x16)^fg()^ca()"
"web" -> "^ca(1,xdotool key super+w w) webs ^ca()"
"code" -> "^ca(1,xdotool key super+w c) code ^ca()"
"haskell" -> "^ca(1,xdotool key super+w h) haskell ^ca()"
"grfx" -> "^ca(1,xdotool key super+w g) grfx ^ca()"
"video" -> "^ca(1,xdotool key super+w v) video ^ca()"
"file" -> "^ca(1,xdotool key super+w f) file ^ca()"
"xmonad" -> "^ca(1,xdotool key super+w x) xmonad ^ca()"
"script" -> "^ca(1,xdotool key super+w s) script ^ca()"
"ruby" -> "^ca(1,xdotool key super+w r) ruby ^ca()"
"docs" -> "^ca(1,xdotool key super+w d) docs ^ca()"
"pdf" -> "^ca(1,xdotool key super+w p) pdf ^ca()"
"music" -> "^ca(1,xdotool key super+w m) music ^ca()"
"scrots" -> "^ca(1,xdotool key super+w q) scrots ^ca()"
"NSP" -> ""
_ -> name
--Replace some layout names
layoutRenamer x = case x of
"DefaultDecoration Spacing 5 Tall" -> xbmIcon "tall"
"DefaultDecoration Spacing 5 Tall" -> xbmIcon "tall"
"DefaultDecoration Spacing 40 Tall" -> xbmIcon "tall"
"DefaultDecoration Spacing 40 Tall" -> xbmIcon "tall"
"DefaultDecoration Spacing 80 Tall" -> xbmIcon "tall"
"DefaultDecoration Mirror Spacing 5 Tall" -> xbmIcon "mtall"
"DefaultDecoration Mirror Spacing 40 Tall" -> xbmIcon "mtall"
"Tabbed Simplest" -> xbmIcon "tabbed"
"DefaultDecoration Full" -> xbmIcon "full"
"Full" -> xbmIcon "full"
"DefaultDecoration Grid" -> xbmIcon "grid"
"ImageButtonDeco Maximize Minimize DefaultDecoration Float" -> xbmIcon "floating"
"IM ReflectX IM ReflectX Tabbed Simplest" -> xbmIcon "gimpTab"
"IM ReflectX IM ReflectX DefaultDecoration Spacing 5 Grid" -> xbmIcon "gimpGrid"
"IM ReflectX IM ReflectX DefaultDecoration Spacing 5 ThreeCol" -> xbmIcon "gimpThreeCol"
"IM ReflectX IM ReflectX ImageButtonDeco Maximize Minimize DefaultDecoration Float" -> xbmIcon "gimpFloat"
"IM ReflectX IM ReflectX DefaultDecoration Spacing 5 Tall" -> xbmIcon "gimpTile"
"IM ReflectX IM ReflectX DefaultDecoration Mirror Spacing 5 Tall" -> xbmIcon "gimpMirror"
"DefaultDecoration Spacing 5 ThreeCol" -> xbmIcon "threeCol"
"DefaultDecoration Spacing 5 Grid" -> xbmIcon "grid"
"DefaultDecoration Spacing 40 ThreeCol" -> xbmIcon "threeCol"
"DefaultDecoration Spacing 40 Grid" -> xbmIcon "grid"
"Spacing 5 Spiral" -> xbmIcon "spiral"
"Spacing 40 Spiral" -> xbmIcon "spiral"
_ -> x
-- Iconizer
xbmIcon icon = "^ca(1,xdotool key super+space) ^i(" ++ myIconDir ++ "/8/" ++ icon ++".xbm) ^ca()"
-- Hide the 'NSP' workspace
noScratchPad ws = if ws == "NSP" then "$" else ws
-- Create a function to 'tag' loggers
tagL l = onLogger $ wrap (l ++ ": ") ""
--Create and tag a volume logger
lVol = logCmd "pamixer --get-volume"
logVol = tagL "^i(/home/tyler/images/icons/8/spkr_01.xbm)" lVol
--------
----Theme Config
--------
myTheme :: Theme
myTheme =
defaultTheme
{ fontName = myFont
, inactiveBorderColor = colorBlk2
, inactiveColor = colorBlk1
, inactiveTextColor = colorWht2
, activeBorderColor = colorBlk2
, activeColor = colorBlk2
, activeTextColor = colorWht1
, urgentBorderColor = colorRed1
, urgentTextColor = colorRed2
, decoHeight = 18
}
myTabTheme :: Theme
myTabTheme =
myTheme
{ inactiveColor = colorBlk1
, inactiveBorderColor = colorBlk2
, activeBorderColor = colorBlk2
}
myButtonTheme :: Theme
myButtonTheme =
defaultThemeWithImageButtons
{ fontName = myFont
, inactiveBorderColor = colorWht1
, inactiveColor = colorBlk1
, inactiveTextColor = colorWht2
, activeBorderColor = colorWht2
, activeColor = colorBlk2
, activeTextColor = colorWht1
, urgentBorderColor = colorRed1
, urgentTextColor = colorRed2
, decoHeight = 18
, windowTitleIcons = [ (menuButton , CenterLeft 3)
, (closeButton , CenterRight 3)
, (maxiButton , CenterRight 18)
, (miniButton , CenterRight 33)
]
}
where
convertToBool' :: [Int] -> [Bool]
convertToBool' = map (\x -> x == 1)
convertToBool :: [[Int]] -> [[Bool]]
convertToBool = map convertToBool'
menuButton' :: [[Int]]
menuButton' = [[0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0],
[0,0,1,1,0,0,1,1,0,0],
[0,0,1,0,0,0,0,1,0,0],
[0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0],
[0,0,1,0,0,0,0,1,0,0],
[0,0,1,1,0,0,1,1,0,0],
[0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0]]
menuButton :: [[Bool]]
menuButton = convertToBool menuButton'
miniButton' :: [[Int]]
miniButton' = [[0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0],
[0,1,1,1,1,1,1,1,1,0],
[0,0,0,0,0,0,0,0,0,0]]
miniButton :: [[Bool]]
miniButton = convertToBool miniButton'
maxiButton' :: [[Int]]
maxiButton' = [[0,0,0,0,0,0,0,0,0,0],
[0,1,1,1,1,1,1,1,1,0],
[0,1,0,0,0,0,0,0,1,0],
[0,1,0,0,0,0,0,0,1,0],
[0,1,0,0,0,0,0,0,1,0],
[0,1,0,0,0,0,0,0,1,0],
[0,1,0,0,0,0,0,0,1,0],
[0,1,0,0,0,0,0,0,1,0],
[0,1,1,1,1,1,1,1,1,0],
[0,0,0,0,0,0,0,0,0,0]]
maxiButton :: [[Bool]]
maxiButton = convertToBool maxiButton'
closeButton' :: [[Int]]
closeButton' = [[0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0],
[0,0,1,0,0,0,0,1,0,0],
[0,0,0,1,0,0,1,0,0,0],
[0,0,0,0,1,1,0,0,0,0],
[0,0,0,0,1,1,0,0,0,0],
[0,0,0,1,0,0,1,0,0,0],
[0,0,1,0,0,0,0,1,0,0],
[0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0]]
closeButton :: [[Bool]]
closeButton = convertToBool closeButton'
|
x
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | module Topics
( myTopics
, myTopicConfig
, spawnSublIn
, spawnSubl
, spawnFileIn
, spawnFile
, spawnShellIn
, spawnShell
, createOrGoto
, createGoto
, promptedGoto
, promptedShift
, ) where
import XMonad
import XMonad.Prompt
import XMonad.Prompt.Workspace
import XMonad.Actions.TopicSpace
import XMonad.Actions.DynamicWorkspaces
import XMonad.Prompt.Input as PI
import qualified XMonad.StackSet as W
import qualified Data.Map as M
import Config
import Utils
------------------------------------------------------------------------------------
------ Topic configuration
------------------------------------------------------------------------------------
myTopics :: [Topic]
myTopics = [ "dash" , "code", "web"
, "haskell", "xmonad", "video"
, "conf", "script", "ruby", "music"
, "docs", "file", "pdf" ]
myTopicConfig :: TopicConfig
myTopicConfig = defaultTopicConfig
{ topicDirs = M.fromList $
[ ( "dash" , homeDir )
, ( "conf" , homeDir ++ "/etc" )
, ( "code" , homeDir ++ "/src/c" )
, ( "web" , homeDir ++ "/down/web" )
, ( "haskell" , homeDir ++ "/src/haskell" )
, ( "xmonad" , homeDir ++ "/etc/xmonad" )
, ( "video" , homeDir ++ "/video" )
, ( "script" , homeDir ++ "/bin" )
, ( "ruby" , homeDir ++ "/src/ruby" )
, ( "docs" , homeDir ++ "/doc" )
, ( "file" , homeDir )
, ( "pdf" , homeDir ++ "/doc/pdf" )
, ( "music" , homeDir ++ "/audio/music" )
, ( "scrots" , homeDir ++ "/images/scrots" )
]
, defaultTopicAction = const $ spawn ""
, defaultTopic = "dash"
, topicActions = M.fromList $
[ ( "conf" , spawnShell >> spawnFile >> spawnSubl ) -- | A shell, a file manager, and a text editor
, ( "code" , spawnShell >*> 2 >> spawnSubl ) -- | 2 shells and a text editor
, ( "web" , spawn "google-chrome" ) -- | Google Chrome
, ( "haskell" , spawnShell >> spawn "urxvt -e ghci" >> spawnSubl ) -- | A shell, ghci, and a text editor
, ( "grfx" , spawn "gimp" ) -- | Image editor
, ( "xmonad" , spawnShell >> spawnShellIn "/home/tyler/etc/xmonad/lib" >>
spawnSubl ) -- | 2 shells and a text editor
, ( "video" , videoSelect ) -- | Video selection prompt
, ( "script" , spawnShell >*> 2 >> spawnSubl ) -- | 2 shells and a text editor
, ( "ruby" , spawnShell >> spawn "urxvt -e irb" >> spawnSubl ) -- | A shell, irb, and a text editor
, ( "file" , spawnFile ) -- | A file manager, in current directory
, ( "pdf" , pdfSelect ) -- | PDF selection prompt
, ( "music" , spawn "urxvt -e ncmpcpp" >>
spawn "urxvt -e ncmpcpp --screen visualizer" ) -- | 2 instances of ncmpcpp
, ( "scrots" , spawnShell >> pictureSelect >> spawn "urxvt --hold -e alsi" )
]
}
------------------------------------------------------------------------------------
------ Functions on workspaces (topics)
------------------------------------------------------------------------------------
goto :: WorkspaceId -> X ()
goto = switchTopic myTopicConfig
shift :: WorkspaceId -> X()
shift = windows . W.shift
spawnSublIn :: Dir -> X ()
spawnSublIn dir = spawn $ "subl -n -a " ++ dir
spawnSubl :: X ()
spawnSubl = currentTopicDir myTopicConfig >>= spawnSublIn
spawnFileIn :: Dir -> X ()
spawnFileIn dir = spawn $ "pcmanfm " ++ dir
spawnFile :: X ()
spawnFile = currentTopicDir myTopicConfig >>= spawnFileIn
spawnShellIn :: Dir -> X ()
spawnShellIn dir = spawn $ "urxvt -cd " ++ dir
spawnShell :: X ()
spawnShell = currentTopicDir myTopicConfig >>= spawnShellIn
promptedGoto :: X ()
promptedGoto = workspacePrompt myXPConfig goto
promptedShift :: X ()
promptedShift = workspacePrompt myXPConfig $ shift
createGoto :: WorkspaceId -> X ()
createGoto w = newWorkspace w >> switchTopic myTopicConfig w
createOrGoto :: WorkspaceId -> X ()
createOrGoto w = do
exists <- workspaceExist w
if (not exists)
then
createGoto w
else
goto w
newWorkspace :: WorkspaceId -> X ()
newWorkspace w = do
exists <- workspaceExist w
if (not exists)
then
addHiddenWorkspace w
else
return ()
workspaceExist :: WorkspaceId -> X Bool
workspaceExist w = do xs <- get
return $ workspaceExists w ( windowset xs )
workspaceExists :: WorkspaceId -> W.StackSet WorkspaceId l a s sd -> Bool
workspaceExists w ws = w `elem` map W.tag (W.workspaces ws)
|
x
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | module Utils
( videoSelect
, pdfSelect
, pictureSelect
, restartXMonad
, roleName ) where
import XMonad
import XMonad.Actions.TopicSpace
import Config
videoSelect :: X ()
videoSelect = spawn "mplayer \"$(zenity --file-selection --title=\"Select a video\" --filename=$HOME/video/)\""
pdfSelect :: X ()
pdfSelect = spawn "llpp $(zenity --file-selection --title=\"Select a pdf\" --filename=$HOME/doc/pdf/)"
pictureSelect :: X ()
pictureSelect = spawn "feh \"$(zenity --file-selection --title=\"Select a Picture\" --filename=$HOME/images/walls/)\""
roleName :: Query String
roleName = stringProperty "WM_WINDOW_ROLE"
restartXMonad :: X ()
restartXMonad = spawn "pkill dzen2; xmonad --recompile; xmonad --restart"
|
x
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | background no
short_units yes
out_to_console yes
out_to_x no
# Update interval in seconds
update_interval 5.0
TEXT
$if_mpd_playing^fg(\#252525)^r(1x16)^fg()^ca(1,/home/tyler/.xmonad/dzen/dzenMusic.sh) ^fg(\#385E6B)^i(/home/tyler/images/icons/8/note.xbm)^fg() ^fg(\#546A29)${mpd_artist}^fg() ^ca()\
^fg(\#ffffff)^ca(1,mpc prev)^i(/home/tyler/images/icons/8/prev.xbm)^ca() ${exec /home/tyler/.xmonad/dzen/playPause.sh} ^ca(1,mpc next)^i(/home/tyler/images/icons/8/next.xbm)^ca()^fg() ^fg(\#252525)^r(1x16)^fg()$endif \
^fg(\#385E6B)^i(/home/tyler/images/icons/8/spkr_01.xbm)^fg() ${exec pamixer --get-volume}% ^fg(\#252525)^r(1x16)^fg() \
^ca(1,/home/tyler/.xmonad/dzen/dzenNetwork.sh)^fg(\#385E6B)^i(/home/tyler/images/icons/8/net_wired.xbm)^fg() ${addr enp2s0} ^fg(\#252525)^r(1x16)^fg()^ca() \
^ca(1,/home/tyler/.xmonad/dzen/dzenHardware.sh)^fg(\#385E6B)^i(/home/tyler/images/icons/8/arch_10x10.xbm)^fg() ${exec uname -r} ^fg(\#252525)^r(1x16)^fg()^ca() \
^ca(1,/home/tyler/.xmonad/dzen/dzenPacman.sh)^fg(\#385E6B)^i(/home/tyler/images/icons/8/pacman.xbm)^fg() ${exec pacman -Qu | wc -l} updates ^fg(\#252525)^r(1x16)^fg()^ca() \
^ca(1,/home/tyler/.xmonad/dzen/dzenCal.sh)^fg(\#385E6B)^i(/home/tyler/images/icons/8/calendar.xbm)^fg() ${exec date +"%a %b %d %Y"} ^fg(\#252525)^r(1x16)^fg()^ca() \
^fg(\#385E6B)^i(/home/tyler/images/icons/8/clock.xbm)^fg() ${exec date +"%I:%M %p"} ^fg(\#252525)^r(1x16)^fg() \
^ca(1,/home/tyler/.xmonad/dzen/dzenLog.sh)^fg(\#385E6B)^i(/home/tyler/images/icons/8/info_02.xbm)^fg() ^ca()^fg(\#252525)^r(1x16)^fg()
|
x
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | background no
short_units yes
out_to_console yes
out_to_x no
# Update interval in seconds
update_interval 1.0
TEXT
$if_mpd_playing\
Artist ^fg(\#FFFFFF)${mpd_artist}^fg()
Album ^fg(\#FFFFFF)${mpd_album}^fg()
Track ^fg(\#FFFFFF)${mpd_title}^fg()
${exec /home/tyler/.xmonad/dzen/dzenBar.sh}
$endif
|
x
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | #!/bin/bash
background="#151515"
#foreground="#ffffff"
foreground="#C6A57B"
black0="#343638"
black1="#404040"
red0="#2f468e"
red1="#7791e0"
green0="#424242"
green1="#828a8c"
yellow0="#6b8ba3"
yellow1="#8ebdde"
blue0="#1c4582"
blue1="#5365a6"
magenta0="#74636d"
magenta1="#927d9e"
cyan0="#556c85"
cyan1="#6e98b8"
white0="#b2b2b2"
white1="#bdbdbd"
#XPOS=$(xdotool getmouselocation | awk -F " " '{print $1}' | cut -d ":" -f 2)
YPOS="2"
HEIGHT="16"
FONT="-*-bitocra13-*-*-*-*-*-*-*-*-*-*-*-*"
highlight="#FFFFFF"
|
x
1 2 3 4 5 6 7 8 | #!/bin/bash
times=$(mpc | sed -n 2p | awk '{print $3}' | sed 's|/| |g')
percent=$(mpc | sed -n 2p | awk '{print $4}' | sed -e 's|(||g' -e 's|)||g' -e 's|\%||g')
remaining=$(echo $times | awk '{print $1}')
total=$(echo $times | awk '{print $2}')
echo $percent | gdbar -w 150 -h 3 -min 0 -max 100 -l "$remaining " -nonl; echo " $total"
|
x
1 2 3 4 5 6 7 8 9 10 11 | #!/bin/zsh
(
month=$(date +%B)
year=$(date +%Y)
gcal --cc-holiday=US_NY | sed -e 's/</ ^bg(#546A29)^fg(#222222)/;s/>/ ^fg()^bg() /' \
-e 's/:/ ^bg(#385E6B)^fg(#222222)/;s/:/ ^fg()^bg()/' \
-e 's/Su Mo Tu We Th Fr Sa/^fg(#546A29)Su Mo Tu We Th Fr Sa^fg()/' \
-e "s/$(date +'%B %Y')/^fg(#385E6B)$(date +'%B %Y')^fg()/" \
) | dzen2 -p -l 8 -x 1700 -y 1 -w 132 -h 16 -fn 'bitocra' -e 'onstart=uncollapse,hide;button1=exit;button3=exit;'
|
x
1 2 3 4 5 6 7 8 9 10 11 12 | #!/bin/bash
source $(dirname $0)/config.sh
XPOS="1419"
WIDTH="500"
LINES="56"
date=$(date --rfc-3339=date)
dmesg=$(dmesg | tail -n25 | cut -b16-)
journal=$(journalctl --no-pager --since=$date | tail -n25)
(echo " ^fg($highlight)Logs"; echo "^fg($highlight)USER "; echo " "; echo "^fg()$dmesg"; echo " "; echo "^fg($highlight)SYSTEM "; echo " "; echo "$journal") | dzen2 -p -fg $foreground -bg $background -fn $FONT -x $XPOS -y $YPOS -w $WIDTH -l $LINES -e 'onstart=uncollapse,hide;button1=exit;button3=exit'
|
x
1 2 3 4 5 6 7 8 | #!/bin/bash
source $(dirname $0)/config.sh
XPOS="1085"
WIDTH="250"
LINES="3"
conky --config $HOME/.xmonad/dzen/mpdConkyrc \
| dzen2 -fn bitocra13 -x $XPOS -y 17 -w $WIDTH -h 16 -l $LINES -ta l -e 'onstart=uncollapse;button1=exit;button3=exit'
|
x
1 2 3 4 5 6 7 8 9 10 11 12 13 | #!/bin/bash
source $(dirname $0)/config.sh
XPOS="1383"
WIDTH="200"
LINES="6"
interface=$(ifconfig enp2s0 | sed -n 1p | awk '{print $1}' | sed 's|:||g')
mac=$(ifconfig enp2s0 | awk '/ether/ {print $2}')
inet=$(ifconfig enp2s0 | sed -n "2p" | awk -F " " '{print $2}')
netmask=$(ifconfig enp2s0 | sed -n "2p" | awk -F " " '{print $4}')
broadcast=$(ifconfig enp2s0 | sed -n "2p" | awk -F " " '{print $6}')
(echo ""; echo " Interface: ^fg($highlight)enp2s0"; echo " IP: ^fg($highlight)$inet"; echo " Netmask: ^fg($highlight)$netmask"; echo " Broadcast: ^fg($highlight)$broadcast"; echo " MAC: ^fg($highlight)$mac";) | dzen2 -p -fg $foreground -bg $background -fn $FONT -x $XPOS -y $YPOS -w $WIDTH -l $LINES -e 'onstart=uncollapse,hide;button1=exit;button3=exit'
|
x
1 2 3 4 5 6 7 8 9 10 | #!/bin/bash
source $(dirname $0)/config.sh
XPOS="1605"
WIDTH="200"
pacmanlines=$(pacman -Qu | wc -l)
LINES=$(( $pacmanlines + 2 ))
updates=$(pacman -Qu)
(echo "^fg($white)Updates"; echo "$updates"; echo " "; echo "^fg($white)Click to exit") | dzen2 -p -fg $foreground -bg $background -fn $FONT -x $XPOS -y $YPOS -w $WIDTH -l $LINES -e 'onstart=uncollapse,hide;button1=exit;button3=exit'
|
x
1 2 3 4 5 6 7 8 9 10 11 | #!/bin/bash
playing="$(mpc status | awk 'NR==2 {print $1}' | sed -e 's|\[||' -e 's|\]||')"
if [ "$playing" == "playing" ]; then
icon=$(echo "^ca(1,mpc toggle)^i(/home/tyler/images/icons/8/pause.xbm)^ca()")
echo $icon
else
icon=$(echo "^ca(1,mpc toggle)^i(/home/tyler/images/icons/8/play.xbm)^ca()")
echo $icon
fi
|
x
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | #!/bin/bash
source $(dirname $0)/config.sh
XPOS="1490"
WIDTH="350"
LINES="27"
cputemp=$(sensors | grep "temp1" | cut -d'+' -f2 | head -c2)F
cpuutiluser=$(iostat -c | sed -n "4p" | awk -F " " '{print $1}')
cpuutilsystem=$(iostat -c | sed -n "4p" | awk -F " " '{print $3}')
cpuutilidle=$(iostat -c | sed -n "4p" | awk -F " " '{print $6}')
ramtotal=$(free -m | sed -n "2p" | awk -F " " '{print $2}')
ramused=$(free -m | sed -n "2p" | awk -F " " '{print $3}')
hostname=$(uname -n)
uptime=$(uptime | sed -n "1p" | awk -F "," '{print $1}')
kernel=$(uname -r)
packages=$(pacman -Q | wc -l)
hdd1=$(df -h | grep "/dev/sd" | sed -n "1p")
hdd2=$(df -h | grep "/dev/sd" | sed -n "2p")
hdd3=$(df -h | grep "/dev/sd" | sed -n "3p")
hddtitle=$(df -h | head -1)
hddtotal=$(df -h --total | tail -1)
toptitle=$(top -bn1 | grep PID | cut -b1-5,42-)
top=$(top -bn1 | tail -n+8 | sort -k9nr -k10nr | cut -b1-5,42- | grep -v "chromium" | head -n8)
(echo " ^fg($highlight)System"; echo " Temp: ^fg($highlight)$cputemp"; echo " CPU User : ^fg($highlight)$cpuutiluser %"; echo " CPU System : ^fg($highlight)$cpuutilsystem %"; echo " Idle: ^fg($highlight)$cpuutilidle %"; echo " RAM: ^fg($highlight)$ramused MB / $ramtotal MB"; echo " "; echo " Hostname: ^fg($highlight)$hostname"; echo " Uptime: ^fg($highlight)$uptime"; echo " Kernel: ^fg($highlight)$kernel"; echo " Packages: ^fg($highlight)$packages"; echo " "; echo "^fg($highlight)$toptitle"; echo "$top"; echo " ";echo " ^fg($highlight)$hddtitle"; echo " $hdd1"; echo " $hdd2"; echo " $hdd3"; echo " $hddtotal") | dzen2 -p -fg $foreground -bg $background -fn $FONT -x $XPOS -y $YPOS -w $WIDTH -l $LINES -e 'onstart=uncollapse,hide;button1=exit;button3=exit'
|
x