Skip to content

[Bug]: custom theme does not seem to work #2671

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 task done
leonard-slass opened this issue Apr 6, 2025 · 16 comments
Open
1 task done

[Bug]: custom theme does not seem to work #2671

leonard-slass opened this issue Apr 6, 2025 · 16 comments
Labels
bug Something isn't working

Comments

@leonard-slass
Copy link

What did you expect to happen?

I have followed the instructions:

find ~/.config/atuin -type f
/home/tile/.config/atuin/config.toml
/home/tile/.config/atuin/themes/my-theme.toml

Relevant excerpt from config.toml:

[theme]
name = "my-theme"
debug = true
cat themes/my-theme.toml
[theme]
name = "my-theme"
parent = "autumn"

[colors]
AlertInto = "green"
Guidance = "#888844"

I was expecting to get the autumn theme with some color modified.

What happened?

I got the default theme. Setting debug to true did not give me further information.

Atuin doctor output

{
  "atuin": {
    "version": "18.4.0",
    "sync": null,
    "sqlite_version": "3.46.0"
  },
  "shell": {
    "name": "fish",
    "default": "fish",
    "plugins": [
      "atuin"
    ],
    "preexec": "built-in"
  },
  "system": {
    "os": "Arch Linux",
    "arch": "x86_64",
    "version": "unknown",
    "disks": [
      {
        "name": "/dev/sda2",
        "filesystem": "ext4"
      },
      {
        "name": "/dev/sda1",
        "filesystem": "vfat"
      },
      {
        "name": "/dev/sda6",
        "filesystem": "ext4"
      },
      {
        "name": "/dev/mapper/crypt",
        "filesystem": "ext4"
      },
      {
        "name": "/dev/sdb1",
        "filesystem": "fuseblk"
      }
    ]
  }
}

Code of Conduct

  • I agree to follow this project's Code of Conduct
@leonard-slass leonard-slass added the bug Something isn't working label Apr 6, 2025
@philtweir
Copy link
Contributor

Thanks @leonard-slass - I'll try and get a look this afternoon but will ping if I have any trouble reproducing!

@philtweir
Copy link
Contributor

philtweir commented Apr 6, 2025

Hmm - I have tried this with the following settings:

config.toml:
...
[theme]
name = "my-theme"
debug = true
my-theme.toml:

[theme]
name = "my-theme"
parent = "autumn"

[colors]
AlertError = "#ff857f"

and using atuin 18.4.0 (freshly downloaded from releases) and fish (I thought maybe that was the issue as I would not see a regression there perhaps). I am having some odd line overlap issue in fish, but that does not seem to be related.

It seems to work OK:

Config as above

Image

Config without AlertError line

[theme]
name = "my-theme"
parent = "autumn"

[colors]

Keeping [colors] heading albeit empty to ensure it is parsed correctly.

Image

Without parent

[theme]
name = "my-theme"

[colors]
AlertError = "#ff857f"

Taking the line out of my-theme.toml

Image

Without theme settings

Removing the custom theme from config.toml entirely

Image


  • 1 shows the custom pink colour on the active command, overriding autumn theme
  • 2 shows the autumn theme with normal autumn colours
  • 3 shows the default theme with pink overriding
  • 4 shows the default theme with default red active command

A couple of thoughts:

  • sorry to ask but just to make 100% sure, as this was an issue someone else had, is the theme block correctly located in config.toml and not scoped under another block or anything like that?
  • does the autumn theme work if you pick it as a theme in the config.toml theme block?
  • if you remove the parent can you do a custom theme on top of the default one?

@leonard-slass
Copy link
Author

Hi Phil,

Following your thoughts I have tried:

  1. I have modified config.toml with just the theme section. I removed everything else. It does not work.
[theme]
name = "my-theme"

debug = true
  1. I have changed the theme to autumn, works great.

  2. I have removed the parent and tried to tweak the AlertErrors so that it's pink like you did. That does not work either.

@leonard-slass
Copy link
Author

Couple more things I have tried:

  1. I used gnome-terminal instead of xterm but nope
  2. I ran the install script instead of using Arch's package but still no good :(

I am out of ideas...

@philtweir
Copy link
Contributor

Good thinking to try those - I am on gnome-terminal. Very puzzling!

If you would be willing to try the branch on #2673, that might improve the debugging -- I will look at adding some more, but right now there are only a couple of messages available, stil it should help narrow it down!

@leonard-slass
Copy link
Author

Hi,
I have compiled your branch and tried setting ATUIN_LOG to 1 and atuin_client=debug but I am not seeing any log on my terminal. Is it going to a file somewhere?
Have a good day!

@philtweir
Copy link
Contributor

Hmm - if you are not seeing anything, even output from other atuin components, it feels like something odd more than the theme is going on :/

Just to try and further isolate this, could you try the attached script please? Essentially, it runs a docker container of the official atuin (server) image and sets up the config. Note that it does run as root inside the container, to minimize moving parts in this test, so feel free to adjust if you prefer.

#!/bin/sh

for theme in "default" "autumn" "mytheme"
do
  docker run --user 0 --rm -it --entrypoint /bin/bash ghcr.io/atuinsh/atuin:18.4.0 -c "$(cat <<END
  echo "eval \"\\\$(atuin init bash)\"" >> ~/.bashrc
  bash -i -c "$(cat <<ENDI
    atuin history start testcommand > /dev/null
    cat <<ENDJ >>/config/config.toml
      [theme]
      name=\"$theme\"
ENDJ
    mkdir -p /root/.config/atuin/themes
    cat <<ENDJ >>/root/.config/atuin/themes/mytheme.toml
      [theme]
      name=\"mytheme\"
      [colors]
      AlertError=\"#ffffff\"
ENDJ
    TERM=xterm atuin stats | head -n 1
ENDI
  )"
END
  )"
done

The output should look like:

Image

As a side-note, there is something funny going on with the config paths as root, where the main config file is under /config, but the theme is looking at /root/.config/atuin - obviously, this is not a normal use-case, but makes me wonder if there are other circumstances where these do not align - will take a look.

@philtweir
Copy link
Contributor

This highlighted that the themes do not use ATUIN_CONFIG_DIR so #2707 addresses that -- is it possible that this is your issue, if that envvar is non-empty?

@leonard-slass
Copy link
Author

Hi,
I have tried the script and got the exact same output as you. ATUIN_CONFIG_DIR is no set in my environment.
I have no idea what's going on....
Take care

@philtweir
Copy link
Contributor

I am both fascinated and confused 😂 Sorry, that is not very helpful!

However, the good news is that it works in the container, so it should be possible to bisect what is going on locally. Will get back with a couple of suggested steps!

@philtweir
Copy link
Contributor

So, this suggests that the problem definitely within the atuin setup, at least.

However, just to make 100% sure the atuin build is working as expected, could you try something like:

https://gist.github.com/philtweir/087cb13d221ec4affa8b47ed288f1579

This version copies your env's atuin to /tmp/atuin-local and tests it in an archlinux container -- you might need to tweak the VERSION to make sure it works with your local. If that does work, then if you can try copying in your ~/.config/atuin directory that would be good. If it doesn't work, then if you can try commenting lines 13 and 14, then it should start working.

Sorry this is taking a number of loops, but if there is something underlying this I just can't reproduce, it is probably affecting others, so really appreciate your patience :/ For reference, the point of scripting this, rather than a Dockerfile is to make it easier to reproduce the exact Arch setup steps if needed.

@leonard-slass
Copy link
Author

Hi Phil,
Here is the output of the script.
Image
It looks good but I am not too sure what the next steps are.
Take care

@philtweir
Copy link
Contributor

philtweir commented May 11, 2025

OK, great - narrowing in.

I have updated https://gist.github.com/philtweir/087cb13d221ec4affa8b47ed288f1579 to copy in your ~/.config/atuin and make sure that works too. Steps:

  1. firstly, remove the [theme] section from your ~/.config/atuin/config.toml entirely
  2. run the new version of the script as-is
  3. if it works correctly, then double-check your .env because it seems like the theme directory is not being picked up during normal operation (or your theme file is broken)
  4. if it does not work correctly, then run it with DEBUG=1 ATUIN_BIN=location-of-your-build-of-atuin-from-the-theme-debug-branch ./run-atuin-stats.sh -- this should give debug output (if not, let me know), which you can share here (it should not have anything sensitive, but double-check, obvs)

@leonard-slass
Copy link
Author

Hi Phil,
Step 3 works properly. Now I am not too sure what you mean by checking my .env.
Take care,

@philtweir
Copy link
Contributor

philtweir commented May 18, 2025

Thanks @leonard-slass - Just noticing, the first post has AlertInto = "green" instead of AlertInfo = "green" - when I tested, I used AlertError because it was used in reverse search and so was handy for that test sequence I posted. I just tried with AlertInto and got he behaviour you described and, while the debug output would show that loading failure, you mentioned you did not get it to work so would not have seen any. That said, on Apr 6, you tried with AlertError and had the same issue, so this is probably a stretch (although I noticed you mentioned AlertErrors, so I'm hoping that it's a double-coincidence because I'm running low on ideas :D).

Either way though, making sure the debug is working and showing any loading problems is the next step, so I'll upload a Dockerfile to test the config later!

@philtweir
Copy link
Contributor

philtweir commented May 18, 2025

This should be a fairly robust way of working around the logging:

 curl -O https://gist.githubusercontent.com/philtweir/dfab4e8228a8f7c3fe59c71f149cd639/raw/02b5e642ed1ce54761a04e55cb38909ce5cddcde/Dockerfile.atuin-with-theme-debug
 cat Dockerfile.atuin-with-theme-debug

Make sure you are happy with the steps it is doing - it is similar to the Dockerfile in the repo, but more like the script above, but the goal is getting debug output rather than replicating steps.

Copy your atuin config (~/.config/atuin) to /tmp/atuin (if you have any symlinked dotfiles, make sure links are followed), then:

docker build -t tmp-atuin-docker-test .
docker run -v /tmp/atuin:/home/atuin/.config/atuin --rm -it tmp-atuin-docker-test search

That should give theme debug:

Image

Now I am not too sure what you mean by checking my .env.

Sorry, typo - I meant making double-checking the environment variables match inside and outside the container with env

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants