i3-settree: Use prettier names

This commit is contained in:
2018-12-23 12:07:07 -06:00
parent 789821ae8e
commit b740748e71

View File

@@ -29,8 +29,8 @@ prepare_input() {
# Cannot read the file; skip it # Cannot read the file; skip it
continue continue
fi fi
if [[ "$file" = *".rc" ]]; then if ! [[ "$file" = *".json" ]]; then
# File is an rc script; skip it # File is not a json structure; skip it
continue continue
fi fi
if ! [ -f "$file" ]; then if ! [ -f "$file" ]; then
@@ -38,10 +38,10 @@ prepare_input() {
return 1 return 1
fi fi
if [ -z "$options" ]; then if [ -z "$options" ]; then
options="$file" options="$(basename -s ".json" -- "$file")"
else else
options="$options options="$options
$file" $(basename -s ".json" -- "$file")"
fi fi
done done
printf "%s" \ printf "%s" \
@@ -79,9 +79,13 @@ step_validate_files() {
step_get_input() { step_get_input() {
# Get the user input, store it in $choice # Get the user input, store it in $choice
choice="$(rofi -dmenu -p "i3 tree" <<< "$(prepare_input)")" choice="$(rofi -dmenu -p "i3 tree" <<< "$(prepare_input)")"
choicefile="$treespath/$choice.json"
if [ -z "$choice" ]; then if [ -z "$choice" ]; then
log "User cancelled the operation" log "User cancelled the operation"
return 1 return 1
else
log "Choice: $choice"
log "Choicefile: $choicefile"
fi fi
} }
step_act() { step_act() {
@@ -90,10 +94,10 @@ step_act() {
# functionality later # functionality later
case "$choice" in case "$choice" in
*) *)
i3-msg "append_layout $choice" > /dev/null 2>&1 i3-msg "append_layout $choicefile" > /dev/null 2>&1
if [ -r "$choice.rc" ]; then if [ -r "$choicefile.rc" ]; then
log "Running $choice.rc" log "Running $choicefile.rc"
"$choice".rc "$choicefile".rc
fi fi
return $! return $!
;; ;;