From 9576798f7abf946e10e722b4b051c36268eee3fb Mon Sep 17 00:00:00 2001 From: Scott Moreau Date: Tue, 24 Dec 2024 09:48:09 -0700 Subject: [PATCH] core: Add option to run as root To run wayfire as root, pass the option --with-great-power-comes-great-responsibility. Fixes #2540. --- src/main.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 4073616d9..6a8d60401 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -274,6 +274,7 @@ int main(int argc, char *argv[]) {"damage-debug", no_argument, NULL, 'D'}, {"damage-rerender", no_argument, NULL, 'R'}, {"legacy-wl-drm", no_argument, NULL, 'l'}, + {"with-great-power-comes-great-responsibility", no_argument, NULL, 'r'}, {"help", no_argument, NULL, 'h'}, {"version", no_argument, NULL, 'v'}, {0, 0, NULL, 0} @@ -282,9 +283,10 @@ int main(int argc, char *argv[]) std::string config_file; std::string config_backend = WF_DEFAULT_CONFIG_BACKEND; std::vector extended_debug_categories; + bool allow_root = false; int c, i; - while ((c = getopt_long(argc, argv, "c:B:d::DhRlv", opts, &i)) != -1) + while ((c = getopt_long(argc, argv, "c:B:d::DhRlrv", opts, &i)) != -1) { switch (c) { @@ -308,6 +310,10 @@ int main(int argc, char *argv[]) runtime_config.legacy_wl_drm = true; break; + case 'r': + allow_root = true; + break; + case 'h': print_help(); break; @@ -408,7 +414,7 @@ int main(int argc, char *argv[]) core.egl = wlr_gles2_renderer_get_egl(core.renderer); assert(core.egl); - if (!drop_permissions()) + if (!allow_root && !drop_permissions()) { wl_display_destroy_clients(core.display); wl_display_destroy(core.display);