From 1b42f6954ed7c1dba5d8f41d8735b62afdb33f37 Mon Sep 17 00:00:00 2001 From: Anastasios Grammenos Date: Sat, 12 Sep 2020 15:00:51 +0300 Subject: Initial.. --- xmonad.hs | 182 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 182 insertions(+) create mode 100644 xmonad.hs (limited to 'xmonad.hs') diff --git a/xmonad.hs b/xmonad.hs new file mode 100644 index 0000000..fb9de1b --- /dev/null +++ b/xmonad.hs @@ -0,0 +1,182 @@ +import XMonad +import XMonad.Config.Desktop + +import System.Exit + +import qualified Data.Map as M +import XMonad.Hooks.ManageHelpers +import qualified XMonad.StackSet as W + +import XMonad.Hooks.DynamicLog +import XMonad.Util.Run +import XMonad.Util.SpawnOnce + +import XMonad.Util.WorkspaceCompare + +import XMonad.Hooks.ManageDocks + +import XMonad.Layout.Grid +import XMonad.Layout.CenteredMaster +import XMonad.Layout.Circle +import XMonad.Layout.Grid +import XMonad.Layout.MosaicAlt +import XMonad.Layout.Tabbed +import XMonad.Layout.ResizableTile + + +import XMonad.Layout.SubLayouts +import XMonad.Layout.WindowNavigation + +import XMonad.Prompt +import XMonad.Prompt.Shell +import XMonad.Prompt.XMonad + +myPP = def { ppCurrent = xmobarColor "#1ABC9C" "" . wrap "[" "]" + , ppTitle = xmobarColor "#1ABC9C" "" . shorten 60 + , ppVisible = wrap "(" ")" + , ppUrgent = xmobarColor "red" "yellow" + -- , ppSort = getSortByXineramaPhysicalRule def + } + +main = do + h <- spawnPipe "xmobar ~/.xmonad/xmobar.hs" + xmonad $ desktopConfig + { terminal = "urxvt" + , modMask = mod4Mask + , startupHook = startup + , layoutHook = myLayout +-- , keys = \c -> mykeys c `M.union` keys def c + , keys = mykeys + , manageHook = myManageHook <+> manageDocks <+> manageHook def + , logHook = dynamicLogWithPP myPP + { ppOutput = hPutStrLn h } + } + where + mykeys (XConfig {modMask = modm}) = + M.fromList $ + [ ((modm , xK_o), spawn "xlnch ~/xlnch/xlnchrc") + , ((modm , xK_n), spawn "xlnch ~/xlnch/nude-xlnchrc") + , ((modm , xK_p), spawn "passmenu") + , ((modm , xK_j), spawn "jira-issue-nude.sh") + , ((modm .|. controlMask, xK_x), shellPrompt def) + , ((modm .|. shiftMask , xK_x), xmonadPrompt def) + , ((modm, xK_x), sendMessage MirrorShrink) + , ((modm, xK_s), sendMessage MirrorExpand) + + , ((modm, xK_Return), spawn "urxvt-server-client") + + -- launch dmenu + , ((modm, xK_d ), spawn "exe=`dmenu_path | dmenu` && eval \"exec $exe\"") + + -- launch gmrun + , ((modm .|. shiftMask, xK_p ), spawn "gmrun") + + -- close focused window + , ((modm .|. shiftMask, xK_q ), kill) + + -- Rotate through the available layout algorithms + , ((modm, xK_w ), sendMessage NextLayout) + + -- Reset the layouts on the current workspace to default + --, ((modm .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook def) + + -- Resize viewed windows to the correct size + --, ((modm, xK_n ), refresh) + + -- Move focus to the next window + , ((modm, xK_Tab ), windows W.focusDown) + + -- Move focus to the next window + , ((modm, xK_e ), windows W.focusDown) + + -- Move focus to the previous window + , ((modm, xK_a ), windows W.focusUp ) + + -- Move focus to the master window + , ((modm, xK_m ), windows W.focusMaster ) + + -- Swap the focused window and the master window + , ((modm .|. shiftMask, xK_Return), windows W.swapMaster) + + -- Swap the focused window with the next window + , ((modm .|. shiftMask, xK_e ), windows W.swapDown ) + + -- Swap the focused window with the previous window + , ((modm .|. shiftMask, xK_a ), 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 (used with avoidStruts from Hooks.ManageDocks) + -- , ((modm , xK_b ), sendMessage ToggleStruts) + + -- Quit xmonad + , ((modm .|. shiftMask, xK_z ), io (exitWith ExitSuccess)) + + -- Restart xmonad + , ((modm , xK_z ), restart "xmonad" True) ] + + ++ + + [((modm .|. controlMask, xK_h), sendMessage $ pullGroup L) + , ((modm .|. controlMask, xK_l), sendMessage $ pullGroup R) + , ((modm .|. controlMask, xK_k), sendMessage $ pullGroup U) + , ((modm .|. controlMask, xK_j), sendMessage $ pullGroup D) + , ((modm .|. controlMask, xK_m), withFocused (sendMessage . MergeAll)) + , ((modm .|. controlMask, xK_u), withFocused (sendMessage . UnMerge)) + , ((modm .|. controlMask, xK_period), onGroup W.focusUp') + , ((modm .|. controlMask, xK_comma), onGroup W.focusDown')] + + ++ + + -- + -- 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 def) [xK_1 .. xK_9] + , (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)]] + +background = "feh --recursive --randomize --bg-scale /usr/share/backgrounds" + +startup :: X () +startup = do + spawn "xrandr --output Virtual1 --primary --mode 1440x900 --pos 0x0 --rotate normal --output Virtual2 --off --output Virtual3 --off --output Virtual4 --off --output Virtual5 --off --output Virtual6 --off --output Virtual7 --off --output Virtual8 --off" + spawn background + spawn "setxkbmap -model pc104 -layout us,gr -variant qwerty -option grp:win_space_toggle,ctrl:nocaps,grp_led:scroll" + spawnOnce "trayer --edge top --align left --SetDockType true --SetPartialStrut true --expand true --transparent true --alpha 0 --tint 0x000000 --height 16 --width 5" + spawnOnce "nm-applet" + spawnOnce "dunst" + spawnOnce "blueman-applet" + +-- myLayout = tiled ||| Mirror tiled ||| Full ||| Grid ||| dragPane Vertical 0.1 0.5 +myLayout = + avoidStruts ( windowNavigation $ + subTabbed $ + MosaicAlt M.empty ||| + ResizableTall 1 (5/100) (1/2) [] ||| + Full ||| + Tall 1 (5/100) (1/2) ) + +myManageHook = composeAll . concat $ + [ [ className =? "xlnch" --> doCenterFloat ] ] -- cgit v1.2.3