Skip to content

Commit

Permalink
wip update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
oknozor committed Feb 2, 2023
1 parent fd8ff3f commit 10cf49e
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 118 deletions.
16 changes: 15 additions & 1 deletion website/content/docs/config-import/import.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ top = false
Instead of having all your configs defined in a single toml file, you can split it into multiple file :

```toml

[settings.dots]
alacritty = { source = "alacritty", target = ".config/alacritty" }
zsh = { source = "zsh/zshrc", target = ".zshrc" }
Expand All @@ -35,6 +34,21 @@ path = "sway/sway.toml"
path = "i3/i3.toml"
```

Alternatively you can define multiple imports at once:
```toml
dotfiles_dir = "dotfiles"

import = [
{ path = "sway/sway.toml" },
{ path = "i3/i3.toml" },
]

[settings.dots]
alacritty = { source = "terminals/alacritty", target = ".config/alacritty" }
zsh = { source = "zsh/zshrc", target = ".zshrc" }
# ...
```

In this example we have defined our `i3` and `sway` profile in separate files :

```toml
Expand Down
2 changes: 2 additions & 0 deletions website/content/docs/getting-started/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ Once you are satisfied with your config, you can install your dotfiles:
bombadil link
```

Alternatively you can use `bombadil watch` to continuously render templates while editing.

### Clean up

If you want to remove symlinks generated by Toml Bombadil run the following:
Expand Down
24 changes: 10 additions & 14 deletions website/content/docs/hooks/hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,21 @@ per profile hooks :

```toml
[settings]
prehooks = [ "echo \"Updating dots\""]
posthooks = [ "echo \"Default profile\"" ]
prehooks = [ "echo 'Updating dots'"]
posthooks = [ "echo 'Default profile'" ]

[profiles.sway]
prehooks = [ "echo \"Sway profile\"" ]
# Use toml multiline string to escape quotes and special characters
prehooks = [
"""
echo "Sway profile"
"""
]

posthooks = [ "sway reload" ]

[profiles.i3]
prehooks = [ "echo \"i3 profile\"" ]
prehooks = [ "echo 'i3 profile'" ]
posthooks = [ "i3-msg reload" ]
```

Expand All @@ -61,14 +67,4 @@ posthooks = [ "i3-msg reload" ]
posthooks = [ "source /home/user/.zshrc" ] # This does not work !
```

- Environment variables won't be expanded unless you explicitly call a sub-shell :

```toml
posthooks = [ "echo $HOME" ] # This will print "$HOME"
```

```toml
posthooks = [ "zsh -c \"echo $HOME\"" ] # This works
```

That's it for hooks, in the next chapter we will see how to split your Bombadil config into multiple files.
13 changes: 6 additions & 7 deletions website/content/docs/profiles-and-themes/profile-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,14 @@ Let's assume you have the following in your `.bashrc` dotfile:
```bash
# ~/bombadil-example/bashrc
export JAVA_HOME={{java_home}}
# ...
```

And your default profiles variable look like this:

```toml
# ~/bombadil-example/vars.toml
java_home = "/etc/java-openjdk"
# ...
[java]
home = "/etc/java-openjdk"
```

Here is our bombadil config:
Expand All @@ -40,7 +39,7 @@ dotfile_dir = "bombadil-example"
vars = [ "vars.toml" ]

[settings.dots]
bashrc = { source = "bashrc", target = ".bashrc"}
bashrc = { source = "bashrc", target = ".bashrc" }
```

So far we have defined a variable for `$JAVA_HOME` and we are using it once.
Expand All @@ -57,7 +56,7 @@ dotfile_dir = "bombadil-example"
vars = [ "vars.toml" ]

[settings.dots]
bashrc = { source = "bashrc", target = ".bashrc"}
bashrc = { source = "bashrc", target = ".bashrc" }

[profiles.corporate]
vars = [ "java10-vars.toml" ]
Expand All @@ -66,8 +65,8 @@ vars = [ "java10-vars.toml" ]
The profile variable file will be loaded after the default one and any matching variable name will override the default:

```toml
java_home = "/etc/java10-openjdk"
# ...
[java]
home = "/etc/java10-openjdk"
```

Running `bombadil link -p corporate` would now produce the following `.bashrc` :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,15 @@ Notice on the `corporate` profile we are redefining the `maven` dot entry and on
Linking the default profile with `bombadil link`, will produce the following link :
```bash
bombadil link
[Created]
"/home/okno/dotfiles/.dots/maven/settings.xml" => "/home/okno/.m2/settings.xml"
```

Linking with the `corporate` profile will use the alternate source for `.m2/settings.xml` :

```bash
bombadil link -p corporate
[Created]
"/home/okno/dotfiles/.dots/maven/settings.corporate.xml" => "/home/okno/.m2/settings.xml"
```

Expand Down
2 changes: 1 addition & 1 deletion website/content/docs/profiles-and-themes/profiles.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ top = false
## Profile configuration

As we saw Bombadil allows to define a default profile. For some programs you might want to
set an alternate configuration.
set alternative configurations.

Bombadil allow you two do this in several ways :
- override dot entries `source` and/or `target` value.
Expand Down
73 changes: 0 additions & 73 deletions website/content/docs/template-and-variables/variable-references.md

This file was deleted.

16 changes: 7 additions & 9 deletions website/content/docs/template-and-variables/variable-scope.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ toc = true
top = false
+++

### Variable scopes
### Variable collocation

By default, bombadil will look for a file named `vars.toml` in every dotfile entry source directory :

Expand All @@ -44,16 +44,14 @@ wofi = { source = "wofi", target = ".config/wofi" }
And some variables defined in `wofi/vars.toml` :

```toml
# Here we use variable references from `theme.toml`
bg = "%blue"
input_bg = "%white"
input_color = "%light_blue"
input_focused_bg = "%blue"
[colors]
gb = "#292C3E"
input_bg = "#EBEBEB"
input_color = "#FF261E"
input_focused_bg = "#FF261E"
```

Running `bombadil link` will render variables defined in `wofi/vars.toml` only for templates that resides in `wofi/`.

### Explicitly declare scoped variables
### Explicitly declare variable collocation

The previous example works fine as long as our dotfile source is a directory.
Indeed, Bombadil will look for a variable file named `vars.toml` in the source directory and everything will be rendered
Expand Down
24 changes: 12 additions & 12 deletions website/content/docs/template-and-variables/variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,16 @@ vars = [ "colors.toml", "env_vars.toml" ]

### Declare variables

A Bombadil var files is a toml file containing key with string values only.
A Bombadil var files is a normal toml file.

For example, you have the following file in `{dotfiles_dir}/vars.toml`.

```toml
[apps]
terminal = "alacritty"
bar = "waybar"

[theme.colors]
background = "#292C3E"
foreground = "#EBEBEB"
text = "#FF261E"
Expand All @@ -51,8 +55,8 @@ green = "#A0E521"
yellow = "#FFC620"
blue = "#1BA6FA"

# A flag to conditionally include some block of configuration.
set_cursor_color = "true"
[theme.settings]
set_cursor_color = true
```

Given the following dot entry :
Expand All @@ -65,15 +69,14 @@ The `source` attributes point to a template dotfile named `alacritty.yaml`.
We can use the previously defined variables using the `{{variable_name}}` syntax :

```yaml
# {dotfiles}/alacritty.yml
colors:
primary:
background: "{{background}}"
foreground: "{{foreground}}"
{%- if set_cursor_color == "true" %}
background: "{{theme.colors.background}}"
foreground: "{{theme.colors.foreground}}"
{%- if theme.settings.set_cursor_color == "true" %}
cursor:
text: "{{text}}"
cursor: "{{cursor}}"
text: "{{theme.colors.text}}"
cursor: "{{theme.colors.cursor}}"
{% endif -%}
```

Expand All @@ -86,16 +89,13 @@ Templates will be rendered to the `.dots` directory, then symlinked according to
In the previous example the output file actually linked to alacritty's config would look like this:

```yaml
...
# {dotfiles}/.dots/alacritty.yml
colors:
primary:
background: "#292C3E"
foreground: "#EBEBEB"
cursor:
text: "#FF261E"
cursor: "#FF261E"
# ...
```
In the next section we will see how to organize our variables to make reusable structured themes using variable references.
2 changes: 1 addition & 1 deletion website/themes/adidoks/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
{{ macros_head::favicons() }}
{% block math %}{{ macros_math::math() }}{% endblock math %}
</head>
{% block body %}{% set page_class="home dark" %}{% endblock body %}
{% block body %}{% set page_class="home" %}{% endblock body %}
<body class="{{ page_class }}">
{% block header %}
{{ macros_header::header(current_section="/") }}
Expand Down

0 comments on commit 10cf49e

Please sign in to comment.