Last active
March 20, 2017 09:15
-
-
Save ssh0/1540ca4be75be81893f1 to your computer and use it in GitHub Desktop.
xmonadとxmobarの設定 ref: http://qiita.com/ssh0/items/dedeebe249d0d6ba4975
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
spacing 18 $ ResizableTall 1 (3/100) (3/5) [] |
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
wsbar <- spawnPipe myWsBar | |
xmonad $ defaultConfig | |
{ | |
... | |
-- xmobar setting | |
, logHook = myLogHook wsbar | |
... | |
} |
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
myLogHook h = dynamicLogWithPP $ wsPP { ppOutput = hPutStrLn h } | |
myWsBar = "xmobar /home/ssh0/.xmonad/xmobarrc" | |
wsPP = xmobarPP { ppOrder = \(ws:l:t:_) -> [ws,t] | |
, ppCurrent = xmobarColor colorGreen colorNormalbg | |
, ppUrgent = xmobarColor colorWhite colorNormalbg | |
, ppVisible = xmobarColor colorWhite colorNormalbg | |
, ppHidden = xmobarColor colorWhite colorNormalbg | |
, ppHiddenNoWindows = xmobarColor colorGray colorNormalbg | |
, ppTitle = xmobarColor colorWhite colorNormalbg | |
, ppWsSep = "" | |
, ppSep = " ::: " | |
} |
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
-- -*- mode:haskell -*- | |
Config { font = "xft:TakaoPGothic-9:Bold" | |
, bgColor = "#1a1e1b" | |
, fgColor = "#676767" | |
, position = Top | |
, lowerOnStart = False | |
, commands = [ Run Network "wlan0" [ "-t" , " ⇩ <rx> : ⇧ <tx>" | |
, "-L" , "40" | |
, "-H" , "200" | |
, "--normal" , "#d3d7cf" | |
, "--high" , "#88b986" | |
] 10 | |
, Run MultiCpu [ "-t" , "<total0>.<total1>.<total2>.<total3>" | |
, "-L" , "40" | |
, "-H" , "85" | |
, "--normal" , "#d3d7cf" | |
, "--high" , "#c16666" | |
] 50 | |
, Run Memory [ "-t" , "<usedratio>%" | |
, "-L" , "40" | |
, "-H" , "90" | |
, "--normal" , "#d3d7cf" | |
, "--high" , "#c16666" | |
] 10 | |
, Run BatteryP ["CMB1"] | |
[ "-t" , "<acstatus>" | |
, "-L" , "20" | |
, "-H" , "80" | |
, "--low" , "#c16666" | |
, "--normal" , "#d3d7cf" | |
, "--" | |
, "-o" , "<left>% (<timeleft>)" | |
, "-O" , "Charging <left>%" | |
, "-i" , "<left>%" | |
] 50 | |
, Run Date "%a %m/%d %H:%M" "date" 10 | |
, Run StdinReader | |
] | |
, sepChar = "%" | |
, alignSep = "}{" | |
, template = " %StdinReader% }{≫%multicpu% ≫%memory% ≫%wlan0% ≫%battery% <fc=#c7a273>%date%</fc> " | |
} |
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 qualified Data.Map as M | |
import XMonad | |
import qualified XMonad.StackSet as W -- myManageHookShift | |
import Control.Monad (liftM2) -- myManageHookShift | |
import System.IO -- for xmobar | |
import XMonad.Actions.WindowGo | |
import XMonad.Actions.CycleWS | |
import XMonad.Hooks.DynamicLog -- for xmobar | |
import XMonad.Hooks.EwmhDesktops | |
import XMonad.Hooks.FadeWindows | |
import XMonad.Hooks.ManageDocks -- avoid xmobar area | |
import XMonad.Hooks.Place | |
import XMonad.Layout | |
import XMonad.Layout.DragPane -- see only two window | |
import XMonad.Layout.Gaps | |
import XMonad.Layout.IM | |
import XMonad.Layout.Magnifier -- this makes window bigger | |
import XMonad.Layout.MultiToggle | |
import XMonad.Layout.MultiToggle.Instances | |
import XMonad.Layout.Named | |
import XMonad.Layout.NoBorders -- In Full mode, border is no use | |
import XMonad.Layout.ResizableTile -- Resizable Horizontal border | |
import XMonad.Layout.Spacing -- this makes smart space around windows | |
import XMonad.Layout.Tabbed | |
import XMonad.Layout.ThreeColumns -- for many windows | |
import XMonad.Layout.ToggleLayouts -- Full window at any time | |
import XMonad.Util.EZConfig -- removeKeys, additionalKeys | |
import XMonad.Util.Run(spawnPipe) -- spawnPipe, hPutStrLn | |
import XMonad.Util.Run | |
import Graphics.X11.ExtraTypes.XF86 | |
tall = ResizableTall 1 (3/100) (1/2) [] | |
myWorkspaces = [" main ", " browser ", " media ", " work ", " tray "] | |
modm = mod4Mask | |
colorBlue = "#857da9" | |
colorGreen = "#88b986" | |
colorGray = "#676767" | |
colorWhite = "#d3d7cf" | |
colorGrayAlt = "#313131" | |
colorNormalbg = "#1a1e1b" | |
-- Define keys to remove | |
keysToRemove x = | |
[ | |
-- Unused gmrun binding | |
(modm .|. shiftMask, xK_p) | |
-- Unused close window binding | |
, (modm .|. shiftMask, xK_c) | |
, (modm .|. shiftMask, xK_Return) | |
] | |
-- Delete the keys combinations we want to remove. | |
strippedKeys x = foldr M.delete (keys defaultConfig x) (keysToRemove x) | |
main :: IO () | |
main = do | |
wsbar <- spawnPipe myWsBar | |
xmonad $ defaultConfig | |
{ borderWidth = 2 | |
, terminal = "urxvt" | |
, normalBorderColor = colorGray | |
, focusedBorderColor = colorGreen | |
, startupHook = myStartupHook | |
, manageHook = placeHook myPlacement <+> myManageHookShift <+> myManageHookFloat <+> manageDocks | |
-- any time Full mode, avoid xmobar area | |
, layoutHook = toggleLayouts (noBorders Full) $ avoidStruts $ myLayout | |
-- xmobar setting | |
, logHook = myLogHook wsbar | |
, handleEventHook = fadeWindowsEventHook | |
, workspaces = myWorkspaces | |
, modMask = modm } | |
`additionalKeys` | |
[ ((modm , xK_f ), sendMessage ToggleLayout) | |
, ((modm , xK_g ), sendMessage ToggleGaps) | |
, ((modm , xK_l ), sendMessage MirrorShrink) | |
, ((modm , xK_h ), sendMessage MirrorExpand) | |
, ((modm , xK_Right ), nextWS ) -- go to next workspace | |
, ((modm , xK_Left ), prevWS ) -- go to prev workspace | |
, ((modm .|. shiftMask, xK_Right ), shiftToNext) | |
, ((modm .|. shiftMask, xK_Left ), shiftToPrev) | |
, ((modm , xK_comma ), sendMessage MagnifyLess) -- smaller window | |
, ((modm , xK_period), sendMessage MagnifyMore) -- bigger window | |
, ((modm , xK_j ), windows W.focusDown) | |
, ((modm , xK_k ), windows W.focusUp) | |
, ((modm .|. shiftMask, xK_j ), windows W.swapDown) | |
, ((modm .|. shiftMask, xK_k ), windows W.swapUp) | |
, ((modm , xK_w ), nextScreen) ] | |
`additionalKeys` | |
[ ((modm .|. m, k), windows $ f i) | |
| (i, k) <- zip myWorkspaces | |
[ xK_exclam, xK_at, xK_numbersign | |
, xK_dollar, xK_percent, xK_asciicircum | |
, xK_ampersand, xK_asterisk, xK_parenleft | |
, xK_parenright | |
] | |
, (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)] | |
] | |
`additionalKeys` | |
[ ((mod1Mask .|. controlMask, xK_l ), spawn "xscreensaver-command -lock") | |
, ((modm , xK_Return ), spawn "urxvt") | |
, ((modm , xK_c ), kill) -- %! Close the focused window | |
, ((modm , xK_p ), spawn "exe=`dmenu_run -nb '#1a1e1b' -nf '#d3d7cf' -sb '#88b986' -sf '#1a1e1b'` && exec $exe") | |
, ((mod1Mask .|. controlMask, xK_f ), spawn "python /home/ssh0/Workspace/python/web_search/websearch.py") | |
, ((0 , 0x1008ff13), spawn "amixer -D pulse set Master 5%+ && paplay /usr/share/sounds/freedesktop/stereo/audio-volume-change.oga") | |
, ((0 , 0x1008ff11), spawn "amixer -D pulse set Master 5%- && paplay /usr/share/sounds/freedesktop/stereo/audio-volume-change.oga") | |
, ((0 , 0x1008ff12), spawn "amixer -D pulse set Master toggle") | |
-- Brightness Keys | |
, ((0 , 0x1008FF02), spawn "xbacklight + 10") | |
, ((0 , 0x1008FF03), spawn "xbacklight - 10") | |
] | |
-- Handle Window behaveior | |
myLayout = (spacing 18 $ ResizableTall 1 (3/100) (3/5) []) | |
||| (spacing 2 $ (dragPane Horizontal (1/10) (1/2))) | |
||| (dragPane Vertical (1/10) (1/2)) | |
-- Start up (at xmonad beggining), like "wallpaper" or so on | |
myStartupHook = do | |
spawn "gnome-settings-daemon" | |
spawn "nm-applet" | |
spawn "gnome-sound-applet" | |
spawn "xscreensaver -no-splash" | |
spawn "feh --bg-fill /media/ssh0/STOCK/Pictures/wallpapers/Abstract-gauss.jpg" | |
spawn "compton --config /home/ssh0/.config/compton/compton.conf -b" | |
spawn "/home/ssh0/.dropbox-dist/dropboxd" | |
-- some window must created there | |
myManageHookShift = composeAll | |
-- if you want to know className, type "$ xprop|grep CLASS" on shell | |
[ className =? "Firefox" --> doShift " browser " | |
, className =? "Mplayer" --> doShift " media " | |
] | |
-- where viewShift = doF . liftM2 (.) W.view W.shift | |
-- new window will created in Float mode | |
myManageHookFloat = composeAll | |
[ className =? "MPlayer" --> doFloat, | |
className =? "Gimp" --> doFloat, | |
className =? "Websearch.py" --> doFloat, | |
className =? "Plugin-container" --> doFloat, | |
title =? "Speedbar" --> doFloat] | |
myLogHook h = dynamicLogWithPP $ wsPP { ppOutput = hPutStrLn h } | |
myWsBar = "xmobar /home/ssh0/.xmonad/xmobarrc" | |
wsPP = xmobarPP { ppOrder = \(ws:l:t:_) -> [ws,t] | |
, ppCurrent = xmobarColor colorGreen colorNormalbg | |
, ppUrgent = xmobarColor colorWhite colorNormalbg | |
, ppVisible = xmobarColor colorWhite colorNormalbg | |
, ppHidden = xmobarColor colorWhite colorNormalbg | |
, ppHiddenNoWindows = xmobarColor colorGray colorNormalbg | |
, ppTitle = xmobarColor colorWhite colorNormalbg | |
, ppWsSep = "" | |
, ppSep = " ::: " | |
} | |
myPlacement = fixed (0.5, 0.5) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment