Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Cover image for Oh, My Xmonad!
Abhishek Anand Amralkar
Abhishek Anand Amralkar

Posted on

     

Oh, My Xmonad!

Well, I use Linux(On Debian Buster currently) on almost all of my personal laptops + desktop, and when you use Linux you get N numbers of options for almost everything to plug and play and use it.

In Linux, you have various GUIs available and my personal favorite is Gnome3 because of its clean user interface and the tweaks it allows for the look and feels.

The problems with GUIs

  • How to manage the various windows. I ended up buying an extra monitor.

  • Space issues like a title bar and subtitle bar etc so in the end you end up with a very small space (actually not that small) for your actual work.

  • Sometime it feels sluggish and needs a lot more resources than you want to spend on GUIs stuff.

  • The unwanted stuff you get along with the GUIs which you will never be going to use.

So What's the Fix?

Enter the Tiling Window Manager. There are many options available but my favorite is Xmonad.

Xmonad a minimal tiling window manager written in Haskell and DIY tiling manager which means it comes with no batteries you need to manage your Xmonad via a config file

~/.xmonad/xmonad.hs

Xmonad is very light and easy to use (actually not that easy) but man once you understand the terminologies you will love it and again you will learn little bit Haskell isn't it cool?

Another cool thing about the tiling window manager is you move towards a keyboard-driven approach and that means a less distraction at least for me and super productive.

Configurations

Let's walk through the config file snippet for the Xmonad

importXMonadimportSystem.ExitimportqualifiedXMonad.StackSetasWimportqualifiedData.MapasMmyTerminal="terminator"myBorderWidth=1myModMask=mod1Mask

In the above config

  • I have defined my defaultterminal and I loveTerminator .

  • I definedmyModmask which means mymodkey which I bind tomod1Mask which means the leftAlt key on QWERTY keyboard.

Key Bindings

myKeysconf@(XConfig{XMonad.modMask=modm})=M.fromList$[((modm.|.shiftMask,xK_Return),spawn$XMonad.terminalconf),((modm,xK_Print),spawn"scrot screen_%Y-%m-%d-%H-%M-%S.png -d 1"),((modm.|.controlMask,xK_Print),spawn"scrot window_%Y-%m-%d-%H-%M-%S.png -d 1-u"),((modm,xK_p),spawn"exe=`dmenu_path | dmenu` && eval\"exec $exe\""),((modm.|.shiftMask,xK_p),spawn"gmrun"),((modm.|.shiftMask,xK_c),kill),((modm,xK_h),sendMessageShrink),((modm,xK_l),sendMessageExpand),((modm,xK_t),withFocused$windows.W.sink)]

The above is just a snippet from my Xmonad config file. Let's go through the keywords we are seeing in the above snippet.

XMonad.modMask=modm

For my meta key or mod key, I will be using modm. Later part we can define our key bindings.

  • To launch a terminal
((modm.|.shiftMask,xK_Return),spawn$XMonad.terminalconf)

The above code snippet will bind themeta key ormod key in my case itsAlt key andshiftMask = Shift Key plusEnter = xK_Return tospawn my terminal which isTerminator.

  • ScreenShots
((modm,xK_Print),spawn"scrot screen_%Y-%m-%d-%H-%M-%S.png -d 1"),((modm.|.controlMask,xK_Print),spawn"scrot window_%Y-%m-%d-%H-%M-%S.png -d 1-u")

To take a screenshot for full screen or for the focused window bind the keymodm and ControlKey + PrintScreen Key and it will spawn a daemon namescrot. On other notescrot stands forSCReenshoT.

  • Open a Menu or DMenu
((modm,xK_p),spawn"exe=`dmenu_path | dmenu` && eval\"exec $exe\"")

The above command will open Dmenu and we can just type the program name we want to access likenautilus,brave,emacs etc.

  • To kill a focus window
((modm.|.shiftMask,xK_c),kill)

The above command which isalt and shift + c will kill the focused window.

  • To shrink the window
((modm,xK_h),sendMessageShrink)

The above command which isalt + h will shrink the focused window.

  • To expand the window
((modm,xK_l),sendMessageExpand)

The above command which isalt + l will expand the focused window.

  • To move focus to next window
((modm,xK_j),sendMessageExpand)
  • To move focus to the previous window
((modm,xK_j),sendMessageExpand)
  • To switch between tiling mode
((modm,xK_space),sendMessageNextLayout)

All above key bindings are a few drops out of the ocean. Please refer to the official documentation for more config settings.

Conclusion

  • Tiling window manager is really good when you need a minimal GUI and mostly your work is Keyboard driven.

  • Tiling window manager needs some learning actually it really needs to rewire your mind in order to operate.

  • Tiling window manager is lightweight and can work on low-end machines, old machines.

Happy Tiling!!

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Abhishek leads the Cloud Infrastructure / DevSecOps team where he designs the next generation of Cloud Infrastructure in a cost-effective and reliable manner without comprising
  • Location
    Pune
  • Education
    B.E Computers
  • Work
    Cloud DevOps Architect
  • Joined

More fromAbhishek Anand Amralkar

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp