aboutsummaryrefslogtreecommitdiff
path: root/xnm-tray
blob: 203b3e128e674989c2451b227df41ac16e8afbb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
#
# Start nm-tray if on laptop boxes.
#

if laptop-detect; then
  if which nm-tray &> /dev/null; then
    # Sleep a while until a tray should be available
    sleep 5

    # Get basic system info
    source /etc/os-release

    # Set QT_QPA_PLATFORMTHEME
    #
    # References:
    #
    # * https://doc.qt.io/qt-6/qpa.html
    # * https://wiki.archlinux.org/title/Uniform_look_for_Qt_and_GTK_applications
    # * https://wiki.gentoo.org/wiki/GTK_themes_in_Qt_applications
    # * https://itsfoss.gitlab.io/blog/how-to-add-qtqpaplatformthemeqt5ct-environment-variable-in-arch-linux/
    # * https://unix.stackexchange.com/questions/680483/how-to-add-qt-qpa-platformtheme-qt5ct-environment-variable-in-arch-linux
    # * https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=983536
    #
    # May use a theme such as https://packages.debian.org/stable/breeze-icon-theme
    #
    #export XDG_CURRENT_DESKTOP="GNOME"
    #export QT_QPA_PLATFORMTHEME="gnome"
    if [ "$VERSION_ID" == "12" ]; then
      # nm-tray on Debian bookworm is linked against Qt5
      export QT_QPA_PLATFORMTHEME="qt5ct"
    else
      # nm-tray on Debian trixie is linked against Qt6
      export QT_QPA_PLATFORMTHEME="qt6ct"
    fi

    # Then start nm-tray
    nm-tray
  fi
fi