Skip to content

iogrt/XMonadEngineerLayout

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Engineer Layout

An XMonad layout for fine-grained customisation. It allows you to set pre-defined layouts for when a specific group of windows is present on the workspace. Window categories and how to categorise them is left up to you to define.

Example: example all layouts

Instalation

Download the EngineerLayout.hs file in this repo (or clone everything) and place that file inside your xmonad lib directory (~.xmonad/lib/)

⚠ Warning

While hot reloading a modified config you need to press mod+shift+space to see changes

Example config

  1. Define the datatype for window categories. It needs to derive Show Ord Eq and Read
import EngineerLayout

data ProgramType = Discord
                 | Emacs
                 | Browser
                 | Terminal
                 | Other deriving (Show, Ord, Eq, Read)
  1. Create the windowFunction, which has the window categorization logic
  • the function type here is windowFunction MyWindowFn :: (Window) -> X ProgramType) alter the instance according to your datatype and name MyWindowFnwhatever you like.
  • look here for querying other window properties beyond appName
  • use xprop to find out window properties of the apps you use.
data MyWindowFn = MyWindowFn deriving(Show,Read)
instance WindowFn MyWindowFn ProgramType where
  windowFunction _ =
    runQuery (pickProgram <$> appName)
    where
      pickProgram "discord" = Discord
      pickProgram "emacs" = Emacs
      pickProgram "google-chrome" = Browser
      pickProgram "qutebrowser" = Browser
      pickProgram "kitty" = Terminal
      pickProgram _ = Other
  1. Use the layout, declaring where to place windows in various combinations and at the end, giving a default layout if the categories are different.
myLayout = Engineer MyWindowFn
    [ [ (Discord, RationalRect (2%12) (1%12) (8%12) (10%12))]
    , [ (Browser, RationalRect (3%20) 0 (7%10) 1)]
    , [ (Browser,RationalRect (4%10) 0 (6%10) 1)
      , (Discord,RationalRect 0 0 (4%10) 1)
      ]
    , [ (Emacs, RationalRect (3%12) (1%48) (6%12) (46%48))]
    , [ (Emacs, RationalRect (1%50) (1%50) (23%50) (48%50))
      , (Emacs, RationalRect (26%50) (1%50) (23%50) (48%50))
    ]
    , [ (Terminal, RationalRect (3%12) (10%48) (6%12) (24%48))]
    ] (GridRatio 1.5)

Example Result

Browser

[ (Browser, RationalRect (3%20) 0 (7%10) 1)]

My layout for Browser

Discord

[ (Discord, RationalRect (2%12) (1%12) (8%12) (10%12))]

Result layout for Discord

Browser and Discord

[ (Browser,RationalRect (4%10) 0 (6%10) 1)
, (Discord,RationalRect 0 0 (4%10) 1)
]

Result layout for Browser and Discord

One Emacs

[ (Emacs, RationalRect (3%12) (1%48) (6%12) (46%48))]

Result layout for Emacs

Two Emacs

[ (Emacs, RationalRect (1%50) (1%50) (23%50) (48%50))
, (Emacs, RationalRect (26%50) (1%50) (23%50) (48%50))
]

Result layout for two emacs

Terminal

[ (Terminal, RationalRect (3%12) (10%48) (6%12) (24%48))]

Result layout for Browser

About

a layout for pre-defined placement for XMonad

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published