Give the tray an icon a black bar cannot swallow

A session that names no desktop, which is what i3 and a bare X11 login are,
leaves Qt with hicolor as its only icon theme, and hicolor has none of the four
names the tray asks for. So fromTheme returns nothing and the shapes drawn in
trayicon.py are used, as they are on macOS. They were drawn in black, which
macOS recolours through the mask and X11 does not, and i3's bar is black: the
icon was there all along, painted onto a bar of its own colour. Outside macOS
they are now white over a dark copy of themselves spread a pixel out, which
stands out on a dark bar and stays readable on a light one, and the mask is set
only where something reads it.

The .desktop files had the same hole from the other side. They named
audio-input-microphone, which is in Breeze and in Adwaita but not in hicolor, so
the menu entry and the autostart entry were blank on the same systems. install.sh
now draws the application icon into ~/.local/share/icons/hicolor and both entries
name it; uninstall.sh takes it back. The windows carry it too on X11, where a
window has no .desktop file to be looked up in.

Closes #27
This commit is contained in:
2026-08-16 13:28:57 +03:00
parent 416c788421
commit e40191e3a7
5 changed files with 343 additions and 50 deletions
+6
View File
@@ -1093,6 +1093,12 @@ def run_app(args):
app = QApplication(sys.argv)
app.setApplicationName("Dikte")
app.setDesktopFileName("dikte")
# Wayland goes from that name to the .desktop file and takes the icon from
# there, and macOS takes it from the bundle, but an X11 window has only what
# it carries itself, and a settings window with no icon is a blank square in
# every task bar and alt-tab list.
if sys.platform != "darwin":
app.setWindowIcon(trayicon.app_icon())
app.setQuitOnLastWindowClosed(False)
_stay_out_of_the_dock()
# Before Dikte is built, because building it is what may start a server, and