WillPower3309 / swayfx

SwayFX: Sway, but with eye candy!
MIT License
1.29k stars 48 forks source link

Keep config file backwards compatible with sway #143

Open BramBonne opened 1 year ago

BramBonne commented 1 year ago

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.

luizansounds commented 1 year ago

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

ErikReider commented 1 year ago

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)

Kommynct commented 1 year ago

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

head-gardener commented 1 year ago

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

Yaroslav-95 commented 1 year ago

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.