![Awesome の特定のタグでプロセス/コマンドを生成するにはどうすればいいですか?](https://rvso.com/image/1304096/Awesome%20%E3%81%AE%E7%89%B9%E5%AE%9A%E3%81%AE%E3%82%BF%E3%82%B0%E3%81%A7%E3%83%97%E3%83%AD%E3%82%BB%E3%82%B9%2F%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89%E3%82%92%E7%94%9F%E6%88%90%E3%81%99%E3%82%8B%E3%81%AB%E3%81%AF%E3%81%A9%E3%81%86%E3%81%99%E3%82%8C%E3%81%B0%E3%81%84%E3%81%84%E3%81%A7%E3%81%99%E3%81%8B%3F.png)
デフォルトの 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
ここで、デフォルトでタグ内のいくつかのアプリケーションを起動したいと思います。例: tags['main'] = ターミナル tags['web'] = web-browser
API ドキュメントを確認しましたが、タグを取得してタグ内でプロセスを生成する方法が見つかりません。
答え1
Awesome は dwm から派生したものですよね? dwm では、特定のプログラムに「ルール」を追加します (デフォルトでは、dwm のソースに gimp と firefox のルールがあります)。
一致するルールを awesome.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},