dwm官網:https://dwm.suckless.org/
dwm是一個簡潔的平鋪式窗口管理器
配置簡單,使用便捷,沒有多少依賴,占用內存非常小
總之dwm正合口味
安裝方法
首先在官網下載dwm.tar.gz並解壓
得到這些東西:
BUGS config.mk drw.h dwm.c dwm.png Makefile...
我們主要來編輯config.h來進行一些配置和編輯config.mk來正確編譯
對config.h來說,只要略微閱讀官網文檔即可配置,詳見https://dwm.suckless.org/customisation/
我覺得原設定除了firefox的tags mask以外,就沒什么需要了
改了一下selbordercolor, selbgcolor, selfgcolor, topbar,就是狀態欄的邊界、背景和字體顏色還有底部狀態欄
注意dmenu還是在頂部,要改底部的話應該在dmenu那里配置
cp config.def.h config.h
// config.h
/* See LICENSE file for copyright and license details. */
/* appearance */
static const char *fonts[] = {
"monospace:size=10"
};
static const char dmenufont[] = "monospace:size=10";
static const char normbordercolor[] = "#444444";
static const char normbgcolor[] = "#222222";
static const char normfgcolor[] = "#bbbbbb";
static const char selbordercolor[] = "#000000"; // "#005577";
static const char selbgcolor[] = "#669999"; // "#005577";
static const char selfgcolor[] = "#000000"; // "#eeeeee";
static const unsigned int borderpx = 1; /* border pixel of windows */
static const unsigned int snap = 32; /* snap pixel */
static const int showbar = 1; /* 0 means no bar */
static const int topbar = 0; // 1; /* 0 means bottom bar */
/* tagging */
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
static const Rule rules[] = {
/* xprop(1):
* WM_CLASS(STRING) = instance, class
* WM_NAME(STRING) = title
*/
/* class instance title tags mask isfloating monitor */
{ "Gimp", NULL, NULL, 0, 1, -1 },
// { "Firefox", NULL, NULL, 1 << 8, 0, -1 },
};
/* layout(s) */
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
static const int nmaster = 1; /* number of clients in master area */
static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
static const Layout layouts[] = {
/* symbol arrange function */
{ "[]=", tile }, /* first entry is default */
{ "><>", NULL }, /* no layout function means floating behavior */
{ "[M]", monocle },
};
/* key definitions */
#define MODKEY Mod1Mask
#define TAGKEYS(KEY,TAG) \
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
/* commands */
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf", selfgcolor, NULL };
static const char *termcmd[] = { "st", NULL };
static Key keys[] = {
/* modifier key function argument */
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
{ MODKEY, XK_b, togglebar, {0} },
{ MODKEY, XK_j, focusstack, {.i = +1 } },
{ MODKEY, XK_k, focusstack, {.i = -1 } },
{ MODKEY, XK_i, incnmaster, {.i = +1 } },
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
{ MODKEY, XK_Return, zoom, {0} },
{ MODKEY, XK_Tab, view, {0} },
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
{ MODKEY, XK_space, setlayout, {0} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
{ MODKEY, XK_0, view, {.ui = ~0 } },
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
{ MODKEY, XK_period, focusmon, {.i = +1 } },
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
TAGKEYS( XK_1, 0)
TAGKEYS( XK_2, 1)
TAGKEYS( XK_3, 2)
TAGKEYS( XK_4, 3)
TAGKEYS( XK_5, 4)
TAGKEYS( XK_6, 5)
TAGKEYS( XK_7, 6)
TAGKEYS( XK_8, 7)
TAGKEYS( XK_9, 8)
{ MODKEY|ShiftMask, XK_q, quit, {0} },
};
/* button definitions */
/* click can be ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
static Button buttons[] = {
/* click event mask button function argument */
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
{ ClkWinTitle, 0, Button2, zoom, {0} },
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
{ ClkTagBar, 0, Button1, view, {0} },
{ ClkTagBar, 0, Button3, toggleview, {0} },
{ ClkTagBar, MODKEY, Button1, tag, {0} },
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
};
接下來開始改寫config.mk,用來順利通過make
對於一般linux用戶,我們這樣make即可
make X11INC=/usr/include/X11 X11LIB=/usr/lib/X11 FREETYPEINC=/usr/include/freetype2
編譯過后鏈接一下
ln -s /usr/local/dwm-6.1/dwm /usr/bin/
我是十分討厭開機自動進入圖形界面的,所以啟動時startx就好
至於為什么討厭,原因是在做神經網絡的時候,安裝nvidia顯卡驅動后gnome各種崩潰進入不了命令行,只能借別人電腦寫啟動盤重新安裝arch
dwm補丁的安裝
用了dwm后,有兩個很讓人難受的問題
- 一個就是終端窗口縫隙的問題
這個問題有兩種解決方法
其一,編輯config.h設置resizehints為0
這樣做確實可以解決,然而會帶來vim顯示不正常的問題,於是放棄
其二,用其他的終端程序
我找到了terminator,使用體驗不錯,這個問題將就過去了 - 再一個就是在改變窗口位置的同時,其他標簽的窗口位置也會改變
這個問題有時候實在忍不了,於是考慮安裝補丁pertag
按照dwm版本下載.diff文件
.diff文件是用diff文件生成的,用patch命令即可打上補丁
patch < dwm-pertag-6.1.diff
然后普通的編譯即可
fcitx和狀態欄簡單配置
回宿舍了,配置了一下筆記本,打算寫個隨筆來着
突然發現輸入法忘了裝,於是安裝fcitx
注意fcitx-qt5可能很多源都沒有,不安裝亦可
如果發現某些軟件下載404,很可能是源沒有更新,關於yaourt的用法
yaourt -Sy
yaourt -S fcitx fcitx-im fcitx-googlepinyin fcitx-configtool
記得重啟后用fcitx-configtool添加一下輸入法
最后配置一下狀態欄
# .xinitrc
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export XMODIFIERS=@im=fcitx
fcitx &
while true; do
xsetroot -name "Bat.$(acpi -b | awk '{print $4}') | Vol.$(amixer get Master| tail -n 1 | awk ‘{print $5}' | tr -d '[]') $(LC_ALL='C' date +'%F[%b %a] %R')"
sleep 20
done &
exec dwm
# exec i3
# exec xmonad
順便說一句,燕麥片加了糖好吃了不少
最后加個圖吧
> 2018-3-16更新:修改了yaourt更新源的問題 > 2018-6-09更新:修改了config.h