wayfire icon indicating copy to clipboard operation
wayfire copied to clipboard

Any alternative to exec_always from sway?

Open ErikReider opened this issue 4 years ago • 17 comments

I added Kanshi to autostart kanshi = kanshi and it works fine until I change a setting in the Wayfire config. I also experienced this issue in sway https://github.com/emersion/kanshi/issues/43. To fix this, I ran this script in exec_always:

killall -9 kanshi
while pgrep -u $UID -x kanshi >/dev/null; do sleep 1; done
kanshi &

This isn't possible here because of the lack of exec_always. Is there any other alternative to exec_always or any other way?

Wayfire version 0.8.0-e510e70f (May 26 2021, branch 'master')

ErikReider avatar May 31 '21 11:05 ErikReider

What does exec_always do in sway?

ammen99 avatar May 31 '21 12:05 ammen99

FWIW, the kanshi problem will also be solved, but in a different way. I'm envisioning an option which tells Wayfire: 'as soon as an external entity has configured the outputs, do not ever read their configuration from the config file'. This is not implemented yet, however.

ammen99 avatar May 31 '21 13:05 ammen99

@ammen99 the command executes a command on config reload while the normal exec runs once on start

ErikReider avatar May 31 '21 15:05 ErikReider

@ErikReider Can you elaborate on what you mean by config reload? This may have different meanings depending on the compositor.

soreau avatar May 31 '21 18:05 soreau

@soreau I'm not sure about what sway exactly does but you're able to reload the conf file while waybar does this automatically on save

ErikReider avatar May 31 '21 18:05 ErikReider

@ErikReider Can you elaborate on what you mean by config reload? This may have different meanings depending on the compositor.

reload-config is a signal in Wayfire :)

This is the general bug where Wayfire resets the output config set by an external application (kanshi, wdisplays, etc.) when the config file is changed and Wayfire re-parses the config file.

ammen99 avatar May 31 '21 18:05 ammen99

@ammen99 what's weird is that I've removed all of the output lines in the config. It's probably using a default value. Weird that both sway and wayfire have this issue

ErikReider avatar May 31 '21 18:05 ErikReider

I added Kanshi to autostart kanshi = kanshi and it works fine until I change a setting in the Wayfire config.

Can you say what stops working when the problem happens? What happens with kanshi that makes you think there is a problem?

soreau avatar May 31 '21 19:05 soreau

This is the general bug where Wayfire resets the output config set by an external application (kanshi, wdisplays, etc.) when the config file is changed and Wayfire re-parses the config file.

Ah, this bug^^

soreau avatar May 31 '21 19:05 soreau

For this to work we should get rid of output config in wayfire.ini altogether and use default output configuration when wayfire starts without configuration, and kanshi instead when it's available.

soreau avatar May 31 '21 19:05 soreau

For this to work we should get rid of output config in wayfire.ini altogether and use default output configuration when wayfire starts without configuration, and kanshi instead when it's available.

Getting rid of wayfire.ini configurarion is nowhere near good enough. Kanshi does not support mirrored outputs, custom modelines and potentially more things we'll add in the future.

https://github.com/WayfireWM/wayfire/issues/1201#issuecomment-851475688 provides a much better fix, because it still allows for these use-cases where kanshi is not enough.

ammen99 avatar May 31 '21 19:05 ammen99

Getting rid of wayfire.ini configurarion is nowhere near good enough. Kanshi does not support mirrored outputs, custom modelines and potentially more things we'll add in the future.

Sounds like opportunities for improvement in wlr-output-management-unstable protocol.

soreau avatar May 31 '21 19:05 soreau

gde-gnome-bridge depends on setting display options through wf-config currently too! Would rather not have to rewrite all that code just yet :)

But I agree wlr-output-management should be extended. Also, I'm pretty sure it already supports mirroring: just set both outputs to the same x,y position

AdrianVovk avatar May 31 '21 20:05 AdrianVovk

@ErikReider try the option described in #1202

ammen99 avatar Jun 01 '21 07:06 ammen99

But I agree wlr-output-management should be extended. Also, I'm pretty sure it already supports mirroring: just set both outputs to the same x,y position

Not really. https://github.com/swaywm/wlr-protocols/issues/101

We could special-case this by saying "equal x/y == mirrored", but this is not described in the protocol, and also a bit counter-intuitive IMO.

ammen99 avatar Jun 01 '21 07:06 ammen99

Putting low-priority as the kanshi problem was fixed in a different way, and we don't really have a use-case for exec_always

ammen99 avatar Jun 02 '21 08:06 ammen99

Putting low-priority as the kanshi problem was fixed in a different way, and we don't really have a use-case for exec_always

There's a valid use-case for exec_always, it lets your autostart script run every time you reload the config. The alternative is monitoring wayfire.ini for changes and restarting the script, but that's not good.

exec-always ~/.scripts/autostart.sh would mean the autostart.sh would run again every wayfire.ini modification

It's an old i3 wm pattern, you've got exec_always and exec. Sway is essentially i3 for Wayland, and some compositors take inspiration from Sway too. So this exec-always design still makes sense for many end users.

If you have a workaround, then the issue is solved. Or just say the compositor won't support it, some compositors don't have that feature anyway :P

killown avatar Jun 24 '25 12:06 killown