Browse Source

file-browser: pid file

K. Lange 2 years ago
parent
commit
7e57d22c2a
3 changed files with 20 additions and 10 deletions
  1. 14 10
      apps/file-browser.c
  2. 5 0
      apps/reload_desktop.sh
  3. 1 0
      base/etc/startup.d/00_tmpfs.sh

+ 14 - 10
apps/file-browser.c

@@ -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 - 0
apps/reload_desktop.sh

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

+ 1 - 0
base/etc/startup.d/00_tmpfs.sh

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