micro-editor / micro-editor/micro

Cannot set third party color scheme as sudo

Open
#2,896 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
29.6k
Forks
1.4k
Avg merge
2d 18h
Merged PRs (30d)
10

Description

Description of the problem or steps to reproduce

On an up to date system run sudo apt install followed by sudo apt update and sudo apt upgrade. Download dracula theme to ~/.config/micro/colorschemes. I also gave catppuccin themes a try, same results.

Specifications

Third party colorschemes do not work under sudo. They do as a regular user and the themes provided by micro itself can be changed under sudo.
Regarding Issue 2201 I went into .bashrc and added the line export MICRO_CONFIG_HOME=/home/myusername/.config/micro/. I also gave the value "~/.config/micro/" a try, both times with and without quotation marks. Everytime I did a change, I saved the file, backed out of it, closed alacritty, restarted alacritty, ran sudo micro and tried to set a scheme with CTRL+E->set colorscheme dracula->Enter. Unfortunately I get faced with "dracula is not a valid colorscheme". Everything works fine when using micro without sudo privs.

I also ran sudo micro -config-dir /home/myusername/.config/micro/ again, once with and once without quotation marks. After both runs a blank file opened and I hit CTRL+E->set colorscheme dracula->Enter. No Error-Message, but also no change in the visuals. When backing out of the file and running sudo micro, there still is no change in the visuals, when now trying to change the scheme again, I am hit with "dracula is not a valid colorscheme".

The export which is set in the .bashrc itself seems to work though as there are now a folder called buffers, a bindings.json and settings.json file in the /.config/micro/ folder. The settings.json file does hold the data colorscheme "dracula" as expected.

Commit hash: 2.0.11
OS: Debian 12
Terminal: Alacritty
Shell: bash 5.2.15

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue on Debian 12 with micro 2.0.11, using sudo and the reported MICRO_CONFIG_HOME or -config-dir values. Investigate how third-party colorschemes are located under sudo and compare that with the built-in schemes; done means Dracula or another external scheme loads consistently when micro runs with sudo.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.