Myrlyn under GNOME

I am using GNOME DE on both Tumbleweed and Leap 16.

When starting Myrlyn (Read-only) the application follows the GNOME theme (adwaita) nicely.

When starting Myrlyn (root) it does not follow the GNOME theme. Most noticeable are different fonts and a different title bar.

I know that Myrlyn is built with the Qt library and that probably is at least part of the reason for the differences.

It does not bother me much but thought I would bring it up here.
So, has anyone found a way to make Myrlyn always follow the GNOME theme?

Forum search:

This are the explanations from the Myrlyn maintainer.

User and root settings are traditionally seperated and different.

1 Like

When using root settings come from /root and may be different from the settings in your home.

Well, to begin with, I use KDE Plasma, not GNOME, so what I have to offer may not work on GNOME.

If you examine the menu entries for Myrlyn (root) and Myrlyn (Read-only for a user), those are each scripts, customizing the execution.

For me - the quick answer is to execute at the Konsole (KDE windowed command line):

user@machine :~>  sudo -E myrlyn
[sudo] password for user:
[...]

Executing as such shows Myrlyn with my user’s GUI configuration (Breeze Dark) and with root privileges (of course). It is rendered exactly like the Myrlyn (my user-account, read-only) version. See screenshot.

(sidenote: if I remember my research, the (root, i.e., sudo) script wants to run as wayland, but I use X11).
.

I wrote a lot of text about Myrlyn and root privileges here (it’s even one of the pinned issues):

sudo -E might work for some users, but it depends very much on your sudo setup. That’s why I wrote the myrlyn-sudo script that handles this transparently and without relying too much on your sudo setup.

As for the font and the widget theme, that’s indeed what @hui linked above.

Ok, I understand that making Myrlyn use the default GNOME theme in all cases is not straight forward.
As previously written, it does not bother me much and I will not waste any more time on this minor problem.
Myrlyn is still a great application!

1 Like

I recently reinstalled Tumbleweed with XFCE as the desktop environment and the adwaita-dark theme. For me, using myrlyn-sudo results in the wrong light theme being applied, while sudo -E myrlin applies the correct theme. I tried editing the myrlyn-sudo script to use the -AE flag instead of just -A and that fixed the issue for me as well. I know it’s probably a skill issue on my part and the result of sticking with a gtk desktop environment, just thought I’d mention.

I am also a happy Xfce user.

sudo -E tells sudo to keep all environment variables; this may or may not work, depending on the settings in /etc/sudoers (or /usr/etc/sudoers or files in /etc/sudoers.d or /usr/etc/sudoers.d).

If that is set up in a very restrictive way, sudo may simply refuse it; that’s why myrlyn-sudo calls /usr/bin/env as the command to run with root privileges: It builds a well-defined shell environment from some select environment variables and then calls myrlyn (still using root privileges) with that environment.

I added a good number of environment variables like QT_QPA_PLATFORMTHEME and others so you can set things like your preferred Qt widget theme, the widget colors, fonts, font size (if you used qt6ctfor your root account to set them).

By default, Qt tries to use your (in this case root’s) desktop settings for such things. But since this looks them up in the home directory of root, this might fail if you never logged in as root before.

An easy workaround is to log into a graphical session with root once to set these things: Set a root password with sudo passwd root if you don’t have one, log in as root into a graphical desktop, change the theme / fonts etc. there and then log out again.

You can delete the root password again with sudo passwd -d root if you wish, and of course if your sudo settings let you use your own password for it.

More details at the GitHub issue that I linked above.

HTH

Sure. And if it works and

does not it suggests that myrlyn-sudo misses some variables.

@baconcatbug Comparison of environment variables after sudo -E and myrlyn-sudo would be interesting (you can fetch it using something like sudo -- sh -c "tr '\0' '\n' < /proc/\$(pidof myrlyn)/environ").

That is possible. If anybody tells me which ones are missing, I will gladly add them. But the possibilities are very much endless.

And if I’d try to replicate the whole environment, for sure the security experts would complain; that’s why they introduced discarding the environment by default in sudo in the first place.

When running sudo-myrlyn uneddited

[baconcatbug@localhost ~] $ sudo -- sh -c "tr '\0' '\n' < /proc/\$(pidof myrlyn)/environ"
XAUTHORITY=/home/baconcatbug/.Xauthority
LANG=en_GB.utf8
TERM=xterm
DISPLAY=:0.0
MAIL=/var/mail/root
PATH=/usr/sbin:/usr/bin:/sbin:/bin
LOGNAME=root
USER=root
HOME=/root
SHELL=/bin/bash
SUDO_COMMAND=/usr/bin/env DISPLAY=:0.0 WAYLAND_DISPLAY= XAUTHORITY=/home/baconcatbug/.Xauthority XDG_RUNTIME_DIR=/run/user/1000 QT_QPA_PLATFORMTHEME= QT_ENABLE_HIGHDPI_SCALING= QT_SCALE_FACTOR= LANG=en_GB.utf8 LC_MESSAGES= LC_COLLATE= LC_NUMERIC= LC_TIME= LC_ALL= LANGUAGE= /usr/bin/myrlyn
SUDO_USER=baconcatbug
SUDO_UID=1000
SUDO_GID=1000
SUDO_HOME=/home/baconcatbug
WAYLAND_DISPLAY=
XDG_RUNTIME_DIR=/run/user/1000
QT_QPA_PLATFORMTHEME=
QT_ENABLE_HIGHDPI_SCALING=
QT_SCALE_FACTOR=
LC_MESSAGES=
LC_COLLATE=
LC_NUMERIC=
LC_TIME=
LC_ALL=
LANGUAGE=

After editing it to run SUDO_ASKPASS=$ASKPASS sudo -AE /usr/bin/env $ENV /usr/bin/myrlyn $MYRLYN_ARGS with the -E flag

SUDO_ASKPASS=/usr/bin/myrlyn-askpass
SHELL=/bin/bash
SESSION_MANAGER=local/localhost.localdomain:@/tmp/.ICE-unix/3890,unix/localhost.localdomain:/tmp/.ICE-unix/3890
XDG_CONFIG_DIRS=/etc/xdg:/usr/local/etc/xdg:/usr/etc/xdg:/etc/xdg
LESS=-M -I -R
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0
XDG_MENU_PREFIX=xfce-
GTK_IM_MODULE=cedilla
MACHTYPE=x86_64-suse-linux
G_BROKEN_FILENAMES=1
HOSTNAME=localhost.localdomain
HISTSIZE=1000
FROM_HEADER=
MINICOM=-c on
GDMFLEXISERVER=/usr/libexec/lightdm/gdmflexiserver
AUDIODRIVER=pulseaudio
JRE_HOME=/usr/lib64/jvm/java-25-openjdk-25
SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
XDG_DATA_HOME=/home/baconcatbug/.local/share
CPU=x86_64
XDG_CONFIG_HOME=/home/baconcatbug/.config
XMODIFIERS=@im=local
DESKTOP_SESSION=xfce
GPG_TTY=not a tty
EDITOR=nano
GTK_MODULES=canberra-gtk-module
XDG_SEAT=seat0
PWD=/home/baconcatbug
QEMU_AUDIO_DRV=pa
XDG_SESSION_DESKTOP=xfce
LOGNAME=root
XDG_SESSION_TYPE=x11
PANEL_GDK_CORE_DEVICE_EVENTS=0
MANPATH=/usr/local/man:/usr/share/man
XAUTHORITY=/home/baconcatbug/.Xauthority
XDG_GREETER_DATA_DIR=/var/lib/lightdm-data/baconcatbug
XKEYSYMDB=/usr/X11R6/lib/X11/XKeysymDB
GDM_LANG=en_GB.utf8
XNLSPATH=/usr/share/X11/nls
HOME=/root
SSH_ASKPASS=/usr/libexec/ssh/ssh-askpass
LANG=en_GB.utf8
XDG_CURRENT_DESKTOP=XFCE
PYTHONSTARTUP=/etc/pythonstart
OSTYPE=linux
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
QT_IM_SWITCHER=imsw-multi
LESS_ADVANCED_PREPROCESSOR=no
XSESSION_IS_UP=yes
XDG_CACHE_HOME=/home/baconcatbug/.cache
MOZ_GMP_PATH=/usr/lib64/mozilla/plugins/gmp-gmpopenh264/system-installed
LESSCLOSE=lessclose.sh %s %s
XDG_SESSION_CLASS=user
TERM=xterm
G_FILENAME_ENCODING=@locale,UTF-8,ISO-8859-15,CP1252
HOST=localhost.localdomain
XAUTHLOCALHOSTNAME=localhost.localdomain
LESSOPEN=lessopen.sh %s
USER=root
MORE=-sl
VISUAL=nano
CSHEDIT=emacs
DISPLAY=:0.0
SHLVL=1
WINDOWMANAGER=startxfce4
PAGER=less
QT_IM_MODULE=xim
XDG_VTNR=7
XDG_SESSION_ID=1
XDG_STATE_HOME=/home/baconcatbug/.local/state
XDG_RUNTIME_DIR=/run/user/1000
DEBUGINFOD_URLS=https://debuginfod.opensuse.org/ 
MANPATHISSET=yes
XDG_DATA_DIRS=/usr/local/share:/usr/share
VENDOR=suse
CONFIG_SITE=/usr/share/site/x86_64-pc-linux-gnu
PATH=/usr/sbin:/usr/bin:/sbin:/bin
GDMSESSION=xfce
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
PROFILEREAD=true
MAIL=/var/mail/baconcatbug
HOSTTYPE=x86_64
LESSKEY=/usr/etc/lesskey.bin
_=/usr/bin/sudo
SUDO_COMMAND=/usr/bin/env DISPLAY=:0.0 WAYLAND_DISPLAY= XAUTHORITY=/home/baconcatbug/.Xauthority XDG_RUNTIME_DIR=/run/user/1000 QT_QPA_PLATFORMTHEME= QT_ENABLE_HIGHDPI_SCALING= QT_SCALE_FACTOR= LANG=en_GB.utf8 LC_MESSAGES= LC_COLLATE= LC_NUMERIC= LC_TIME= LC_ALL= LANGUAGE= /usr/bin/myrlyn
SUDO_USER=baconcatbug
SUDO_UID=1000
SUDO_GID=1000
SUDO_HOME=/home/baconcatbug
WAYLAND_DISPLAY=
QT_QPA_PLATFORMTHEME=
QT_ENABLE_HIGHDPI_SCALING=
QT_SCALE_FACTOR=
LC_MESSAGES=
LC_COLLATE=
LC_NUMERIC=
LC_TIME=
LC_ALL=
LANGUAGE=

Checking the diff shows the non-E one has the MAIL variable but the -E one doesn’t, strangely, but the -E one has 74 additional variables, one of which I assume is allowing the theme to go though.

For what it’s worth, I did attempt logging into root graphically and setting the theme there, as well as running xfce4-appearance-settings as sudo. They both report as adwaita-dark (and when I open thunar for example as sudo, the theme does apply), but it doesn’t work for myrlyn.

Try to preserve XDG_CURRENT_DESKTOP. Seems to (sort of) work for me.

Adding XDG_CURRENT_DESKTOP to the ENV_KEEP variable in the script did it for me as well.

Funny. In my case myrlyn as user is using dark theme but myrlyn as root is using light theme. Confused …

Apparently doing so is difficult. The developer has offered a few solutions that all require the user understanding how to modify system files. I have asked the same question regarding font sizes (I have a 4k screen; sometimes fonts are unreasonably tiny).

The solution was to open a text window, edit (as root! ) /usr/share/applications/myrlyn-sudo.desktop to choose one of the Exec= options, and modify the text size (QT_SCALE_FACTOR=1.6) it to suit my preferences. This is stupid, and a reason why Linux is still a second/third/… choice.

That is what we’ve been talking about in this thread. Either edit the myrlyn-sudo script as I mentioned before or run sudo -E myrlyn in console

Amused. You seriously believe that after I have told you what environment variable to preserve I did not know it? That is exactly what I meant with “sort of”.

In any case, this has very little to do with allowing myrlyn or any other application run via sudo/su to use the user theme. I have never explicitly changed theme in GNOME, Adwaita is apparently the openSUSE default and in this case the system default theme was not applied, not a user theme.

Well, yeah, if the root user has a light theme set then Myrlyn as root will use that light theme? Set your root user to use the same theme as your non-root user and it will work?

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