Skip to content

Instantly share code, notes, and snippets.

@socksy
Created November 15, 2015 10:48
Show Gist options
  • Save socksy/ac074cc4670d2de5c5c6 to your computer and use it in GitHub Desktop.
Save socksy/ac074cc4670d2de5c5c6 to your computer and use it in GitHub Desktop.
background yes
out_to_console yes
out_to_x no
# Update interval in seconds
update_interval 1
user_spacer left
pad_percents 2
TEXT
^fg(\#ffee55) ^i(/home/ben/.xmonad/dzen2/clouds.xbm) ^fg(\#828a8c)${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ EDDI temperature}°\
^fg(\#ffee55) ^i(/home/ben/.xmonad/dzen2/mem.xbm) ^fg(\#828a8c)${memperc}%\
^fg(\#ffee55) ^i(/home/ben/.xmonad/dzen2/wifi_02.xbm) ^fg(\#828a8c)${wireless_essid wlp3s0} \
^fg(\#ffee55) ^i(/home/ben/.xmonad/dzen2/battery.xbm) ^fg(\#828a8c)${battery} \
^fg(\#ffee55) ^i(/home/ben/.xmonad/dzen2/clock24.xbm) ^fg(\#cdcdcd)${time %T}
Xft.dpi: 220
Xft.autohint: 0
Xft.rgba: rgb
Xft.antialias: 1
Xft.lcdfilter: lcddefault
Xft.hintstyle: hintfull
Xft.hinting: 1
import XMonad
import System.Exit
import XMonad.Hooks.EwmhDesktops
import XMonad.Actions.WorkspaceNames
import XMonad.Actions.SpawnOn
import XMonad.Prompt
import qualified XMonad.StackSet as W
import qualified Data.Map as M
import XMonad.Layout.Spiral
import XMonad.Layout.NoBorders
import XMonad.Layout.ResizableTile
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.UrgencyHook
import XMonad.Hooks.DynamicLog
import XMonad.Util.Run
import XMonad.Util.NamedWindows
myTerminal = "xfce4-terminal"
myBorderWidth = 1
myModMask = mod4Mask
myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
-- launch a terminal
[ ((modm .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf)
-- launch dmenu
, ((modm, xK_p ), spawn "$(yeganesh -x -- -fn \"xft:Dejavu Sans:size=8:antialias=true\")")
-- launch gmrun
, ((modm .|. shiftMask, xK_p ), spawn "gmrun")
-- close focused window
, ((modm .|. shiftMask, xK_c ), kill)
-- rename current workspace
, ((modm .|. shiftMask, xK_r ), refresh)
-- Rotate through the available layout algorithms
, ((modm, xK_space ), sendMessage NextLayout)
-- Reset the layouts on the current workspace to default
, ((modm .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf)
--, ((modm, xK_n ), spawn "cat '12 3' > ~/.pomodoro_session")
-- Move focus to the next window
, ((modm, xK_Tab ), windows W.focusDown)
--Move focus back to previous window
, ((modm .|. shiftMask, xK_Tab ), windows W.focusUp)
-- Move focus to the next window
, ((modm, xK_j ), windows W.focusDown)
-- Move focus to the previous window
, ((modm, xK_k ), windows W.focusUp )
-- Move focus to the master window
, ((modm, xK_m ), windows W.focusMaster )
-- Swap the focused window and the master window
, ((modm, xK_Return), windows W.swapMaster)
-- Swap the focused window with the next window
, ((modm .|. shiftMask, xK_j ), windows W.swapDown )
-- Swap the focused window with the previous window
, ((modm .|. shiftMask, xK_k ), windows W.swapUp )
-- Shrink the master area
, ((modm, xK_h ), sendMessage Shrink)
-- Expand the master area
, ((modm, xK_l ), sendMessage Expand)
-- Push window back into tiling
, ((modm, xK_t ), withFocused $ windows . W.sink)
-- Increment the number of windows in the master area
, ((modm , xK_comma ), sendMessage (IncMasterN 1))
-- Deincrement the number of windows in the master area
, ((modm , xK_period), sendMessage (IncMasterN (-1)))
-- Toggle the status bar gap
-- Use this binding with avoidStruts from Hooks.ManageDocks.
-- See also the statusBar function from Hooks.DynamicLog.
--
, ((modm , xK_b ), sendMessage ToggleStruts)
-- Quit xmonad
, ((modm .|. shiftMask, xK_q ), io (exitWith ExitSuccess))
-- Restart xmonad
, ((modm , xK_q ), spawn "killall dzen2 && xmonad --recompile; xmonad --restart")
]
++
--
-- mod-[1..9], Switch to workspace N
-- mod-shift-[1..9], Move client to workspace N
--
[((m .|. modm, k), windows $ f i)
| (i, k) <- zip (XMonad.workspaces conf) ([xK_1 .. xK_9] ++ [xK_0, xK_minus, xK_equal])
, (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
++
--
-- mod-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3
-- mod-shift-{w,e,r}, Move client to screen 1, 2, or 3
--
[((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f))
| (key, sc) <- zip [xK_w, xK_e, xK_r] [0..]
, (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
data LibNotifyUrgencyHook = LibNotifyUrgencyHook deriving (Read, Show) --no idea why i have this
instance UrgencyHook LibNotifyUrgencyHook where
urgencyHook LibNotifyUrgencyHook w = do
name <- getName w
Just idx <- fmap (W.findTag w) $ gets windowset
safeSpawn "notify-send" [show name, "workspace " ++ idx]
myWorkspaces = ["1", "irc", "3", "focus", "5", "6", "7", "8", "9", "0", "-", "hide"]
myNormalBorderColour = "#dddddd"
myFocusedBorderColour = "#ff0000"
myFocusFollowsMouse :: Bool
myFocusFollowsMouse = True
myLayout = tiled ||| Mirror tiled ||| spiral(6/7) ||| Full
where
tiled = ResizableTall nmaster delta ratio []
nmaster = 1
delta = (3/100)
ratio = (9/15)
-- myLogHook = workspaceNamesPP xmobarPP >>= dynamicLogString >>= xmonadPropLog
myLogHook h = dynamicLogWithPP $ defaultPP
{
ppCurrent = (dzenColor "#ebac54" "#1B1D1E" . pad)
, ppVisible = (dzenColor "white" "#1B1D1E" . pad)
, ppHidden = (dzenColor "white" "#1B1D1E" . pad)
, ppHiddenNoWindows = (dzenColor "#7b7b7b" "#1B1D1E" . pad)
, ppUrgent = (dzenColor "#ff0000" "#1B1D1E" . pad)
, ppWsSep = " "
, ppSep = " | "
, ppLayout = (dzenColor "#ebac54" "#1B1D1E" . pad)
, ppTitle = ((" " ++) . dzenColor "white" "#1B1D1E" . dzenEscape)
, ppOutput = hPutStrLn h
}
myManageHooks = composeAll
[ isFullscreen --> (doF W.focusDown <+> doFullFloat)
]
main = do
dzenBar <- spawnPipe "dzen2 -h 24 -ta l -w 1600 -fn \"xft:Dejavu Sans:size=8\""
dzenBar2 <- spawnPipe "conky -c /home/ben/.xmonad/.conky_dzen | dzen2 -h 24 -ta r -xs 1 -x -1000 -y 0 -w 1000 -fn \"xft:Dejavu Sans:size=8\""
xmonad (withUrgencyHook LibNotifyUrgencyHook (defaultConfig {
terminal = myTerminal
,focusFollowsMouse = myFocusFollowsMouse
,borderWidth = myBorderWidth
,modMask = myModMask
,keys = myKeys
,workspaces = myWorkspaces
,normalBorderColor = myNormalBorderColour
,focusedBorderColor = myFocusedBorderColour
,handleEventHook = fullscreenEventHook
,logHook = myLogHook dzenBar
,manageHook = myManageHooks
-- ,startupHook = myStartupHook
,layoutHook = avoidStruts $ smartBorders $ myLayout
}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment