Skip to content

Xmonad

xmonad is a dynamically tiling X11 window manager that is written and configured in Haskell. In a normal WM, you spend half your time aligning and searching for windows. xmonad makes work easier, by automating this.

Categories

Plugins

검토

Utilities

  • feh: 이미지 프리뷰, 배경 이미지 설정 등.
  • maim: 스크린샷

Installation

xmonad를 사용한다면 다음과 같이 설치한다.

$ sudo pacman -S xmonad xmonad-contrib

Note

업그레이드 후 xmonad --recompile 명령을 사용해야 합니다. 그렇지 않으면 공유 라이브러리를 검색에 문제가 생길 수 있습니다.

Starting

Run xmonad with xinit.

# .xsession

xrdb -merge .Xresources
xpmroot ~/background.xpm &

$HOME/bin/xmonad

Bar/Tray

합성 창 관리자 (Compositing window manager)

Flags

플래그는 다음과 같습니다:

--recompile
~/.xmonad/xmonad.hs에서 구성을 다시 컴파일합니다.
--restart
현재 실행중인 xmonad 프로세스를 다시 시작합니다.
--replace
현재 창 관리자를 xmonad로 바꿉니다.
--version
xmonad의 디스플레이 버전
--verbose-version
xmonad의 상세 버전 표시

Key binding

Xmbindings.png
Xmonad_cheatsheet.png

Default keyboard bindings

mod-shift-return
기본 터미널 실행
mod-p
dmenu 실행
mod-shift-p
gmrun 실행
mod-shift-c
현재 포커스의 윈도우 닫기.
mod-space
사용 가능한 레이아웃 알고리즘을 사용해 윈도우를 회전.
mod-shift-space
현재 작업 공간의 레이아웃을 기본값으로 재설정.
mod-n
Resize viewed windows to the correct size
mod-tab
Move focus to the next window
mod-shift-tab
Move focus to the previous window
mod-j
Move focus to the next window
mod-k
Move focus to the previous window
mod-m
Move focus to the master window
mod-return
Swap the focused window and the master window
mod-shift-j
Swap the focused window with the next window
mod-shift-k
Swap the focused window with the previous window
mod-h
Shrink the master area
mod-l
Expand the master area
mod-t
윈도우를 타일에 배치시킨다. Floating 윈도우를 타일에 다시 배치시키고 싶을 때 사용한다.
mod-comma
Increment the number of windows in the master area
mod-period
Deincrement the number of windows in the master area
mod-shift-q
Quit xmonad
mod-q
Restart xmonad
mod-shift-slash
Run xmessage with a summary of the default keybindings (useful for beginners)
mod-[1..9]
Switch to workspace N
mod-shift-[1..9]
Move client to workspace N
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
mod-button1
Set the window to floating mode and move by dragging
mod-button2
Raise the window to the top of the stack
mod-button3
Set the window to floating mode and resize by dragging

Customization

xmonad is customized in ~/.xmonad/xmonad.hs, and then restarting with mod-q.

You can find many extensions to the core feature set in the xmonad- contrib package, available through your package manager or from xmonad.org.

Modular Configuration

As of xmonad-0.9, any additional Haskell modules may be placed in ~/.xmonad/lib/ are available in GHC's searchpath. Hierarchical modules are supported: for example, the file ~/.xmonad/lib/XMonad/Stack/MyAdditions.hs could contain:

module XMonad.Stack.MyAdditions (function1) where
    function1 = error "function1: Not implemented yet!"

Your xmonad.hs may then import XMonad.Stack.MyAdditions as if that module was contained within xmonad or xmonad-contrib.

List of Tiling window manager

Troubleshooting

Xmonad 멈추는 문제

Xmonad가 window들의 아웃풋을 받아 그를 로깅을 위해 파이프로 출력하는데 파이프가 다 차버렸기 때문에 블럭된것이었다. 그래서 한 윈도우(emacs등)에서 진드감치 작업하면 며칠에 한번씩 블럭되고 여러 윈도우를 왔다갔다 하면 얼마 지나지 않아 얼어버리고 하는 것이었다. 그런데 원래 Xmonad의 상태바인 xmobar에는 stdin을 읽어 화면에 출력해주는 StdinReader 설정을 했다. 그 StdinReader가 죽어버려서 문제였던것.

StdinReader가 왜 죽느냐 또 찾아봤더니 UTF8 코드를 hGetLine()이 처리를 못해서 그렇다고 한다. 넷에는 System.IO.UTF8.hGetLine으로 처리하면 된다고 하는데, 실제로 해보니 죽기는 마찬가지. 이리저리해보다 결국 xmobar의 StdinReader 처리부에서 해당 핸들을 latin1인코딩으로 세팅해버렸다. 그랬더니 안죽는다. 아래 실험 코드에서 bar.txtUTF8문자열이 있다했을때 latin1으로 x를 설정하기 전에는 계속 hGetLine: invalid argument (Invalid or .... multibyte or wide character) 에러를 냈던 것이다.

import IO
import System.IO
import System.IO.UTF8

main = do x <- openFile "/tmp/bar.txt" ReadMode
          hSetEncoding x System.IO.latin1
          y <- System.IO.UTF8.hGetLine x
          IO.putStr y

GNOME with xmonad

The simplest solution to this problem for me was to use

import XMonad
import XMonad.Config.Gnome

main = do
    xmonad $ gnomeConfig

instead of defaultConfig in my ~/.xmonad/xmonad.hs file.

FullScreen SDL Game

I don't play games on my xmonad machines, but maybe this will help. Does SDL use the EWMH fullscreen hint?

I import XMonad.Hooks.EwmhDesktops and then have this in my manage hooks:

isFullscreen --> doFullFloat

I also create an ewmh config object:

ewmhConfig = ewmh defaultConfig

And then I compose ewmhConfig into my manage hooks, layout hooks, and event hooks (ewmhDesktopsEventHook). Oh, and I put the fullscreenEventHook also in with the event hooks.

See also

Favorite site

Guide