落書きノート

ふと自分が気になった事を書いてます

xmonadの設定その2 UbuntuやGentooで

xmonadの設定です。UbuntuGentooでそれぞれ使ってみてます。スクリーンショットはこんな感じです。

f:id:kh2n:20170818171251p:plain

f:id:kh2n:20170818171312p:plain

Ubuntuで設定すると楽ですよ。GentooとかこういうOSで慣れてる人はおすすめです。

import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Util.Run
import XMonad.Util.EZConfig
import XMonad.Hooks.EwmhDesktops
import System.IO

main :: IO ()
main = do
  left_bar <- spawnPipe $ "dzen2 -x 0 -w " ++ (show l_width) ++ " -ta l " ++ dzen_style
  spawn $ "conky -c ~/.xmonad/conkyrc | dzen2 -x " ++ (show l_width) ++ " -w " ++ (show r_width) ++ " -ta r " ++ dzen_style
  spawn $ "stalonetray -bg \"#000000\" --icon-gravity SE --grow-gravity SW -i 16 "
          ++ "--kludges force_icons_size "
          ++ "-s " ++ (show tray_slot)
          ++ " --geometry " ++ (show icon_len) ++ "+" ++ (show tray_geo_x)
  xmonad $ defaultConfig
    { terminal    = myTerminal
    , modMask     = myModMask
    , borderWidth = myBorderWidth
    , logHook     = dynamicLogWithPP $ my_dzen_PP left_bar
    , layoutHook  = avoidStruts $ layoutHook defaultConfig
    , manageHook  = manageHook defaultConfig <+> manageDocks
    , handleEventHook = fullscreenEventHook
    } `additionalKeys`
    [ ((mod4Mask .|. shiftMask, xK_z), spawn "xscreensaver-command -lock")
    , ((controlMask, xK_Print), spawn "sleep 0.2; scrot -s")
    , ((0, xK_Print), spawn "scrot")
    ]

myTerminal    = "evilvte -fn \"SF Mono for Powerline 10\""
myModMask     = mod4Mask
myBorderWidth = 3

dzen_style = "-h '18' -fg '#aaaaaa' -bg '#000000' -fn 'SF Mono:size=10'"

my_dzen_PP h = defaultPP { ppCurrent = dzenColor "#00ffaa" "" . wrap "[" "]"
                         , ppHidden  = dzenColor "#00aa11" "" . wrap "" ""
                         , ppUrgent  = dzenColor "#ff0000" "" . wrap " " " "
                         , ppSep     = " : "
                         , ppLayout  = dzenColor "#aaaaaa" ""
                         , ppOutput  = hPutStrLn h
                         }

screen_width = 1366
bar_height = 20
l_width = 742
r_width = screen_width - l_width - tray_slot * icon_len
tray_geo_x = l_width + r_width
tray_slot = bar_height
icon_len = 5