material-decoration icon indicating copy to clipboard operation
material-decoration copied to clipboard

LIM: Respect Menu Font Settings

Open QORTEC opened this issue 5 years ago • 8 comments

Current behaviour: Currently LIM uses the Window title font settings

Expected behaviour: LIM should use the Menu font settings

Steps to Reproduce: Open KDE “System Settings” Under Appearance click on Fonts Change the font settings for Menu and Window title Click Apply

Screenshot_20210205_223433

Additional Information: System OS: Solus Plasma material-decoration: 65fe6f577a978a9e601241d29bea35185eb7f69c built & packaged solbuild package-material-decoration.yml

QORTEC avatar Feb 06 '21 04:02 QORTEC

The actual (dropdown section) menu follows menu font. Menu items in the titlebar use titlebar font - actually this looks good to me.

ben2talk avatar Feb 06 '21 05:02 ben2talk

@ben2talk thanks for pointing that out, don't know how I missed that. I mainly opened the bug report since the menu was not following the expected behaviour (to me anyways).

It could be argued that:

  • since the LIM is integrated with titlebar it should; all elements in inside titlebar itself should use the Window title settings
  • since changing the Menu settings effects the entire menu in KDE by default; LIM should respect that

If the current behaviour is preferred/expected; I would like to know how feasible would it be to add a toggle between the two settings (Window title & Menu)?

QORTEC avatar Feb 09 '21 20:02 QORTEC

I won't be adding an option, but you can modify it to do so.

  • Here's where material draws the menu in the titlebar:
    • https://github.com/Zren/material-decoration/blob/master/src/TextButton.cc#L59
  • Here's how the KDecoration API calculates the titlebar QFont:
    • https://github.com/KDE/kdecoration/blob/master/src/private/decorationsettingsprivate.cpp#L46-L49
    • https://doc.qt.io/qt-5/qfontdatabase.html#SystemFont-enum
  • No idea how to get the font for the menu.
    • https://github.com/KDE/breeze/blob/master/kstyle/breezestyle.cpp#L4796
    • https://doc.qt.io/qt-5/qfont.html

It's probably easier to hardcode a QFont with the desired size + family.

Zren avatar Feb 09 '21 21:02 Zren

Hello, just to mention that I've implemented the option in my fork: https://github.com/hexclover/material-decoration. Feel free to test it out.

With the option ON:

image

With the option OFF:

image

hexclover avatar Jul 29 '22 19:07 hexclover

@hexclover I just built and tested your Material-Decorations fork. After some quick testing it I noticed that the Use menu font when drawing menu items option uses the general font not the menu font. (I use the same font for both so I'm happy with it as is.)

System Information:

Operating System: Solus 4.3
Kernel Version: 5.15.50-216-zfs
KDE Plasma Version: 5.25.3
KDE Frameworks Version: 5.96.0
QT Version: 5.15.5
Graphics Platform: X11

commit c089983 | hexclover fork

QORTEC avatar Jul 30 '22 07:07 QORTEC

@QORTEC Hello, what was your testing procedure? Can you try the following steps:

  1. In system settings, set General and Menu fonts to different fonts.
  2. Logout and login again. Or, at least restart KWin.
  3. Try toggling the option. Did it work?

hexclover avatar Jul 30 '22 07:07 hexclover

@hexclover, it works! Kinda? There seems to be a bug, when you change a font the menu uses the general font. Restarting kwin resets the menu to use the menu font.

Steps to Reproduce:

  1. change any font whatsoever
  2. apply said change

Result: The menu uses the general font.

Expected Behaviour: The menu uses the menu font.

Workaround: Restart kwin, the menu will use the menu font.

QORTEC avatar Jul 30 '22 08:07 QORTEC

@QORTEC Yes, there seems to be a long-standing bug in KDE (?): If you change any (?) of the font settings and apply them, applications will start to use the General font for menus until restart. I don't think this is related/specific to material-decoration.

hexclover avatar Jul 30 '22 12:07 hexclover