fix typos in README.md and config.toml comments
This commit is contained in:
25
README.md
25
README.md
@@ -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.
|
||||||
|
|
||||||
|
|||||||
58
config.toml
58
config.toml
@@ -1,6 +1,6 @@
|
|||||||
[general]
|
[general]
|
||||||
# if dry run is set to true
|
# if dry run is set to true
|
||||||
# userctx will only validate config
|
# userctx will only validate config
|
||||||
# and tell you what it will do to apply context
|
# and tell you what it will do to apply context
|
||||||
# tasks
|
# tasks
|
||||||
dry_run = true
|
dry_run = true
|
||||||
@@ -15,9 +15,9 @@ 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
|
||||||
@@ -32,18 +32,18 @@ source_path = "~/.config/userctx"
|
|||||||
# if not overridden with general.target_path.
|
# if not overridden with general.target_path.
|
||||||
# Setting "target_path" overrides this.
|
# Setting "target_path" overrides this.
|
||||||
# $CONTEXT_DST env will hold the actual destination path.
|
# $CONTEXT_DST env will hold the actual destination path.
|
||||||
# symlinks will be created relative to this specified
|
# symlinks will be created relative to this specified
|
||||||
# path.
|
# path.
|
||||||
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
|
||||||
# by default source is ~/.config/userctx/<context_name>/example
|
# by default source is ~/.config/userctx/<context_name>/example
|
||||||
# and target directory is ~/.config/example
|
# and target directory is ~/.config/example
|
||||||
# for app named "example"
|
# for app named "example"
|
||||||
#
|
#
|
||||||
# this will link file from context dir to destination dir
|
# this will link file from context dir to destination dir
|
||||||
# $CONTEXT_SRC/context_file.conf -> $CONTEXT_DST/symlink_to_context_file.conf
|
# $CONTEXT_SRC/context_file.conf -> $CONTEXT_DST/symlink_to_context_file.conf
|
||||||
@@ -58,7 +58,7 @@ symlink."subdir/yet_another_file.conf" = "yet_another_file.conf"
|
|||||||
# If symlinks mapping is not empty then only instructions from the map
|
# If symlinks mapping is not empty then only instructions from the map
|
||||||
# will be applied. If you want to redefine linking rules only for single
|
# will be applied. If you want to redefine linking rules only for single
|
||||||
# file and symlink others according to default rules then add the following
|
# file and symlink others according to default rules then add the following
|
||||||
# rule as well.
|
# rule as well.
|
||||||
symlink."*" = "*"
|
symlink."*" = "*"
|
||||||
|
|
||||||
# As a special case, providing the following mapping symlinks
|
# As a special case, providing the following mapping symlinks
|
||||||
@@ -68,20 +68,20 @@ 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
|
||||||
echo "$CONTEXT_SRC"
|
echo "$CONTEXT_SRC"
|
||||||
echo "$CONTEXT_DST"
|
echo "$CONTEXT_DST"
|
||||||
echo "$CONTEXT_NAME"
|
echo "$CONTEXT_NAME"
|
||||||
@@ -89,10 +89,10 @@ exec = """
|
|||||||
|
|
||||||
# if "script" array is not empty
|
# if "script" array is not empty
|
||||||
# then userctx will try to find
|
# then userctx will try to find
|
||||||
# named files in $CONTEXT_SRC and
|
# named files in $CONTEXT_SRC and
|
||||||
# execute them with $SHELL <script>
|
# execute them with $SHELL <script>
|
||||||
# IMPORTANT: if array is empty
|
# IMPORTANT: if array is empty
|
||||||
# and action "scripts" is present in
|
# and action "scripts" is present in
|
||||||
# "actions" array above then all files
|
# "actions" array above then all files
|
||||||
# in $CONTEXT_SRC will be treated as scripts
|
# in $CONTEXT_SRC will be treated as scripts
|
||||||
# (note the "apps.gtk section below")
|
# (note the "apps.gtk section below")
|
||||||
@@ -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,9 +134,9 @@ 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.
|
||||||
# For niri since 25.11 you can just put your includes
|
# For niri since 25.11 you can just put your includes
|
||||||
# into the context dir and omit [apps.niri] altogether.
|
# into the context dir and omit [apps.niri] altogether.
|
||||||
@@ -152,7 +152,7 @@ reload = "pkill -USR1 hx"
|
|||||||
|
|
||||||
[apps.gtk]
|
[apps.gtk]
|
||||||
# To setup the look of GTK you may put a simple shell script
|
# To setup the look of GTK you may put a simple shell script
|
||||||
# into ~/.userctx/<context_name>/gtk/theme.sh with contents similar to:
|
# into ~/.userctx/<context_name>/gtk/theme.sh with contents similar to:
|
||||||
# gsettings set org.gnome.desktop.interface color-scheme 'default'
|
# gsettings set org.gnome.desktop.interface color-scheme 'default'
|
||||||
# gsettings set org.gnome.desktop.interface gtk-theme 'Yaru'
|
# gsettings set org.gnome.desktop.interface gtk-theme 'Yaru'
|
||||||
# gsettings set org.gnome.desktop.interface icon-theme 'Yaru'
|
# gsettings set org.gnome.desktop.interface icon-theme 'Yaru'
|
||||||
@@ -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'
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user