i3-settree: Use prettier names
This commit is contained in:
20
i3-settree
20
i3-settree
@@ -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 $!
|
||||||
;;
|
;;
|
||||||
|
Reference in New Issue
Block a user