This commit is contained in:
2025-12-27 11:49:06 +03:00
parent ac5267fd76
commit 84ea17c4b2
3 changed files with 82 additions and 39 deletions

View File

@@ -1,7 +1,7 @@
[general]
# if dry run is set to true
# userctx will only validate config
# and tell you what it will do to execute
# and tell you what it will do to apply context
# tasks
dry_run = true
@@ -10,16 +10,16 @@ dry_run = true
# set, then userctx will do nothing.
# Uncomment apps below.
apps = [
#"niri",
#"fuzzel",
#"gtk",
#"helix",
#"kitty",
#"mako",
#"sway",
#"swaybg",
#"waybar",
#"wofi",
"niri",
"fuzzel",
"gtk",
"helix",
"kitty",
"mako",
"sway",
"swaybg",
"waybar",
"wofi",
]
# target directory where managed configs
@@ -30,24 +30,11 @@ target_path = "~/.config"
# directory where contexts are stored
# default is "~/.config/userctx"
source_path = "~/code/userctx/test"
source_path = "~/.config/userctx"
# section that demonstrates all the available
# features of userctx
[apps.example]
# Path to appliaction configs is read from
# general.source_path. The default source path is
# ~/.config/userctx/<context_name>/example for this
# app.
# Individual path for app can be provided via
# "source_path" for particular app. Then userctx will try to lookup
# app settings in /source_path/<context_name>
# Default is general.source_path/<context_name>/<app_name>.
# For this example it will expand to
# ~/.config/userctx/<context_name/example.
# TODO: do we really need this?
source_path = "~/tmp/contexts"
# The default path to apply your context to is
# ~/.config/example (for app name "example")
# if not overridden with general.target_path.
@@ -60,7 +47,7 @@ target_path = "~/.config/example/configs"
# "symlink" map defines
# which files will be symlinked to users home
# directory.
# Names of files in thes mapping are relative to
# Names of files in this mapping are relative to
# context directory and target directory
# by default source is ~/.config/userctx/<context_name>/example
# and target directory is ~/.config/example
@@ -74,7 +61,19 @@ symlink."context_file.conf" = "symlink_to_context_file.conf"
# Note that destination subdir must be created beforehand.
# $CONTEXT_SRC/other_file.conf -> $CONTEXT_DST/subdir/other_file.conf
symlink."other_file.conf" = "subdir/other_file.conf"
symlink."subdir/yet_another_file.conf" = "yet_another_file.conf"
symlink."subdir/yet_another_file.conf" = "yet_another_file.conf"
# 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
# file and symlink others according to default rules then add the following
# rule as well.
symlink."*" = "*"
# As a special case, providing the following mapping symlinks
# a SINGLE file (the first one found) from context directory
# to a specified name (see helix section below).
# This reads "symlinks ANY file you find to this path".
# symlink."*" = "some/destination.conf"
# "exec" let's you write a reload command or
@@ -96,7 +95,8 @@ exec = """
echo "$CONTEXT_NAME"
"""
# scripts array will try to find
# if "script" array is not empty
# then userctx will try to find
# named files in $CONTEXT_SRC and
# execute them with $SHELL <script>
# IMPORTANT: if array is empty
@@ -104,13 +104,30 @@ exec = """
# "actions" array above then all files
# in $CONTEXT_SRC will be treated as scripts
# (note the "apps.gtk section below")
scripts = [
script = [
"script1.sh",
"script2.sh",
]
# if "reload" is present, the command will be executed after everythong alse is done
reload = "pkill -USR1 example"
# "actions" array specifies the order of actions when
# applying context. If omitted, the default behaviour
# it to symlink, run scripts, run exec part then run reload
# command (if relevant actions are specified).
# If nothig has been customized in apps configuration here
# (no commands array, not symlinks mapping etc.) then userctx
# will just symlink anythong it finds to target_path.
# If actions array is declared empty (actions = []) then
# userctx will do nothig.
actions = [
"symlink",
"exec",
"script",
"reload",
]
#########################
# settings for some
# commonly used apps