cwm 是一款 X11 窗口管理器,它的重點是讓你擺脫困境,提高工作效率。 它最初源於 evilwm,但代碼庫已從頭開始重新編寫。
cwm 是作為 OpenBSD 基本系統的一部分開發的。此外,還有一個可在 Linux 上運行的 "便攜"版本。
安裝
安裝下列軟體包之一:
配置
cmw 通過編輯 ~/.cwmrc
進行配置。沒有默認的 cwmrc
文件;所有默認設置(包括按鍵綁定)都在 conf.c 中定義。cwm(1)列出了默認按鍵;cwmrc(5)列出了所有配置指令。
不過,您可以使用 unbind-key all
和 unbind-mouse all
刪除所有默認鍵綁定。
窗口分組
cwm 沒有傳統的"工作區",但可以將窗口分配到"組"中。這是一種更靈活的方法,因為可以同時顯示兩個或多個組,而且與許多平鋪窗口管理器的工作區功能相似或相同。
例如,可以將聊天/IRC 應用程式放在第 4 組,然後指定一個鍵來切換該組的可見性(bind-key <k> group-toggle 4
),以便在顯示其他窗口/組的同時顯示該組。
您還可以使用 bind-key <k> group-only <n>
來顯示僅該組中的窗口,隱藏其他所有窗口。
新窗口的默認設置是不歸入任何組,這意味著它們將始終顯示(許多 WM 將其稱為 "粘性 "窗口)。不過,通過使用 sticky yes
啟用 "粘性組模式",窗口將默認分配到當前選定的組中。
您還可以使用 autogroup
目錄對窗口進行自動分組。
移動窗口
沒有將窗口移動到預定義位置的操作;但可以使用 xdotool包 解決這個問題;將 cwm-w-mv
腳本放到 PATH
中:
#!/bin/sh # Move a window to the side of a screen. case "$1" in "left") xdotool getactivewindow windowmove 0 y ;; "top") xdotool getactivewindow windowmove x 0 ;; "right") screen_width=$(xwininfo -root | grep Width | cut -d: -f2 | tr -d ' ') win_width=$(xdotool getactivewindow getwindowgeometry --shell | grep WIDTH | cut -d= -f2) xdotool getactivewindow windowmove $(( $screen_width - $win_width )) y ;; "bottom") screen_height=$(xwininfo -root | grep Height | cut -d: -f2 | tr -d ' ') win_height=$(xdotool getactivewindow getwindowgeometry --shell | grep HEIGHT | cut -d= -f2) xdotool getactivewindow windowmove x $(( $screen_height - $win_height )) ;; *) echo "Unsupported: \"$1\"" exit 1 esac
然後在 cwm 中進行綁定,例如
bind-key 4-h cwm-w-mv left # Move window to side of the screen. bind-key 4-j cwm-w-mv bottom bind-key 4-k cwm-w-mv top bind-key 4-l cwm-w-mv right bind-key 4-Left cwm-w-mv left bind-key 4-Down cwm-w-mv bottom bind-key 4-Up cwm-w-mv top bind-key 4-Right cwm-w-mv right
這將使 Mod4("Windows 鍵")加 hjkl 或方向鍵將窗口移到側面。
參見
- OpenBSD 源
- 便攜版
- cwmrc 示例:[1]
- Absolute OpenBSD 包含 CWM 簡介。