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