如何在 Awesome 中的特定標籤中產生進程/cmd?

如何在 Awesome 中的特定標籤中產生進程/cmd?

我遵循預設的 rc.lua 並創建了我自己的標籤清單。

for s = 1, screen.count() do
    -- Each screen has its own tag table.
    tags[s] = awful.tag({ "main", "web", 3, 4, 5, 6, 7, 8, 9 }, s, layouts[2])
end

現在我想預設啟動標籤中的一些應用程式。例如,標籤['main'] = 終端標籤['web'] = 網路瀏覽器

我檢查了 API 文檔,但找不到獲取標籤並在標籤中生成進程的方法。

答案1

Awesome 是源自 dwm 吧?在 dwm 中,您可以為某些程式新增「規則」(預設情況下,dwm 原始碼中有一個針對 gimp 和 firefox 的規則)。

看起來 Awesome-wm 也是。

您可以將符合規則新增至 bad.rules.rules 表中。預設的 rc.lua 已經有幾個範例,但這裡還有更多範例:

 -- Set Firefox to always map on tag number 2 of screen 1
 { rule = { class = "Firefox" },  properties = {tag = tags[1][2]}},

 -- Set Smplayer to tag 4 of screen 1
 { rule = { class = "Smplayer" }, properties = {tag = tags[1][4]}},

 -- Set Emacs to tag 5 of screen 2
 { rule = { class = "Emacs", instance = "emacs" }, properties = {tag = tags[2][5]}},

 -- Set Alpine to tag 6 of the last screen 
 { rule = { name = "Alpine" },    properties = {tag = tags[screen.count()][6]}},

 -- Set Akregator to tag 8 of the last screen and add a titlebar trough callback
 { rule = { class = "Akregator" },properties = {tag = tags[screen.count()][8]},    callback = awful.titlebar.add},

 -- Set Xterm to multiple tags on screen 1
 { rule = { class = "XTerm" }, callback = function(c) c:tags({tags[1][5], tags[1][6]}) end},

 -- Set ROX-Filer to tag 2 of the currently selected and active screen
 { rule = { class = "ROX-Filer" }, callback = function(c) awful.client.movetotag(tags[mouse.screen][2], c) end},

 -- Set ROX-Filer to tag 8 on screen 1 and switch to that tag imidiatelly
 { rule = { class = "ROX-Filer" }, properties = { tag = tags[1][8], switchtotag = true } } 

 -- Set Geeqie to the currently focused tag, as floating
 { rule = { instance = "geeqie" }, properties = {floating = true}},

 -- Set Xterm as floating with a fixed position
 { rule = { class = "XTerm" }, properties = {floating = true}, callback = function(c) c:geometry({x=0, y=0}) end},

相關內容