Created
April 18, 2016 23:30
-
-
Save socksy/8ab26a6e869381d6ec3f5369cb07fbe7 to your computer and use it in GitHub Desktop.
xmonad stuff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
background yes | |
out_to_console yes | |
out_to_x no | |
# Update interval in seconds | |
update_interval 1 | |
user_spacer left | |
pad_percents 2 | |
lua_load ~/.xmonad/.conky_lua_scripts.lua | |
TEXT | |
^fg(\#ffee55) ^i(/home/ben/.xmonad/dzen2/clouds.xbm) ^fg(\#828a8c)${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ EDDT 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) ^ca(3,/home/ben/bin/dzen/clock.sh)^i(/home/ben/.xmonad/dzen2/clock24.xbm)^ca() ^fg(\#cdcdcd)${time %a %d %b %T %Z} \ | |
#^fg(\#ffee55) ^i(/home/ben/.xmonad/dzen2/arch_10x10.xbm) ^fg(\#828a8c)${exec uname -r} ^ca() \ | |
#^fg(\#ebac54) ${if_existing /proc/net/route wlp3s0} ^i(/home/ben/.xmonad/dzen2/net_wired.xbm) ${endif} ^fg(\#00aa4a) ^i(/home/ben/.xmonad/dzen2/net_down_03.xbm)${lua_parse pad %3.0f ${downspeed wlp3s0}} ^fg(\#ff3333) ^i(/home/ben/.xmonad/dzen2/net_up_03.xbm)${lua_parse pad ${upspeed wlp3s0}} ^i(/home/ben/.xmonad/dzen2/cpu.xbm) ^fg(\#FFFFFF)${lua_parse pad ${cpu}}% ^i(\#FFFFFF)${battery_percent} ^i(/home/ben/.xmonad/dzen2/mem.xbm) ^fg(\#FFFFFF)${memperc} %^fg(\#ebac54) ^i(/home/ben/.xmonad/dzen2/volume.xbm) ^fg(\#00ffff)${exec amixer get Master | egrep -o "[0-9]+%" | head -1 | egrep -o "[0-9]*"}% ^fg(\#ebac54) ^i(/home/ben/.xmonad/dzen2/clock.xbm) ^fg(\#FFFFFF) ${time %d %m %Y} ^fg(\#ebac54) ${time %T} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import XMonad | |
import System.Exit | |
import XMonad.Hooks.EwmhDesktops | |
import Data.List | |
import XMonad.Actions.WorkspaceNames | |
import XMonad.Actions.SpawnOn | |
import XMonad.Prompt | |
import XMonad.Prompt.Window | |
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.Layout.BinarySpacePartition | |
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 | |
altMask = mod1Mask | |
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) | |
-- find a window | |
, ((modm , xK_f ), windowPromptGoto defaultXPConfig {font = "xft:Dejavu Sans:size=8:antialias=true", height = fromIntegral 50, searchPredicate = isInfixOf, autoComplete = Just 100000}) | |
-- 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))) | |
-- keybindings to move around BSP | |
, ((modm .|. altMask, xK_l ), sendMessage $ ExpandTowards R) | |
, ((modm .|. altMask, xK_h ), sendMessage $ ExpandTowards L) | |
, ((modm .|. altMask, xK_j ), sendMessage $ ExpandTowards D) | |
, ((modm .|. altMask, xK_k ), sendMessage $ ExpandTowards U) | |
, ((modm .|. altMask .|. controlMask , xK_l ), sendMessage $ ShrinkFrom R) | |
, ((modm .|. altMask .|. controlMask , xK_h ), sendMessage $ ShrinkFrom L) | |
, ((modm .|. altMask .|. controlMask , xK_j ), sendMessage $ ShrinkFrom D) | |
, ((modm .|. altMask .|. controlMask , xK_k ), sendMessage $ ShrinkFrom U) | |
, ((modm .|. altMask, xK_r ), sendMessage Rotate) | |
, ((modm, xK_s ), sendMessage Swap) | |
-- 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] | |
myWorkspaceNames = ["1", "irc", "3", "focus", "5", "6", "7", "8", "9", "0", "-", "hide"] | |
myWorkspaces = clickable . (map dzenEscape) $ myWorkspaceNames | |
where | |
clickable l = [ "^ca(1,xdotool key super+" ++ k ++ ")" ++ ws ++ "^ca()" | (k,ws) <- zip wsKeys l ] | |
wsKeys = (map show [1..9]) ++ ["0", "minus", "equal"] | |
myNormalBorderColour = "#dddddd" | |
myFocusedBorderColour = "#ff0000" | |
myFocusFollowsMouse :: Bool | |
myFocusFollowsMouse = True | |
myLayout = tiled ||| Mirror tiled ||| spiral(6/7) ||| emptyBSP ||| 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 "#1B1D1E" "#ebac54" . pad) | |
, ppVisible = (dzenColor "#1B1D1E" "white" . 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) | |
, className =? "Xfce4-notifyd" --> doIgnore | |
] | |
main = do | |
dzenBar <- spawnPipe "dzen2 -h 24 -ta l -w 1460 -bg '#1B1D1E' -e 'button2=;' -fn \"xft:Dejavu Sans:size=8\"" | |
dzenBar2 <- spawnPipe "conky -c /home/ben/.xmonad/.conky_dzen | dzen2 -h 24 -ta r -xs 1 -x -1100 -y 0 -w 1100 -bg '#1B1D1E' -e 'button2=;' -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