mirror of
https://github.com/swaywm/sway.git
synced 2025-10-29 05:40:18 -04:00
swaybar: save id upon startup
This adds an id property to the bar, which will be used to filter barconfig_update events
This commit is contained in:
parent
1f90f92f45
commit
d0b54e932b
5 changed files with 13 additions and 13 deletions
|
|
@ -22,7 +22,6 @@ void sway_terminate(int code) {
|
|||
|
||||
int main(int argc, char **argv) {
|
||||
char *socket_path = NULL;
|
||||
char *bar_id = NULL;
|
||||
bool debug = false;
|
||||
|
||||
static struct option long_options[] = {
|
||||
|
|
@ -59,7 +58,7 @@ int main(int argc, char **argv) {
|
|||
socket_path = strdup(optarg);
|
||||
break;
|
||||
case 'b': // Type
|
||||
bar_id = strdup(optarg);
|
||||
swaybar.id = strdup(optarg);
|
||||
break;
|
||||
case 'v':
|
||||
fprintf(stdout, "swaybar version " SWAY_VERSION "\n");
|
||||
|
|
@ -80,7 +79,7 @@ int main(int argc, char **argv) {
|
|||
wlr_log_init(WLR_ERROR, NULL);
|
||||
}
|
||||
|
||||
if (!bar_id) {
|
||||
if (!swaybar.id) {
|
||||
wlr_log(WLR_ERROR, "No bar_id passed. "
|
||||
"Provide --bar_id or let sway start swaybar");
|
||||
return 1;
|
||||
|
|
@ -96,13 +95,12 @@ int main(int argc, char **argv) {
|
|||
|
||||
signal(SIGTERM, sig_handler);
|
||||
|
||||
if (!bar_setup(&swaybar, socket_path, bar_id)) {
|
||||
if (!bar_setup(&swaybar, socket_path)) {
|
||||
free(socket_path);
|
||||
return 1;
|
||||
}
|
||||
|
||||
free(socket_path);
|
||||
free(bar_id);
|
||||
|
||||
bar_run(&swaybar);
|
||||
bar_teardown(&swaybar);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue