file-browser: pid file

This commit is contained in:
K. Lange 2018-11-27 20:27:01 +09:00
parent c0229ae597
commit 7e57d22c2a
3 changed files with 20 additions and 10 deletions

View File

@ -536,16 +536,6 @@ static void reinitialize_contents(void) {
redraw_files();
}
/**
* Desktop mode responsds to sig_usr2 by returning to
* the bottom of the Z-order stack.
*/
static void sig_usr2(int sig) {
yutani_set_stack(yctx, main_window, YUTANI_ZORDER_BOTTOM);
yutani_flip(yctx, main_window);
signal(SIGUSR2, sig_usr2);
}
/**
* Redraw the entire window.
*/
@ -1034,6 +1024,17 @@ static void _handle_button_press(int index) {
}
}
/**
* Desktop mode responsds to sig_usr2 by returning to
* the bottom of the Z-order stack.
*/
static void sig_usr2(int sig) {
yutani_set_stack(yctx, main_window, YUTANI_ZORDER_BOTTOM);
yutani_flip(yctx, main_window);
signal(SIGUSR2, sig_usr2);
_menu_action_refresh(NULL);
}
int main(int argc, char * argv[]) {
yctx = yutani_init();
@ -1050,6 +1051,9 @@ int main(int argc, char * argv[]) {
yutani_window_move(yctx, main_window, 0, 0);
yutani_set_stack(yctx, main_window, YUTANI_ZORDER_BOTTOM);
arg_ind++;
FILE * f = fopen("/var/run/.wallpaper.pid", "w");
fprintf(f, "%d\n", getpid());
fclose(f);
} else {
main_window = yutani_window_create(yctx, 800, 600);
yutani_window_move(yctx, main_window, yctx->display_width / 2 - main_window->width / 2, yctx->display_height / 2 - main_window->height / 2);

5
apps/reload_desktop.sh Normal file
View File

@ -0,0 +1,5 @@
#!/bin/sh
export-cmd DESKTOP cat /var/run/.wallpaper.pid
if not empty? "$DESKTOP" then kill -SIGUSR2 $DESKTOP

View File

@ -2,3 +2,4 @@
mount tmpfs tmp,777 /tmp
mount tmpfs var,755 /var
mkdir /var/run