helloSystem / hello

Desktop system for creators with a focus on simplicity, elegance, and usability. Based on FreeBSD. Less, but better!
2.3k stars 57 forks source link

Global Menu not in menu bar #124

Closed schusz closed 3 years ago

schusz commented 3 years ago

IMG_2579 @probonopd On my Dell Latitude E4300 (Hardware Probe https://bsd-hardware.info/?probe=d5051ef185#Devices) running helloSystem build: 0D26 for commit: 9c09b32B, from a Live ISO image on a 32 GB SanDisk USB-3 flash drive, the Global Menu is not in the menu bar.

There is only a double rightward arrow (>>) in the menu bar. When this is clicked a dropdown menu appears:

System File Edit View History Bookmarks Tools Help

The more applications are opened, the more to the right do the rightward arrows move in the menu bar.

When I boot another laptop from the same USB drive, the Global Menu behaves normally.

probonopd commented 3 years ago

Thanks @schusz. I suspect it has to do with the DPI setting somehow. Possibly related to https://github.com/helloSystem/ISO/issues/139 but the other way around.

Can you edit /usr/local/bin/start-hello and add a line export QT_FONT_DPI=96, then log out and log in again? Does this improve things?

Note to self: Is [ 563.947] (**) VESA(0): DPI set to (112, 112) in Xorg.log the culprit?

schusz commented 3 years ago

Hi @probonopd I added the line export QT_FONT_DPI=96 to /usr/local/bin/start-hello, logged out and in again, even restarted. Didn’t make any difference.

schusz commented 3 years ago

@probonopd Do you have another possible solution I may try?

probonopd commented 3 years ago

Hi @schusz unfortunately I don't have another idea yet. I would suspect that the fonts on the affected machine are rendered larger than in our screenshot e.g., at https://hellosystem.github.io/docs and hence do not fit into the menu bar anymore - can you confirm this? If this is the cause, then we must understand why the fonts are rendered differently on some systems. I still think it somehow has to do with the detected dpi.

schusz commented 3 years ago

Hi @probonopd , it's hard to tell if the font size is the culprit. If I hold the screenshot from my desktop and the one from https://hellosystem.github.io/docs next to each other, I can hardly see a difference:

Screenshot 2021-03-04 at 10 02 08

Would you know how to change the font size?

probonopd commented 3 years ago

The font is set in the QtPlugin project in platformthemeplugin/hintsettings.cpp:

https://github.com/helloSystem/QtPlugin/blob/4705ee86c4f3563042bd52ee78fe11c98515878d/platformthemeplugin/hintsettings.cpp#L83-L96

I suspect that this effect somehow is related to Logical DPI vs. Physical DPI. There is a scale factor that either the operating system or Qt applies, and if that factor is very close but not exactly 1 then there might be almost no visible difference in size on the screen but still the font might not fit into the menu anymore.

https://doc.qt.io/qt-5/highdpi.html

We need someone with more detailed Qt knowledge to look into this.

What happens if you run

killall menubar
QT_AUTO_SCREEN_SCALE_FACTOR=0 QT_SCALE_FACTOR=1 /System/Menu.AppDir/usr/bin/menubar

?

schusz commented 3 years ago

The result of running

killall menubar
QT_AUTO_SCREEN_SCALE_FACTOR=0 QT_SCALE_FACTOR=1 /System/Menu.AppDir/usr/bin/menubar

is:

Roels-Latitude-E4300% killall menubar
Roels-Latitude-E4300% QT_AUTO_SCREEN_SCALE_FACTOR=0 QT_SCALE_FACTOR=1 /System/Menu.AppDir/usr/bin/menubar
# Descending into "/Applications"
probono: Installing event filter
# Found "3D Printing" , a directory that is not an .app bundle nor an .AppDir
# Descending into "/Applications/3D Printing"
probono: Installing event filter
# Found "/Applications/3D Printing/FreeCAD.app/FreeCAD"
# Found "/Applications/3D Printing/PrusaSlicer.app/PrusaSlicer"
# Found "/Applications/3D Printing/Ultimaker Cura.app/Ultimaker Cura"
# Found "Audio" , a directory that is not an .app bundle nor an .AppDir
# Descending into "/Applications/Audio"
probono: Installing event filter
# Found "/Applications/Audio/Audacity.app/Audacity"
# Found "/Applications/Audio/LMMS.app/LMMS"
# Found "Developer" , a directory that is not an .app bundle nor an .AppDir
# Descending into "/Applications/Developer"
probono: Installing event filter
# Found "/Applications/Developer/LiteIDE.app/LiteIDE"
# Found "/Applications/Developer/PyCharm CE.app/PyCharm CE"
# Found "/Applications/Developer/QHexEdit.app/QHexEdit"
# Found "/Applications/Developer/Qt Creator.app/Qt Creator"
# Found "/Applications/Developer/Zeal.app/Zeal"
# Found "Developer Preview" , a directory that is not an .app bundle nor an .AppDir
# Descending into "/Applications/Developer Preview"
probono: Installing event filter
# Found "/Applications/Developer Preview/Disk First Aid.app/Disk First Aid"
# Found "/Applications/Developer Preview/Disk Utility.app/Disk Utility"
# Found "/Applications/Developer Preview/Energy Saving.app/Energy Saving"
# Found "/Applications/Developer Preview/Network.app/Network"
# Found "/Applications/Developer Preview/Screencast.app/Screencast"
# Found "/Applications/Developer Preview/Simple Browser.app/Simple Browser"
# Found "/Applications/Developer Preview/Start Disk.app/Start Disk"
# Found "/Applications/Developer Preview/Volume.app/Volume"
# Found "/Applications/Falkon.app/Falkon"
# Found "/Applications/FeatherPad.app/FeatherPad"
# Found "Graphics" , a directory that is not an .app bundle nor an .AppDir
# Descending into "/Applications/Graphics"
probono: Installing event filter
# Found "/Applications/Graphics/Blender.app/Blender"
# Found "/Applications/Graphics/GIMP.app/GIMP"
# Found "/Applications/Graphics/Inkscape.app/Inkscape"
# Found "/Applications/Graphics/Krita.app/Krita"
# Found "/Applications/Graphics/Scribus.app/Scribus"
# Found "/Applications/Graphics/Skanlite.app/Skanlite"
# Found "/Applications/Lector.app/Lector"
# Found "Office" , a directory that is not an .app bundle nor an .AppDir
# Descending into "/Applications/Office"
probono: Installing event filter
# Found "/Applications/Office/LibreOffice.app/LibreOffice"
# Found "Preferences" , a directory that is not an .app bundle nor an .AppDir
# Descending into "/Applications/Preferences"
probono: Installing event filter
# Found "/Applications/Preferences/Boot Environments.app/Boot Environments"
# Found "/Applications/Preferences/Desktop.app/Desktop"
# Found "/Applications/Preferences/Keyboard.app/Keyboard"
# Found "/Applications/Preferences/Mouse.app/Mouse"
# Found "/Applications/Preferences/Print Settings.app/Print Settings"
# Found "/Applications/Preferences/Screen Settings.app/Screen Settings"
# Found "/Applications/Preferences/Sharing.app/Sharing"
# Found "/Applications/Preferences/Shortcut Keys.app/Shortcut Keys"
# Found "/Applications/Preferences/Sound.app/Sound"
# Found "/Applications/Preferences/Users.app/Users"
# Found "/Applications/Preferences/Wireless Networks.app/Wireless Networks"
# Found "/Applications/qpdfview.app/qpdfview"
# Found "Utilities" , a directory that is not an .app bundle nor an .AppDir
# Descending into "/Applications/Utilities"
probono: Installing event filter
# Found "/Applications/Utilities/Android File Transfer (MTP).app/Android File Transfer (MTP)"
# Found "/Applications/Utilities/BuildNotify.app/BuildNotify"
# Found "/Applications/Utilities/Calculator.app/Calculator"
# Found "/Applications/Utilities/Calendar.app/Calendar"
# Found "/Applications/Utilities/Create Live Media.app/Create Live Media"
# Found "/Applications/Utilities/Hardware Probe.app/Hardware Probe"
# Found "/Applications/Utilities/Help.app/Help"
# Found "/Applications/Utilities/Install FreeBSD.app/Install FreeBSD"
# Found "/Applications/Utilities/Logs.app/Logs"
# Found "/Applications/Utilities/QTerminal.app/QTerminal"
# Found "/Applications/Utilities/Remote Assistance.app/Remote Assistance"
# Found "/Applications/Utilities/Sticky Notes.app/Sticky Notes"
# Found "/Applications/Utilities/Zeroconf.app/Zeroconf"
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: too many profiles
# Found "Video" , a directory that is not an .app bundle nor an .AppDir
# Descending into "/Applications/Video"
probono: Installing event filter
# Found "/Applications/Video/OBS Studio.app/OBS Studio"
# Found "/Applications/Video/Shotcut.app/Shotcut"
probono: WM_CLASS "qterminal"
loaded  "datetime"  !!!
loaded  "statusnotifier"  !!!
loaded  "volume"  !!!
QKqueueFileSystemWatcherEngine::addPaths: open: No such file or directory
()
qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 626, resource id: 0, major code: 18 (ChangeProperty), minor code: 0
QObject::connect: No such slot MainWindow::append(const QString&)
probono: WM_CLASS "qterminal"
probonopd commented 3 years ago

And does it change how your menu looks on the affected system?

schusz commented 3 years ago

@probonopd No, unfortunately it did not change the menubar.

So I just hope someone with expert knowledge about this will pick up on this thread.

Thanks so far and keep up the good work :-).

schusz commented 3 years ago

@probonopd I had a look in platformthemeplugin/hintsettings.cpp

And In there I found something that hints at a font-size:

qreal HintsSettings::systemFontPointSize() const
{
    return m_settings->value(s_systemPointFontSize, 11).toDouble(); // was 10.5
}

Might that have anything to do with the font-size in the menu bar?

Size is 11. Could it somehow, somewhere be changed to another value and see if that fixes the issue?

Mind you, I have no experience with these kinds of things at all. Just trying to find a solution and thinking along :-).

probonopd commented 3 years ago

Yes, if you set a smaller font size there then it may work on your affected system; but the font size will be too small for everyone else. We need to find a way to make the font size in pixels (not points) identical for your affected system to non-affected systems.

Unfortunately I don't know how yet.

probonopd commented 3 years ago

https://github.com/helloSystem/ISO/issues/139#issuecomment-796984832 might possibly give a hint on what is going on; more investigation needed.

probonopd commented 3 years ago

When I change the font size for QObject, QMenuBar and QMenu to a too large one, then interestingly the fonts get rendered correctly for Search and for the time on the right-hand side of the menu, but the QMenu itself changes and shows this nasty >> symbol instead.

image

Questions:

probonopd commented 3 years ago

Probably related:

image

Here the user is running in QEMU and all controls are too large; as a result they don't fit into the fixed-size window, and as a result the installer does not work.

xdpyinfo | grep resolution reports 187x144 dots per inch on that system. Why? (It reports 101x101 dots per inch on my bare metal machine.)

We need to find a way to fix fonts in size.

probonopd commented 3 years ago

Would specifying the font size in px rather than pt solve this? And not break HiDPI?

Also see https://forum.qt.io/topic/43625/point-sizes-are-they-reliable/5

probonopd commented 3 years ago

Could you please test the following:

  1. nano $HOME/.Xresources, add the line Xft.dpi: 96
  2. Save
  3. xrdb -load ~/.Xresources
  4. Log out of your session, then log in again

https://linuxreviews.org/HOWTO_set_DPI_in_Xorg


If this does not work, please try:

sudo nano /usr/local/etc/xdg/stylesheet.qss

At the bottom of the file add:

QObject {
    font-size: 15px;
}

This sets the font size in pixels rather than points.

Press Ctrl-Alt+Esc and click on the menu to kill it.

Press Command+Spacebar (Alt+Spacebar or Ctrl+Spacebar on PC keyboards) to launch the menu again.

Do the items now get displayed correctly in the menu? This did solve the issue for the user who reported https://github.com/helloSystem/hello/issues/124#issuecomment-812633198.


If this does not work, please try:

  1. Undo the change in /usr/local/etc/xdg/stylesheet.qss if you made it
  2. As root, open /usr/local/bin/start-hello to edit it
  3. Find the line echo "Not assuming HiDPI"
  4. Below that line, add 2x (two times the same line!) xrandr --dpi 96
  5. Save
  6. Log out of your session, then log in again
probonopd commented 3 years ago

https://linuxreviews.org/HOWTO_set_DPI_in_Xorg suggests:

  1. Undo the change in /usr/local/etc/xdg/stylesheet.qss if you made it
  2. As root, open /usr/local/bin/start-hello to edit it
  3. Find the line echo "Not assuming HiDPI"
  4. Below that line, add 2x (two times the same line!) xrandr --dpi 96
  5. Save
  6. Log out of your session, then log in again

Alternative idea:

  1. Undo the changes above
  2. nano $HOME/.Xresources, add the line Xft.dpi: 96
  3. Save
  4. xrdb -merge ~/.Xresources
  5. Log out of your session, then log in again
probonopd commented 3 years ago

@schusz the issue might be resolved in experimental builds 0E120 and newer. Can you please verify?

schusz commented 3 years ago

Hi @probonopd, I won't be able to test it until 6 April.

schusz commented 3 years ago

@probonopd I installed hello-0.5.0_0E37-FreeBSD-12.2-amd64.iso. Global Menu displays as intended. I also installed hello-0.5.0_0E142-FreeBSD-13.0-amd64.iso and hello-0.5.0_0E157-FreeBSD-13.0-amd64.iso.

On both the desktop is not displayed correctly. The Global Menu's top half is not visible.

And the screen is divided in 2 {see screenshot). Right part of the desktop occupies approx. left 4/5th of screen, and Left part occupies right 1/5th of screen.

photo_2021-04-07_20-47-29

probonopd commented 3 years ago

Thanks for testing @schusz.

So it looks like the "font size"/global menu bar issue has been resolved. I am hence closing this issue.

But there is now another issue (screen being cut off and split). Could you please open a separate GitHub issue for that one: https://github.com/helloSystem/ISO/issues/new?assignees=&labels=bug&template=bug_report.md&title=

It is important for me to understand whether this happens on both Live and Installed systems, and on which exact hardware configuration. (This happens only on FreeBSD 13 based ISOs, correct? And only when installed to disk, not in Live mode?)

Thank you very much!