fix typos in README.md and config.toml comments

This commit is contained in:
2026-02-10 20:42:01 +03:00
parent 5d28bc72ad
commit fad35ec04b
2 changed files with 40 additions and 43 deletions

View File

@@ -1,10 +1,10 @@
# userctx # userctx
Manage you configurations and themes with ease. Manage your configurations and themes with ease.
## Installation ## Installation
You just need to copy the file to a directory You just need to copy the file to a directory
in your $PATH (for example: /usr/loca/bin) and in your $PATH (for example: /usr/local/bin) and
copy/create a config file. copy/create a config file.
```bash ```bash
sudo install userctx.py /usr/local/bin/userctx sudo install userctx.py /usr/local/bin/userctx
@@ -29,8 +29,8 @@ Typically a context directory looks like this.
In the above example, context "Goldfish" contains configs for apps "sway" and "wofi". In the above example, context "Goldfish" contains configs for apps "sway" and "wofi".
These configs will be applied when you apply context "Goldfish". These configs will be applied when you apply context "Goldfish".
When a context is applied the app configs from context directory are get When a context is applied the app configs from context directory get
symlinked to youe ~/.config/ folder for each managed app. Goldfish/wofi/style.css symlinks to symlinked to your ~/.config/ folder for each managed app. Goldfish/wofi/style.css symlinks to
\~/.config/wofi/style.css, Goldfish/sway/theme.conf symlinks to \~/.config/sway/theme.conf etc. \~/.config/wofi/style.css, Goldfish/sway/theme.conf symlinks to \~/.config/sway/theme.conf etc.
This default behaviour can be changed and specific actions or customizations This default behaviour can be changed and specific actions or customizations
@@ -67,7 +67,7 @@ This section contains global settings for **userctx**.
### The `[apps]` section ### The `[apps]` section
For each application defined in the `general.apps` array, you can have a dedicated section to specify its configuration. For each application defined in the `general.apps` array, you can have a dedicated section to specify its configuration.
You can create **[apps.<you_app>]** section in the config to specify **userctx** behaviour for the app. The following options are supported. You can create **[apps.<your_app>]** section in the config to specify **userctx** behavior for the app. The following options are supported.
- `source_path` (string, optional): Overrides the global `source_path` for this specific application. - `source_path` (string, optional): Overrides the global `source_path` for this specific application.
- `target_path` (string, optional): Overrides the global `target_path` for this specific application. The final destination path for an application's configuration will be `<target_path>/<app_name>`. - `target_path` (string, optional): Overrides the global `target_path` for this specific application. The final destination path for an application's configuration will be `<target_path>/<app_name>`.
@@ -83,10 +83,10 @@ You can create **[apps.<you_app>]** section in the config to specify **userctx**
TODO: a more detailed explanation of wildcard symlinking. TODO: a more detailed explanation of wildcard symlinking.
## Examples ## Examples
### Basic usecase: we only need symlinks ### Basic use case: we only need symlinks
Let's add configuration for "foot" terminal emulator, which Let's add configuration for "foot" terminal emulator, which
will be applied when we apply context "Goldfish" assuming will be applied when we apply context "Goldfish" assuming
we would like to switch foot's visual theme when swithching context. we would like to switch foot's visual theme when switching context.
1. First we need to create a separate file for visuals config in our 1. First we need to create a separate file for visuals config in our
context directory. context directory.
@@ -146,7 +146,7 @@ apps = [
"wofi", "wofi",
] ]
``` ```
4. Test you configuration 4. Test your configuration
```bash ```bash
userctx --nop apply Goldfish userctx --nop apply Goldfish
``` ```
@@ -158,7 +158,7 @@ a symlink will be created in your homedir:
~/.config/foot/theme.ini -> ~/.config/userctx/Goldfish/foot/theme.ini ~/.config/foot/theme.ini -> ~/.config/userctx/Goldfish/foot/theme.ini
### More advanced usecase: run command and hot-reload ### More advanced use case: run command and hot-reload
Let's configure **userctx** to apply theme to helix editor. Let's configure **userctx** to apply theme to helix editor.
1. Similar to the above section, create ~/.config/userctx/Goldfish/helix/helix.toml 1. Similar to the above section, create ~/.config/userctx/Goldfish/helix/helix.toml
@@ -189,9 +189,9 @@ reload = "pkill -USR1 hx"
Here we instruct **userctx** to symlink any (single) file it finds in "helix" subdirectory of context folder Here we instruct **userctx** to symlink any (single) file it finds in "helix" subdirectory of context folder
to ~/.config/helix/themes/current_theme.toml to ~/.config/helix/themes/current_theme.toml
Then we run sed to change the config file. This part is not really necessare if helix is Then we run sed to change the config file. This part is not really necessary if helix is
configured to use theme named "current_theme" and you're sure that config won't change. configured to use theme named "current_theme" and you're sure that config won't change.
We could just replace the file and issue USR1. The sed part if for the case when config We could just replace the file and issue USR1. The sed part is for the case when config
is changed by user or other app. is changed by user or other app.
Finally we set the reload command which Finally we set the reload command which
@@ -202,5 +202,4 @@ will tell helix to reload config.
userctx --nop apply Goldfish userctx --nop apply Goldfish
``` ```
See also template "config.toml" with numerous app settings. See also template "config.toml" with some app settings.

View File

@@ -17,7 +17,7 @@ apps = [
# target directory where managed configs # target directory where managed configs
# are located # are located
# defaults to $XDG_CONFIG_HOME if specifically set # defaults to $XDG_CONFIG_HOME if specifically set
# or ~/.config if $XGD_CONFIG_HOME is not set # or ~/.config if $XDG_CONFIG_HOME is not set
target_path = "~/.config" target_path = "~/.config"
# directory where contexts are stored # directory where contexts are stored
@@ -37,7 +37,7 @@ source_path = "~/.config/userctx"
target_path = "~/.config/example/configs" target_path = "~/.config/example/configs"
# "symlink" map defines # "symlink" map defines
# which files will be symlinked to users home # which files will be symlinked to user's home
# directory. # directory.
# Names of files in this mapping are relative to # Names of files in this mapping are relative to
# context directory and target directory # context directory and target directory
@@ -68,17 +68,17 @@ symlink."*" = "*"
# symlink."*" = "some/destination.conf" # symlink."*" = "some/destination.conf"
# "exec" let's you write a reload command or # "exec" lets you write a reload command or
# even a bigger custom script that will apply contents of # even a bigger custom script that will apply contents of
# your context. Note the triple double-qoutes for multiline # your context. Note the triple double-quotes for multiline
# strings (see TOML spec). # strings (see TOML spec).
# This string will be passed as is to $SHELL for execution. # This string will be passed as is to $SHELL for execution.
exec = """ exec = """
# this is a normal shell script which will # this is a normal shell script which will
# be executed by user's $SHELL or 'bash' binary # be executed by user's $SHELL or 'bash' binary
# if users $SHELL is empty # if user's $SHELL is empty
# users envs are available # user's envs are available
echo "$HOME" echo "$HOME"
# additional envs are available # additional envs are available
@@ -101,18 +101,18 @@ script = [
"script2.sh", "script2.sh",
] ]
# if "reload" is present, the command will be executed after everythong alse is done # if "reload" is present, the command will be executed after everything else is done
reload = "pkill -USR1 example" reload = "pkill -USR1 example"
# "actions" array specifies the order of actions when # "actions" array specifies the order of actions when
# applying context. If omitted, the default behaviour # applying context. If omitted, the default behaviour
# it to symlink, run scripts, run exec part then run reload # it to symlink, run scripts, run exec part then run reload
# command (if relevant actions are specified). # command (if relevant actions are specified).
# If nothig has been customized in apps configuration here # If nothing has been customized in apps configuration here
# (no commands array, not symlinks mapping etc.) then userctx # (no commands array, no symlinks mapping etc.) then userctx
# will just symlink anythong it finds to target_path. # will just symlink anything it finds to target_path.
# If actions array is declared empty (actions = []) then # If actions array is declared empty (actions = []) then
# userctx will do nothig. # userctx will do nothing.
actions = [ actions = [
"symlink", "symlink",
"exec", "exec",
@@ -134,7 +134,7 @@ target_path = "~/.config/niri/configs"
# The snippet below is needed for niri 25.8 which did not # The snippet below is needed for niri 25.8 which did not
# support imports/includes in the config. I'm splitting # support imports/includes in the config. I'm splitting
# config into several parts, putting those to ~/.config/niri/configs # config into several parts, putting those to ~/.config/niri/configs
# and them concatenating them after applying changes to theme. # and then concatenating them after applying changes to theme.
# Also note the custom target path above. It instructs userctx to # Also note the custom target path above. It instructs userctx to
# symlink configs found in the context dir to # symlink configs found in the context dir to
# ~/.config/niri/configs, which then get concatenated. # ~/.config/niri/configs, which then get concatenated.
@@ -171,11 +171,9 @@ reload = 'pkill -USR1 kitty'
reload = 'pkill -USR2 waybar' reload = 'pkill -USR2 waybar'
[apps.swaybg] [apps.swaybg]
# This config is for swaybg setup as s systemd service. # This config is for swaybg setup as a systemd service.
# Unit runs "swaybg -m fill -i "%h/.config/swaybg/wallpaper". # Unit runs "swaybg -m fill -i "%h/.config/swaybg/wallpaper".
# ~/.config/userctx/<context>/swaybg/ contains single file # ~/.config/userctx/<context>/swaybg/ contains single file
# which gets symlinked to ~/.config/swaybg/wallpaper # which gets symlinked to ~/.config/swaybg/wallpaper
symlink."*" = "wallpaper" symlink."*" = "wallpaper"
reload = 'systemctl --user restart swaybg.service' reload = 'systemctl --user restart swaybg.service'