Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import XMonad hiding ( (|||) )
- import Control.Monad
- import Data.Ratio ((%))
- import Foreign.C (CChar)
- import System.Exit
- import qualified XMonad.StackSet as W
- import qualified Data.Map as M
- import qualified Data.ByteString as B
- -- Actions
- import XMonad.Actions.CycleWS
- import XMonad.Actions.FloatSnap
- import XMonad.Actions.FloatKeys
- import XMonad.Actions.OnScreen
- import XMonad.Actions.SpawnOn
- import XMonad.Actions.SwapWorkspaces
- import XMonad.Actions.UpdateFocus
- -- Hooks
- import XMonad.Hooks.DynamicLog
- import XMonad.Hooks.EwmhDesktops
- import XMonad.Hooks.ManageDocks
- import XMonad.Hooks.ManageHelpers
- import XMonad.Hooks.Place
- import XMonad.Hooks.SetWMName
- import XMonad.Hooks.WorkspaceByPos
- import XMonad.Hooks.UrgencyHook hiding (Never)
- -- Layouts
- import XMonad.Layout.BoringWindows
- import XMonad.Layout.CenteredMaster
- import XMonad.Layout.Grid
- import XMonad.Layout.IM
- import XMonad.Layout.LayoutCombinators
- import XMonad.Layout.MagicFocus
- import XMonad.Layout.Minimize
- import XMonad.Layout.NoBorders
- import XMonad.Layout.PerWorkspace
- import XMonad.Layout.Reflect
- import XMonad.Layout.Renamed
- import XMonad.Layout.Spacing
- import XMonad.Layout.StackTile
- import XMonad.Layout.TwoPane
- import XMonad.Layout.Tabbed
- import qualified XMonad.Layout.ToggleLayouts as Tog
- -- Prompts
- import XMonad.Prompt
- import XMonad.Prompt.Shell
- import XMonad.Prompt.XMonad
- import XMonad.Prompt.RunOrRaise
- -- Utils
- import XMonad.Util.NamedScratchpad
- import XMonad.Util.Run(spawnPipe)
- import XMonad.Util.EZConfig(additionalKeysP, additionalKeys)
- myBrowser = "/home/haron/.local/bin/firefox"
- myTerminal = "urxvtc"
- myShell = "zsh"
- myFocusFollowsMouse :: Bool
- myFocusFollowsMouse = True
- myBorderWidth = 1
- myModMask = mod4Mask
- myWorkspaces :: [String]
- myWorkspaces = [ "W", "M", "E", "F", "S", "V", "P", "J", "T" , "0" , "IM"]
- myNormalBorderColor = "#151515"
- myFocusedBorderColor = "#9df"
- myFont = "xft:SonyEricssonLogo:size=10:antialias=true:hinting=true"
- ------------------------------------------------------------------------
- -- 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 dmenu
- --, ((modm, xK_p ), spawn "dmenu_run -i -p 'Run:' -sb '#333' -nf '#999' -sf '#9df' -fn '-misc-fixed-medium-r-normal-*-14-140-75-75-c-90-iso10646-1'")
- -- launch gmrun
- --, ((modm .|. shiftMask, xK_p ), spawn "gmrun")
- -- sound up/down & mpc
- , ((0, 0x1008ff13), spawn "amixer set Master 5%+")
- , ((0, 0x1008ff11), spawn "amixer set Master 5%-")
- , ((0, 0x1008ff12), spawn "amixer set Master toggle")
- , ((0, 0x1008ff14), spawn "mpc toggle")
- , ((0, 0x1008ff15), spawn "mpc stop")
- , ((0, 0x1008ff16), spawn "mpc prev")
- , ((0, 0x1008ff17), spawn "mpc next")
- -- appstart
- , ((mod1Mask, 0xffbf), spawn "dmenu_run -i -p 'Run:' -sb '#333' -nf '#999' -sf '#9df' -fn '-misc-fixed-medium-r-normal-*-14-140-75-75-c-90-iso10646-1'")
- , ((mod1Mask, 0xffc0), spawn "gmrun")
- , ((0, 0x1008ff30), spawn "urxvtc -name htop -e /usr/bin/htop")
- , ((0, 0x1008ff18), spawn "pcmanfm")
- , ((mod1Mask, 0x1008ff18), spawn "gksu pcmanfm")
- , ((0, 0x1008ff19), spawn "thunderbird")
- , ((0, 0x1008ff5d), spawn "firefox")
- , ((0, 0x1008ff1d), spawn "galculator")
- , ((0, 0x1008ff2f), spawn "slock")
- , ((0, 0x1008ff81), spawn "urxvtc -name ncmpcpp -e /usr/bin/ncmpcpp")
- , ((0, 0x1008ff1b), spawn "catfish")
- , ((0, 0x1008ff73), spawn "compreboot")
- , ((modm, 0x1008ff73), spawn "xmrestart")
- , ((0, 0xff69), spawn "compdown")
- , ((0, 0xffc9), spawn "terminal")
- , ((0, 0xff61), spawn "scrot -e 'mv $f ~/Pictures/Screenshots/ 2>/dev/null'") --Print
- , ((mod1Mask, 0xff61), spawn "scrot -s -e 'mv $f ~/Pictures/Screenshots/ 2>/dev/null'") --Alt+Print
- , ((mod1Mask, 0x61), spawn "doublecmd") --Alt+A
- , ((mod1Mask, 0x62), spawn "baobab") --Alt+B
- , ((mod1Mask, 0x63), spawn "chromium") --Alt+C
- , ((mod1Mask, 0x64), spawn "deluged") --Alt+D
- , ((mod1Mask .|. shiftMask,0x64), spawn "deluge-gtk") --Alt+Shift+D
- , ((mod1Mask, 0x65), spawn "urxvtc -name equaliser -e alsamixer -D equal") --Alt+E
- , ((mod1Mask, 0x66), spawn "fupdate.zsh") --Alt+F
- , ((mod1Mask, 0x67), spawn "gimp") --Alt+G
- , ((mod1Mask .|. shiftMask,0x67), spawn "python3 /home/haron/lib/gis-weather/gis-weather.py") --Alt+Shift+G
- , ((mod1Mask, 0x68), spawn "hexchat") --Alt+H
- , ((mod1Mask, 0x69), spawn "iron") --Alt+I
- , ((mod1Mask, 0x6c), spawn "cat /home/haron/Documents/last.pass | cut -c 1-24 | xclip -selection clipboard") --Alt+L
- , ((mod1Mask, 0x6d), spawn "urxvtc -name mc -e /usr/bin/mc") --Alt+M
- , ((mod1Mask, 0x6f), spawn "soffice") --Alt+O
- , ((mod1Mask, 0x70), spawn "env WINEPREFIX='/home/haron/.wine' wine '/home/haron/lib/Pro100-5.20-GIV/PRO100.exe'") --Alt+P
- , ((mod1Mask, 0x73), spawn "subl3") --Alt+S
- , ((mod1Mask .|. shiftMask,0x73), spawn "shutter") --Alt+Shift+S
- , ((mod1Mask, 0x74), spawn "thunar") --Alt+T
- , ((mod1Mask .|. shiftMask,0x74), spawn "gksu thunar") --Alt+Shift+T
- , ((mod1Mask, 0x76), spawn "tor-browser") --Alt+V
- , ((mod1Mask, 0x77), spawn "gksu pacmanxg") --Alt+W
- , ((mod1Mask, 0x7a), spawn "transd") --Alt+Z
- , ((mod1Mask .|. shiftMask,0x7a), spawn "transgui") --Alt+Shift+Z
- -- close focused window
- , ((modm .|. shiftMask, xK_c ), kill)
- -- 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, xK_n ), refresh)
- -- Move focus to the next window
- , ((mod1Mask, xK_Tab ), windows W.focusDown)
- -- Toggle to the workspace displayed previously
- , ((modm, xK_Tab ), toggleWS' ["NSP"])
- -- Move focus to the next window
- , ((modm, xK_j ), windows W.focusDown)
- -- Move focus to the previous window
- , ((modm, xK_k ), windows W.focusUp )
- -- Move focus to the master window
- , ((modm, xK_m ), windows W.focusMaster )
- -- Swap the focused window and the master window
- , ((modm, xK_Return), windows W.swapMaster)
- -- Swap the focused window with the next window
- , ((modm .|. shiftMask, xK_j ), windows W.swapDown )
- -- Swap the focused window with the previous window
- , ((modm .|. shiftMask, xK_k ), windows W.swapUp )
- -- Shrink the master area
- , ((modm, xK_h ), sendMessage Shrink)
- -- Expand the master area
- , ((modm, xK_l ), sendMessage Expand)
- -- 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))
- -- Deincrement the number of windows in the master area
- , ((modm , xK_period), sendMessage (IncMasterN (-1)))
- -- Toggle the status bar gap
- -- Use this binding with avoidStruts from Hooks.ManageDocks.
- -- See also the statusBar function from Hooks.DynamicLog.
- --
- , ((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_2, xK_3, xK_4, xK_5, xK_6, xK_7, xK_8, xK_9, xK_0, xK_minus]
- , (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)]]
- ------------------------------------------------------------------------
- -- Mouse bindings: default actions bound to mouse events
- --
- myMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList $
- -- mod-button1, Set the window to floating mode and move by dragging
- [ ((modm, button1), (\w -> focus w >> mouseMoveWindow w
- >> windows W.shiftMaster))
- -- mod-button2, Raise the window to the top of the stack
- , ((modm, button2), (\w -> focus w >> windows W.shiftMaster))
- -- mod-button3, Set the window to floating mode and resize by dragging
- , ((modm, button3), (\w -> focus w >> mouseResizeWindow w
- >> windows W.shiftMaster))
- ]
- ------------------------------------------------------------------------
- -- Layouts:
- myLayout = avoidStruts
- $ Tog.toggleLayouts (noBorders Full)
- $ smartBorders
- $ onWorkspace "W" (tabbedBottom shrinkText myTabConfig)
- $ onWorkspace "M" (tabbedBottom shrinkText myTabConfig)
- $ onWorkspace "E" (Mirror tiled)
- $ onWorkspace "F" (magicFocus (smartSpacing 2 $ TwoPane 0.01 0.7) ||| (smartSpacing 2 $ Mirror $ TwoPane 0.01 0.5))
- $ onWorkspace "S" (tabbedBottom shrinkText myTabConfig)
- $ onWorkspace "V" (Full)
- $ onWorkspace "P" (Full ||| (centerMaster Grid))
- $ onWorkspace "J" (Full)
- $ onWorkspace "T" (magicFocus (smartSpacing 2 $ TwoPane 0.01 0.7) ||| (smartSpacing 2 $ Mirror $ TwoPane 0.01 0.5))
- $ onWorkspace "0" (tabbedBottom shrinkText myTabConfig)
- $ onWorkspace "IM" (smartSpacing 2 $ withIM 0.17 (ClassName "psi") (GridRatio 1))
- $ tiled ||| Mirror tiled ||| Full
- where
- tiled = Tall nmaster delta ratio
- nmaster = 1
- ratio = 0.66
- delta = 0.01
- -- IMLayout
- myIMLayout = withIM (1%7) psi Grid
- where
- psi = And (ClassName "psi") (Role "main")
- -- Tabs:
- myTabConfig = defaultTheme {
- activeColor = "#151515",
- inactiveColor = "#151515",
- activeBorderColor = "#151515",
- inactiveBorderColor = "#151515",
- activeTextColor = "#ccc",
- inactiveTextColor = "#555",
- fontName = myFont,
- decoHeight = 24
- }
- ------------------------------------------------------------------------
- -- Window rules:
- myManageHook = composeAll . concat $
- [
- [className =? c --> doF (W.shift "W") | c <- myWeb]
- , [className =? c --> doF (W.shift "M") | c <- myMail]
- , [className =? c --> doF (W.shift "E") | c <- myEdit]
- , [className =? c --> doF (W.shift "F") | c <- myFile]
- , [className =? c --> doF (W.shift "S") | c <- mySystem]
- , [className =? c --> doF (W.shift "V") | c <- myVideo]
- , [className =? c --> doF (W.shift "P") | c <- myPic]
- , [className =? c --> doF (W.shift "J") | c <- myWork]
- , [className =? c --> doF (W.shift "T") | c <- myTorrent]
- , [className =? c --> doF (W.shift "0") | c <- myOther]
- , [className =? c --> doF (W.shift "IM") | c <- myIM]
- --, [resource =? "downer" --> doF W.swapDown]
- --, [title =? "obnoxious window" --> doF W.swapDown]
- , [appName =? "libreoffice" --> doF (W.shift "3") ]
- , [isDialog --> doFloat]
- , [isFullscreen --> doFullFloat]
- , [manageDocks]
- ]
- where
- myWeb = ["Firefox","Chromium","Opera","Iron","Tor Browser","Zenmap"]
- myMail = ["Thunderbird"]
- myEdit = ["Subl3","Et","Wps","Wpp","Acroread"]
- myFile = ["Pcmanfm","Thunar","Doublecmd"]
- mySystem = ["pacmanxg","Baobab","systemdx","GParted","Sysinfo"]
- myVideo = ["mpv","Gnome-mpv","Vlc","Sopcast-player.py","Cheese","smplayer","smtube","Deadbeef"]
- myPic = ["Pinta","Gimp","Gimp-2.8","Inkscape"]
- myWork = ["Wine"]
- myTorrent = ["Tixati","Deluge","Deluge-gtk","Transgui","Transmission-gtk","Transmission-remote-gtk"]
- myOther = ["VirtualBox","Gis-weather.py"]
- myIM = ["Hexchat","psi","Psi","Viber"]
- ------------------------------------------------------------------------
- -- Event handling
- myEventHook = fullscreenEventHook <+> docksEventHook
- ------------------------------------------------------------------------
- -- Status bars and logging.
- myLogHook = dynamicLogString $ xmobarPP {
- ppCurrent = xmobarColor "#9df" "",
- ppTitle = xmobarColor "#999" "",
- ppHidden = xmobarColor "#999" "",
- --ppUrgent = xmobarColor "#f00" "",
- --ppHiddenNoWindows = xmobarColor "#333" "",
- ppLayout = xmobarColor "#999" "" }
- -- toggleStrutsKey XConfig {XMonad.modMask = modMask} = (modMask, xK_b)
- ------------------------------------------------------------------------
- -- Startup hook
- myStartupHook = return () <+> adjustEventInput
- myScratchpads = [ NS "ncmpcpp" "urxvtc -name ncmpcpp -e ncmpcpp" (appName =? "ncmpcpp") (customFloating $ W.RationalRect 0.15 0.2 0.7 0.6)
- , NS "htop" "urxvtc -name htop -e htop" (appName =? "htop") (customFloating $ W.RationalRect 0.05 0.05 0.9 0.9)
- , NS "mc" "urxvtc -name mc -e mc" (appName =? "mc") (customFloating $ W.RationalRect 0.05 0.05 0.9 0.9)
- , NS "terminal" "urxvtc -name terminal" (appName =? "terminal") (customFloating $ W.RationalRect 0.1 0.15 0.8 0.7)
- , NS "lxappearance" "lxappearance" (appName =? "lxappearance") (customFloating $ W.RationalRect 0.2 0.2 0.6 0.6)
- , NS "xarchiver" "xarchiver" (appName =? "xarchiver") (customFloating $ W.RationalRect 0.2 0.2 0.6 0.6)
- , NS "equaliser" "urxvtc -name equaliser -e alsamixer -D equal" (appName =? "equaliser") (customFloating $ W.RationalRect 0.2 0.2 0.6 0.6)
- , NS "feh" "feh" (className =? "feh") (customFloating $ W.RationalRect 0.05 0.05 0.9 0.9)
- , NS "Mirage" "mirage" (className =? "Mirage") (customFloating $ W.RationalRect 0.05 0.05 0.9 0.9)
- , NS "Shutter" "shutter" (className =? "Shutter") (customFloating $ W.RationalRect 0.1 0.1 0.8 0.8)
- , NS "galculator" "galculator" (className =? "Galculator") (customFloating $ W.RationalRect 0.3 0.3 0.4 0.3)
- , NS "zenity" "zenity" (className =? "Zenity") (customFloating $ W.RationalRect 0.35 0.4 0.3 0.1)
- ]
- main = do
- xmonad defaults
- encodeCChar :: B.ByteString -> [CChar]
- encodeCChar = map fromIntegral . B.unpack
- defaults = ewmh $ withUrgencyHook NoUrgencyHook defaultConfig {
- terminal = myTerminal,
- focusFollowsMouse = myFocusFollowsMouse,
- borderWidth = myBorderWidth,
- modMask = myModMask,
- workspaces = myWorkspaces,
- normalBorderColor = myNormalBorderColor,
- focusedBorderColor = myFocusedBorderColor,
- keys = myKeys,
- mouseBindings = myMouseBindings,
- layoutHook = avoidStruts myLayout,
- manageHook = manageHook defaultConfig <+> manageDocks <+> myManageHook <+> namedScratchpadManageHook myScratchpads <+> placeHook (smart (0.5,0.5)) <+> workspaceByPos,
- handleEventHook = myEventHook,
- logHook = myLogHook >>= xmonadPropLog,
- startupHook = myStartupHook
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement