mirror of
https://github.com/swaywm/sway.git
synced 2024-11-25 17:31:28 +00:00
swaybar: send signal to status when hiding or showing bar
This commit is contained in:
parent
f6f72cb949
commit
a29ee77411
|
@ -22,6 +22,9 @@ struct status_line {
|
||||||
const char *text;
|
const char *text;
|
||||||
struct wl_list blocks; // i3bar_block::link
|
struct wl_list blocks; // i3bar_block::link
|
||||||
|
|
||||||
|
int stop_signal;
|
||||||
|
int cont_signal;
|
||||||
|
|
||||||
bool click_events;
|
bool click_events;
|
||||||
bool clicked;
|
bool clicked;
|
||||||
char *buffer;
|
char *buffer;
|
||||||
|
|
|
@ -396,6 +396,10 @@ bool determine_bar_visibility(struct swaybar *bar, bool moving_layer) {
|
||||||
destroy_layer_surface(output);
|
destroy_layer_surface(output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
wlr_log(WLR_DEBUG, "Sending %s signal to status command",
|
||||||
|
visible ? "cont" : "stop");
|
||||||
|
kill(bar->status->pid,
|
||||||
|
visible ? bar->status->cont_signal : bar->status->stop_signal);
|
||||||
}
|
}
|
||||||
return visible;
|
return visible;
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,6 +83,17 @@ bool status_handle_readable(struct status_line *status) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
json_object *signal;
|
||||||
|
if (json_object_object_get_ex(header, "stop_signal", &signal)) {
|
||||||
|
status->stop_signal = json_object_get_int(signal);
|
||||||
|
wlr_log(WLR_DEBUG, "Setting stop signal to %d", status->stop_signal);
|
||||||
|
}
|
||||||
|
if (json_object_object_get_ex(header, "cont_signal", &signal)) {
|
||||||
|
status->cont_signal = json_object_get_int(signal);
|
||||||
|
wlr_log(WLR_DEBUG, "Setting cont signal to %d", status->cont_signal);
|
||||||
|
}
|
||||||
|
|
||||||
json_object_put(header);
|
json_object_put(header);
|
||||||
|
|
||||||
wl_list_init(&status->blocks);
|
wl_list_init(&status->blocks);
|
||||||
|
@ -121,6 +132,9 @@ bool status_handle_readable(struct status_line *status) {
|
||||||
|
|
||||||
struct status_line *status_line_init(char *cmd) {
|
struct status_line *status_line_init(char *cmd) {
|
||||||
struct status_line *status = calloc(1, sizeof(struct status_line));
|
struct status_line *status = calloc(1, sizeof(struct status_line));
|
||||||
|
status->stop_signal = SIGSTOP;
|
||||||
|
status->cont_signal = SIGCONT;
|
||||||
|
|
||||||
status->buffer_size = 8192;
|
status->buffer_size = 8192;
|
||||||
status->buffer = malloc(status->buffer_size);
|
status->buffer = malloc(status->buffer_size);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue