Rofi config doesn't import all file

Hi beautiful people!
I’m configuring my openbox installation (veeery slowly) and I’m right now working on my rofi configuration. Now, it’s the first time I’m using rofi, so probably I’m doing something very silly on plain wrong but that being said there is a behavior that I cannot understand.
To centralize the color scheme I’ve created a file called colors.rasi where I simply define all the colors

/* Color-Scheme */

* {
    BG:     #2E3440ff;
    BGA:    #4C566Aff;
    FG:     #D8DEE9ff;
    BDR:    #88C0D0ff;
    SEL:    #88C0D0ff;
    UGT:    #BF616Aff;
    IMG:    #8FBCBBff;
    ON:     #EBCB8Bff;
    OFF:    #81A1C1ff;
}

and then import it in the configuration.rasi file with

@import colors.rasi

both files are in the same folder, and apparently it work, but only partially. With that I mean that if I use one of the first 3 colors defined e.g

element selected {
    background-color: @BG;
}

it work without problem, and if I change the BG color in colors.rasi it change when I call rofi too. But, there is a but, if I use for example the ON variable, or whatever in the middle, I simply get nothing.

Things I tried:

  • Changed the name of the starting variables in colors and configuration, nothing changed, first couple works, the others not (as far as I know there are no specific names that you have to use)
  • checked if I’ve made some typo or if some where tabulated and other spaced: all are formatted the same way and there is no typo (that I can see at least)
  • add the color in hex directly in the configuration.rasi (tested with ON color) and it works, so is not a problem related to the color itself

In the end, I mean, is not a big problem to have to set the color directly in the configuration, but having more than one it will be a little bit annoying.
I’ve seen this type of configuration used by others and they work, so as stated at the start, surely I’m doing something wrong.

At last my rofi version is this

Name            : rofi
Version         : 1.7.0-1

Thank you for your time folks

Some of us had been working on Rofi bugs just last week - and the unfortunate answer to this it seems - Rofi is kind of broken. I’ll let some others chime in, but the newest Rofi that was just updated seems to be kind of a mess. . .

If you use:

@import

It will APPEND to the existing theme

@theme

will clear the existing theme and load the new one.

In your config.rasi include your theme using:

@theme “mytheme”

Thank you for the reply, so I’ve tested @theme too and it doesn’t works either.
The only way found right now is paste the all colors.rasi content inside the config.rasi. At least that way I can set the color only one time per file and not in every entry.
Hope that the situation will be better in the future, but well, will wait for now.
I’ll leave the thread open in case someone else will have some idea.

For now thank you for the help.

Why does it work for me?
my config and theme are two different files …

… your color.rasi file should be in the folder themes

Sorry maybe I misunderstood how to do it. I’ve change @import with @theme. Haven’t changed any other stuff. There was else I’d to do to make it works with @theme? If so I’ll try.

Create a themes folder ~/.config/rofi/themes and put your color.rasi theme there.

At the end of the config file config.rasi add :
@theme “color”

or use complete path if you do not follow rofis structure:

@import "/path/to/colors.rasi"

Thanks! full path worked like a charm!

1 Like

i was on that journey after last rofi update to fix eos-i3 rofi menus…

I use same folder for config and colors i do not see a reason to have them in different folders…
You can also have both in one rasi file like the examples come with rofi…

ok so it’s strange, because I’ve the files (config and colors) in the same folder, but if I use full path it works, if I use relative it don’t.

yes exactly … rofi using its own folder preset… where you have rofi/themes and rofi/configs of you do not follow this structure you need to give full path…

2 Likes

ok, now I’ve understood! Thanks again

It’s just that I have a habit of storing themes in a separate directory.
Kitty - Alacritty - Rofi - themes everywhere in a separate directory.

But for the full path hint also thanks, i did not know.

1 Like

good that it is possible to choose

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.