davatorium / rofi

Rofi: A window switcher, application launcher and dmenu replacement
https://davatorium.github.io/rofi/
Other
13.37k stars 615 forks source link

[BUG] `-config` path resolved differently from `-theme` path #2040

Open coloursofnoise opened 1 month ago

coloursofnoise commented 1 month ago

Rofi version (rofi -v)

Version: 1.7.5

Configuration

https://gist.github.com/coloursofnoise/9a0c574a1c50df9aad94e78ebb09407c#file-config-rasi

Theme

https://gist.github.com/coloursofnoise/9a0c574a1c50df9aad94e78ebb09407c#file-theme-rasi

Timing report

No response

Launch command

rofi -config test.rasi

Step to reproduce

% cat  > `$XDG_CONFIG_HOME/rofi/test.rasi` <<EOF
configuration {
    modes: [ "filebrowser" ];
}
EOF
% rofi -config test.rasi -dump-theme

Expected behavior

-dump-config output should include modes: "filebrowser";.

Actual behavior

-dump-config output only has default values (/* modes: "window,drun,run,ssh";*/).

Additional information

This behaviour differs from the -theme option, which does work with test.rasi.

Using wayland display server protocol

I've checked if the issue exists in the latest stable release

DaveDavenport commented 1 month ago

I am not sure this is a bug, but more intended behavior. We could change the behavior easily:

diff --git a/source/rofi.c b/source/rofi.c
index 9ebe28df..fb1224c7 100644
--- a/source/rofi.c
+++ b/source/rofi.c
@@ -328,7 +328,8 @@ static void print_main_application_options(int is_term) {
                  "Behave as a normal window. (experimental)", NULL, is_term);
   print_help_msg("-transient-window", "",
                  "Behave as a modal dialog that is transient to the currently "
-                 "focused window. (experimental)", NULL, is_term);
+                 "focused window. (experimental)",
+                 NULL, is_term);
   print_help_msg("-show", "[mode]",
                  "Show the mode 'mode' and exit. The mode has to be enabled.",
                  NULL, is_term);
@@ -1063,7 +1064,7 @@ int main(int argc, char *argv[]) {
       g_free(etc);
     }

-    if (config_path && g_file_test(config_path, G_FILE_TEST_IS_REGULAR)) {
+    if (config_path) {
       if (rofi_theme_parse_file(config_path)) {
         rofi_theme_free(rofi_theme);
         rofi_theme = NULL;
coloursofnoise commented 1 month ago

One issue I could see is having the same filename in both $XDG_CONFIG_HOME/rofi and $XDG_CONFIG_HOME/rofi/themes, where presumably one would want -config to prioritize the former and -theme the latter. I think the distinction between config and theme is blurry enough that it shouldn't matter all that much though.