Use sudo for terminal update inhibition
This commit is contained in:
1 parent
dc1224c03a
commit
4cc14933a4
3 files changed
+38
-2
No files matched your search
@@ -83,21 +83,31 @@ stop() {
|
||||
start() {
|
||||
local inhibit_pid=""
|
||||
local inhibit_start_time=""
|
||||
local inhibit_runner=()
|
||||
local idle_owner="$$:$RANDOM:$RANDOM"
|
||||
|
||||
stop
|
||||
mkdir -p "$state_dir"
|
||||
|
||||
if omarchy-cmd-present systemd-inhibit; then
|
||||
if (( EUID != 0 )); then
|
||||
if [[ -t 0 ]]; then
|
||||
sudo -v
|
||||
inhibit_runner=(sudo)
|
||||
else
|
||||
inhibit_runner=(pkexec)
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -n ${OMARCHY_UPDATE_LOCK_FD:-} ]]; then
|
||||
systemd-inhibit \
|
||||
"${inhibit_runner[@]}" systemd-inhibit \
|
||||
--what=sleep:idle \
|
||||
--who=omarchy-update \
|
||||
--why="Omarchy update in progress" \
|
||||
--mode=block \
|
||||
sleep infinity >/dev/null 2>&1 {OMARCHY_UPDATE_LOCK_FD}>&- &
|
||||
else
|
||||
systemd-inhibit \
|
||||
"${inhibit_runner[@]}" systemd-inhibit \
|
||||
--what=sleep:idle \
|
||||
--who=omarchy-update \
|
||||
--why="Omarchy update in progress" \
|
||||
|
||||
Reference in new issue
Block a user