Skip to content

Instantly share code, notes, and snippets.

@SIMULATAN
Last active July 6, 2022 07:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SIMULATAN/ec8b753a415d408c869775e815e83536 to your computer and use it in GitHub Desktop.
Save SIMULATAN/ec8b753a415d408c869775e815e83536 to your computer and use it in GitHub Desktop.
Dotter Blog Post
# add this to your .dotter/global.toml file:
# [helpers]
# bool = ".dotter/helpers/bool.rhai"
#
# use like this:
# bool my_condition
if params[0] == true || params[0] == "true" {
"true"
}
function dotfiles() {
if [ "$1" != "" ]; then
if [ $(echo "$1" | tr '[:upper:]' '[:lower:]') = "github" ]; then
# run in subshell to prevent current shell from cd'ing into the dotfiles repo
(cd {{dotter.current_dir}} && export REPO=$(git config --get remote.origin.url) && if [ "$REPO" != "" ]; then xdg-open "$REPO" && echo "Opened '$REPO' in your Browser."; else echo No git repo found.; fi)
return 0
elif [ -d "{{dotter.current_dir}}/$1" ]; then
cd {{dotter.current_dir}}/$1
pwd
else
echo Directory \'$1\' not found.
return 1
fi
else
cd {{dotter.current_dir}}
fi
# show all files, except for "." and ".." (current / upper directory)
ls -a -I "." -I ".."
}
# don't forget to 'chmod +x post_deploy.sh'
# rename this to 'post_deploy.sh' and put this file into your '.dotter' folder
#
# Explanation: checks if the 'dotter.packages.i3' package is enabled (true), and then restarts i3
# bool is required because 'dotter.packages.i3' can also be 'false', see 'bool.rhai' in this gist
# Configurable version
# add a 'auto_restart_i3 = "false|true"' variable to your i3 package in the 'global.toml' file
# for example:
# [i3.variables]
# auto_restart_id = "true"
{{#if (and (bool dotter.packages.i3) (bool auto_restart_i3))}}
# reloads i3
i3-msg restart
{{/if}}
# Version without the variable
{{#if (bool dotter.packages.i3)}}
# reloads i3
i3-msg restart
{{/if}}
# don't forget to 'chmod +x post_deploy.sh'
# rename this to 'post_deploy.sh' and put this file into your '.dotter' folder
notify-send "Dotter deployed!" -u low -t 2000 -a "Dotter" -c "transfer.complete"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment