Output of awesome --version:
awesome v4.2 (Human after all)
• Compiled against Lua 5.3.3 (running with Lua 5.3)
• D-Bus support: ✔
• execinfo support: ✔
• xcb-randr version: 1.5
• LGI version: 0.9.2
How to reproduce the issue:
`
awful.layout.layouts = {
awful.layout.suit.floating,
awful.layout.suit.tile,
awful.layout.suit.fair,
}
...
lo = awful.layout.layouts
my_tags = {
tags = {
{ names = { "float1_1", "float1_2", "tile1_1", "tile1_2" },
layout = { lo[1], lo[1], lo[2], lo[2] }
},
{ names = { "float2_1", "tile2_1", "fair2_1", "float2_2", "tile2_2" },
layout = { lo[1], lo[2], lo[3], lo[1], lo[2] }
},
}
}
`
Here you can see that monitor two has this "fair2_1" tag. I have rules for different apps like so:
`
{ rule = { class = "Lxmusic" },
properties = { screen = 2, tag = "tile2_2" } },
{ rule = { class = "Deadbeef" },
properties = { screen = 2, tag = "tile2_2" } },
{ rule = { class = "Audacious" },
properties = { screen = 2, tag = "tile2_2" } },
{ rule = { class = "Pavucontrol" },
properties = { screen = 2, tag = "tile2_2" } },
{ rule = { class = "HipChat" },
properties = { screen = 2, tag = "float2_2", floating = true } },
{ rule = { class = "Skype" },
properties = { screen = 2, tag = "float2_2", floating = true } },
{ rule = { class = "Sky" },
properties = { screen = 2, tag = "float2_2", floating = true } },
{ rule = { class = "Evolution" },
properties = { screen = 2, tag = "float2_2", floating = true } },
{ rule = { class = "Thunderbird" },
properties = { screen = 2, tag = "float2_2", floating = true } },
{ rule = { class = "Opera" },
properties = { screen = 2, tag = "float2_2", floating = true } },
}
`
And it works nicely, for example thunderbird always appears on screen 2 and tag "float2_2". But what I want is 4 lxterminals on start on screen 2 on tag "fair2_1" and other lxterminals I launch not from rc.lua but manually to appear on the tag I'm focused on. So this is how I try to achive that
`
--for i=1,2 do
spawn("lxterminal", "lxterminal", false, {
floating = false,
screen = 2,
tag = "fair2_1",
maximized_vertical = false,
maximized_horizontal = false
})
--end
`
If I remove the commented out lines only first lxterminal ends up in screen 2, tag "fair2_1", and the rest will automatically appear on the tag I'm focused at. spawn it just a wrapper around awful.spawn where I've tried to fix this with like so:
`
local function isrunning(pname)
local fpid = io.popen("pgrep -u " .. os.getenv("USER") .. " -o " .. pname)
local pid = fpid:read("*n")
fpid:close()
if pid == nil or pid == "" then
return false
end
return true
end
local function spawn(pname, cmd, once, sn_rules)
if not cmd then
cmd = pname
end
-- XXX: stupid fix for windows not opening in their set tags in awful.spawn
-- no idea why this helps but it does (you don't need to specify tag
-- here, it's enough to have it in sn_rules)
local cb
cb = function(c)
--awful.client.movetotag("fair2_1", c)
client.connect_signal("manage", cb)
end
if not (once and isrunning(pname)) then
awful.spawn(cmd, sn_rules)
client.disconnect_signal("manage", cb)
end
end
local function spawn_once(pname, cmd, sn_rules)
if not cmd then
cmd = pname
end
spawn(cmd, pname, true, sn_rules)
end`
It just calls awful.spawn in the end passing a table with parameters and also tries to apply a fix with connecting to "manage" signal but IIRC this doesn't help.
Actual result:
Only first lxterminal appear on specified screen/tag. Rest go to the focused. on.
Expected result:
4 lxterminals launched with correct parameters like screen and tag should end up in specified screen and tag and not just the first one.
You can find my rc lua for two monitors in attach: rc_2_mon.txt
Please try with git-master. I fixed a few bugs regarding this
On Fri, Dec 7, 2018, 5:59 PM xor512 <[email protected] wrote:
Output of awesome --version:
awesome v4.2 (Human after all)
• Compiled against Lua 5.3.3 (running with Lua 5.3)
• D-Bus support: ✔
• execinfo support: ✔
• xcb-randr version: 1.5
• LGI version: 0.9.2How to reproduce the issue:
- Have two monitors
- Configure a fair tag (not the first one on them, for example:
`
awful.layout.layouts = {
awful.layout.suit.floating, awful.layout.suit.tile, awful.layout.suit.fair,}
...
lo = awful.layout.layouts
my_tags = {
tags = { { names = { "float1_1", "float1_2", "tile1_1", "tile1_2" }, layout = { lo[1], lo[1], lo[2], lo[2] } }, { names = { "float2_1", "tile2_1", "fair2_1", "float2_2", "tile2_2" }, layout = { lo[1], lo[2], lo[3], lo[1], lo[2] } }, }}
`
Here you can see that monitor two has this "fair2_1" tag. I have rules for
different apps like so:`
{ rule = { class = "Lxmusic" },
properties = { screen = 2, tag = "tile2_2" } },
{ rule = { class = "Deadbeef" },
properties = { screen = 2, tag = "tile2_2" } },
{ rule = { class = "Audacious" },
properties = { screen = 2, tag = "tile2_2" } },
{ rule = { class = "Pavucontrol" },
properties = { screen = 2, tag = "tile2_2" } },
{ rule = { class = "HipChat" },
properties = { screen = 2, tag = "float2_2", floating = true } },
{ rule = { class = "Skype" },
properties = { screen = 2, tag = "float2_2", floating = true } },
{ rule = { class = "Sky" },
properties = { screen = 2, tag = "float2_2", floating = true } },
{ rule = { class = "Evolution" },
properties = { screen = 2, tag = "float2_2", floating = true } },
{ rule = { class = "Thunderbird" },
properties = { screen = 2, tag = "float2_2", floating = true } },
{ rule = { class = "Opera" },
properties = { screen = 2, tag = "float2_2", floating = true } },
}
`And it works nicely, for example thunderbird always appears on screen 2
and tag "float2_2". But what I want is 4 lxterminals on start on screen 2
on tag "fair2_1" and other lxterminals I launch not from rc.lua but
manually to appear on the tag I'm focused on. So this is how I try to
achive that`
--for i=1,2 do
spawn("lxterminal", "lxterminal", false, {
floating = false, screen = 2, tag = "fair2_1", maximized_vertical = false, maximized_horizontal = false})
--end
`
If I remove the commented out lines only first lxterminal ends up in
screen 2, tag "fair2_1", and the rest will automatically appear on the tag
I'm focused at. spawn it just a wrapper around awful.spawn where I've tried
to fix this with like so:`
local function isrunning(pname)
local fpid = io.popen("pgrep -u " .. os.getenv("USER") .. " -o " .. pname) local pid = fpid:read("*n") fpid:close() if pid == nil or pid == "" then return false end return trueend
local function spawn(pname, cmd, once, sn_rules)
if not cmd then cmd = pname end -- XXX: stupid fix for windows not opening in their set tags in awful.spawn -- no idea why this helps but it does (you don't need to specify tag -- here, it's enough to have it in sn_rules) local cb cb = function(c) --awful.client.movetotag("fair2_1", c) client.connect_signal("manage", cb) end if not (once and isrunning(pname)) then awful.spawn(cmd, sn_rules) client.disconnect_signal("manage", cb) endend
local function spawn_once(pname, cmd, sn_rules)
if not cmd then cmd = pname end spawn(cmd, pname, true, sn_rules)end`
It just calls awful.spawn in the end passing a table with parameters and
also tries to apply a fix with connecting to "manage" signal but IIRC this
doesn't help.Actual result:
Only first lxterminal appear on specified screen/tag. Rest go to the
focused. on.Expected result:
4 lxterminals launched with correct parameters like screen and tag should
end up in specified screen and tag and not just the first one.You can find my rc lua for two monitors in attach: rc_2_mon.txt
https://github.com/awesomeWM/awesome/files/2658992/rc_2_mon.txt—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/awesomeWM/awesome/issues/2491, or mute the thread
https://github.com/notifications/unsubscribe-auth/AAUxoEotsj-RFwtl1k2ArpZw8KwgU1EGks5u2vLXgaJpZM4ZJRnp
.
Thanks! I will definitely try it.
Can you give an advice how to better do it for Ubuntu? For arch it is trivial https://aur.archlinux.org/packages/awesome-git/. For Ubunutu LTS which I have at work and which sucks is there an easier way than build everything manually?
PS I understand that corporations wants LongTimeSupport and dont'w want their s..t stop to work so they stay with Ubuntu LTS. But in Arch there are advantages which does make it more stable:
But I'm stucked to this corporate sh...t. and it seems I'm also stucked to build awesome myself (and to create deb package is pain, while in Arch it's easy.: https://github.com/awesomeWM/awesome/issues/1048 :(
Will this help?
or by auto-generating a .deb or .rpm package, for easy removal later on:
make package
(c) https://github.com/awesomeWM/awesome
Anyway, I'll try, and the come back with feedback, thanks!
you can just copy build commands for awesome and its deps from .travis.yml
travis also using some ancient ubuntu version
@xor512
apt build-dep awesome
git clone https://github.com/awesomewm/awesome
cd awesome
make package
apt install *.deb
Unfortunately this doesn't help.
I've just installed https://aur.archlinux.org/packages/awesome-git/ for Arch. Now version is:
`$ awesome --version
awesome v4.2-525-g7d097691 (Human after all)
• Compiled against Lua 5.3.5 (running with Lua 5.3)
• D-Bus support: ✔
• execinfo support: ✔
• xcb-randr version: 1.6
• LGI version: 0.9.2
`
I'm running awesome from ~/.xinitrc at home and startx is called from .bash_profile (1 monitor). At work I am using Ubuntu with default xsession manager which allows to switch WMs (gdm? I'm not sure. Just installed awesome as package with standard setup and choose it in menu when login). In both cases the loop below doesn't work as expected (opens only 1 lxterminal in tag specified ("fair1") and rest in the currently focused tag ("float1"), which by chance at startup is the first one). Below I try to explain this more clear.
This for loop in the end:
`-- TODO
for i=1,4 do
spawn("lxterminal", "lxterminal", false, {
floating = false,
screen = 1,
tag = "fair1",
maximized_vertical = false,
maximized_horizontal = false
})
end
`
even for 1 monitor setup at home with git version of awesome opens 1 lxterminal in "fair1" and 3 next lxterminals in the currently focused tag which is "float1" by chance (on start). My config for 1 monitor is here: https://pastebin.com/tkgqTqRW. The loop which is problematic is marked with TODO and is at the bottom.
Desired behavior:
Since I explicitely specify screen = 1, tag = "fair1" in spawn which just a simple wrapper over awful.spawn I expect all 4 lxterminals to open in tag = "fair1".
Actual behavior:
Only the first lxterminal in the loop is opened in tag = "fair1", rest opens in first tag which on startup is "float1".
PS
Uhm... So, as far as I see, LXTerminal does not support startup-notification (nothing when grepping its source code for "startup" or "notification" (case-insensitively)). As such, anything working based on awful.spawn's sn_rules-argument cannot work, I think.
So far this is just a theory. Could you test this by running this in a terminal:
awesome-client 'require("awful.spawn")({"lxterminal"}, { callback = function(c) require("naughty").notify{ text = c.name } end })'
(I just tried with gvim instead of lxterminal and that one worked fine (=a naughty notification showed up). Then again I tried with xterm and got no notification, as expected.)
Since you just want all of these to open in the same tag, can you not do some rule that always matches LXTerminal and checks some global variable to see if anything should actually be done? Something like the following (untested):
local expected_lxterminals = 0
awful.rules.rules = { { class = "lxterminal" }, callback = function(c)
if expected_lxterminals == 0 then return end
expected_lxterminals = expected_lxterminals - 1
-- Do whatever changes to the client that you want to do here
c.screen = 2
c:tags{ tags[2][3] }
end }
-- And when spawning some LXTerminals, increase expected_lxterminals as needed
Alternatively, the docs for git/master have some Linux-specific hacks that try to get the needed startup-notification stuff from /proc/PID/environ: https://awesomewm.org/apidoc/classes/client.html#client.startup_id
(I think this code does not work in v4.2, but I am not sure)
Do I understand that you propose to have a global which will count up to 4 and apply the rules and once this is achieved will ignore the global because each closed lxterminals won't decrement that? I will try that now, thank you
BTW no notification happend when I've ran:
awesome-client 'require("awful.spawn")({"lxterminal"}, { callback = function(c) require("naughty").notify{ text = c.name } end })'
Please give me an hour to try a proposed workaround with the global. If it will work I will close the issue
It worked! @psychon I thank you very much! Here's what I did (following your suggestiong):
expected_terminals_on_start = 4
<skip>
awful.rules.rules = {
<skip>
-- This is a hack to make sure 4 lxterminals on startup go to fair1
-- (or fair2_1 in 2-monitors setup)
{ rule = { class = "Lxterminal" },
callback = function(c)
if expected_terminals_on_start > 0 then
expected_terminals_on_start = expected_terminals_on_start - 1
c.screen = 1
c.tags{ "fair1" }
end
end
},
}
And then uncommented the loop:
for i=1,4 do
spawn("lxterminal", "lxterminal", false, {
floating = false,
screen = 1,
tag = "fair1",
maximized_vertical = false,
maximized_horizontal = false
})
end
I belive the sn_rules are irrelevant here but I've left them if one day it will be made working without a hack.
Now this works because expected_terminals_on_start is only decremented but never incremented (e.g. on lxterminal close). So after 4 lxterminals appear in "fair2" I can safely close some of them and be sure that other opened with for example "modkey+Enter" will appear on the currently focused tag (since expected_terminals_on_start keeps being <= 0).
Cool! Closing this as the workaround @psychon suggested worked! Many kudos to you, man, you've made my life more comfortable. Where should I send beer? Seriously.
@psychon made my day and suggested a workaround which works!
For some reason the workaround only works if I restart awesome with Ctrl-Modkey-R. On startup it is still 1 lxterminal on "fair1" and 3 on currently focused tag. I don't understand this.
If I add a notification in between like so:
{ rule = { class = "Lxterminal" },
callback = function(c)
-- TODO: remove this debug
naughty.notify({preset=naughty.config.presets.normal, title="debug", text=tostring(expected_terminals_on_start)})
if expected_terminals_on_start > 0 then
expected_terminals_on_start = expected_terminals_on_start - 1
c.screen = 1
c.tags{ "fair1" }
end
end
},
it works. Do I need to add a sleep there? I've just tried and it works:
{ rule = { class = "Lxterminal" },
callback = function(c)
if expected_terminals_on_start > 0 then
expected_terminals_on_start = expected_terminals_on_start - 1
c.screen = 1
c.tags{ "fair1" }
-- TODO: huh?
os.execute('sleep 0.5')
end
end
},
Is there a better way then sleep?
I confirm that xfce4-terminals works without any hacks
i guess nothing to be done here, you can report it to fix in LXterminal
I've switched to xfce4-terminal, see no differences, so I won't bother lxterminals guys. On other hand... Minute. https://github.com/lxde/lxterminal/issues/62
Thanks. I subscribed to that bug report and can follow up on activity there (depending on what they ask...).
Most helpful comment
I've switched to xfce4-terminal, see no differences, so I won't bother lxterminals guys. On other hand... Minute. https://github.com/lxde/lxterminal/issues/62