Skip to content

Commit

Permalink
Showing 2 changed files with 21 additions and 14 deletions.
7 changes: 2 additions & 5 deletions qubes-rpc/gui-fatal.c
Original file line number Diff line number Diff line change
@@ -37,16 +37,13 @@ static void produce_message(const char *type, const char *fmt, va_list args)
case 0:
if (geteuid() == 0) {
if (setuid(getuid()) != 0) {
perror("setuid failed, not calling kdialog/zenity");
perror("setuid failed, not calling zenity/kdialog");
exit(1);
}
}
fix_display();
#ifdef USE_KDIALOG
execlp("/usr/bin/kdialog", "kdialog", "--sorry", dialog_msg, NULL);
#else
execlp("/usr/bin/zenity", "zenity", "--error", "--text", dialog_msg, NULL);
#endif
execlp("/usr/bin/kdialog", "kdialog", "--sorry", dialog_msg, NULL);
exit(1);
default:;
}
28 changes: 19 additions & 9 deletions qubes-rpc/qvm-copy-to-vm.gnome
Original file line number Diff line number Diff line change
@@ -21,8 +21,19 @@

set -e -o pipefail

set_qdbus() {
for cmd in qdbus qdbus-qt{6,5}; do
type "$cmd" >&2 || continue
qdbus=$cmd
return 0
done

unset qdbus
return 1
}

copy() {
/usr/lib/qubes/qrexec-client-vm @default \
PROGRESS_TYPE=gui /usr/lib/qubes/qrexec-client-vm @default \
qubes.Filecopy /usr/lib/qubes/qfile-agent "$@"
}

@@ -33,11 +44,10 @@ progress_kdialog() {
if [[ $pos == 0 ]]; then
# shellcheck disable=SC2207
ref=( $(kdialog --progressbar "$DESCRIPTION") )
trap 'qdbus "${ref[@]}" close' EXIT # for this subshell
qdbus "${ref[@]}" Set "" maximum "$SIZE"
trap '"$qdbus" "${ref[@]}" close' EXIT # for this subshell
fi

qdbus "${ref[@]}" Set "" value "$pos"
"$qdbus" "${ref[@]}" value $((100 * pos / SIZE))
done) >/dev/null # hide qdbus's empty output lines
}

@@ -79,11 +89,11 @@ else
fi

if [[ $SIZE == 0 ]]; then
PROGRESS_TYPE=none copy "$@"
elif [[ $0 == *.kde ]] && type kdialog qdbus >/dev/null; then
PROGRESS_TYPE=gui copy "$@" | progress_kdialog
copy "$@" >/dev/null
elif [[ $0 == *.kde ]] && type kdialog >/dev/null && set_qdbus; then
copy "$@" | progress_kdialog
elif type zenity >/dev/null; then
PROGRESS_TYPE=gui copy "$@" | progress_zenity
copy "$@" | progress_zenity
else
PROGRESS_TYPE=none copy "$@"
copy "$@" >/dev/null
fi

0 comments on commit 4ec4c79

Please sign in to comment.