i3-settree: Change prompt, add script support
This commit is contained in:
parent
4f6540b0d2
commit
789821ae8e
10
i3-settree
10
i3-settree
@ -29,6 +29,10 @@ prepare_input() {
|
||||
# Cannot read the file; skip it
|
||||
continue
|
||||
fi
|
||||
if [[ "$file" = *".rc" ]]; then
|
||||
# File is an rc script; skip it
|
||||
continue
|
||||
fi
|
||||
if ! [ -f "$file" ]; then
|
||||
# Glob failed and no files exist; error
|
||||
return 1
|
||||
@ -74,7 +78,7 @@ step_validate_files() {
|
||||
}
|
||||
step_get_input() {
|
||||
# Get the user input, store it in $choice
|
||||
choice="$(rofi -dmenu -p "append tree" <<< "$(prepare_input)")"
|
||||
choice="$(rofi -dmenu -p "i3 tree" <<< "$(prepare_input)")"
|
||||
if [ -z "$choice" ]; then
|
||||
log "User cancelled the operation"
|
||||
return 1
|
||||
@ -87,6 +91,10 @@ step_act() {
|
||||
case "$choice" in
|
||||
*)
|
||||
i3-msg "append_layout $choice" > /dev/null 2>&1
|
||||
if [ -r "$choice.rc" ]; then
|
||||
log "Running $choice.rc"
|
||||
"$choice".rc
|
||||
fi
|
||||
return $!
|
||||
;;
|
||||
esac
|
||||
|
Loading…
Reference in New Issue
Block a user