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 | # |
Stepan Salenikovich | be87d2c | 2016-01-25 14:14:34 -0500 | [diff] [blame] | 3 | # Copyright (C) 2015-2016 Savoir-faire Linux Inc. |
Stepan Salenikovich | ee805ad | 2015-06-03 10:43:51 -0400 | [diff] [blame] | 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 | # |
Stepan Salenikovich | 0d707a6 | 2015-05-29 10:48:04 -0400 | [diff] [blame] | 21 | |
| 22 | HAS_KDE=0 |
| 23 | HAS_GNOME=0 |
| 24 | |
Stepan Salenikovich | ee805ad | 2015-06-03 10:43:51 -0400 | [diff] [blame] | 25 | if type "ring-kde" > /dev/null 2> /dev/null; then |
Stepan Salenikovich | 0d707a6 | 2015-05-29 10:48:04 -0400 | [diff] [blame] | 26 | HAS_KDE=1 |
| 27 | fi |
| 28 | |
Stepan Salenikovich | 526c41e | 2016-06-08 16:48:20 -0400 | [diff] [blame] | 29 | if type "gnome-ring" > /dev/null 2> /dev/null; then |
Stepan Salenikovich | 0d707a6 | 2015-05-29 10:48:04 -0400 | [diff] [blame] | 30 | HAS_GNOME=1 |
| 31 | fi |
| 32 | |
Stepan Salenikovich | ee805ad | 2015-06-03 10:43:51 -0400 | [diff] [blame] | 33 | # No clients installd |
| 34 | if [ $HAS_KDE == "0" ] && [ $HAS_GNOME == "0" ]; then |
| 35 | echo "Ring not found" >&2 |
| 36 | exit 1 |
| 37 | fi |
| 38 | |
| 39 | # Only one client is installed |
| 40 | if [ $HAS_KDE == "1" ] && [ $HAS_GNOME == "0" ]; then |
| 41 | ring-kde $* |
Stepan Salenikovich | 0d707a6 | 2015-05-29 10:48:04 -0400 | [diff] [blame] | 42 | exit $? |
Stepan Salenikovich | ee805ad | 2015-06-03 10:43:51 -0400 | [diff] [blame] | 43 | elif [ $HAS_KDE == "0" ] && [ $HAS_GNOME == "1" ]; then |
Stepan Salenikovich | 526c41e | 2016-06-08 16:48:20 -0400 | [diff] [blame] | 44 | gnome-ring $* |
Stepan Salenikovich | 0d707a6 | 2015-05-29 10:48:04 -0400 | [diff] [blame] | 45 | exit $? |
| 46 | fi |
| 47 | |
Stepan Salenikovich | ee805ad | 2015-06-03 10:43:51 -0400 | [diff] [blame] | 48 | # Both clients installed: run KDE client if KDE wm is running |
| 49 | # else use the Gnome client. |
| 50 | if [ -z "$(ps aux | grep kwin | grep -v grep)" ]; then |
Stepan Salenikovich | 526c41e | 2016-06-08 16:48:20 -0400 | [diff] [blame] | 51 | gnome-ring $* |
Stepan Salenikovich | 0d707a6 | 2015-05-29 10:48:04 -0400 | [diff] [blame] | 52 | exit $? |
| 53 | else |
Stepan Salenikovich | ee805ad | 2015-06-03 10:43:51 -0400 | [diff] [blame] | 54 | ring-kde $* |
Stepan Salenikovich | 0d707a6 | 2015-05-29 10:48:04 -0400 | [diff] [blame] | 55 | exit $? |
| 56 | fi |