-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update launch script and desktop file
- Loading branch information
1 parent
538e46c
commit 2125f6c
Showing
2 changed files
with
1 addition
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,3 @@ | ||
#! /usr/bin/env bash | ||
|
||
app_command='python3 /usr/lib/thinkfan-ui/fan.py' | ||
|
||
if [ `id -u` -eq 0 ]; then | ||
# user is admin | ||
${app_command} | ||
else | ||
# user is not admin | ||
if `echo $- | grep "i" >/dev/null 2>&1`; then | ||
# script is running in interactive mode | ||
su - -c "${app_command}" | ||
else | ||
# script is running in non-interactive mode | ||
if [ $XDG_SESSION_TYPE = "wayland" ]; then | ||
xhost +SI:localuser:root | ||
pkexec ${app_command} | ||
xhost -SI:localuser:root | ||
xhost | ||
elif command -v pkexec >/dev/null 2>&1; then | ||
pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY ${app_command} | ||
elif command -v sudo >/dev/null 2>&1; then | ||
x-terminal-emulator -e "sudo ${app_command}" | ||
elif command -v su >/dev/null 2>&1; then | ||
x-terminal-emulator -e "su - -c '${app_command}'" | ||
else | ||
x-terminal-emulator -e "echo 'Command must be run as root user: ${app_command}'" | ||
fi | ||
fi | ||
fi | ||
python3 /usr/lib/thinkfan-ui/fan.py "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters