mirror of
https://codeberg.org/frosty/dotfiles.git
synced 2024-09-19 11:47:09 -04:00
add qtile and xmonad
This commit is contained in:
parent
f4be49d1ab
commit
0adaa1bb2e
118
qtile/.config/qtile/config.py
Normal file
118
qtile/.config/qtile/config.py
Normal file
|
@ -0,0 +1,118 @@
|
||||||
|
from libqtile import bar, layout, qtile, widget
|
||||||
|
from libqtile.config import Click, Drag, Group, Key, Match, Screen
|
||||||
|
from libqtile.lazy import lazy
|
||||||
|
|
||||||
|
app_bindings = [
|
||||||
|
(["mod4"], "F1", "thunar"),
|
||||||
|
(["mod4"], "F2", "firefox"),
|
||||||
|
(["mod4"], "p", "dmenu_run"),
|
||||||
|
(["mod4"], "Return", "st"),
|
||||||
|
]
|
||||||
|
|
||||||
|
keys = [
|
||||||
|
Key(["mod4"], "j", lazy.layout.next()),
|
||||||
|
Key(["mod4"], "k", lazy.layout.previous()),
|
||||||
|
Key(["mod4", "shift"], "j", lazy.layout.shuffle_down()),
|
||||||
|
Key(["mod4", "shift"], "k", lazy.layout.shuffle_up()),
|
||||||
|
|
||||||
|
Key(["mod4"], "i", lazy.layout.decrease_nmaster()),
|
||||||
|
Key(["mod4"], "d", lazy.layout.increase_nmaster()),
|
||||||
|
|
||||||
|
Key(["mod4"], "h", lazy.layout.decrease_ratio()),
|
||||||
|
Key(["mod4"], "l", lazy.layout.increase_ratio()),
|
||||||
|
Key(["mod4"], "n", lazy.layout.normalize()),
|
||||||
|
|
||||||
|
Key(["mod4", "shift"], "c", lazy.window.kill()),
|
||||||
|
Key(["mod4", "shift"], "f", lazy.window.toggle_fullscreen()),
|
||||||
|
Key(["mod4", "shift"], "space", lazy.window.toggle_floating()),
|
||||||
|
|
||||||
|
Key(["mod4", "control"], "r", lazy.reload_config()),
|
||||||
|
Key(["mod4", "control"], "q", lazy.shutdown()),
|
||||||
|
]
|
||||||
|
keys.extend(
|
||||||
|
Key(mod, key, lazy.spawn(command))
|
||||||
|
for mod, key, command in app_bindings
|
||||||
|
)
|
||||||
|
|
||||||
|
groups = [Group(i) for i in "123456789"]
|
||||||
|
|
||||||
|
for i in groups:
|
||||||
|
keys.extend(
|
||||||
|
[
|
||||||
|
Key(["mod4"], i.name,lazy.group[i.name].toscreen()),
|
||||||
|
Key(["mod4", "shift"], i.name, lazy.window.togroup(i.name)),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
layout_defaults = {
|
||||||
|
"border_focus": "#ff0000",
|
||||||
|
"border_normal": "#555555",
|
||||||
|
"border_width": 1,
|
||||||
|
"margin": 0,
|
||||||
|
"ratio": 0.50,
|
||||||
|
}
|
||||||
|
|
||||||
|
layouts = [
|
||||||
|
# layout.Columns(border_focus_stack=["#d75f5f", "#8f3d3d"], border_width=4),
|
||||||
|
# layout.Max(),
|
||||||
|
# Try more layouts by unleashing below layouts.
|
||||||
|
# layout.Stack(num_stacks=2),
|
||||||
|
# layout.Bsp(),
|
||||||
|
# layout.Matrix(),
|
||||||
|
layout.MonadTall(
|
||||||
|
**layout_defaults,
|
||||||
|
),
|
||||||
|
# layout.MonadWide(),
|
||||||
|
# layout.RatioTile(),
|
||||||
|
# layout.Tile(),
|
||||||
|
# layout.TreeTab(),
|
||||||
|
# layout.VerticalTile(),
|
||||||
|
# layout.Zoomy(),
|
||||||
|
]
|
||||||
|
|
||||||
|
widget_defaults = dict(
|
||||||
|
font="sans",
|
||||||
|
fontsize=12,
|
||||||
|
padding=3,
|
||||||
|
)
|
||||||
|
extension_defaults = widget_defaults.copy()
|
||||||
|
|
||||||
|
screens = [
|
||||||
|
Screen(
|
||||||
|
bottom=bar.Bar(
|
||||||
|
[
|
||||||
|
widget.CurrentLayout(),
|
||||||
|
widget.GroupBox(),
|
||||||
|
widget.WindowName(),
|
||||||
|
widget.Systray(),
|
||||||
|
widget.Clock(format="%Y-%m-%d %a %I:%M %p"),
|
||||||
|
widget.QuickExit(),
|
||||||
|
],
|
||||||
|
24,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
||||||
|
mouse = [
|
||||||
|
Drag(["mod4"], "Button1", lazy.window.set_position_floating(), start=lazy.window.get_position()),
|
||||||
|
Drag(["mod4"], "Button3", lazy.window.set_size_floating(), start=lazy.window.get_size()),
|
||||||
|
Click(["mod4"], "Button2", lazy.window.bring_to_front()),
|
||||||
|
]
|
||||||
|
|
||||||
|
dgroups_key_binder = None
|
||||||
|
dgroups_app_rules = []
|
||||||
|
follow_mouse_focus = True
|
||||||
|
bring_front_click = False
|
||||||
|
floats_kept_above = True
|
||||||
|
cursor_warp = False
|
||||||
|
floating_layout = layout.Floating(
|
||||||
|
float_rules=[
|
||||||
|
*layout.Floating.default_float_rules,
|
||||||
|
]
|
||||||
|
)
|
||||||
|
auto_fullscreen = True
|
||||||
|
focus_on_window_activation = "smart"
|
||||||
|
reconfigure_screens = True
|
||||||
|
|
||||||
|
auto_minimize = True
|
223
xmonad/.config/xmonad/xmonad.hs
Normal file
223
xmonad/.config/xmonad/xmonad.hs
Normal file
|
@ -0,0 +1,223 @@
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
-- Imports
|
||||||
|
|
||||||
|
-- Base
|
||||||
|
import XMonad
|
||||||
|
import System.Exit
|
||||||
|
import qualified XMonad.StackSet as W
|
||||||
|
|
||||||
|
-- Dataq
|
||||||
|
import Data.Monoid
|
||||||
|
import qualified Data.Map as M
|
||||||
|
|
||||||
|
-- Layouts
|
||||||
|
import XMonad.Layout.ThreeColumns
|
||||||
|
|
||||||
|
-- Layout modifiers
|
||||||
|
import XMonad.Layout.LayoutModifier
|
||||||
|
import XMonad.Layout.PerWorkspace
|
||||||
|
import XMonad.Layout.Renamed
|
||||||
|
import XMonad.Layout.Spacing
|
||||||
|
import qualified XMonad.Layout.ToggleLayouts as T (toggleLayouts, ToggleLayout(Toggle))
|
||||||
|
|
||||||
|
-- Hooks
|
||||||
|
import XMonad.Hooks.EwmhDesktops
|
||||||
|
import XMonad.Hooks.InsertPosition
|
||||||
|
import XMonad.Hooks.ManageHelpers
|
||||||
|
import XMonad.Hooks.WindowSwallowing
|
||||||
|
|
||||||
|
-- Utilities
|
||||||
|
import XMonad.Util.EZConfig
|
||||||
|
import XMonad.Util.Hacks (javaHack, windowedFullscreenFixEventHook)
|
||||||
|
import XMonad.Util.NamedScratchpad
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
-- Main options
|
||||||
|
|
||||||
|
myTerminal = "st"
|
||||||
|
|
||||||
|
myWorkspaces = ["1", "2", "3", "4", "5", "6", "7", "8", "9"]
|
||||||
|
|
||||||
|
mySwallowClasses = ["St", "XTerm"]
|
||||||
|
|
||||||
|
myBorderWidth = 1
|
||||||
|
myNormalBorderColor = "#888888"
|
||||||
|
myFocusedBorderColor = "#ff0000"
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
-- Scratchpads
|
||||||
|
|
||||||
|
myScratchPads =
|
||||||
|
[ NS "terminal" "st -c scratchpad" (className =? "scratchpad") (customFloating $ W.RationalRect (1/6) (1/6) (2/3) (2/3))
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
-- Key action functions
|
||||||
|
|
||||||
|
toggleFloat :: Window -> X ()
|
||||||
|
toggleFloat = \w -> do
|
||||||
|
floating <- gets (M.member w . W.floating . windowset)
|
||||||
|
if floating
|
||||||
|
then windows $ W.sink w
|
||||||
|
else withFocused float
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
-- Key bindings
|
||||||
|
|
||||||
|
myKeys = \c -> mkKeymap c $
|
||||||
|
-- Launching
|
||||||
|
[ ("M-<Return>", spawn $ terminal c)
|
||||||
|
, ("M-p", spawn "dmenu_run")
|
||||||
|
|
||||||
|
-- Layouts
|
||||||
|
, ("M-<Tab>", sendMessage NextLayout)
|
||||||
|
, ("M-t", sendMessage $ JumpToLayout "tall")
|
||||||
|
, ("M-w", sendMessage $ JumpToLayout "wide")
|
||||||
|
, ("M-m", sendMessage $ JumpToLayout "monocle")
|
||||||
|
|
||||||
|
-- Window focus
|
||||||
|
, ("M-j", windows W.focusDown)
|
||||||
|
, ("M-k", windows W.focusUp)
|
||||||
|
|
||||||
|
-- Master focus/swap
|
||||||
|
, ("M-v", windows W.focusMaster)
|
||||||
|
, ("M-S-v", windows W.swapMaster)
|
||||||
|
|
||||||
|
-- Swap windows
|
||||||
|
, ("M-S-j", windows W.swapDown)
|
||||||
|
, ("M-S-k", windows W.swapUp)
|
||||||
|
|
||||||
|
-- Master area
|
||||||
|
, ("M-h", sendMessage Shrink)
|
||||||
|
, ("M-l", sendMessage Expand)
|
||||||
|
|
||||||
|
-- Window actions
|
||||||
|
, ("M-S-c", kill)
|
||||||
|
, ("M-S-f", sendMessage $ T.Toggle "monocle")
|
||||||
|
, ("M-S-<Space>", withFocused $ toggleFloat)
|
||||||
|
|
||||||
|
-- Master amount
|
||||||
|
, ("M-i", sendMessage (IncMasterN 1))
|
||||||
|
, ("M-d", sendMessage (IncMasterN (-1)))
|
||||||
|
|
||||||
|
-- Scratchpads
|
||||||
|
, ("M-'", namedScratchpadAction myScratchPads "terminal")
|
||||||
|
|
||||||
|
-- Window spacing
|
||||||
|
, ("M-S-i", incWindowSpacing 4)
|
||||||
|
, ("M-S-d", decWindowSpacing 4)
|
||||||
|
|
||||||
|
-- Session
|
||||||
|
, ("M-S-<Delete>", io (exitWith ExitSuccess))
|
||||||
|
, ("M-<Delete>", spawn "xmonad --recompile; xmonad --restart")
|
||||||
|
] ++
|
||||||
|
|
||||||
|
-- View workspace N
|
||||||
|
[ ("M-" ++ show i, windows $ W.greedyView (myWorkspaces !! (i-1)))
|
||||||
|
| i <- [1..9]
|
||||||
|
] ++
|
||||||
|
|
||||||
|
-- Shift window to workspace N
|
||||||
|
[ ("M-S-" ++ show i, windows $ W.shift (myWorkspaces !! (i-1)))
|
||||||
|
| i <- [1..9]
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
-- Mouse bindings
|
||||||
|
|
||||||
|
myMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList $
|
||||||
|
-- Set the window to floating mode and move by dragging
|
||||||
|
[ ((modm, button1), (\w -> focus w >> mouseMoveWindow w >> windows W.shiftMaster))
|
||||||
|
-- Raise the window to the top of the stack
|
||||||
|
, ((modm, button2), (\w -> focus w >> windows W.shiftMaster))
|
||||||
|
-- Set the window to floating mode and resize by dragging
|
||||||
|
, ((modm, button3), (\w -> focus w >> mouseResizeWindow w >> windows W.shiftMaster))
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
-- Layouts
|
||||||
|
|
||||||
|
tall =
|
||||||
|
renamed [Replace "tall"]
|
||||||
|
$ spacing 4
|
||||||
|
$ Tall 1 (3/100) (1/2)
|
||||||
|
wide =
|
||||||
|
renamed [Replace "wide"]
|
||||||
|
$ Mirror tall
|
||||||
|
monocle =
|
||||||
|
renamed [Replace "monocle"]
|
||||||
|
$ spacing 4
|
||||||
|
$ Full
|
||||||
|
threeCol =
|
||||||
|
renamed [Replace "threeCol"]
|
||||||
|
$ spacing 4
|
||||||
|
$ ThreeCol 1 (3/100) (1/2)
|
||||||
|
|
||||||
|
myLayout =
|
||||||
|
onWorkspaces ["4", "5"] monocle
|
||||||
|
$ T.toggleLayouts monocle
|
||||||
|
$ tall ||| wide ||| monocle ||| threeCol
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
-- Window rules
|
||||||
|
|
||||||
|
|
||||||
|
myManageHook = composeAll
|
||||||
|
[ className =? "MPlayer" --> doFloat
|
||||||
|
, className =? "Gimp" --> doFloat
|
||||||
|
, resource =? "desktop_window" --> doIgnore
|
||||||
|
, resource =? "kdesktop" --> doIgnore
|
||||||
|
, isFullscreen --> doFullFloat
|
||||||
|
] <+> namedScratchpadManageHook myScratchPads <+> insertPosition End Newer
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
-- Event handling
|
||||||
|
|
||||||
|
myEventHook =
|
||||||
|
swallowEventHook (foldr1 (<||>) $ map (\name -> className =? name) mySwallowClasses) (return True)
|
||||||
|
-- Fixes
|
||||||
|
<> windowedFullscreenFixEventHook
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
-- Status bars and logging
|
||||||
|
|
||||||
|
myLogHook = return ()
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
-- Main
|
||||||
|
|
||||||
|
-- Static options
|
||||||
|
myModMask = mod4Mask
|
||||||
|
myFocusFollowsMouse = True
|
||||||
|
myClickJustFocuses = False
|
||||||
|
|
||||||
|
main :: IO ()
|
||||||
|
main = do
|
||||||
|
xmonad $ def
|
||||||
|
{ terminal = myTerminal
|
||||||
|
, focusFollowsMouse = myFocusFollowsMouse
|
||||||
|
, clickJustFocuses = myClickJustFocuses
|
||||||
|
, borderWidth = myBorderWidth
|
||||||
|
, modMask = myModMask
|
||||||
|
, workspaces = myWorkspaces
|
||||||
|
, normalBorderColor = myNormalBorderColor
|
||||||
|
, focusedBorderColor = myFocusedBorderColor
|
||||||
|
|
||||||
|
, keys = myKeys
|
||||||
|
, mouseBindings = myMouseBindings
|
||||||
|
|
||||||
|
, layoutHook = myLayout
|
||||||
|
, manageHook = myManageHook
|
||||||
|
, handleEventHook = myEventHook
|
||||||
|
, logHook = myLogHook
|
||||||
|
}
|
Loading…
Reference in a new issue