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
Save)
file="$treespath/$name-layout-$(date +%s%N).json"
if [ -f "$file" ]; then
log "Not clobbering existing layout file: $file"
return 60
if command -v kdialog > /dev/null 2>&1; then
# Handle with kdialog
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
i3-save-tree > "$file"
notify-send \