Skip to content

Commit 75e59fa

Browse files
committed
call dbus-send command for bypass screenshot permission dialog is possible
1 parent e521a7c commit 75e59fa

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

data/tr.org.pardus.pen.default.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ is-vertical=true
1919
fuar=false
2020
xwayland=false
2121
eraser-mode=true
22+
dbus_init=false

src/main.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,22 @@ extern void mainWindowInit();
1818
bool force_xwayland = false;
1919
int history;
2020

21+
#ifdef DBUS
22+
static void accept_screenshot_permission(){
23+
const char* cmd = "dbus-send --session \
24+
--print-reply=literal \
25+
--dest=org.freedesktop.impl.portal.PermissionStore \
26+
/org/freedesktop/impl/portal/PermissionStore \
27+
org.freedesktop.impl.portal.PermissionStore.SetPermission \
28+
string:'screenshot' \
29+
boolean:'true' \
30+
string:'screenshot' \
31+
string:'tr.org.pardus.pen' \
32+
array:string:'yes'";
33+
system(cmd);
34+
}
35+
#endif
36+
2137
static bool detect_etap(){
2238
FILE *f = fopen("/etc/os-release", "r");
2339
if(f == NULL){
@@ -110,10 +126,19 @@ int main(int argc, char *argv[]) {
110126

111127
mainWindowInit();
112128

129+
#ifdef DBUS
130+
if(!get_bool("dbus_init")){
131+
accept_screenshot_permission();
132+
set_bool("dbus_init", true);
133+
}
134+
#endif
135+
113136
#ifdef LIBARCHIVE
114137
if (argc > 1) {
115138
openFile( QString(argv[1]));
116139
}
117140
#endif
118141
return app.exec();
119142
}
143+
144+

0 commit comments

Comments
 (0)