i3-settree: Add kdialog integration

This commit is contained in:
Salt 2019-01-14 18:14:23 -06:00
parent 06352b30a6
commit 022afcb4c0

View File

@ -97,9 +97,24 @@ step_act() {
case "$choice" in case "$choice" in
Save) Save)
file="$treespath/$name-layout-$(date +%s%N).json" file="$treespath/$name-layout-$(date +%s%N).json"
if [ -f "$file" ]; then if command -v kdialog > /dev/null 2>&1; then
log "Not clobbering existing layout file: $file" # Handle with kdialog
return 60 newpath="$(kdialog --getsavefilename "$file" "i3 Layout Trees (*.json)")"
# Shellcheck you're a dumb
# We need that output, man
#shellcheck disable=2181
if ! [ $? -eq 0 ]; then
log "User canceled the save operation"
return 61
else
file="$newpath"
fi
else
# Basic handling
if [ -f "$file" ]; then
log "Not clobbering existing layout file: $file"
return 60
fi
fi fi
i3-save-tree > "$file" i3-save-tree > "$file"
notify-send \ notify-send \