Update statusbar on waking up from deep sleep so battery % & time accurate
This commit is contained in:
parent
87c99ec024
commit
10705f08cd
1 changed files with 15 additions and 0 deletions
|
@ -32,6 +32,7 @@ void lockscreen(Display *dpy, int screen);
|
||||||
void readinputloop(Display *dpy, int screen);
|
void readinputloop(Display *dpy, int screen);
|
||||||
void setpineled(enum Color c);
|
void setpineled(enum Color c);
|
||||||
void syncstate();
|
void syncstate();
|
||||||
|
void updatestatusbar();
|
||||||
void writefile(char *filepath, char *str);
|
void writefile(char *filepath, char *str);
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
|
@ -237,6 +238,8 @@ syncstate()
|
||||||
setpineled(Red);
|
setpineled(Red);
|
||||||
configuresuspendsettingsandwakeupsources();
|
configuresuspendsettingsandwakeupsources();
|
||||||
writefile(powerstatefile, "mem");
|
writefile(powerstatefile, "mem");
|
||||||
|
// Just woke up
|
||||||
|
updatestatusbar();
|
||||||
state = StateSuspendPending;
|
state = StateSuspendPending;
|
||||||
syncstate();
|
syncstate();
|
||||||
} else if (state == StateNoInput) {
|
} else if (state == StateNoInput) {
|
||||||
|
@ -251,6 +254,18 @@ syncstate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
updatestatusbar()
|
||||||
|
{
|
||||||
|
pid_t statusbarpid = -1;
|
||||||
|
char buffer[999];
|
||||||
|
// TODO: there's probably a better way..
|
||||||
|
if (fgets(buffer, 999, popen("pgrep -f sxmo_statusbar.sh", "r")) != NULL)
|
||||||
|
statusbarpid = (pid_t) atoi(buffer);
|
||||||
|
if (statusbarpid != -1)
|
||||||
|
kill(statusbarpid, SIGUSR1);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
writefile(char *filepath, char *str)
|
writefile(char *filepath, char *str)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue