From 0eddc8920e08fe71113e32d457f3686ce992664f Mon Sep 17 00:00:00 2001 From: Salt Date: Tue, 21 May 2019 18:42:21 -0500 Subject: [PATCH] Generate configs on first run automatically --- README.md | 8 ++------ firestarter | 5 ++++- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 93c32d3..7413c04 100644 --- a/README.md +++ b/README.md @@ -8,20 +8,16 @@ Execute `firestarter` as your `.xinitrc`, either by replacing the file or by `exec`ing it after performing your own basic setup. -## Quickstart - -Install as instructed per [Installation](#installation). Then, before starting the session, run Firestarter with the `-g` flag to produce default configs in `~/.config/firestarter`. These default configuration files can start most sessions, but can be edited to contain alternatives if desired. - ## Configuration -When invoked with `firestarter -g`, Firestarter will generate a series of configuration files in `~/.config/firestarter`. These files consist of several lines that look like the following: +On first run and when invoked with `firestarter -g`, Firestarter will generate a series of configuration files in `~/.config/firestarter`. These files consist of several lines that look somewhat like the following: command -v i3 i3 Every odd line is a command that must succeed in order for the following even line to be executed. Once an even command is executed, parsing stops. When Firestarter is invoked with no arguments, every configuration file is parsed this way. -If you would like to prevent all later alternatives from being parsed, simply set `:` or similar as an execution line. As an example, the following configuration file will only attempt to start a bar in an X environment: +By setting a dummy execution line, one can effectively prevent an entire configuration file from being parsed in certain environments. As an example, the following configuration file will only attempt to start an X infobar in an X environment: [ -z "$DISPLAY" ] : diff --git a/firestarter b/firestarter index e50e6ad..860acb7 100755 --- a/firestarter +++ b/firestarter @@ -266,7 +266,10 @@ step_execute() { fi for file in "$g_configdir"/*; do if ! [ -f "$file" ]; then - err "No configuration files found; please run \"$0 -g\"" 54 + log "No configuration files found; generating defaults" + step_generate + step_execute + break fi filename="$(basename -- "$file")" logfile="$g_logdir/$filename"