swayfx icon indicating copy to clipboard operation
swayfx copied to clipboard

Keep config file backwards compatible with sway

Open BramBonne opened this issue 2 years ago • 6 comments

It would be nice if I could share my config file between machines running swayfx and machines running sway.

One way to achieve this could be to allow all swayfx-specific options to be prefixed with exec swayfx-config, which afaik would cause it to be ignored by sway as long as no binary swayfx-config exists.

BramBonne avatar Apr 17 '23 07:04 BramBonne

Tbh it is compatible with sway as is, it just shows a pop up that there os something wrong with your config, what i do is keep my swayfx options in a separate file

luizansounds avatar Apr 17 '23 08:04 luizansounds

what i do is keep my swayfx options in a separate file

This is a good idea. Just add a include ./swayfx or something :)

Not really sure if anything else can be done.

You can always exec a shell script that checks if you're running swayfx or not and set those variables (may be difficult depending on if the commands are config time only or not)

ErikReider avatar Apr 17 '23 10:04 ErikReider

Is there a way to make the include command only include if we're running swayfx? That might be a better workaround if it's possible

Kommynct avatar May 25 '23 06:05 Kommynct

Is there a way to make the include command only include if we're running swayfx? That might be a better workaround if it's possible

This will require upstream edits, except for the exec swayfx-config trick if it works

head-gardener avatar May 25 '23 09:05 head-gardener

A workaround for those who would like to use the same config for both sway and swayfx would be to set an environment variable, for example, in your .profile, say, SWAYFLAVOR=vanilla for vanilla sway and SWAYFLAVOR=fx for swayfx, and then use an include in your config such as

include "~/.config/sway/`echo $SWAYFLAVOR`"

where in this example you would have in ~/.config/sway/ a file called vanilla for sway-specific config (or just empty) and fx for swayfx.

You can also use host-specific secondary config files if you use swayfx in some machines and vanilla sway in others; I use this setup regadless of fx-specific configurations, for host-specific configs such as display configurations, i.e.:

include "~/.config/sway/`uname -n`"

And of course, you need a file with the name of your hostname there.

Yaroslav-95 avatar Jul 13 '23 21:07 Yaroslav-95