aboutsummaryrefslogtreecommitdiffstats
path: root/sway/config/output.c
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2018-03-28 16:38:11 -0400
committerLibravatar Drew DeVault <sir@cmpwn.com>2018-03-28 16:42:13 -0400
commit68cfa7ef6705c530ff28d9754c5b6cab7b429150 (patch)
tree0c25eb44f1285f2522b6a5f014276239cfa6ae3f /sway/config/output.c
parentAdd initial layer shell skeleton (diff)
downloadsway-68cfa7ef6705c530ff28d9754c5b6cab7b429150.tar.gz
sway-68cfa7ef6705c530ff28d9754c5b6cab7b429150.tar.zst
sway-68cfa7ef6705c530ff28d9754c5b6cab7b429150.zip
Render layer surfaces and respect exclusive zone
Diffstat (limited to 'sway/config/output.c')
-rw-r--r--sway/config/output.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/sway/config/output.c b/sway/config/output.c
index 69e883f1..c4168b4f 100644
--- a/sway/config/output.c
+++ b/sway/config/output.c
@@ -1,9 +1,12 @@
1#define _XOPEN_SOURCE 700 1#define _XOPEN_SOURCE 700
2#include <assert.h>
2#include <stdbool.h> 3#include <stdbool.h>
3#include <string.h> 4#include <string.h>
4#include <assert.h> 5#include <signal.h>
6#include <sys/wait.h>
5#include <wlr/types/wlr_output.h> 7#include <wlr/types/wlr_output.h>
6#include <wlr/types/wlr_output_layout.h> 8#include <wlr/types/wlr_output_layout.h>
9#include <unistd.h>
7#include "sway/config.h" 10#include "sway/config.h"
8#include "sway/output.h" 11#include "sway/output.h"
9#include "log.h" 12#include "log.h"
@@ -107,6 +110,16 @@ static void set_mode(struct wlr_output *output, int width, int height,
107 } 110 }
108} 111}
109 112
113void terminate_swaybg(pid_t pid) {
114 int ret = kill(pid, SIGTERM);
115 if (ret != 0) {
116 wlr_log(L_ERROR, "Unable to terminate swaybg [pid: %d]", pid);
117 } else {
118 int status;
119 waitpid(pid, &status, 0);
120 }
121}
122
110void apply_output_config(struct output_config *oc, swayc_t *output) { 123void apply_output_config(struct output_config *oc, swayc_t *output) {
111 assert(output->type == C_OUTPUT); 124 assert(output->type == C_OUTPUT);
112 125
@@ -160,12 +173,12 @@ void apply_output_config(struct output_config *oc, swayc_t *output) {
160 } 173 }
161 174
162 if (oc && oc->background) { 175 if (oc && oc->background) {
163 // TODO swaybg 176 if (output->sway_output->bg_pid != 0) {
164 /*if (output->bg_pid != 0) { 177 terminate_swaybg(output->sway_output->bg_pid);
165 terminate_swaybg(output->bg_pid);
166 } 178 }
167 179
168 wlr_log(L_DEBUG, "Setting background for output %d to %s", output_i, oc->background); 180 wlr_log(L_DEBUG, "Setting background for output %d to %s",
181 output_i, oc->background);
169 182
170 size_t bufsize = 12; 183 size_t bufsize = 12;
171 char output_id[bufsize]; 184 char output_id[bufsize];
@@ -173,17 +186,17 @@ void apply_output_config(struct output_config *oc, swayc_t *output) {
173 output_id[bufsize-1] = 0; 186 output_id[bufsize-1] = 0;
174 187
175 char *const cmd[] = { 188 char *const cmd[] = {
176 "swaybg", 189 "./swaybg/swaybg",
177 output_id, 190 output_id,
178 oc->background, 191 oc->background,
179 oc->background_option, 192 oc->background_option,
180 NULL, 193 NULL,
181 }; 194 };
182 195
183 output->bg_pid = fork(); 196 output->sway_output->bg_pid = fork();
184 if (output->bg_pid == 0) { 197 if (output->sway_output->bg_pid == 0) {
185 execvp(cmd[0], cmd); 198 execvp(cmd[0], cmd);
186 }*/ 199 }
187 } 200 }
188} 201}
189 202