Created
October 19, 2017 10:12
-
-
Save mopemope/f9defa104be5cb7b42a69106d6c15bb2 to your computer and use it in GitHub Desktop.
卍卍卍卍卍卍卍卍卍卍卍卍卍卍卍卍卍卍卍卍卍卍卍卍卍
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
Config { font = "xft:Ricty:size=13:antialias=true" | |
, bgColor = "#1c1c1c" | |
, fgColor = "#FFFFFF" | |
, alpha = 10 | |
, position = TopSize C 100 16 | |
, lowerOnStart = False | |
, overrideRedirect = False | |
, border = NoBorder | |
, commands = [ Run Network "wlp1s0" ["-t" , "Net:<rx>Kb/s <tx>Kb/s " | |
, "-L" , "40" | |
, "-H" , "200" | |
, "-m" , "3" | |
, "--normal" , "#ffffff" | |
, "--high" , "#a5d6a7" | |
] 10 | |
, Run MultiCpu [ "-t" , "CPU:<total>%" | |
, "-L" , "40" | |
, "-H" , "85" | |
, "-m" , "3" | |
, "--normal" , "#ffffff" | |
, "--high" , "#f44336" | |
] 10 | |
, Run Memory [ "-t" , "Memory:<usedratio>%" | |
, "-L" , "40" | |
, "-H" , "90" | |
, "-m" , "3" | |
, "--normal" , "#ffffff" | |
, "--high" , "#f44336" | |
] 10 | |
, Run DiskIO [("/", "IO:<read> <write>" )] | |
["-m", "3"] 10 | |
, Run DiskU [("/", "Disk:<used>/<size>")] | |
[ | |
"-L" , "50" | |
, "-H" , "90" | |
, "-m" , "2" | |
, "--normal" , "#ffffff" | |
, "--high" , "#f44336" | |
] 10 | |
, Run Battery [ "-t" , "Batt:<acstatus>" | |
, "-L" , "20" | |
, "-H" , "80" | |
, "--low" , "#f44336" | |
, "--normal" , "#ffffff" | |
, "--" | |
, "-o" , "<left>% (<timeleft>)" | |
, "-O" , "Charging <left>%" | |
, "-i" , "<left>%" | |
] 50 | |
, Run Date "%a %m/%d %H:%M" "date" 10 | |
, Run StdinReader | |
] | |
, sepChar = "%" | |
, alignSep = "}{" | |
, template = " %StdinReader% }{ %wlp1s0% %multicpu% %memory% %diskio% %disku% %battery% <fc=#F4D03F>%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 Graphics.X11.ExtraTypes.XF86 | |
import System.IO | |
import XMonad | |
import XMonad.Actions.CopyWindow | |
(copyToAll, kill1, killAllOtherCopies) | |
import XMonad.Actions.CycleWS | |
import qualified XMonad.Actions.FlexibleResize as Flex | |
import XMonad.Actions.GridSelect (defaultGSConfig, goToSelected) | |
import XMonad.Actions.Search (google, selectSearchBrowser) | |
import XMonad.Hooks.DynamicLog | |
import XMonad.Hooks.FadeWindows | |
import XMonad.Hooks.ManageDocks | |
import XMonad.Hooks.ManageHelpers | |
import XMonad.Hooks.SetWMName | |
import XMonad.Layout.Gaps | |
-- import XMonad.Layout.Grid (Grid(..)) | |
import XMonad.Layout.IndependentScreens | |
(countScreens, onCurrentScreen, withScreens) | |
import XMonad.Layout.Minimize | |
(MinimizeMsg(..), minimize, minimizeWindow) | |
import XMonad.Layout.NoBorders | |
import XMonad.Layout.ResizableTile | |
(MirrorResize(..), ResizableTall(..)) | |
import XMonad.Layout.Simplest (Simplest(..)) | |
import XMonad.Layout.Spacing | |
import XMonad.Layout.StackTile (StackTile(..)) | |
-- import XMonad.Layout.ThreeColumns (ThreeCol(..)) | |
import XMonad.Layout.ToggleLayouts | |
import XMonad.Layout.TwoPane (TwoPane(..)) | |
import XMonad.Prompt | |
import XMonad.Prompt.RunOrRaise (runOrRaisePrompt) | |
import qualified XMonad.StackSet as W | |
import XMonad.Util.EZConfig (additionalKeys, removeKeys) | |
import XMonad.Util.NamedScratchpad | |
import XMonad.Util.Run (spawnPipe) | |
import XMonad.Util.WorkspaceCompare (getSortByIndex) | |
-- 1. local variables | |
myWorkspaces :: [String] | |
myWorkspaces = map show [1 .. 5] | |
modm :: KeyMask | |
modm = mod4Mask | |
-- Color Setting | |
colorBlue :: String | |
colorBlue = "#9fc7e8" | |
colorGreen :: String | |
colorGreen = "#2ABB9B" | |
colorRed :: String | |
colorRed = "#CF000F" | |
colorGray :: String | |
colorGray = "#9e9e9e" | |
colorWhite :: String | |
colorWhite = "#ffffff" | |
colorGrayAlt :: String | |
colorGrayAlt = "#eceff1" | |
colorNormalbg :: String | |
colorNormalbg = "#1c1c1c" | |
colorfg :: String | |
colorfg = "#ffffff" | |
-- Border width | |
borderwidth :: Dimension | |
borderwidth = 2 | |
-- Border color | |
mynormalBorderColor :: String | |
mynormalBorderColor = colorNormalbg | |
myfocusedBorderColor :: String | |
myfocusedBorderColor = colorGreen | |
-- gapwidth | |
gapwidth :: Int | |
gapwidth = 2 | |
gapwidthU :: Int | |
gapwidthU = 0 | |
gapwidthD :: Int | |
gapwidthD = 1 | |
gapwidthL :: Int | |
gapwidthL = 1 | |
gapwidthR :: Int | |
gapwidthR = 1 | |
myTerminal :: String | |
myTerminal = "urxvtc" | |
-- 2. scratchpad settings | |
myScratchpads :: [NamedScratchpad] | |
myScratchpads = | |
[ NS | |
"qurxvt" | |
"urxvtc -name qurxvt" | |
(appName =? "qurxvt") | |
(customFloating $ W.RationalRect 0 0.02 1 0.48) | |
, NS | |
"qurxvt2" | |
"urxvtc -name qurxvt2" | |
(appName =? "qurxvt2") | |
(customFloating $ W.RationalRect 0 0.5 1 0.50) | |
, NS | |
"htop" | |
"urxvtc -e htop" | |
(title =? "htop") | |
(customFloating $ W.RationalRect 0 0.02 1 0.4) | |
, NS | |
"ranger" | |
"urxvtc -e ranger" | |
(title =? "ranger") | |
(customFloating $ W.RationalRect 0 0.02 1 0.8) | |
, NS | |
"zeal" | |
"zeal" | |
(className =? "Zeal") | |
(customFloating $ W.RationalRect 0 0.02 1 0.6) | |
, NS | |
"chrome" | |
"google-chrome-stable" | |
(className =? "Google-chrome") | |
(customFloating $ W.RationalRect 0 0.02 1 0.98) | |
, NS | |
"firefox" | |
"firefox" | |
(className =? "Firefox") | |
(customFloating $ W.RationalRect 0 0.02 1 0.98) | |
, NS | |
"skypeforlinux" | |
"skypeforlinux" | |
(className =? "skypeforlinux") | |
(customFloating $ W.RationalRect 0 0.02 1 0.98) | |
] | |
-- 3. keybindings | |
-- shiftAndView dir = findWorkspace getSortByIndexNoSP dir HiddenNonEmptyWS 1 | |
-- >>= \t -> (windows . W.shift $ t) >> (windows . W.greedyView $ t) | |
-- where notSP = (return $ ("SP" /=) . W.tag) :: X (WindowSpace -> Bool) | |
-- getSortByIndexNoSP = fmap (.namedScratchpadFilterOutWorkspace) getSortByIndex | |
-- myToggle = windows $ W.view =<< W.tag . head . filter | |
-- ((\x -> x /= "NSP" && x /= "SP") . W.tag) . W.hidden | |
notSP :: X (WindowSpace -> Bool) | |
notSP = return $ ("NSP" /=) . W.tag | |
nextWS' :: X () | |
nextWS' = moveTo Next (WSIs notSP) | |
prevWS' :: X () | |
prevWS' = moveTo Prev (WSIs notSP) | |
myKeyBinding :: [((KeyMask, KeySym), X ())] | |
myKeyBinding | |
-- Shrink / Expand the focused window | |
= | |
[ ((modm, xK_comma), sendMessage Shrink) | |
, ((modm, xK_period), sendMessage Expand) | |
, ((modm, xK_z), sendMessage MirrorShrink) | |
, ((modm, xK_a), sendMessage MirrorExpand) | |
-- Close the focused window | |
, ((modm, xK_c), kill1) | |
-- Toggle layout (Fullscreen mode) | |
, ((modm, xK_f), sendMessage ToggleLayout) | |
-- Go to the next / previous workspace | |
, ((modm, xK_Down), nextWS') | |
, ((modm, xK_Up), prevWS') | |
-- , ((modm , xK_l ), nextWS ) | |
-- , ((modm , xK_h ), prevWS ) | |
-- Shift the focused window to the next / previous workspace | |
, ((modm .|. shiftMask, xK_Down), shiftToNext) | |
, ((modm .|. shiftMask, xK_Up), shiftToPrev) | |
-- , ((modm .|. shiftMask , xK_l ), shiftToNext) | |
-- , ((modm .|. shiftMask , xK_h ), shiftToPrev) | |
-- CopyWindow | |
--, ((modm , xK_v ), windows copyToAll) | |
--, ((modm .|. shiftMask , xK_v ), killAllOtherCopies) | |
-- Move the focus down / up | |
, ((modm, xK_j), windows W.focusDown) | |
, ((modm, xK_k), windows W.focusUp) | |
-- Swap the focused window down / up | |
, ((modm .|. shiftMask, xK_j), windows W.swapDown) | |
, ((modm .|. shiftMask, xK_k), windows W.swapUp) | |
-- Google Search | |
, ( (modm .|. shiftMask, xK_g) | |
, selectSearchBrowser "/usr/bin/google-chrome-stable" google) | |
, ((0, xK_F12), namedScratchpadAction myScratchpads "qurxvt") | |
, ((0, xK_F11), namedScratchpadAction myScratchpads "qurxvt2") | |
-- , ((modm, xK_h), namedScratchpadAction myScratchpads "htop") | |
, ((modm .|. shiftMask, xK_f), namedScratchpadAction myScratchpads "firefox") | |
-- , ((modm .|. shiftMask, xK_r), namedScratchpadAction myScratchpads "ranger") | |
, ((modm, xK_g), namedScratchpadAction myScratchpads "chrome") | |
-- , ((modm, xK_b), namedScratchpadAction myScratchpads "chrome") | |
-- , ((modm, xK_s), namedScratchpadAction myScratchpads "skypeforlinux") | |
, ((modm, xK_e), namedScratchpadAction myScratchpads "emacs") | |
, ((modm .|. shiftMask, xK_Return), spawn "urxvt -name terminal") | |
-- RunOrRaisePrompt | |
, ((modm, xK_r), runOrRaisePrompt myXPConfig) | |
-- Grid Select Binding | |
, ((modm, xK_Tab), goToSelected defaultGSConfig) | |
, ((modm, xK_m), withFocused minimizeWindow) | |
, ((modm .|. shiftMask, xK_m), sendMessage RestoreNextMinimizedWin) | |
, ((modm, xK_F7), spawn "xset dpms force suspend") | |
, ((0, xF86XK_MonBrightnessDown), spawn "xbacklight -10") | |
, ((0, xF86XK_MonBrightnessUp), spawn "xbacklight +10") | |
, ((0, xF86XK_AudioLowerVolume), spawn "pactl set-sink-volume 0 -1.5%") | |
, ((0, xF86XK_AudioRaiseVolume), spawn "pactl set-sink-volume 0 +1.5%") | |
, ((0, xF86XK_AudioMute), spawn "pactl set-sink-mute 0 toggle") | |
, ((0, xK_Print), spawn "xfce4-screenshooter -r -s ~/Pictures") | |
] | |
-- , ((modm , xK_z), namedScratchpadAction myScratchpads "zeal") | |
-- , ((modm , xK_i), namedScratchpadAction myScratchpads "idea") | |
-- 4. layouts | |
myLayout = | |
spacing gapwidth $ | |
gaps | |
[ (U, gapwidth + gapwidthU) | |
, (D, gapwidth + gapwidthD) | |
, (L, gapwidth + gapwidthL) | |
, (R, gapwidth + gapwidthR) | |
] $ | |
minimize | |
(ResizableTall 1 (1 / 100) (3 / 5) [] ||| | |
StackTile 1 (1 / 100) (3 / 5) ||| TwoPane (1 / 100) (3 / 5) ||| Simplest) | |
-- ||| ThreeColMid 1 (1/100) (16/35) | |
-- 5. startup programms | |
startup' :: [String] -> X () | |
startup' = mapM_ spawn | |
myStartupHook :: X () | |
myStartupHook = startup' myStartup >> setWMName "LG3D" | |
myStartup :: [String] | |
myStartup = | |
[ "xsetroot -solid black" | |
, "feh --bg-fill ~/Pictures/noop.png" | |
, "xsetroot -cursor_name left_ptr" | |
, "setxkbmap -layout jp" | |
, "xset r rate 400 55" | |
, "syndaemon -R -t -i 2 -d" | |
, "urxvtd -o -q" | |
, "sudo hciconfig hci0 up" | |
, "fcitx" | |
, "plasmawindowed org.kde.kdeconnect --statusnotifier" | |
, "xcompmgr" | |
, "$HOME/.dropbox-dist/dropboxd" | |
] | |
-- , "feh --bg-fill ~/Pictures/wild_night.jpg" | |
-- , "feh --bg-fill ~/Pictures/mth1.jpg" | |
-- , "feh --bg-fill ~/Pictures/blue.png" | |
-- , "xautolock -detectsleep -time 10 -locker 'dm-tool lock'" | |
-- 6. manage hooks | |
myManageHookShift :: ManageHook | |
myManageHookShift = composeAll [] | |
myManageHookFloat :: ManageHook | |
myManageHookFloat = | |
composeAll | |
[ className =? "MPlayer" --> doCenterFloat | |
, className =? "SMPlayer" --> doCenterFloat | |
, className =? "Blueman-manager" --> doCenterFloat | |
, className =? "BayposApp" --> doCenterFloat | |
, className =? "Emacs" --> (customFloating $ W.RationalRect 0 0.02 1 0.96) | |
, className =? "Chromium" --> | |
(customFloating $ W.RationalRect 0 0.02 1 0.98) | |
, appName =? "terminal" --> (customFloating $ W.RationalRect 0 0.02 1 0.98) | |
, className =? "Franz" --> (customFloating $ W.RationalRect 0 0.02 1 0.98) | |
] | |
myLogHook :: Handle -> X () | |
myLogHook h = | |
dynamicLogWithPP . namedScratchpadFilterOutWorkspacePP $ | |
wsPP {ppOutput = hPutStrLn h} | |
-- 7. xmobar setting | |
myWsBar :: String | |
myWsBar = "xmobar $HOME/.xmonad/xmobarrc" | |
wsPP :: PP | |
wsPP = | |
xmobarPP | |
{ ppOrder = \(ws:_:t:_) -> [ws, t] | |
, ppCurrent = xmobarColor colorRed colorNormalbg . const "*" | |
, ppUrgent = xmobarColor colorfg colorNormalbg . const "*" | |
, ppVisible = xmobarColor colorfg colorNormalbg . const "*" | |
, ppHidden = xmobarColor colorfg colorNormalbg . const "*" | |
, ppHiddenNoWindows = xmobarColor colorfg colorNormalbg . const "-" | |
, ppTitle = xmobarColor colorGreen colorNormalbg | |
, ppSort = fmap (. namedScratchpadFilterOutWorkspace) getSortByIndex | |
, ppOutput = putStrLn | |
, ppWsSep = " " | |
, ppSep = " : " | |
} | |
-- 8. XPConfig | |
myXPConfig :: XPConfig | |
myXPConfig = | |
defaultXPConfig | |
{ font = "xft:Ricty:size=12:antialias=true" | |
, fgColor = colorfg | |
, bgColor = colorNormalbg | |
, borderColor = colorNormalbg | |
, height = 20 | |
, promptBorderWidth = 1 | |
, autoComplete = Just 100000 | |
, bgHLight = colorWhite | |
, fgHLight = colorNormalbg | |
, position = Bottom | |
} | |
myXPConfig2 :: XPConfig | |
myXPConfig2 = | |
defaultXPConfig | |
{ font = "xft:Ricty:size=12:antialias=true" | |
, fgColor = colorfg | |
, bgColor = colorNormalbg | |
, borderColor = colorNormalbg | |
, height = 20 | |
, promptBorderWidth = 1 | |
, autoComplete = Nothing | |
, bgHLight = colorWhite | |
, fgHLight = colorNormalbg | |
, position = Top | |
} | |
--9. mouse bindings | |
myMouse :: t -> [((KeyMask, Button), Window -> X ())] | |
myMouse _ = [((modm, button3), \w -> focus w >> Flex.mouseResizeWindow w)] | |
newMouse :: XConfig Layout -> M.Map (ButtonMask, Button) (Window -> X ()) | |
newMouse x = M.union (mouseBindings defaultConfig x) (M.fromList (myMouse x)) | |
-- 10. Define keys to remove | |
myRemoveKey :: [(KeyMask, KeySym)] | |
myRemoveKey = [(modm, xK_p), (modm, xK_t), (modm .|. shiftMask, xK_p)] | |
------------------------------------------------------------------------------------------------ | |
-- 11 main | |
------------------------------------------------------------------------------------------------ | |
main :: IO () | |
main = do | |
nScreens <- countScreens | |
wsbar <- spawnPipe myWsBar | |
xmonad $ | |
defaultConfig | |
{ borderWidth = borderwidth | |
, terminal = myTerminal | |
, focusFollowsMouse = False | |
, normalBorderColor = mynormalBorderColor | |
, focusedBorderColor = myfocusedBorderColor | |
, startupHook = myStartupHook | |
, manageHook = | |
myManageHookShift <+> | |
myManageHookFloat <+> | |
namedScratchpadManageHook myScratchpads <+> manageDocks | |
, layoutHook = | |
lessBorders OnlyFloat $ | |
toggleLayouts (avoidStruts $ noBorders Full) $ avoidStruts myLayout | |
, logHook = myLogHook wsbar | |
, handleEventHook = fadeWindowsEventHook | |
, workspaces = withScreens nScreens myWorkspaces | |
, modMask = modm | |
, mouseBindings = newMouse | |
} `additionalKeys` | |
myKeyBinding `additionalKeys` | |
[ ((modm .|. m, k), windows $ onCurrentScreen f i) | |
| (i, k) <- zip myWorkspaces [xK_1 .. xK_9] | |
, (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)] | |
] `removeKeys` | |
myRemoveKey |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment