You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello.
I have the following situation in my rc.lua -- I have special keybinds for changing volume or turning it off, they use "amixer". I also need to update my volume widget's information after every execution of such command. I update volume widget's information using update_volume(volume_widget) lua command, which is provided by volume widget itself.
I tried the following configuration:
function ()
awful.util.spawn("amixer set Master 4%+ on")
update_volume(volume_widget)
end)
But I met a problem: volume widget is updated faster, than volume changes, so its information is not correct.
I have also tried the following two methods:
local f = io.popen("amixer set Master 4%+ on")
f:close()
update_volume(volume_widget)
and
os.execute("amixer set Master 4%+ on")
update_volume(volume_widget)
They both work fine, and update_volume runs just after "amixer" finishes its execution.
But one man has said, that when I use such commands as io.popen;close and os.execute, the whole Awesome freezes and waits, until "amixer" command finishes its execution. Is it so?
If it is, could you please recommend me, how should I implement the following: "Run lua command just after system command finishes its execution" in a correct way? I know that I can run "amixer ... && echo "update_volume(volume_widget)" | awesome-client", but it seems to be a slow and ungraceful solution.
The text was updated successfully, but these errors were encountered:
It's not the best API, but we now have awful.spawn.with_line_callback("amixer, set Master 4%+ on", function() end(), function() end, function() update_volume(volume_widget) end). This needs those "empty functions" to work correctly. Hm....
Hello.
I have the following situation in my rc.lua -- I have special keybinds for changing volume or turning it off, they use "amixer". I also need to update my volume widget's information after every execution of such command. I update volume widget's information using update_volume(volume_widget) lua command, which is provided by volume widget itself.
I tried the following configuration:
function ()
awful.util.spawn("amixer set Master 4%+ on")
update_volume(volume_widget)
end)
But I met a problem: volume widget is updated faster, than volume changes, so its information is not correct.
I have also tried the following two methods:
local f = io.popen("amixer set Master 4%+ on")
f:close()
update_volume(volume_widget)
and
os.execute("amixer set Master 4%+ on")
update_volume(volume_widget)
They both work fine, and update_volume runs just after "amixer" finishes its execution.
But one man has said, that when I use such commands as io.popen;close and os.execute, the whole Awesome freezes and waits, until "amixer" command finishes its execution. Is it so?
If it is, could you please recommend me, how should I implement the following: "Run lua command just after system command finishes its execution" in a correct way? I know that I can run "amixer ... && echo "update_volume(volume_widget)" | awesome-client", but it seems to be a slow and ungraceful solution.
The text was updated successfully, but these errors were encountered: