i3-compat: swaybar: default to first bar-id

When launching swaybar from the command line without a --bar-id flag,
default to the first configured bar.

This is a mirror of i3 PR https://github.com/i3/i3/pull/4231.

This makes it easier to call swaybar from the command line since the
majority of swaybar users have only one bar configured.
This commit is contained in:
Orestis Floros 2026-05-23 10:16:11 +02:00 committed by Simon Ser
parent 9c663b1fa1
commit e52c14d535
2 changed files with 22 additions and 6 deletions

View file

@ -72,12 +72,6 @@ int main(int argc, char **argv) {
sway_log_init(SWAY_INFO, NULL);
}
if (!swaybar.id) {
sway_log(SWAY_ERROR, "No bar_id passed. "
"Provide --bar_id or let sway start swaybar");
return 1;
}
if (!socket_path) {
socket_path = get_socketpath();
if (!socket_path) {