diff options
author | Thomas Letan <lthms@soap.coffee> | 2022-10-02 12:55:30 +0200 |
---|---|---|
committer | Thomas Letan <lthms@soap.coffee> | 2022-10-02 12:55:30 +0200 |
commit | cc907dff58af749874aeda75df9b442aa6767c74 (patch) | |
tree | ea9dc9a46771f4a0e7955a260ecde0a4676d3d10 | |
parent | Exit gracefully when Sway’s socket closes (diff) |
Run 'pkill' in its own thread
-rw-r--r-- | bin/spatial/dune | 2 | ||||
-rw-r--r-- | bin/spatial/jobs.ml | 2 | ||||
-rw-r--r-- | bin/spatial/main.ml | 2 |
3 files changed, 4 insertions, 2 deletions
diff --git a/bin/spatial/dune b/bin/spatial/dune index f0fd72b..4b910b4 100644 --- a/bin/spatial/dune +++ b/bin/spatial/dune @@ -1,3 +1,3 @@ (executable (name main) - (libraries poll spatial-sway.ipc sway-ipc unix)) + (libraries poll spatial-sway.ipc sway-ipc unix threads)) diff --git a/bin/spatial/jobs.ml b/bin/spatial/jobs.ml new file mode 100644 index 0000000..95e3763 --- /dev/null +++ b/bin/spatial/jobs.ml @@ -0,0 +1,2 @@ +let run f = ignore (Thread.create f ()) +let shell cmd = run (fun () -> Unix.system cmd) diff --git a/bin/spatial/main.ml b/bin/spatial/main.ml index 01d06e6..64b5c2e 100644 --- a/bin/spatial/main.ml +++ b/bin/spatial/main.ml @@ -99,7 +99,7 @@ let rec go poll state sway_socket server_socket = if arrange then ( State.arrange_current_workspace ?force_focus state; (* TODO: Be more configurable about that *) - ignore (Unix.system "/usr/bin/pkill -SIGRTMIN+8 waybar")); + ignore (Jobs.shell "/usr/bin/pkill -SIGRTMIN+8 waybar")); Poll.clear poll; go poll state sway_socket server_socket with Unix.Unix_error (EINTR, _, _) -> |