From 00e7172509f650ce52165b128557879dd8026147 Mon Sep 17 00:00:00 2001 From: Simon Lipp Date: Sun, 9 Mar 2025 14:36:55 +0100 Subject: [PATCH] Allow to set app id from command line --- cage.c | 6 +++++- output.c | 4 ++++ server.h | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/cage.c b/cage.c index 8f14746..736abb4 100644 --- a/cage.c +++ b/cage.c @@ -233,6 +233,7 @@ usage(FILE *file, const char *cage) " -m last Use only the last connected output\n" " -s\t Allow VT switching\n" " -v\t Show the version number and exit\n" + " -i app-id Set application idendifier for the toplevel window\n" "\n" " Use -- when you want to pass arguments to APPLICATION\n", cage); @@ -242,7 +243,7 @@ static bool parse_args(struct cg_server *server, int argc, char *argv[]) { int c; - while ((c = getopt(argc, argv, "dDhm:sv")) != -1) { + while ((c = getopt(argc, argv, "dDhm:svi:")) != -1) { switch (c) { case 'd': server->xdg_decoration = true; @@ -263,6 +264,9 @@ parse_args(struct cg_server *server, int argc, char *argv[]) case 's': server->allow_vt_switch = true; break; + case 'i': + server->app_id = optarg; + break; case 'v': fprintf(stdout, "Cage version " CAGE_VERSION "\n"); exit(0); diff --git a/output.c b/output.c index f1c0419..742463a 100644 --- a/output.c +++ b/output.c @@ -272,6 +272,10 @@ handle_new_output(struct wl_listener *listener, void *data) return; } + if (server->app_id != NULL && wlr_output_is_wl(wlr_output)) { + wlr_wl_output_set_app_id(wlr_output, server->app_id); + } + output->wlr_output = wlr_output; wlr_output->data = output; output->server = server; diff --git a/server.h b/server.h index 00c2a61..68c3582 100644 --- a/server.h +++ b/server.h @@ -66,6 +66,7 @@ struct cg_server { bool return_app_code; bool terminated; enum wlr_log_importance log_level; + const char *app_id; }; void server_terminate(struct cg_server *server);