Reputation: 63
I've installed Awesome WM about a week ago. Since then I've been trying to place terminal clients (bare terminal and vim, vifm, htop) in a specific order on startup. Here is a visual representation of what I'm trying to achieve:
########################
# # htop #
# ###########
# vim # bare #
# ###########
# # vifm #
########################
I've managed to place vim in the right position, but other windows are placed in what seems to be an arbitrary order, which changes with every reboot. Here is the content of my autostart.lua config:
1 local awful = require("awful")
1
2 awful.spawn.single_instance(terminal.."-e xmodmap ~/.Xmodmap; exit")
3 awful.spawn.single_instance("brave-browser", {
4 fullscreen = true,
5 focus = true
6 })
7
8 awful.spawn(terminal.." -e vim", {
9 tag = "edit",
10 placement = awful.placement.left,
11 callback = function(c) awful.client.setmaster(c) end})
12 awful.spawn(terminal.." -e htop", {
13 tag = "edit",
14 height = 80,
15 placement = awful.placement.top_right})
16 awful.spawn(terminal, {
17 tag = "edit",
18 placement = awful.placement.right})
19 awful.spawn(terminal.." -e vifm", {
20 tag = "edit",
21 placement = awful.placement.bottom_right})
22
23 awful.spawn(terminal.." -e neomutt", {
24 tag = "communication",
25 fullscreen = true })
26
27 awful.spawn("Spotify", { tag = "read" })
The layout of the tag with which I have problem is "tile". I'm on Awesome v4.3. What client property should I add to get the desired behavior?
Upvotes: 2
Views: 1085
Reputation: 63
To get clients been spawned in the desired positions on startup callback option should be used. Here is a chunk of my autostart.lua file related to the issue:
1 local awful = require("awful")
1
2 local function spawn_vifm ()
3 awful.spawn(terminal.." -e vifm", {
4 tag = "edit",
5 placement = awful.placement.bottom_right
6 })
7 end
8
9 local function spawn_term ()
10 awful.spawn(terminal, {
11 tag = "edit",
12 placement = awful.placement.right,
13 callback = function(c) spawn_vifm() end
14 })
15 end
16
17 local function spawn_htop ()
18 awful.spawn(terminal.." -e htop", {
19 tag = "edit",
20 placement = awful.placement.top_right,
21 callback = function(c) spawn_term() end
22 })
23 end
.......
38 awful.spawn(terminal.." -e vim", {
39 tag = "edit",
40 placement = awful.placement.left,
41 callback = function(c)
42 awful.client.setmaster(c)
43 store_active_client(awful.tag.find_by_name(awful.screen.focused(), "edit"), c)
44 spawn_htop()
45 end
46 })
Spawning the next client in the callback function of the previous one ensures, that the placement property will be preserved for both of them.
Upvotes: 3
Reputation: 2147
I don't know what you mean by this: "The layout of the tag with which I have problem is tiled left." I assume you mean that your terminals aren't tiling properly? I've used AwesomeWM for about a week a few years ago, but realized quickly it needs a lot of tinkering to get exactly how you want it. What's happening to you is exactly what I was running into.
Found it easier just to use LXDE and Devilspie2. You can Lua script windows to undecorate & maximise, jump to other desktops or whatever you want, fairly easily. This might help get you where you're going, but it's hard to say, without clarification on your question.
local screenwidth = awful.screen.geometry.width
local screenheight = awful.screen.geometry.height
local halfwidth = math.floor( screenwidth /2 )
local thirdheight = math.floor( screenheight /3 )
awful .spawn( terminal .." -e vim", {
tag = "edit",
width = halfwidth,
height = screenheight,
placement = awful .placement .left,
callback = function(c) awful .client .setmaster(c) end } )
awful .spawn( terminal.." -e htop", {
tag = "edit",
width = halfwidth,
height = thirdheight,
placement = awful .placement .top_right } )
awful .spawn( terminal, { -- bare
tag = "edit",
width = halfwidth,
height = thirdheight,
placement = awful .placement .right } )
awful .spawn( terminal .." -e vifm", {
tag = "edit",
width = halfwidth,
height = thirdheight,
placement = awful .placement .bottom_right } )
Also, I'd point out that Conky might be a viable solution, if you're just looking to view terminal output on your desktop, while scripting in Lua.
Upvotes: 1