Skip to content

Commit 293b896

Browse files
authored
Create xsudo
1 parent 0c2f7a6 commit 293b896

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Home/.local/bin/xsudo

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/sh
2+
# xsudo - run graphical applications with root privileges
3+
4+
if [ -z $1 ]; then
5+
echo "at least 1 argument required!" >> /dev/stderr
6+
exit 1
7+
fi
8+
9+
COMMAND=$1
10+
shift #shift first arg
11+
12+
for ARG in "$@"; do
13+
if [ -z "$ARGS" ]; then
14+
ARGS="$ARG"
15+
else
16+
ARGS="$ARGS $ARG"
17+
fi
18+
done
19+
20+
ARGS=\'$ARGS\'
21+
eval pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY $COMMAND $ARGS
22+
exit 0

0 commit comments

Comments
 (0)