Skip to content

Instantly share code, notes, and snippets.

@correl
Last active October 3, 2016 18:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save correl/2189a0821318a8f54a0d to your computer and use it in GitHub Desktop.
Save correl/2189a0821318a8f54a0d to your computer and use it in GitHub Desktop.
Xmonad Configuration
import System.Taffybar
import System.Taffybar.Systray
import System.Taffybar.TaffyPager
import System.Taffybar.SimpleClock
import System.Taffybar.Widgets.PollingGraph
import System.Taffybar.Widgets.PollingBar
import System.Taffybar.Weather
import System.Taffybar.FreedesktopNotifications
import System.Taffybar.Battery
import System.Information.CPU
import System.Information.Memory
cpuCallback = do
(_, systemLoad, totalLoad) <- cpuLoad
return [ totalLoad, systemLoad ]
memCallback = do
mi <- parseMeminfo
return $ memoryUsedRatio mi
colorMem v =
case v of
_ | v < 0.25 -> (0, 0, 1)
_ | v < 0.5 -> (0, 0.5, 1)
_ | v < 0.625-> (0, 1, 0.5)
_ | v < 0.75 -> (0, 1, 0)
_ | v < 0.8 -> (0.5, 1, 0)
_ | v < 0.9 -> (1, 1, 0)
_ | v < 0.95 -> (1, 0.5, 0)
_ -> (1, 0, 0)
main = do
let cpuCfg = defaultGraphConfig { graphDataColors = [ (0, 1, 0, 1), (1, 0, 1, 0.5)]
, graphLabel = Just "cpu"
}
memCfg = defaultBarConfig colorMem
weatherCfg = (defaultWeatherConfig "KLOM") { weatherTemplate = "$tempF$°F" }
clock = textClockNew Nothing "<span fgcolor='orange'>%a %b %_d %H:%M</span>" 1
log = taffyPagerNew defaultPagerConfig
tray = systrayNew
cpu = pollingGraphNew cpuCfg 0.5 cpuCallback
mem = pollingBarNew memCfg 1 memCallback
battery = batteryBarNew defaultBatteryConfig 10
weather = weatherNew weatherCfg 10
notifications = notifyAreaNew defaultNotificationConfig
defaultTaffybar defaultTaffybarConfig { startWidgets = [ log ]
, endWidgets = [ tray, weather, clock, mem, cpu, battery, notifications ]
}
{-# LANGUAGE OverloadedStrings #-}
import XMonad
import XMonad.Actions.CopyWindow
import XMonad.Layout.PerWorkspace
import XMonad.Layout.Spacing
import XMonad.Layout.NoBorders
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.SetWMName
import XMonad.Hooks.EwmhDesktops
import qualified XMonad.StackSet as W
import qualified Data.Map as M
import XMonad.Util.Run(spawnPipe)
import XMonad.Util.EZConfig(additionalKeys, additionalKeysP)
import System.IO
import XMonad.Actions.PhysicalScreens
import DBus.Client
import System.Taffybar.Hooks.PagerHints (pagerHints)
myManageHook = composeAll
[ resource =? "Do" --> doIgnore
, className =? "Gimp" --> doFloat
, className =? "Vncviewer" --> doFloat
, title =? "Magic Launcher" --> doFloat
, title =? "Ediff" --> doFloat
, title =? "Minecraft 1.7.10"--> doShift "9:minecraft"
, title =? "Minecraft 1.7.10"--> doFloat
, title =? "Yakuake" --> doFloat
]
myBorderWidth = 10
myWorkspaces = ["1:dev", "2:chat", "3:web", "4", "5", "6", "7", "8", "9:minecraft"]
defaultLayout = tiled ||| Mirror tiled ||| Full
where
tiled = spacing 5 $ Tall nmaster delta ratio
nmaster = 1
ratio = 3/5
delta = 5/100
mediaLayout = noBorders $ Full
myLayout = onWorkspace "9:minecraft" mediaLayout $ defaultLayout
main = do
client <- connectSession
xmonad $ ewmh $ pagerHints $ defaultConfig
{ manageHook = manageDocks <+> myManageHook -- make sure to include myManageHook definition from above
<+> manageHook defaultConfig
, handleEventHook = handleEventHook defaultConfig <+> fullscreenEventHook
, layoutHook = smartSpacing 15 $ avoidStruts $ layoutHook defaultConfig
, startupHook = setWMName "LG3D"
{-, modMask = mod4Mask -- Rebind Mod to the Windows key-}
{-, handleEventHook = fullScreenEventHook-}
, workspaces = myWorkspaces
, modMask = mod4Mask
, terminal = "terminator"
} `additionalKeys`
[((mod4Mask .|. mask, key), f sc)
| (key, sc) <- zip [xK_w, xK_e, xK_r] [0..]
, (f, mask) <- [(viewScreen, 0), (sendToScreen, shiftMask)]]
`additionalKeys`
[((controlMask, xK_Print), spawn "sleep 0.2; scrot -s")
, ((0, xK_Print), spawn "scrot")
, ((mod4Mask, xK_k), windows W.focusDown) -- %! Move focus to the next window
, ((mod4Mask, xK_j), windows W.focusUp ) -- %! Move focus to the previous window
, ((mod4Mask, xK_a), onPrevNeighbour W.view)
, ((mod4Mask, xK_o), onNextNeighbour W.view)
, ((mod4Mask .|. shiftMask, xK_a), onPrevNeighbour W.shift)
, ((mod4Mask .|. shiftMask, xK_o), onNextNeighbour W.shift)
, ((mod4Mask .|. shiftMask, xK_l ), spawn "slock")
, ((mod4Mask, xK_v ), windows copyToAll) -- @@ Make focused window always visible
, ((mod4Mask .|. shiftMask, xK_v ), killAllOtherCopies) -- @@ Toggle window state back
]
#!/bin/bash
xrdb -merge .Xresources
#trayer --edge top --align right --SetDockType true --SetPartialStrut true --expand true --width 15 --height 12 --transparent true --tint 0x000000 &
# trayer --edge top --align right --SetDockType true --SetPartialStrut true \
# --expand true --width 10 --transparent true --tint 0x191970 --height 12 &
taffybar&
gnome-screensaver&
gnome-settings-daemon&
if [ -x /usr/bin/gnome-power-manager ] ; then
sleep 1
gnome-power-manager&
fi
if [ -x /usr/bin/nm-applet ] ; then
nm-applet --sm-disable &
fi
kmix --keepvisibility
# ubuntuone-launch
# dropbox start
owncloud &
# if [ -x /usr/games/oneko ]; then
# oneko &
# fi
if [ -x shutter ]; then
shutter --min_at_startup &
fi
Disable tapping on the touchpad
if [ -x /usr/bin/synclient ]; then
synclient MaxTapTime=0
fi
if [ -x /usr/bin/xcompmgr ]; then
xcompmgr -c &
fi
if [ -x ~/.xsession ]; then
~/.xsession
fi
nitrogen --restore
exec xmonad
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment