davatorium / rofi

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

[BUG] 1.7.1 breaks pywal. #1531

Closed engageintellect closed 2 years ago

engageintellect commented 2 years ago

Rofi version (rofi -v)

1.7.1

Configuration

https://gist.github.com/jc9361/b5ec4e4888c55b9a89d2afd21110c469

Launch command

rofi -show run -font "Hack Nerd Font 10" -location 0 -theme-str '#window { width: 25%; height:25%; }'

Step to reproduce

Step 1: Point configuration section in ~/.config/rofi/config.rasi to ~/.cache/wal/colors-rofi-dark.rasi (this worked fine in 1.7.0

Step 2: Launch rofi.

Expected behavior

I expect rofi to open and be themed using colors generated from pywal in ~/.cache/wal/colors-rofi-dark.rasi

Actual behavior

everything working as expected except for theme colors.

Additional information

No response

DaveDavenport commented 2 years ago

??

Cyliann commented 2 years ago

I have exact same problem. Using wpgtk with pywal as backend.

DaveDavenport commented 2 years ago

I have no idea from this report what is wrong. Its completely unclear, not all information requested is provided and its closed after 1 hour?

I don't use pywal, not even sure what it is.

What I can see in the config is:

configuration {
        theme: "~/.cache/wal/colors-rofi-dark.rasi";
}

is wrong, also the launch command uses long deprecated options.

The above (but rofi should give a warning) should be replaced by:

@import  "~/.cache/wal/colors-rofi-dark.rasi"

and the end of the config file. This is a change made long ago, the option got deprecated in 1.7.0 (but there was a bug making it 1/2 work) and that got fixed in 1.7.1.

I checked what pywall is, the latest theming option (that been around for years) even makes it so much easier (if correctly used). If pywal would just do an @import "pywall-rofi-theme.rasi" at the end of rofi configuration it could then update that file to change the theme or completely load a new theme.

Cyliann commented 2 years ago

This is my config:

configuration {
modi: "window,drun,run";
display-drun: "";
}

* {
    font: "Agave Nerd Font 11";
    text-color: #f8f8f2;
    background-color: #282a36;
    active-background: #6272a4;
    urgent-background: #ff5555;
    selected-background: @active-background;
    selected-urgent-background: @urgent-background;
    selected-active-background: @active-background;
    separatorcolor: @active-background;
    bordercolor: @active-background;
}

window {
    background-color: @background;
    border:           1;
    border-radius: 6;
    border-color: @bordercolor;
    padding:          5;
}
mainbox {
    border:  0;
    padding: 0;
}
message {
    border:       1px dash 0px 0px ;
    border-color: @separatorcolor;
    padding:      1px ;
}
textbox {
    text-color: @foreground;
}

element-icon { 
    size: 1.65ch; 
}

@import "~/.cache/wal/colors-rofi-dark.rasi";

And this is colors-rofi-dark.rasi:

* {
    active-background: #754452;
    active-foreground: @foreground;
    normal-background: @background;
    normal-foreground: @foreground;
    urgent-background: #6E394C;
    urgent-foreground: @foreground;

    alternate-active-background: @background;
    alternate-active-foreground: @foreground;
    alternate-normal-background: @background;
    alternate-normal-foreground: @foreground;
    alternate-urgent-background: @background;
    alternate-urgent-foreground: @foreground;

    selected-active-background: #6E394C;
    selected-active-foreground: @foreground;
    selected-normal-background: #754452;
    selected-normal-foreground: @foreground;
    selected-urgent-background: #AB2C3E;
    selected-urgent-foreground: @foreground;

    background-color: @background;
    background: #0a0a0e;
    foreground: #f0a9aa;
    border-color: @background;
    spacing: 2;
}

Before 1.7.1 it properly displayed rofi with colors matching pywal theme. After 1.7.1 update it takes foreground color instead of background.

DaveDavenport commented 2 years ago

owh, that should not have changed.

DaveDavenport commented 2 years ago

there should not be a ; after import.. you should get an error for that.

DaveDavenport commented 2 years ago

rofi-2021-11-28-1609-00000

is this right?

Cyliann commented 2 years ago

Ok. Now everything works fine. Removing ; after import has solved the problem, but there wasn't any error or warning that it's incorrect.

DaveDavenport commented 2 years ago

that is very weird.

I get this: image

DaveDavenport commented 2 years ago

@Cyliann what is the launch command, want to see if I can reproduce it.

Cyliann commented 2 years ago

That's my launch command: rofi -run-command "/bin/bash -i -c '{cmd}'" -show drun -show-icons -theme-str 'window {width: 35%;}'

Cyliann commented 2 years ago

When there's ; after import all I get in terminal after running it is: initial found: ||. When the ; is gone I get nothing (rofi still starts but there's nothing in terminal)

DaveDavenport commented 2 years ago

yeah, I noticed that 'initial found: ||' that should be gone.

DaveDavenport commented 2 years ago

Thanks I could repduce the no warning, that is a bug.

(Don't understand it yet :-P).

DaveDavenport commented 2 years ago

quick fix in git for this.

engageintellect commented 2 years ago

Thanks for all the replies. There is some good stuff in here. I was able to fix it by getting rid of ~/.config/rofi/config.rasi and adding "-theme ~/.cache/wal/colors-rofi-dark.rasi" to my rofi commands. Like this:

!/usr/bin/env bash

rofi -show run \ -theme ~/.cache/wal/colors-rofi-dark.rasi \ -font "Hack Nerd Font 10" \ -location 0 \ -theme-str '#window { width: 25%; height:25%; }'

DaveDavenport commented 2 years ago

please fix it the right way. Adding

@import "~/.cache/wal/colors-rofi-dark.rasi"

at the end of config.rasi if it updates the normal theme. If it is a complete theme you can do:

@import "~/.cache/wal/colors-rofi-dark.rasi"

See also the manpages.

engageintellect commented 2 years ago

Thanks Dave. This works also. I have 5-10 different rofi scripts that I rely on for my daily workflow. Your solution of having a ~/.config/rofi/config.rasi file with "@import "~/.cache/wal/colors-rofi-dark.rasi"is much better than my solution of adding a "-theme" flag to to all my scripts.

Thank you for the quick responses on this. My issue is fixed, this issue can be closed.

I would imagine that a good deal of rofi users are using pywal. It might be benificial to add some documentation for getting rofi and pywal to play well together.... Just a thought.

Thanks again.

DaveDavenport commented 2 years ago

Feel free to provide documentation. I don't use pywall and don't have time for documenting things I don't know. it would be appreciated if community would provide something back.

engageintellect commented 2 years ago

Feel free to provide documentation. I don't use pywall and don't have time for documenting things I don't know.

it would be appreciated if community would provide something back.

If be happy to. I can add a little write up and photo of my config, once I clean it up a bit and submit a pull request. Happy to help in any way I can. I really love this project, and depend on it daily for so many things, as I've mentioned. 🙏🏻

DaveDavenport commented 2 years ago

Great, thanks.

ghost commented 2 years ago

Changing the config from

configuration {
  ...
  theme: "~/.cache/wal/colors-rofi-dark";
}

to

configuration {
  ...
}
@import "~/.cache/wal/colors-rofi-dark"

fixed it, thank you 👍🏿

DaveDavenport commented 2 years ago

there should have been an error reporting the solution in a popup, but another bug broke that. :-1:
Happy it is fixed now.

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.