[Seek Help] 怎么给一个应用快捷方式以root权限启动?
Tofloor
poster avatar
reasonss
deepin
2021-03-11 00:06
Author

之前翻过 别的帖子 

用这个指令在命令行上可以,写在应用快捷里面不行。

pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY /usr/share/gitkraken/gitkraken %U --no-sandbox

以命令行调用,它需要补充用户密码,写在应用快捷里不会弹出这个窗口

 

Reply Favorite View the author
All Replies
Maicss
deepin
2021-03-11 00:45
#1

参考资料:https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html

尝试用\转义空格,或者用双引号圈起来 特殊字符$也需要转义。

试试行不行。

 

Reply View the author
Maicss
deepin
2021-03-11 00:46
#2

Reply View the author
Maicss
deepin
2021-03-11 00:50
#3

不确定我解释的是不是完全正确,英文不太好,但问题肯定是这个问题。

Reply View the author
enforcee
deepin
2021-03-11 05:59
#4
Maicss

参考资料:https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html

尝试用\转义空格,或者用双引号圈起来 特殊字符$也需要转义。

试试行不行。

 

转义是两个反斜线"\\"

这个坑了很多人吧

Reply View the author
忘记、过去
deepin
2021-03-12 00:09
#5
It has been deleted!
reasonss
deepin
2021-03-12 17:35
#6
忘记、过去 It has been deleted!

少了那环境参 不行,启动不了

Reply View the author
reasonss
deepin
2021-03-12 17:42
#7

把引用变量改好后可以了,待会我再看看怎么优化

pkexec env DISPLAY=:0 XAUTHORITY=/home/reasonss/.Xauthority /usr/share/gitkraken/gitkraken %U --no-sandbox

Reply View the author