diff options
Diffstat (limited to 'sway/config/output.c')
-rw-r--r-- | sway/config/output.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/sway/config/output.c b/sway/config/output.c index 648ded27..1bf9e5f1 100644 --- a/sway/config/output.c +++ b/sway/config/output.c | |||
@@ -90,7 +90,7 @@ static void set_mode(struct wlr_output *output, int width, int height, | |||
90 | float refresh_rate) { | 90 | float refresh_rate) { |
91 | int mhz = (int)(refresh_rate * 1000); | 91 | int mhz = (int)(refresh_rate * 1000); |
92 | if (wl_list_empty(&output->modes)) { | 92 | if (wl_list_empty(&output->modes)) { |
93 | wlr_log(L_DEBUG, "Assigning custom mode to %s", output->name); | 93 | wlr_log(WLR_DEBUG, "Assigning custom mode to %s", output->name); |
94 | wlr_output_set_custom_mode(output, width, height, mhz); | 94 | wlr_output_set_custom_mode(output, width, height, mhz); |
95 | return; | 95 | return; |
96 | } | 96 | } |
@@ -106,9 +106,9 @@ static void set_mode(struct wlr_output *output, int width, int height, | |||
106 | } | 106 | } |
107 | } | 107 | } |
108 | if (!best) { | 108 | if (!best) { |
109 | wlr_log(L_ERROR, "Configured mode for %s not available", output->name); | 109 | wlr_log(WLR_ERROR, "Configured mode for %s not available", output->name); |
110 | } else { | 110 | } else { |
111 | wlr_log(L_DEBUG, "Assigning configured mode to %s", output->name); | 111 | wlr_log(WLR_DEBUG, "Assigning configured mode to %s", output->name); |
112 | wlr_output_set_mode(output, best); | 112 | wlr_output_set_mode(output, best); |
113 | } | 113 | } |
114 | } | 114 | } |
@@ -116,7 +116,7 @@ static void set_mode(struct wlr_output *output, int width, int height, | |||
116 | void terminate_swaybg(pid_t pid) { | 116 | void terminate_swaybg(pid_t pid) { |
117 | int ret = kill(pid, SIGTERM); | 117 | int ret = kill(pid, SIGTERM); |
118 | if (ret != 0) { | 118 | if (ret != 0) { |
119 | wlr_log(L_ERROR, "Unable to terminate swaybg [pid: %d]", pid); | 119 | wlr_log(WLR_ERROR, "Unable to terminate swaybg [pid: %d]", pid); |
120 | } else { | 120 | } else { |
121 | int status; | 121 | int status; |
122 | waitpid(pid, &status, 0); | 122 | waitpid(pid, &status, 0); |
@@ -144,22 +144,22 @@ void apply_output_config(struct output_config *oc, struct sway_container *output | |||
144 | } | 144 | } |
145 | 145 | ||
146 | if (oc && oc->width > 0 && oc->height > 0) { | 146 | if (oc && oc->width > 0 && oc->height > 0) { |
147 | wlr_log(L_DEBUG, "Set %s mode to %dx%d (%f GHz)", oc->name, oc->width, | 147 | wlr_log(WLR_DEBUG, "Set %s mode to %dx%d (%f GHz)", oc->name, oc->width, |
148 | oc->height, oc->refresh_rate); | 148 | oc->height, oc->refresh_rate); |
149 | set_mode(wlr_output, oc->width, oc->height, oc->refresh_rate); | 149 | set_mode(wlr_output, oc->width, oc->height, oc->refresh_rate); |
150 | } | 150 | } |
151 | if (oc && oc->scale > 0) { | 151 | if (oc && oc->scale > 0) { |
152 | wlr_log(L_DEBUG, "Set %s scale to %f", oc->name, oc->scale); | 152 | wlr_log(WLR_DEBUG, "Set %s scale to %f", oc->name, oc->scale); |
153 | wlr_output_set_scale(wlr_output, oc->scale); | 153 | wlr_output_set_scale(wlr_output, oc->scale); |
154 | } | 154 | } |
155 | if (oc && oc->transform >= 0) { | 155 | if (oc && oc->transform >= 0) { |
156 | wlr_log(L_DEBUG, "Set %s transform to %d", oc->name, oc->transform); | 156 | wlr_log(WLR_DEBUG, "Set %s transform to %d", oc->name, oc->transform); |
157 | wlr_output_set_transform(wlr_output, oc->transform); | 157 | wlr_output_set_transform(wlr_output, oc->transform); |
158 | } | 158 | } |
159 | 159 | ||
160 | // Find position for it | 160 | // Find position for it |
161 | if (oc && (oc->x != -1 || oc->y != -1)) { | 161 | if (oc && (oc->x != -1 || oc->y != -1)) { |
162 | wlr_log(L_DEBUG, "Set %s position to %d, %d", oc->name, oc->x, oc->y); | 162 | wlr_log(WLR_DEBUG, "Set %s position to %d, %d", oc->name, oc->x, oc->y); |
163 | wlr_output_layout_add(output_layout, wlr_output, oc->x, oc->y); | 163 | wlr_output_layout_add(output_layout, wlr_output, oc->x, oc->y); |
164 | } else { | 164 | } else { |
165 | wlr_output_layout_add_auto(output_layout, wlr_output); | 165 | wlr_output_layout_add_auto(output_layout, wlr_output); |
@@ -187,7 +187,7 @@ void apply_output_config(struct output_config *oc, struct sway_container *output | |||
187 | terminate_swaybg(output->sway_output->bg_pid); | 187 | terminate_swaybg(output->sway_output->bg_pid); |
188 | } | 188 | } |
189 | 189 | ||
190 | wlr_log(L_DEBUG, "Setting background for output %d to %s", | 190 | wlr_log(WLR_DEBUG, "Setting background for output %d to %s", |
191 | output_i, oc->background); | 191 | output_i, oc->background); |
192 | 192 | ||
193 | size_t len = snprintf(NULL, 0, "%s %d %s %s", | 193 | size_t len = snprintf(NULL, 0, "%s %d %s %s", |
@@ -195,28 +195,30 @@ void apply_output_config(struct output_config *oc, struct sway_container *output | |||
195 | output_i, oc->background, oc->background_option); | 195 | output_i, oc->background, oc->background_option); |
196 | char *command = malloc(len + 1); | 196 | char *command = malloc(len + 1); |
197 | if (!command) { | 197 | if (!command) { |
198 | wlr_log(L_DEBUG, "Unable to allocate swaybg command"); | 198 | wlr_log(WLR_DEBUG, "Unable to allocate swaybg command"); |
199 | return; | 199 | return; |
200 | } | 200 | } |
201 | snprintf(command, len + 1, "%s %d %s %s", | 201 | snprintf(command, len + 1, "%s %d %s %s", |
202 | config->swaybg_command ? config->swaybg_command : "swaybg", | 202 | config->swaybg_command ? config->swaybg_command : "swaybg", |
203 | output_i, oc->background, oc->background_option); | 203 | output_i, oc->background, oc->background_option); |
204 | wlr_log(L_DEBUG, "-> %s", command); | 204 | wlr_log(WLR_DEBUG, "-> %s", command); |
205 | 205 | ||
206 | char *const cmd[] = { "sh", "-c", command, NULL }; | 206 | char *const cmd[] = { "sh", "-c", command, NULL }; |
207 | output->sway_output->bg_pid = fork(); | 207 | output->sway_output->bg_pid = fork(); |
208 | if (output->sway_output->bg_pid == 0) { | 208 | if (output->sway_output->bg_pid == 0) { |
209 | execvp(cmd[0], cmd); | 209 | execvp(cmd[0], cmd); |
210 | } else { | ||
211 | free(command); | ||
210 | } | 212 | } |
211 | } | 213 | } |
212 | if (oc && oc->dpms_state != DPMS_IGNORE) { | 214 | if (oc && oc->dpms_state != DPMS_IGNORE) { |
213 | switch (oc->dpms_state) { | 215 | switch (oc->dpms_state) { |
214 | case DPMS_ON: | 216 | case DPMS_ON: |
215 | wlr_log(L_DEBUG, "Turning on screen"); | 217 | wlr_log(WLR_DEBUG, "Turning on screen"); |
216 | wlr_output_enable(wlr_output, true); | 218 | wlr_output_enable(wlr_output, true); |
217 | break; | 219 | break; |
218 | case DPMS_OFF: | 220 | case DPMS_OFF: |
219 | wlr_log(L_DEBUG, "Turning off screen"); | 221 | wlr_log(WLR_DEBUG, "Turning off screen"); |
220 | wlr_output_enable(wlr_output, false); | 222 | wlr_output_enable(wlr_output, false); |
221 | break; | 223 | break; |
222 | case DPMS_IGNORE: | 224 | case DPMS_IGNORE: |