~scoopta/wofi#182: 
@import (CSS) does not read paths relative to the stylesheet it's on

Running wofi 1.2.4 on Arch.

The CSS @import directive reads the path given relative to wofi's current working directory instead of the stylesheet's as would be expected.

For example, given the following directory structure, with wofi being started with ~ as the cwd (what I assume is the most common use case): /home/$USER |-- .config | |-- wofi | | |-- config | | |-- style.css | | |-- foo.css Given a style.css with @import "foo.css" at its top, instead of ~/.config/wofi/foo.css being imported, there is instead an attempt to read ~/foo.css, which fails. Should the file in fact be present in ~ then it is loaded as expected.

Status
REPORTED
Submitter
Rodrigo Gameiro
Assigned to
No-one
Submitted
2 years ago
Updated
1 year, 22 days ago
Labels
No labels applied.

Rodrigo Gameiro 2 years ago · edit

I apologise for the formatting mishap, for I keep forgetting sometimes two newlines are necessary for a line break to occur.

The filesystem example was meant to look as follows:

`/home/$USER

|-- .config

| |-- wofi

| | |-- config

| | |-- style.css

| | |-- foo.css`

I'm extremely sorry.

Maxime Dolberg 1 year, 22 days ago · edit

I am having that issue as well.

wofi -s /home/$USER/.config/wofi/style.css

(wofi:37088): Gtk-WARNING **: 23:36:03.452: Theme parsing
error:<data>:1:29: Failed to import: Error opening file
/home/max/.config/foo.css: No such file or directory

The workaround is to adjust the imported style sheet path by adding wofi/ prefix such as:

@import "wofi/foo.css";

~scoopta 1 year, 22 days ago

Thanks for bumping this. Due to wofi being somewhat inactive I miss a lot of the bug reports. I'm not sure if there's actually a way to fix this without having wofi set its cwd to the wofi config folder, which actually might be ok. I believe GTK is just using the program cwd for handling @import, which likely makes some amount of sense from GTK's perspective. I don't have a problem changing this I'm just trying to think if there's any gotchas or problems that could be caused by wofi fixing it's cwd

Maxime Dolberg 1 year, 22 days ago · edit

Erratum on my previous message. I executed wofi from my local ~/.config diectory...

But actually, one can change the working directory before running wofi in a script:

#!/bin/bash

cd ~/.config/wofi
wofi

With the import of further css files in style.css using a relative path:

@import "foo.css"

As you said, it is likely that GTK align the current working directory on the location where wofi is launched.

Register here or Log in to comment, or comment via email.