最近在玩 awesome 這個 tiling window manager,玩得不亦樂乎,於是整理了筆記,分享給大家。
見附件。
|
awesome 是現在極少數支援 pango 卻不依賴 GTK+ 的精簡程式。
(目前 99% 以上使用 pango 的程式都依賴 GTK+)
awesome 使用 pango + cairo,可正確顯示多國語言,確實是很不錯的 window manager。
|
|
這個好用!
|
|
Joey Hess 是 Debian 的大神之一,他是典型的 KISS 支持者 (Keep It Simple, Stupid)。
他的許多觀點都很有意思,底下是他對 awesome 3.x 的不滿:
原文:http://kitenet.net/~joey/blog/entry/awesomely_frustrated/
Just spent a good two^Wthree hours trying to configure awesome 3.0 to match my
awesome 2.x setup. Docs are effectively nonexistant. So far, I'm stuck on
several fronts:
- I want to be able to left click on a titlebar and drag to resize.
Without pressing the modkey. But the definition for that is set deep
within awful.lua, which is not a configuration file, and so I cannot
see a good way to configure it.
- Why can't I resize an xterm to 80 characters wide? It jumps between 79
and 81.
- Why is it that despite using the same font as with 2.0, enough additional
vertical space is used by the title bar and status bar, that I get one
less line in all my xterms? It's using only a few pixels more than
before, but that's too much..
- How do I configure a textbox so that, if I click on it, a command is run?
Update: Figured this one out, for example:
mympd:mouse_add(mouse({ }, 1, function () os.execute("awesome-mpd show &") end))
(Note that if the command isn't run in the background, and opens a window, it will
deadlock awesome.)
- Can't figure out how to use awesome-client to add a value to a graph
widget. (I'm sure this is simple, but I haven't stumbled over an
example. I'd use wicked, but it's not packaged.)
Update: Figured it out via the source: mpgraph:plot_data_add("foo", "10")
- Can't figure out how to make a textbox widget have a fixed width and
truncate the text in it. Since it's displaying the currently plaging
song, using the default dynamic width would make everything on my status
bar jump around.
Update: mytextbox.width=100
- There's no emptybox widget aymmore, so how do I add horizontal padding
between widgets? Best I've managed so far is an empty textbox with a
defined width.
Anyone else hate lua, or at least build-your-own-WM-in-lua config files for
window managers that used to have simple config files? |
|
Anyone else hate lua, or at least build-your-own-WM-in-lua config files for
window managers that used to have simple config files?
|
大概是因為一堆 game 都用 lua 的關係?帶動了一堆爐鴨熱。
爐鴨是沒什麼好或不好,但也不要弄得到處都是,設定檔我個人就覺得很沒必要。
我看 KISS 要有新解才行:Keep It Stupid Smart. 把簡單的事情給弄複雜了!XD
|
awesome 3 還沒進 Debian 的 testing,剉咧等 …… XD
|
最近 Debian Squeeze 升級到 awesome 3 了
好加在我多半用預設設定,需要改的地方不多
dmenu 的設定網路上可找得到:
Arch Linux Forums / awesome 3 queries
dmenu = "dmenu_run -fn 'CodingFontTobi-10' -nb '#333333' -nf '#ffffff' -sb '#1793d1' -sf '#ffffff'"
keybinding({ modkey }, "p", function () awful.util.spawn(dmenu) end):add()
我的設定
key({ modkey }, "F2",
function()
awful.util.spawn("dmenu_run -i -b -nb '#303030' -nf '#CCCCCC' -sb '#97B26B' -sf '#000000'")
end),
dmenu 實在超好用的,那是 dwm-tools 提供的工具,即使你用的不是 dwm、awesome window manager,也可以用。
edited: 1
|
把心得根據 awesome 3.2rc4 的 manpage 修改好了,請看此篇的附件。
edited: 1
|
以前用 Win + b 可以隱藏 statusbar,現在要在 rc.lua 自已設定才行
-- press "Mod4 + b" to hide the statusbar
key({ modkey }, "b", function ()
if mywibox[mouse.screen].screen == nil then
mywibox[mouse.screen].screen = mouse.screen
else
mywibox[mouse.screen].screen = nil
end
end):add() |
離開電腦時,如想按某些鍵直接鎖住螢幕,可以這麼設定
-- press "Mod4 + F12" to lock the screen
key({ modkey }, "F12",
function ()
awful.util.spawn('xscreensaver-command -lock')
end):add() |
這邊用的是 xscreensaver,xscreensaver 是 client/server 的架構,所以要先在 .xinitrc 內執行 xscreensaver &, 這邊按 Win + F12 才用作用。
參考資訊:
Awesome3
FAQ
|
最近學會 gcb 的用法,gcb 與 gcin 的設定畫面在 awesome window manager 會被自動放到最大,很難用,可以透過下列設定解決:
編輯 ~/.config/awesome/rc.lua,在 awful.rules.rules = { …… } 這個區塊內加入以下
{ rule = { instance = "gcin-tools" }, properties = { floating = true } }, { rule = { instance = "gcin" }, properties = { floating = true } },
gcb 的位置可以在「gcin 設定/工具」中的「內定輸入法 & 開啟/關閉」調整
edited: 2
|
最近在玩佈景主題,awesome 佈景主題在 官方的 wiki 有詳細說明
awesome 對佈景主題的支援是透過一個名為 beautiful 的 lua library,是為 awesome 3 以上的版本寫的。
預設狀態下,awesome 切換佈景主題的方式有點簡陋,必需修改 rc.lua 中的設定:
-- 載入 theme 的程式庫 require("beautiful")
-- 設定使用的 theme beautiful.init("path_to_theme_file")
-- beautiful.init 實例:可使用內建程式庫來抓設定資料夾的位置,也可簡單直接指定 beautiful.init(awful.util.getdir("config") .. "/themes/default/theme.lua") beautiful.init("/home/USER/.config/awesome/themes/default/theme.lua")
debian 的 awesome package (v3.4.11-2) 本身附帶有幾個佈景主題:default、sky 與 zenburn,放在 /usr/share/awesome/themes 中,可將 /usr/share/awesome/themes 複製到 ~/.config/awesome/ 方便自己修改亂搞
$ cp -R /usr/share/awesome/themes ~/.config/awesome/
上面紅字的部分就是佈景主題資料夾的名稱
可能有人不滿足於這樣陽春的設定方式,所以官方的 wiki 提供了進階一點的設定,讓我們可以用 awesome 的 menu 來切換佈景主題:
修改 rc.lua 的設定
-- 載入 ~/.config/awesome/current_theme/theme.lua
beautiful.init(awful.util.getdir("config") .. "/current_theme/theme.lua")
-- 選單函式的設定
mythememenu = {} function theme_load(theme) local cfg_path = awful.util.getdir("config") -- Create a symlink from the given theme to /home/user/.config/awesome/current_theme -- (在 /home/USER/.config/awesome/ 建立 symlink current_theme 指向 -- /home/USER/.config/awesome/themes/THEME_NAME) awful.util.spawn("ln -sfn " .. cfg_path .. "/themes/" .. theme .. " " .. cfg_path .. "/current_theme") awesome.restart() end function theme_menu() -- List your theme files and feed the menu table (列出可用的佈景主題並餵給 menu table) local cmd = "ls -1 " .. awful.util.getdir("config") .. "/themes/" local f = io.popen(cmd) for l in f:lines() do local item = { l, function () theme_load(l) end } table.insert(mythememenu, item) end f:close() end
-- Generate your table at startup or restart (啟動或重啟 awesome 時,產生 theme table) theme_menu()
-- Modify your awesome menu to add your theme sub-menu (在主選單中加入切換 theme 的項目) myawesomemenu = { { "manual", terminal .. " -e man awesome" }, { "edit config", editor_cmd .. " " .. awful.util.getdir("config") .. "/rc.lua" }, { "themes", mythememenu }, { "restart", awesome.restart }, { "quit", awesome.quit } }
接下來,必需先手動建立一個 symlink
ln -sfn /home/USER/.config/awesome/themes/THEME_NAME /home/USER/.config/awesome/current_theme
藍字部分請自行代換。
重新啟動 awesome 後應該可以看到選單內多了 themes 選項了,可以藉選單來切換 themes!
edited: 1
|