Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Multiple config files #453

Open
waweic opened this issue Oct 12, 2021 · 0 comments
Open

[Feature Request] Multiple config files #453

waweic opened this issue Oct 12, 2021 · 0 comments

Comments

@waweic
Copy link

waweic commented Oct 12, 2021

Hi, I apologize if this has already been discussed or even implemented, though I have searched the issues and couldn't find any evidence of it.

I do manage my configurations centrally, but sometimes I would like to have little additions to my status line that I do not want to check into the repository - for example a little blocklet that regularly checks the amount of tickets for an event that are still available, the remaining time/price for an auction etc. etc.

Ideally, I would have my blocklets in a dedicated directory, in the usual manner, like

10-ip-address.blocklet
20-vpn-connection.blocklet
30-battery-status.blocklet
40-datetime.blocklet

etc. etc.
I'd then be able to simply add 35-available-tickets.temp.blocklet, put a *.temp*line into my .gitignore and delete the blocklet later when I don't need it anymore, leaving my static configuration untouched. This might also be a solution to #266.

It's quite possible that this might conflict with other options of the configuration, I do not know them very well as I am only a basic user of i3blocks

vivien added a commit that referenced this issue Jan 13, 2023
Interpret the "include" property as a directive to parse the
configuration file described as the value. This mechanism is similar
in behavior to the preprocessor #include directive.

For this to work, the config parsing code changes its working directory
to the directory containing the configuration file being included,
and stores its path in a new "workdir" property, whenever a "command"
property is being read. This allows the block code to change directory
when a command is spawned, and thus allow command scripts relative
to their included configuration fragment to work as expected.

Note that include loop is detected, in which case an error is thrown.

If the include path starts with "~/", tilde is replaced with the
value of the HOME environment variable, if defined.

Below is an example of config file using the "include" directive:

    # ~/.config/i3blocks/config
    separator=true
    separator_block_width=15

    include=contrib/greetings/config

    # ~/.config/i3blocks/contrib/greetings/config
    [greetings]
    command=echo "Hello, $USER!"
    interval=once

Refs #453
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants