Skip to content

Commit 69e1e19

Browse files
committed
fix notification delay
1 parent 5bdcc05 commit 69e1e19

File tree

3 files changed

+22
-15
lines changed

3 files changed

+22
-15
lines changed

src/Utility/OSDNotify.vala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ public class OSDNotify : GLib.Object {
7171

7272
string s = "notify-send -t %d -u %s -i %s \"%s\" \"%s\" -h %s".printf(
7373
durationMillis, urgency, "gtk-dialog-" + dialog_type, title, message, hint);
74-
75-
retVal = exec_sync (s, null, null);
74+
75+
retVal = TeeJee.ProcessHelper.exec_user_async(s);
7676

7777
dt_last_notification = new DateTime.now_local();
7878
}

src/Utility/TeeJee.Process.vala

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,25 @@ namespace TeeJee.ProcessHelper{
202202
}
203203
}
204204

205+
/**
206+
executes a command as the "normal" unprivileged user async
207+
*/
208+
public static int exec_user_async(string command) {
209+
// find correct user
210+
int uid = TeeJee.System.get_user_id();
211+
string cmd = command;
212+
if(uid > 0) {
213+
// non root
214+
string? user = TeeJee.System.get_username_from_uid(uid);
215+
if(user != null) {
216+
cmd = "pkexec --user %s env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%i/bus ".printf(user, uid) + cmd;
217+
}
218+
}
219+
220+
log_debug(cmd);
221+
return TeeJee.ProcessHelper.exec_script_async(cmd);
222+
}
223+
205224
public string? save_bash_script_temp (string commands, string? script_path = null,
206225
bool force_locale = true, bool supress_errors = false){
207226

src/Utility/TeeJee.System.vala

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -151,19 +151,7 @@ namespace TeeJee.System{
151151

152152
string cmd = "xdg-open '%s'".printf(escape_single_quote(file));
153153

154-
// find correct user
155-
int uid = get_user_id();
156-
if(uid > 0) {
157-
// non root
158-
string? user = get_username_from_uid(uid);
159-
if(user != null) {
160-
cmd = "pkexec --user %s env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%i/bus ".printf(user, uid) + cmd;
161-
}
162-
}
163-
164-
log_debug(cmd);
165-
int status = exec_script_async(cmd);
166-
return (status == 0);
154+
return exec_user_async(cmd) == 0;
167155
}
168156

169157
public bool exo_open_folder (string dir_path, bool xdg_open_try_first = true){

0 commit comments

Comments
 (0)