Skip to content

Instantly share code, notes, and snippets.

@gilbertw1
Created March 7, 2017 15:34
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save gilbertw1/f2147eb4ab08918a727a0d0406146436 to your computer and use it in GitHub Desktop.
Save gilbertw1/f2147eb4ab08918a727a0d0406146436 to your computer and use it in GitHub Desktop.
xmonad gruvbox dots
! -----------------------------------------------------------------------------
! File: gruvbox-dark.xresources
! Description: Retro groove colorscheme generalized
! Author: morhetz <morhetz@gmail.com>
! Source: https://github.com/morhetz/gruvbox-generalized
! Last Modified: 6 Sep 2014
! -----------------------------------------------------------------------------
! hard contrast: *background: #1d2021
!*background: #1d2021
*background: #282828
! soft contrast: *background: #32302f
*foreground: #ebdbb2
! Black + DarkGrey
*color0: #282828
*color8: #928374
! DarkRed + Red
*color1: #cc241d
*color9: #fb4934
! DarkGreen + Green
*color2: #98971a
*color10: #b8bb26
! DarkYellow + Yellow
*color3: #d79921
*color11: #fabd2f
! DarkBlue + Blue
*color4: #458588
*color12: #83a598
! DarkMagenta + Magenta
*color5: #b16286
*color13: #d3869b
! DarkCyan + Cyan
*color6: #689d6a
*color14: #8ec07c
! LightGrey + White
*color7: #a89984
*color15: #ebdbb2
# Tmux settings
# Set prefix to Ctrl-Space
#unbind C-b
#set -g prefix C-Space
#bind Space send-prefix
bind b send-prefix
# Set XTerm key bindings
setw -g xterm-keys on
# Set colors
set-option -g default-terminal "screen-256color"
# Remove key timeout
set -s escape-time 0
# Set reload key to r
bind r source-file ~/.tmux.conf
# Count sessions start at 1
set -g base-index 1
# Use vim bindings
setw -g mode-keys vi
# Remap window navigation to vim
unbind-key j
unbind-key k
unbind-key h
unbind-key l
bind-key j select-pane -D
bind-key k select-pane -U
bind-key h select-pane -L
bind-key l select-pane -R
# Resize window vim keybindings
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r H resize-pane -L 5
bind -r L resize-pane -R 5
# Vim copy mode keybindings
bind P paste-buffer
bind-key -t vi-copy 'v' begin-selection
#bind-key -t vi-copy 'y' copy-selection
bind-key -t vi-copy 'r' rectangle-toggle
# Remap split window to emacs style
unbind-key -
bind-key - split-window -v
bind-key / split-window -h
# C-SPACE-SPACE -> last window
bind C-Space last-window
# Evaluate tmux yank plugin
run-shell ~/.tmux-plugins/tmux-yank/yank.tmux
# ================================================
# Theme
# ================================================
# This tmux statusbar config was created based on gruvbox colorscheme
# status bar
set -g status "on"
set -g status-attr "none"
set -g status-justify "left"
set -g status-bg "colour237"
# status left
set -g status-left-attr "none"
set -g status-left-length "100"
set -g status-left "#[fg=colour237,bg=colour7,bold] #S #[fg=colour7,bg=colour237,nobold,nounderscore,noitalics]"
# status right
set -g status-right-attr "none"
set -g status-right-length "100"
set -g status-right "#[fg=colour12]#{?client_prefix,#[reverse]Command#[noreverse] ,} #[fg=colour238,bg=colour237,nobold,nounderscore,noitalics]#[fg=colour7,bg=colour238] %Y-%m-%d  %H:%M #[fg=colour7,bg=colour238,nobold,nounderscore,noitalics]#[fg=colour237,bg=colour7] #h "
# window
setw -g window-status-attr "none"
setw -g window-status-separator ""
setw -g window-status-format "#[fg=colour7,bg=colour237] #I #[fg=colour7,bg=colour237] #W "
# active window
setw -g window-status-activity-attr "none"
setw -g window-status-current-format "#[fg=colour237,bg=colour3,nobold,nounderscore,noitalics]#[fg=colour237,bg=colour3] #I #[fg=colour237,bg=colour3] #W #[fg=colour3,bg=colour237,nobold,nounderscore,noitalics]"
# panes
set -g pane-active-border-fg "colour248"
set -g pane-border-fg "colour238"
# command bar
set -g message-command-fg "colour237"
set -g message-command-bg "colour248"
set -g message-fg "colour237"
set -g message-bg "colour248"
Config {
font = "xft:MesloLGM:size=9.5:bold:antialias=true"
, bgColor = "#282828"
, fgColor = "#ebdbb2"
, position = TopW L 94
, alpha = 150
, commands = [ Run Cpu ["-t", "<fc=#83a598><icon=/home/gilbertw1/.xmonad/icons/cpu.xbm/></fc> <total>%", "-L","3","-H","50","-l","#ebdbb2","-n","#ebdbb2","-h","#fb4934"] 10
, Run Memory ["-t","<fc=#458588><icon=/home/gilbertw1/.xmonad/icons/mem.xbm/></fc> <usedratio>%","-H","80","-L","10","-l","#ebdbb2","-n","#ebdbb2","-h","#fb4934"] 10
, Run Date "%a %b %_d %k:%M" "date" 10
, Run DynNetwork ["-t","<fc=#8ec07c><icon=/home/gilbertw1/.xmonad/icons/arrow_down.xbm/></fc> <rx>, <fc=#d3869b><icon=/home/gilbertw1/.xmonad/icons/arrow_up.xbm/></fc> <tx>","-H","200","-L","10","-h","#ebdbb2","-l","#ebdbb2","-n","#ebdbb2"] 10
, Run CoreTemp ["-t", "<fc=#fabd2f><icon=/home/gilbertw1/.xmonad/icons/temp.xbm/></fc> <core0>°", "-L", "30", "-H", "75", "-l", "lightblue", "-n", "#ebdbb2", "-h", "#aa4450"] 50
, Run Com "network-check.sh" [] "netcheck" 5
-- battery monitor
, Run BatteryP [ "BAT0" ]
[ "--template" , "<fc=#b8bb26><icon=/home/gilbertw1/.xmonad/icons/battery.xbm/></fc> <acstatus>"
, "--Low" , "10" -- units: %
, "--High" , "80" -- units: %
, "--low" , "#fb4934" -- #ff5555
, "--normal" , "#ebdbb2"
, "--high" , "#98be65"
, "--" -- battery specific options
-- discharging status
, "-o" , "<left>% (<timeleft>)"
-- AC "on" status
, "-O" , "<left>% (<fc=#98be65>Charging</fc>)" -- 50fa7b
-- charged status
, "-i" , "<fc=#98be65>Charged</fc>"
] 50
, Run StdinReader
]
, sepChar = "%"
, alignSep = "}{"
, template = "%StdinReader% }{ %cpu% | %coretemp% | %memory% | %battery% | %dynnetwork% (%netcheck%) | <fc=#fabd2f>%date%</fc>" -- #69DFFA
}
import System.Exit
import Data.Maybe (Maybe, isNothing, fromJust)
import qualified Data.List as L
import qualified Data.Map as M
import GHC.IO.Handle
-- Xmonad Core
import XMonad
import qualified XMonad.StackSet as W
import XMonad.Config.Desktop
-- Layouts
import XMonad.Layout.LayoutModifier
import XMonad.Layout.Gaps
import XMonad.Layout.Spacing
import XMonad.Layout.MultiToggle
import XMonad.Layout.NoBorders
import XMonad.Layout.MultiToggle.Instances
import XMonad.Layout.ResizableTile
import XMonad.Layout.BinarySpacePartition
import XMonad.Layout.SimpleFloat
import XMonad.Layout.PerWorkspace (onWorkspace)
import XMonad.Layout.Minimize
-- Actions
import XMonad.Actions.Navigation2D
import XMonad.Actions.GridSelect
import XMonad.Actions.UpdatePointer
import XMonad.Actions.SpawnOn
import XMonad.Actions.CycleWS
-- Hooks
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.SetWMName
import XMonad.Hooks.EwmhDesktops
import XMonad.Hooks.ManageDocks
-- Utils
import XMonad.Util.NamedScratchpad
import XMonad.Util.WorkspaceCompare
import XMonad.Util.Run
import XMonad.Util.EZConfig
-- Xmonad entry point
main = do
xmproc <- spawnPipe "/usr/bin/xmobar"
xmonad $ myConfig xmproc
-- Config
myConfig xmproc = withNavigation2DConfig def {
defaultTiledNavigation = centerNavigation
} $ def {
-- simple stuff
terminal = myTerminal,
focusFollowsMouse = myFocusFollowsMouse,
clickJustFocuses = myClickJustFocuses,
borderWidth = myBorderWidth,
modMask = myModMask,
workspaces = myWorkspaces,
normalBorderColor = myNormalBorderColor,
focusedBorderColor = myFocusedBorderColor,
-- key bindings
keys = myKeys,
mouseBindings = myMouseBindings,
-- hooks, layouts
layoutHook = myLayout,
manageHook = myManageHook <+> manageHook desktopConfig,
handleEventHook = myEventHook <+> handleEventHook desktopConfig,
logHook = (myLogHook xmproc) <+> logHook desktopConfig,
startupHook = myStartupHook
} `additionalKeysP` addKeys
-- Log Hook Definition: Custom Xmobar Output + Update Pointer Hook
myLogHook :: Handle -> X ()
myLogHook xmproc = dynamicLogWithPP xmobarPP
{ ppOutput = hPutStrLn xmproc
, ppCurrent = xmobarColor "#83a598" "" . wrap "[" "]" -- #9BC1B2 #69DFFA
, ppTitle = xmobarColor "#d3869b" "" . shorten 50 -- #9BC1B2 #69DFFA
, ppSort = fmap (.namedScratchpadFilterOutWorkspace) getSortByTag
, ppLayout = xmobarColor "#fabd2f" "" . myIcons
} >> updatePointer (0.75, 0.75) (0.75, 0.75)
-- Use termite as terminal
myTerminal = "termite"
-- Window focus follows mouse
myFocusFollowsMouse = True
-- Clicking on widow focuses and passes the click forward
myClickJustFocuses = False
-- Width of the window border in pixels.
myBorderWidth = 4
-- Defines with mod key to use (mod4mask == super)
myModMask = mod4Mask
-- Define and name each workspace
myWorkspaces = ["1: TERM","2: WEB","3: CODE","4: COMM","5: MAIL","6: MEDIA","7: ETC"] ++ map show [8..8] ++ ["NSP"]
-- Set border color when unfocused
myNormalBorderColor = "#474646"
-- Set norder color when focused
myFocusedBorderColor = "#83a598"
-- Scratch Pads
myScratchpads = [NS "zeal" "zeal" (className =? "Zeal") (customFloating $ W.RationalRect (1/6) (1/6) (2/3) (2/3)),
NS "telegram" "telegram-desktop" ((className =? "Telegram") <||> (className =? "telegram-desktop") <||> (className =? "TelegramDesktop")) (customFloating $ W.RationalRect (1/6) (1/6) (2/3) (2/3)),
NS "termscratch" "termite --class=termscratch -e ~/bin/tmux-stream-dev.sh" (className =? "termscratch") (customFloating $ W.RationalRect (1/10) (1/10) (4/5) (4/5))]
-- Key bindings. Add, modify or remove key bindings here.
myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
-- launch a terminal
[ ((modm .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf)
-- launch thunar
, ((modm .|. shiftMask, xK_f ), spawn "thunar")
-- launch rofi
, ((modm, xK_p ), spawn "rofi -show run")
, ((modm .|. shiftMask, xK_p ), spawn "rofi -show window")
-- launch zeal
, ((modm, xK_z ), namedScratchpadAction myScratchpads "zeal")
-- launch telegram
, ((modm, xK_F10 ), namedScratchpadAction myScratchpads "telegram")
-- close focused window
, ((modm .|. shiftMask, xK_c ), kill)
-- Grid Select
, ((modm, xK_g ), goToSelected def)
-- 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)
-- Resize viewed windows to the correct size
, ((modm .|. shiftMask, xK_r ), refresh)
-- Move focus to the next window
, ((modm, xK_Tab ), windows W.focusDown)
-- Move focus to the next window
, ((modm .|. controlMask, xK_j ), windows W.focusDown)
-- Move focus to the previous window
, ((modm .|. controlMask, xK_k ), windows W.focusUp)
-- Minimize selected window
, ((modm, xK_m ), withFocused minimizeWindow)
-- Restore one minimized window
, ((modm .|. shiftMask, xK_m ), sendMessage RestoreNextMinimizedWin)
-- Maximize selected window
, ((modm, xK_f ), (sendMessage $ Toggle FULL))
-- Swap the focused window and the master window
, ((modm .|. controlMask, xK_Return), windows W.swapMaster)
-- Move focus to the master window
, ((modm, xK_Return ), windows W.focusMaster )
-- Swap the focused window with the next window
, ((modm .|. controlMask .|. shiftMask, xK_j ), windows W.swapDown )
-- Swap the focused window with the previous window
, ((modm .|. controlMask .|. shiftMask, xK_k ), windows W.swapUp )
-- Shrink the master area
, ((modm .|. controlMask, xK_h ), sendMessage Shrink)
, ((modm .|. controlMask .|. shiftMask, xK_h ), sendMessage MirrorShrink)
-- Expand the master area
, ((modm .|. controlMask, xK_l ), sendMessage Expand)
, ((modm .|. controlMask .|. shiftMask, xK_l ), sendMessage MirrorExpand)
-- Toggle Brightness
, ((modm, xK_minus ), spawn "light -U 5")
, ((modm, xK_equal ), spawn "light -A 5")
-- 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))
-- Decrement the number of windows in the master area
, ((modm , xK_period), sendMessage (IncMasterN (-1)))
-- Switch workspaces and screens
, ((modm, xK_Right), moveTo Next (WSIs hiddenNotNSP))
, ((modm, xK_Left), moveTo Prev (WSIs hiddenNotNSP))
, ((modm .|. shiftMask, xK_Right), shiftTo Next (WSIs hiddenNotNSP))
, ((modm .|. shiftMask, xK_Left), shiftTo Prev (WSIs hiddenNotNSP))
, ((modm, xK_Down), nextScreen)
, ((modm, xK_Up), prevScreen)
, ((modm .|. shiftMask, xK_Down), shiftNextScreen)
, ((modm .|. shiftMask, xK_Up), shiftPrevScreen)
-- Binary Space Partition Functions
, ((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 .|. shiftMask, xK_l ), sendMessage $ ShrinkFrom R)
, ((modm .|. altMask .|. shiftMask, xK_h ), sendMessage $ ShrinkFrom L)
, ((modm .|. altMask .|. shiftMask, xK_j ), sendMessage $ ShrinkFrom D)
, ((modm .|. altMask .|. shiftMask, xK_k ), sendMessage $ ShrinkFrom U)
, ((modm, xK_d ), sendMessage Rotate)
, ((modm, xK_s ), sendMessage Swap)
, ((modm, xK_n ), sendMessage FocusParent)
, ((modm .|. controlMask, xK_n ), sendMessage SelectNode)
, ((modm .|. shiftMask, xK_n ), sendMessage MoveNode)
-- Directional Navigation & Moving of Windows
, ((modm, xK_l), windowGo R False)
, ((modm, xK_h), windowGo L False)
, ((modm, xK_k), windowGo U False)
, ((modm, xK_j), windowGo D False)
, ((modm .|. shiftMask, xK_l), windowSwap R False)
, ((modm .|. shiftMask, xK_h), windowSwap L False)
, ((modm .|. shiftMask, xK_k), windowSwap U False)
, ((modm .|. shiftMask, xK_j), windowSwap D False)
-- Toggle the status bar gap
, ((modm , xK_b ), sendMessage ToggleStruts)
-- Quit xmonad
, ((modm .|. shiftMask, xK_q ), io (exitWith ExitSuccess))
-- Restart xmonad
, ((modm , xK_q ), spawn "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]
, (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)]]
-- Additional keybindings for media keys
addKeys = [ ("<XF86AudioLowerVolume>" ,spawn "pulseaudio-ctl down 10")
, ("<XF86AudioRaiseVolume>" ,spawn "pulseaudio-ctl up 10" )
, ("<XF86AudioMute>" ,spawn "pulseaudio-ctl mute" )
, ("<XF86MonBrightnessDown>" ,spawn "light -U 5" )
, ("<XF86MonBrightnessUp>" ,spawn "light -A 5" )
, ("<XF86AudioPlay>" ,spawn "play-pause-mpd.sh" )
, ("<XF86AudioMicMute>" ,spawn "play-pause-mpd.sh" )
, ("<XF86AudioPrev>" ,spawn "mpc prev" )
, ("<XF86AudioNext>" ,spawn "mpc next" )
, ("<XF86PowerOff>" ,spawn "lock.sh" )
, ("<F12>" ,namedScratchpadAction myScratchpads "termscratch")
]
-- Mouse bindings bound to mouse events
myMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList $
[ ((modm, button1), (\w -> focus w >> mouseMoveWindow w >> windows W.shiftMaster))
, ((modm, button2), (\w -> focus w >> windows W.shiftMaster))
, ((modm, button3), (\w -> focus w >> mouseResizeWindow w >> windows W.shiftMaster))
, ((modm .|. shiftMask, button1), (\w -> focus w >> mouseResizeWindow w >> windows W.shiftMaster))
]
-- Layout definitions & modifiers
myLayout = onWorkspace "6: MEDIA" simpleFloat $
desktopLayoutModifiers $
smartBorders $
minimize $
mkToggle (NOBORDERS ?? FULL ?? EOT) layouts
where
layouts = gaps [(U,5), (R,5), (L,5), (D,5)] $ spacing 5 (tiled ||| Mirror tiled ||| emptyBSP ||| Full)
-- tiled resiezable tall layout
tiled = ResizableTall nmaster delta ratio []
-- The default number of windows in the master pane
nmaster = 1
-- Default proportion of screen occupied by master pane
ratio = 1/2
-- Percent of screen to increment by when resizing panes
delta = 3/100
-- Defined icons for various layout types
myIcons layout
| is "Minimize Spacing 5 Mirror ResizableTall" = "<icon=/home/gilbertw1/.xmonad/icons/layout-mirror.xbm/>"
| is "Minimize Spacing 5 ResizableTall" = "<icon=/home/gilbertw1/.xmonad/icons/layout-tall.xbm/>"
| is "Minimize Spacing 5 BSP" = "<icon=/home/gilbertw1/.xmonad/icons/layout-bsp.xbm/>"
| is "Minimize Spacing 5 Full" = "<icon=/home/gilbertw1/.xmonad/icons/layout-full.xbm/>"
| is "Simple Float" = "<icon=/home/gilbertw1/.xmonad/icons/layout-float.xbm/>"
| otherwise = "<icon=/home/gilbertw1/.xmonad/icons/layout-gimp.xbm/>"
where is = (`L.isInfixOf` layout)
-- Manage hook defining various window rules
myManageHook = composeAll
[ className =? "MPlayer" --> doFloat
, resource =? "desktop_window" --> doIgnore
, resource =? "kdesktop" --> doIgnore
, className =? "Xfce4-notifyd" --> doIgnore
, className =? "Pavucontrol" --> doFloat
, className =? "Peek" --> doIgnore
, className =? "peek" --> doIgnore
, isDialog --> doFloat]
<+> (isFullscreen --> doFullFloat)
<+> (namedScratchpadManageHook myScratchpads)
<+> manageSpawn
-- EwmhDesktops users should change this to ewmhDesktopsEventHook
myEventHook = mempty
-- Startup hook, not doing anything
myStartupHook = do
setWMName "LG3D"
startupHook desktopConfig
-- Function that prevents cycling to workspaces available on other screens
hiddenNotNSP :: X (WindowSpace -> Bool)
hiddenNotNSP = do
hs <- gets $ map W.tag . W.hidden . windowset
return (\w -> (W.tag w) /= "NSP" && (W.tag w) `elem` hs)
-- Alias for left alt key modifier
altMask = mod1Mask
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment