1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-08-10 01:35:40 +02:00

src/jami: Simplify launcher.

Remove legacy cruft and streamline logic.

Change-Id: Ia9d0ef9a621e01aac17facb3e94efb11cdb38b0d
This commit is contained in:
Maxim Cournoyer 2022-01-19 12:16:58 -05:00
parent 1daeb26300
commit 16424e530a

View file

@ -1,9 +1,10 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Copyright (C) 2015-2022 Savoir-faire Linux Inc.
# Author: Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com>
# Author: Stepan Salenikovich <stepan.salenikovich@savoirfairelinux.com>
# Author: Albert Babí <albert.babi@savoirfairelinux.com>
# Author: Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -20,49 +21,11 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
HAS_KDE=0
HAS_GNOME=0
HAS_QT=0
if type "ring-kde" > /dev/null 2> /dev/null; then
HAS_KDE=1
fi
if type "jami-gnome" > /dev/null 2> /dev/null; then
HAS_GNOME=1
fi
if type "jami-qt" > /dev/null 2> /dev/null; then
HAS_QT=1
fi
# client-qt always top priority
if [ $HAS_QT == "1" ]; then
jami-qt $*
exit $?
fi
# No clients installed
if [ $HAS_KDE == "0" ] && [ $HAS_GNOME == "0" ]; then
echo "Jami not found" >&2
exit 1
fi
# Only one client is installed
if [ $HAS_KDE == "1" ] && [ $HAS_GNOME == "0" ]; then
ring-kde $*
exit $?
elif [ $HAS_KDE == "0" ] && [ $HAS_GNOME == "1" ]; then
jami-gnome $*
exit $?
fi
# Both clients installed: run KDE client if KDE wm is running
# else use the Gnome client.
if [ -z "$(ps aux | grep kwin | grep -v grep)" ]; then
jami-gnome $*
exit $?
if command -v jami-qt > /dev/null; then
exec jami-qt "$@"
elif command -v jami-gnome > /dev/null; then
exec jami-gnome "$@"
else
ring-kde $*
exit $?
echo "Jami not found" > /dev/error
exit 1
fi