-
-
Save kilisio/331349d51d60c32aec1098ad7e41d034 to your computer and use it in GitHub Desktop.
xmonad configuration with XFCE
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
import XMonad | |
import XMonad.Config.Xfce | |
import XMonad.Hooks.ManageDocks | |
import XMonad.Hooks.EwmhDesktops | |
import XMonad.Hooks.SetWMName | |
import qualified Data.Map as M | |
import qualified XMonad.StackSet as W | |
-- HOOKS | |
import XMonad.Hooks.ManageDocks | |
-- LAYOUTS | |
import XMonad.Layout.Tabbed | |
import XMonad.Layout.Simplest | |
import XMonad.Layout.GridVariants | |
import XMonad.Layout.SimplestFloat | |
import XMonad.Layout.Spiral | |
import XMonad.Layout.ResizableTile | |
import XMonad.Layout.ThreeColumns | |
-- LAYOUT MODIFIERS | |
-- import XMonad.Layout.ShowWName | |
-- import qualified XMonad.Layout.Gaps as G | |
import XMonad.Layout.WindowArranger | |
import qualified XMonad.Layout.ToggleLayouts as T | |
import qualified XMonad.Layout.MultiToggle as MT | |
import XMonad.Layout.Spacing | |
import XMonad.Layout.NoBorders | |
import XMonad.Layout.Renamed | |
import XMonad.Layout.Decoration | |
import XMonad.Layout.LayoutModifier | |
import XMonad.Layout.LimitWindows | |
import XMonad.Layout.Magnifier | |
import XMonad.Layout.MultiToggle | |
import XMonad.Layout.MultiToggle.Instances | |
-- LIST ----------------------------------------------------------------------- | |
tall = | |
renamed [Replace "tall"] | |
$ limitWindows 12 | |
$ ResizableTall 1 (3/100) (3/5) [] | |
magnify = | |
renamed [Replace "magnify"] | |
$ magnifier | |
$ limitWindows 12 | |
$ ResizableTall 1 (3/100) (1/2) [] | |
monocle = | |
renamed [Replace "monocle"] | |
$ limitWindows 20 Full | |
grid = | |
renamed [Replace "grid"] | |
$ limitWindows 12 | |
$ mkToggle (single MIRROR) | |
$ Grid (16/10) | |
spirals = | |
renamed [Replace "spirals"] | |
$ spiral (6/7) | |
threeCol = | |
renamed [Replace "threeCol"] | |
$ limitWindows 7 | |
$ ThreeCol 1 (3/100) (1/2) | |
threeRow = | |
renamed [Replace "threeRow"] | |
$ limitWindows 7 | |
$ Mirror | |
$ ThreeCol 1 (3/100) (1/2) | |
-- CONFIG --------------------------------------------------------------------- | |
myLayout = avoidStruts | |
$ windowArrange | |
$ mkToggle (NBFULL ?? NOBORDERS ?? EOT) | |
$ myDefaultLayout | |
where myDefaultLayout = tall ||| Full ||| threeCol ||| threeRow ||| grid | |
------------------------------------------------------------------------ | |
-- 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 = composeAll | |
[ className =? "mpv" --> doFloat | |
, className =? "Gimp" --> doIgnore | |
, resource =? "desktop_window" --> doIgnore | |
, className =? "Xfce4-panel" --> doFloat | |
, className =? "Xfce-mcs-manager" --> doFloat | |
] | |
myFont :: [Char] | |
myFont = "xft:Hack:size=18" | |
myModMask :: KeyMask | |
myModMask = mod4Mask | |
myFocusFollowsMouse :: Bool | |
myFocusFollowsMouse = True | |
myClickJustFocuses :: Bool | |
myClickJustFocuses = False | |
myBorderWidth :: Dimension | |
myBorderWidth = 2 | |
mySpacing :: Int | |
mySpacing = 4 | |
myWorkspaces :: [String] | |
myWorkspaces = ["I","II","III","IV","V","VI","VII","VIII","IX"] | |
------------------------------------------------------------------------ | |
-- 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)) | |
-- you may also bind events to the mouse scroll wheel (button4 and button5) | |
] | |
------------------------------------------------------------------------ | |
-- Event handling | |
-- * EwmhDesktops users should change this to ewmhDesktopsEventHook | |
-- | |
-- Defines a custom handler function for X Events. The function should | |
-- return (All True) if the default handler is to be run afterwards. To | |
-- combine event hooks use mappend or mconcat from Data.Monoid. | |
-- | |
-- myEventHook = mempty | |
myEventHook = ewmhDesktopsEventHook | |
------------------------------------------------------------------------ | |
-- Status bars and logging | |
-- Perform an arbitrary action on each internal state change or X event. | |
-- See the 'DynamicLog' extension for examples. | |
-- | |
-- To emulate dwm's status bar | |
-- | |
-- > logHook = dynamicLogDzen | |
-- | |
myLogHook = return () | |
------------------------------------------------------------------------ | |
-- Startup hook | |
-- Perform an arbitrary action each time xmonad starts or is restarted | |
-- with mod-q. Used by, e.g., XMonad.Layout.PerWorkspace to initialize | |
-- per-workspace layout choices. | |
-- | |
-- By default, do nothing. | |
myStartupHook = return () | |
myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $ | |
-- Toggle status bar gap | |
[ ((modm, xK_b ), sendMessage ToggleStruts) | |
-- Log out | |
, ((modm .|. shiftMask, xK_q ), spawn "xfce4-session-logout") | |
-- Change configuration | |
-- , ((modm, xK_q ), spawn "xmonad --recompile; xmonad --restart") | |
-- launch a terminal | |
, ((modm .|. shiftMask, xK_Return), spawn "xfce4-terminal") | |
-- launch dmenu | |
, ((modm, xK_p ), spawn "exe=`dmenu_path | dmenu` && eval \"exec $exe\"") | |
-- launch appfinder | |
, ((modm .|. shiftMask, xK_p ), spawn "xfce4-appfinder") | |
-- switch to "es" keyboard | |
, ((modm, xK_s ), spawn "setxkbmap es") | |
-- switch to "us" keyboard | |
, ((modm, xK_d ), spawn "setxkbmap us") | |
-- 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 | |
, ((modm, xK_Tab ), windows W.focusDown) | |
-- 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))) | |
] | |
-- | |
-- mod-[1..9], Switch to workspace N | |
-- | |
-- 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_9] | |
, (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]] | |
-- | |
-- mod-{w,e,r}, Switch to physical/Xinerama screens 1 or 2 | |
-- mod-shift-{w,e,r}, Move client to screen 1, 2, or 3 | |
-- reordered | |
++ | |
[((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f)) | |
| (key, sc) <- zip [xK_w, xK_e] [0..] | |
, (f, m) <- [(W.view, 0), (W.shift, shiftMask)]] | |
------------------------------------------------------------------------ | |
-- Now run xmonad with all the defaults we set up. | |
-- Run xmonad with the settings you specify. No need to modify this. | |
-- | |
--main = xmonad defaults | |
-- A structure containing your configuration settings, overriding | |
-- fields in the default config. Any you don't override, will | |
-- use the defaults defined in xmonad/XMonad/Config.hs | |
-- | |
-- No need to modify this. | |
-- | |
--defaults = defaultConfig { | |
-- IMPORTANT! When you add fields to the record they are overwritten, not merged | |
-- Check https://wiki.haskell.org/Xmonad/Using_xmonad_in_XFCE before touching! | |
main = xmonad xfceConfig | |
{ modMask = myModMask | |
, borderWidth = myBorderWidth | |
, focusFollowsMouse = myFocusFollowsMouse | |
, layoutHook = avoidStruts | |
$ spacing mySpacing | |
$ myLayout | |
, mouseBindings = myMouseBindings | |
, terminal = "xfce4-terminal" | |
, clickJustFocuses = myClickJustFocuses | |
, normalBorderColor = "#dddddd" | |
, focusedBorderColor = "#E04613" | |
, manageHook = manageDocks <+> myManageHook | |
, keys = myKeys | |
, handleEventHook = myEventHook | |
, logHook = myLogHook | |
, startupHook = myStartupHook | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment