File nm-tray.spec of Package nm-tray

#
# spec file for package nm-tray
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


Name:           nm-tray
Version:        @SERVICE@
Release:        0
Summary:        NetworkManager tray icon
License:        GPL-2.0-only
Group:          System/GUI/LXQt
URL:            https://github.com/palinek/nm-tray
Source:         %{name}-%{version}.tar.xz
BuildRequires:  cmake >= 3.6.0
BuildRequires:  cmake(KF6ModemManagerQt)
BuildRequires:  cmake(KF6NetworkManagerQt)
BuildRequires:  cmake(Qt6DBus)
BuildRequires:  cmake(Qt6Gui) >= 6.6.2
BuildRequires:  cmake(Qt6LinguistTools)
BuildRequires:  cmake(Qt6Network)
BuildRequires:  cmake(Qt6Widgets)
BuildRequires:  cmake(Qt6Xml)
Requires:       ModemManager
Requires:       NetworkManager-tui
Recommends:     %{name}-lang

%description
nm-tray is a simple NetworkManager front end with information icon residing in
system tray (like e.g. nm-applet). It's a pure Qt application.

%lang_package

%prep
%autosetup -p1

%build
%cmake_qt6 \
    -DWITH_MODEMMANAGER_SUPPORT=YES \
    -DNM_TRAY_XDG_AUTOSTART_DIR="%{_sysconfdir}/xdg/autostart/"
%qt6_build

%install
%qt6_install

rm -rfv %{buildroot}%{_datadir}/applications
rm -fv %{buildroot}%{_sysconfdir}/xdg/autostart/%{name}-autostart.desktop

cat > %{buildroot}%{_sysconfdir}/xdg/autostart/%{name}.desktop <<-EOF
[Desktop Entry]
Version=1.0
Name=LXQt Network applet
Exec=nm-tray
TryExec=nm-tray
Type=Application
OnlyShowIn=LXQt;
X-LXQt-Need-Tray=true
EOF

%find_lang %{name} --with-qt

%files
%doc README.md
%{_bindir}/%{name}
%config %{_sysconfdir}/xdg/autostart/%{name}.desktop
%{_datadir}/%{name}/%{name}.conf
%license COPYING

%files lang -f %{name}.lang
%dir %{_datadir}/%{name}

%changelog
openSUSE Build Service is sponsored by