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,10 +97,25 @@ 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 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 if [ -f "$file" ]; then
log "Not clobbering existing layout file: $file" log "Not clobbering existing layout file: $file"
return 60 return 60
fi fi
fi
i3-save-tree > "$file" i3-save-tree > "$file"
notify-send \ notify-send \
-u normal \ -u normal \