Created
August 1, 2018 08:10
-
-
Save mimi1vx/9826338fa283aafd6bc3f8c7bcdb45f2 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
{-# LANGUAGE FlexibleContexts #-} | |
-- Ondřej Súkup xmonad config ... | |
-- main import | |
import XMonad | |
-- xmonad hooks | |
import XMonad.Hooks.DynamicLog | |
import XMonad.Hooks.EwmhDesktops hiding (fullscreenEventHook) | |
import XMonad.Hooks.ManageDocks | |
import XMonad.Hooks.ManageHelpers | |
import XMonad.Hooks.SetWMName | |
import XMonad.Hooks.UrgencyHook | |
--xmonad actions | |
import XMonad.Actions.CycleWS | |
import XMonad.Actions.GridSelect | |
import XMonad.Actions.Submap | |
--xmonad utils | |
import XMonad.Util.Cursor | |
import XMonad.Util.EZConfig | |
import XMonad.Util.NamedWindows | |
import XMonad.Util.Scratchpad | |
import XMonad.Util.SpawnOnce (spawnOnce) | |
import XMonad.Util.Themes | |
--xmonad layouts | |
import XMonad.Layout.Fullscreen | |
import XMonad.Layout.LayoutHints | |
import XMonad.Layout.LayoutModifier | |
import XMonad.Layout.NoBorders | |
import XMonad.Layout.PerWorkspace | |
import XMonad.Layout.Tabbed | |
-- import xmonad promt | |
import XMonad.Prompt | |
import XMonad.Prompt.Shell | |
import XMonad.Prompt.Ssh | |
-- qualified imports of Data and Stack | |
import qualified XMonad.StackSet as W | |
import qualified Data.Map as M | |
-- general import | |
import Control.Applicative | |
import Graphics.X11.ExtraTypes.XF86 | |
-- taffybar | |
import System.Taffybar.Support.PagerHints (pagerHints) | |
------------------------------------------------------------------------ | |
promptConfig :: XPConfig | |
promptConfig = | |
def {font = "xft:Source Code Pro:pixelsize=14" | |
,borderColor = "#1e2320" | |
,height = 18 | |
,position = Top} | |
------------------------------------------------------------------------ | |
myWorkspaces :: [WorkspaceId] | |
myWorkspaces = | |
["con","web","irc","email"] ++ map show [5 .. 9] | |
------------------------------------------------------------------------ | |
-- add mouse buttons | |
button8 = 8 :: Button | |
button9 = 9 :: Button | |
------------------------------------------------------------------------ | |
-- Layouts: | |
-- You can specify and transform your layouts by modifying these values. | |
-- If you change layout bindings be sure to use 'mod-shift-space' after | |
-- restarting (with 'mod-q') to reset your layout state to the new | |
-- defaults, as xmonad preserves your old layout settings by default. | |
-- | |
-- The available layouts. Note that each layout is separated by |||, | |
-- which denotes layout choice. | |
-- | |
myBorders = lessBorders Screen | |
--lessBorders (Combine Union Screen OnlyFloat) | |
myLayout = | |
avoidStruts $ | |
myBorders $ | |
layoutHintsToCenter $ | |
onWorkspace "con" | |
( tab ||| full ||| tiled ||| mtiled) $ | |
onWorkspaces ["web","irc"] | |
full $ | |
full ||| tiled ||| mtiled | |
where | |
-- default tiling algorithm partitions the screen into two panes | |
tiled = Tall nmaster delta ratio | |
-- The default number of windows in the master pane | |
nmaster = 1 | |
-- Default proportion of screen occupied by master pane | |
ratio = | |
toRational (2 / (1 + sqrt 5 :: Double)) | |
-- Percent of screen to increment by when resizing panes | |
delta = 5 / 100 | |
-- tab is tabbed | |
tab = | |
tabbed shrinkText (theme smallClean) | |
-- full is Full | |
full = | |
fullscreenFloat Full | |
-- mtiled is mirrortiled | |
mtiled = Mirror tiled | |
------------------------------------------------------------------------ | |
-- Window rules: | |
-- Execute arbitrary actions and WindowSet manipulations when managing | |
-- a new window. You can use this to, for example, always float a | |
-- particular program, or have a client always appear on a particular | |
-- workspace. | |
-- | |
-- To find the property name associated with a program, use | |
-- > xprop | grep WM_CLASS | |
-- and click on the client you're interested in. | |
-- | |
-- To match on the WM_NAME, you can use 'title' in the same way that | |
-- 'className' and 'resource' are used below. | |
-- | |
myManageHook :: ManageHook | |
myManageHook = | |
composeAll $ | |
[isDialog --> doFloat] ++ | |
[appName =? r --> doIgnore | r <- myIgnores] ++ | |
[className =? c --> doCenterFloat | c <- myFloats] ++ | |
[appName =? r --> doShift wsp | (r,wsp) <- myWorkspaceMove] | |
-- fulscreen windows to fullfloating | |
++ | |
[isFullscreen --> doFullFloat] ++ | |
-- unmanage docks such as gnome-panel and dzen | |
[fullscreenManageHook | |
,scratchpadManageHookDefault | |
] | |
where | |
-- windows to operate | |
myIgnores = | |
["desktop","kdesktop","desktop_window"] | |
myFloats = | |
["Steam","steam","vlc","Vlc","mpv"] | |
myWorkspaceMove = | |
[("chromium-browser","web") | |
,("urxvtc-256color","con") | |
,("sakura","con") | |
,("weechat","irc") | |
,("Navigator","web") | |
,("Weechat","irc") | |
,("Evolution","email") | |
,("evolution","email") | |
,("Mutt","email")] | |
------------------------------------------------------------------------ | |
-- Event handling | |
myEventHook = fullscreenEventHook <+> hintsEventHook | |
------------------------------------------------------------------------ | |
-- myStartupHook | |
myStartupHook :: X () | |
myStartupHook = | |
do setDefaultCursor xC_left_ptr | |
setWMName "LG3D" | |
spawnOnce "xrdb -merge ~/.Xresources" | |
spawnOnce "xsetroot -solid black" | |
-- spawnOnce "compton -fb" | |
-- spawnOnce "urxvtd-256color -f -q -o" | |
spawnOnce "/home/mimi/.fehbg" | |
------------------------------------------------------------------------ | |
-- Urgency Hook: | |
-- | |
-- Use libnotify notifications when the X11 urgent hint is set | |
data LibNotifyUrgencyHook = | |
LibNotifyUrgencyHook | |
deriving (Read,Show) | |
instance UrgencyHook LibNotifyUrgencyHook where | |
urgencyHook LibNotifyUrgencyHook w = | |
do name <- getName w | |
wins <- gets windowset | |
whenJust (W.findTag w wins) | |
(flash name) | |
where flash name index = spawn $ | |
"notify-send " ++ | |
"'Workspace " ++ | |
index ++ | |
"' " ++ "'Activity in: " ++ show name ++ "' " | |
------------------------------------------------------------------------ | |
-- Now run xmonad with all the defaults we set up. | |
main :: IO () | |
main = xmonad defaults | |
------------------------------------------------------------------------ | |
myUrgencyHook = | |
withUrgencyHook LibNotifyUrgencyHook | |
defaults = | |
docks $ | |
myUrgencyHook $ | |
ewmh $ | |
pagerHints $ | |
def {terminal = "sakura -l -m" | |
,borderWidth = 2 | |
,modMask = mod4Mask | |
,workspaces = myWorkspaces | |
,layoutHook = myLayout | |
,manageHook = myManageHook | |
,handleEventHook = myEventHook | |
,startupHook = myStartupHook} `additionalKeys` | |
[((mod4Mask,xK_g),goToSelected def) -- Gridselect | |
,((mod4Mask,xK_Print),spawn "scrot '%F-%H-%M-%S.png' -e 'mv $f ~/Shot/'") -- screenshot | |
,((mod4Mask,xK_s),scratchpadSpawnActionTerminal "urxvt-256color") -- scratchpad | |
,((mod4Mask .|. controlMask,xK_p) | |
,submap . M.fromList $ -- add submap Ctrl+Win+P,key | |
[((0,xK_q),spawn "sakura --name Weechat -t weechat -x weechat") | |
,((0,xK_w),spawn "chromium") | |
,((0,xK_e),spawn "sakura --name Vim -t vim -x vim") | |
,((0,xK_r),spawn "sakura --name Mutt -t Mutt -x neomutt") | |
,((0,xK_s),sshPrompt promptConfig)]) | |
,((mod4Mask,xK_p),shellPrompt promptConfig) | |
, | |
-- , ((mod4Mask .|. shiftMask , xK_p ), passPrompt promptConfig ) | |
((mod4Mask,xK_l),spawn "i3lock -c 101010") | |
,((0,xF86XK_AudioMute),spawn "pulseaudio-ctl mute") | |
,((0,xF86XK_AudioRaiseVolume),spawn "pulseaudio-ctl up") | |
,((0,xF86XK_AudioLowerVolume),spawn "pulseaudio-ctl down") | |
,((0,xF86XK_MonBrightnessUp),spawn "xbacklight +5") | |
,((0,xF86XK_MonBrightnessDown),spawn "xbacklight -5") | |
,((mod4Mask,xK_b),sendMessage ToggleStruts)] `additionalMouseBindings` | |
[((0,button8),const prevWS) -- cycle Workspace up | |
,((0,button9),const nextWS) -- cycle Workspace down | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment