Autostart kate - small font

I want to start kate automatically when KDE starts up and also when resuming from sleep. In the first case a KDE autostart script works perfectly. In the second case, I put a script in /usr/lib/systemd/system-sleep; this also works, but has a problem - kate is launched with an unreadably small menu font. The font in the main editing pane is ok, however. Does anyone know how to fix the small menu font in this case?

Can you show your working script? How do you handle launching it with the desired environment variables etc?

Further to the above, your script should set the appropriate DISPLAY and XAUTHORITY environment variables.

Thanks for your reply.
DISPLAY is set correctly. What is the appropriate setting for XAUTHORITY?

That depends on the display manager. Do you have .Xauthority in the user’s home directory?

In you user’s active session, check

ls $HOME/.Xauthority

Perhaps something like this will be sufficient

declare -x XAUTHORITY="/home/<your_user>/.Xauthority"

AFAIU with gdm at least, the pertinent location is now /run/user/1000/gdm/Xauthority

Thanks. I’ve had a serious crash with the system involved. Will try this after it’s recovered.

You should also be launching kate as the desired user (rather than as root).

System is still down. Tried on old system running 15.1, same problem, setting XAUTHORITY has no effect.

So I thought maybe it’s picking up font size from the root account. So I ran systemsettings as root, and changed the menu font size. And I found:

BUG IN PLASMA 5 ?
Changing the menu font settings with systemsettings5 has no effect on the actual fonts used in menus. (True for both root and normal user accounts) On a really old system, running 13.1, a change to menu font in systemsettings shows up in menus of all KDE apps, as you would expect.

So where is menu font actually set in Plasma 5, and how do you change it?

Yes, it is - which is why I already asked you to post your working script, and my hint about not executing it as root user.

OK, here’s my script

#! /bin/bash  
if  "$1" = "post" ]; then   
su ian -c 'DISPLAY=:0 /usr/bin/kate /home/ian/misc/ian.rem' 
fi  

It should probably be run as

su - ian -c 'DISPLAY=:0 /usr/bin/kate /home/ian/misc/ian.rem'

so environment is switched to pertinent user as well.

The additionsl - makes no difference.

As I mentioned a couple of posts back, changing menu font in systemssettings has no effect on the menu font used in KDE apps. Further experimentation shows that they use for their menus the font which is called ‘general’ in systemsettings. (Surely a bug, but not pertinent at the moment.)

So I have tried changing both menu and general fonts in both my user account and in the root account. None of these changes have any effect on the menu font used by kate when launched from script in system-sleep. So where is kate getting its font information in this case???

It’s not clear to me why it would behave differently when launched via desktop autostart vs the systemd script (assuming run as user and same environment variables applied).

So I have tried changing both menu and general fonts in both my user account and in the root account. None of these changes have any effect on the menu font used by kate when launched from script in system-sleep. So where is kate getting its font information in this case???

You could try using the qt5ct (Qt5 Configuration Tool) perhaps.

Thank you! That solves it. I didn’t know about qt5ct. The font set in this app is used for menus and toolbar of kate launched from systemd script. The general font from systemsettings is still used when kate is launched normally from the desktop.

(The scaling is slightly different in the two cases, however…)