Last active
April 30, 2018 19:52
-
-
Save fehu/eeaa0605709eec41225e10e4db58bfbc to your computer and use it in GitHub Desktop.
xmonad setup
This file contains hidden or 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
{-# OPTIONS_GHC -w #-} | |
import XMonad | |
import XMonad.Util.EZConfig | |
import XMonad.Util.NamedActions | |
import XMonad.Util.Run(spawnPipe) | |
import Graphics.X11.ExtraTypes.XF86 | |
import XMonad.Layout.NoBorders | |
import XMonad.Actions.WorkspaceNames | |
import XMonad.Hooks.SetWMName | |
import XMonad.Hooks.DynamicLog | |
import XMonad.Hooks.ManageDocks | |
-- import XMonad.Hooks.EwmhDesktops | |
import XMonad.Operations (setTopFocus) | |
import qualified XMonad.Prompt as P | |
import qualified XMonad.Actions.Search as S | |
import qualified XMonad.StackSet as SS | |
import qualified Data.Map as Map | |
import Control.Arrow (first) | |
import System.IO(hPutStrLn) | |
main = do xmproc <- spawnPipe "xmobar ~/.xmonad/xmobar.hs" | |
xmonad $ addDescrKeys ((mod4Mask, xK_F1), xMessage) describedKeys | |
$ config' xmproc | |
-------------------------------------------------------------------------------- | |
modm = mod4Mask | |
config' xmproc = | |
let cfg = def | |
in cfg { modMask = modm | |
, layoutHook = avoidStruts . smartBorders $ layoutHook cfg | |
-- avoidStruts = leave space for the bar | |
-- smartBorders = no borders in fullscreen | |
, startupHook = startup | |
, logHook = myLogHook xmproc | |
, manageHook = manageDocks | |
, handleEventHook = docksEventHook | |
--, terminal = "urxvt" | |
} -- `additionalKeys` | |
describedKeys c = searchKeys c ++ soundKeys ++ lockKey | |
-------------------------------------------------------------------------------- | |
startup = do spawn "xset s off -dpms" | |
-- spawn "export _JAVA_AWT_WM_NONREPARENTING=1" | |
-- ewmhDesktopsStartup >> | |
setWMName "LG3D" | |
spawn "setxkbmap -layout \"us,ru\"" | |
spawn "setxkbmap -variant \"altgr-intl,\"" | |
spawn "setxkbmap -option \"grp:caps_toggle, terminate:ctrl_alt_bksp\"" | |
-- Color of current window title in xmobar. | |
-- xmobarTitleColor = "#FFB6B0" | |
-- Color of current workspace in xmobar. | |
xmobarCurrentWorkspaceColor = "#CEFFAC" | |
-- Color of current layout in xmobar. | |
xmobarCurrentLayoutColor = "#2F4F4F" | |
myLogHook xmproc = do | |
dynamicLogWithPP $ xmobarPP { | |
ppOutput = hPutStrLn xmproc | |
, ppTitle = const "" | |
-- , ppTitle = xmobarColor xmobarTitleColor "" . shorten 100 | |
, ppCurrent = xmobarColor xmobarCurrentWorkspaceColor "" | |
, ppLayout = xmobarColor xmobarCurrentLayoutColor "" | |
, ppSep = " " | |
} | |
-- setTopFocus >> setWMName "LG3D" -- fix java Bug | |
-------------------------------------------------------------------------------- | |
soundSink="0" | |
pactlVol cmd = spawn $ "pactl set-sink-volume " ++ soundSink ++ " " ++ cmd | |
soundLowerVolume = addName "Volume -" $ pactlVol "-2%" | |
soundRaiseVolume = addName "Volume +" $ pactlVol "+2%" | |
soundMute = addName "Mute Sound" . spawn | |
$ "pactl set-sink-mute " ++ soundSink ++ " toggle" | |
soundKeys = (subtitle "Volume Keys":) | |
[ ((0, xF86XK_AudioLowerVolume), soundLowerVolume) | |
, ((0, xF86XK_AudioRaiseVolume), soundRaiseVolume) | |
, ((0, xF86XK_AudioMute), soundMute) | |
] | |
-------------------------------------------------------------------------------- | |
searchKeys c = (subtitle "Search Keys":) $ mkNamedKeymap c | |
(first ("M-s " ++ ) <$> searchList (S.promptSearch def)) | |
-- (first ("M-S-s " ++ ) <$> searchList S.selectSearch) | |
searchName name = addName $ "search with/in " ++ name | |
searchList method = | |
[ ("g", searchName "google" $ method S.google) | |
, ("h", searchName "hoogle" $ method S.hoogle) | |
, ("H", searchName "hackage" $ method S.hackage) | |
, ("w", searchName "wikipedia" $ method S.wikipedia) | |
, ("m", searchName "google maps" $ method S.maps) | |
, ("y", searchName "youtube" $ method S.youtube) | |
, ("v", searchName "vocabulary" $ method S.vocabulary) | |
] | |
-------------------------------------------------------------------------------- | |
lockKey = [((modm .|. controlMask, xK_l), addName "Lock" lockCmd)] | |
lockCmd = spawn "xlock +description -mode blank \ | |
\ -startCmd 'xset dpms force off' \ | |
\ -endCmd 'xset -dpms'" | |
-------------------------------------------------------------------------------- | |
-- import XMonad.Actions.Launcher | |
-- import XMonad.Prompt(def) | |
-- key : [ ((modm .|. controlMask, xK_l), launcherPrompt def $ defaultLauncherModes launcherConfig ) ] | |
-- launcherConfig = LauncherConfig { pathToHoogle = "/home/fehu/.cabal/bin/hoogle" , browser = "chromium"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment