mako icon indicating copy to clipboard operation
mako copied to clipboard

Allow including config files

Open flipflop133 opened this issue 3 years ago • 10 comments

In order to change a lot of values in mako config files we have to write them one by one each time, a better way would be to have multiple config files and import them inside the main config file, so we just have to change one line. This would be the same behavior as the include keyword of sway.

flipflop133 avatar Jan 02 '22 13:01 flipflop133

Why do you want to change many config options at once? Maybe modes are a better solution to your use-case.

emersion avatar Jan 05 '22 12:01 emersion

Let's take the example of Sway, to theme it, I have two files:

  • lightTheme
  • darkTheme

So with a script I change the include lightTheme line to include darkTheme to change to dark mode at night, with mako I have to change every color individually like this.

I think with modes I'll have to do something like this:

# light theme
[mode=light]
background-color=#f5f5f5
text-color=#242424
progress-color=#85b2f9
border-color=#242424

# dark theme
[mode=dark]
background-color=#353535
text-color=#eeeeec
progress-color=#15539e
border-color=#eeeeec

And use makoctl set-mode light/dark when running the script, the issue is if I restart mako it will switch back to the default one, and I'll have to use makoctl again, while with Sway (and other like fuzzel, bemenu, ...) I don't have to do this since it will use the include command. You can look at my theming script here.

flipflop133 avatar Jan 05 '22 14:01 flipflop133

I'm having a similar issue in regards to light/dark theme.

I wonder if mako could save its current mode(s) to a file and restore them on startup. Though I guess people might want to make only some modes permanent and the rest transient.

WhyNotHugo avatar Feb 04 '22 12:02 WhyNotHugo

I'd rather not save anything to a file, I'd prefer to let the user do this and use makoctl to restore modes on startup if they want to.

emersion avatar Feb 04 '22 12:02 emersion

I can try and write a tiny, simple, service that does this, but it would be good if fr.emersion.Mako had a signal (ModeSet) which signals when modes change so I can keep track of them.

The helper service could keep track of modes (and persist them), and re-set them after mako starts.

WhyNotHugo avatar Feb 04 '22 13:02 WhyNotHugo

A signal sounds like a reasonable thing to add.

emersion avatar Feb 04 '22 13:02 emersion

Dealing with services is annoying with dark/light mode scripts, as you have to write a specific section for each application to communicate with their respective services. Allow to include external config files is far easier as you just have to specify the path to your script, look at my themer script config for reference.

flipflop133 avatar Feb 05 '22 07:02 flipflop133

An include function would have another advantage. With this it could be possible to read the colors out of a file shared with other applications. So an easy theming across multiple programs from one file would be possible

Leaced avatar Mar 23 '23 15:03 Leaced

Yeah @Leaced that's what I pointed out above.

flipflop133 avatar Mar 24 '23 08:03 flipflop133

I'd also like this functionality. However, my use case is different: I have multiple machines with the same config file layout, and host specific configuration is always in ~/.config/host/.... I could keep my main config file the same if it was possible to simply include ~/.config/host/mako/config.

happenslol avatar Apr 10 '23 03:04 happenslol