Stepan Salenikovich | 0d707a6 | 2015-05-29 10:48:04 -0400 | [diff] [blame] | 1 | #!/bin/bash |
Stepan Salenikovich | ee805ad | 2015-06-03 10:43:51 -0400 | [diff] [blame^] | 2 | # |
| 3 | # Copyright (C) 2015 Savoir-Faire Linux Inc. |
| 4 | # Author: Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> |
| 5 | # Author: Stepan Salenikovich <stepan.salenikovich@savoirfairelinux.com> |
| 6 | # |
| 7 | # This program is free software; you can redistribute it and/or modify |
| 8 | # it under the terms of the GNU General Public License as published by |
| 9 | # the Free Software Foundation; either version 3 of the License, or |
| 10 | # (at your option) any later version. |
| 11 | # |
| 12 | # This program is distributed in the hope that it will be useful, |
| 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | # GNU General Public License for more details. |
| 16 | # |
| 17 | # You should have received a copy of the GNU General Public License |
| 18 | # along with this program; if not, write to the Free Software |
| 19 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 20 | # |
| 21 | # Additional permission under GNU GPL version 3 section 7: |
| 22 | # |
| 23 | # If you modify this program, or any covered work, by linking or |
| 24 | # combining it with the OpenSSL project's OpenSSL library (or a |
| 25 | # modified version of that library), containing parts covered by the |
| 26 | # terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. |
| 27 | # grants you additional permission to convey the resulting work. |
| 28 | # Corresponding Source for a non-source form of such a combination |
| 29 | # shall include the source code for the parts of OpenSSL used as well |
| 30 | # as that of the covered work. |
| 31 | # |
Stepan Salenikovich | 0d707a6 | 2015-05-29 10:48:04 -0400 | [diff] [blame] | 32 | |
| 33 | HAS_KDE=0 |
| 34 | HAS_GNOME=0 |
| 35 | |
Stepan Salenikovich | ee805ad | 2015-06-03 10:43:51 -0400 | [diff] [blame^] | 36 | if type "ring-kde" > /dev/null 2> /dev/null; then |
Stepan Salenikovich | 0d707a6 | 2015-05-29 10:48:04 -0400 | [diff] [blame] | 37 | HAS_KDE=1 |
| 38 | fi |
| 39 | |
Stepan Salenikovich | ee805ad | 2015-06-03 10:43:51 -0400 | [diff] [blame^] | 40 | if type "gnome-ring" > /dev/null 2> /dev/null; then |
Stepan Salenikovich | 0d707a6 | 2015-05-29 10:48:04 -0400 | [diff] [blame] | 41 | HAS_GNOME=1 |
| 42 | fi |
| 43 | |
Stepan Salenikovich | ee805ad | 2015-06-03 10:43:51 -0400 | [diff] [blame^] | 44 | # No clients installd |
| 45 | if [ $HAS_KDE == "0" ] && [ $HAS_GNOME == "0" ]; then |
| 46 | echo "Ring not found" >&2 |
| 47 | exit 1 |
| 48 | fi |
| 49 | |
| 50 | # Only one client is installed |
| 51 | if [ $HAS_KDE == "1" ] && [ $HAS_GNOME == "0" ]; then |
| 52 | ring-kde $* |
Stepan Salenikovich | 0d707a6 | 2015-05-29 10:48:04 -0400 | [diff] [blame] | 53 | exit $? |
Stepan Salenikovich | ee805ad | 2015-06-03 10:43:51 -0400 | [diff] [blame^] | 54 | elif [ $HAS_KDE == "0" ] && [ $HAS_GNOME == "1" ]; then |
| 55 | gnome-ring $* |
Stepan Salenikovich | 0d707a6 | 2015-05-29 10:48:04 -0400 | [diff] [blame] | 56 | exit $? |
| 57 | fi |
| 58 | |
Stepan Salenikovich | ee805ad | 2015-06-03 10:43:51 -0400 | [diff] [blame^] | 59 | # Both clients installed: run KDE client if KDE wm is running |
| 60 | # else use the Gnome client. |
| 61 | if [ -z "$(ps aux | grep kwin | grep -v grep)" ]; then |
| 62 | gnome-ring $* |
Stepan Salenikovich | 0d707a6 | 2015-05-29 10:48:04 -0400 | [diff] [blame] | 63 | exit $? |
| 64 | else |
Stepan Salenikovich | ee805ad | 2015-06-03 10:43:51 -0400 | [diff] [blame^] | 65 | ring-kde $* |
Stepan Salenikovich | 0d707a6 | 2015-05-29 10:48:04 -0400 | [diff] [blame] | 66 | exit $? |
| 67 | fi |