how to spawn a process/cmd in a specific tag in Awesome?

2

I followed the default rc.lua and created a list of tag of my own.

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

Now I want to start some applications in the tags by default. e.g. tags['main'] = terminal tags['web'] = web-browser

I checked the API doc, but cannot find a way to get the tags, and to spawn a process in the tag.

David S.

Posted 2012-02-07T13:19:52.993

Reputation: 606

Possible duplicate of awesome-wm: binding programs to workspaces

– Nikana Reklawyks – 2017-01-23T07:32:16.820

Answers

4

Awesome is derived from dwm, right? In dwm, you'd add 'rules' for certain programs (by default there is a rule for gimp and firefox in the source for dwm).

Looks like it's the same for awesome-wm, too.

You can add matching rules to your awful.rules.rules table. The default rc.lua already has several examples, but here are some more:

 -- 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},

Rob

Posted 2012-02-07T13:19:52.993

Reputation: 2 152