• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2
3# This file is part of PulseAudio.
4#
5# PulseAudio is free software; you can redistribute it and/or modify
6# it under the terms of the GNU Lesser General Public License as published by
7# the Free Software Foundation; either version 2 of the License, or
8# (at your option) any later version.
9#
10# PulseAudio is distributed in the hope that it will be useful, but
11# WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13# General Public License for more details.
14#
15# You should have received a copy of the GNU Lesser General Public License
16# along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
17
18set -e
19
20if [ -n "$1" ] ; then
21    case $1 in
22    stop)
23      @PACTL_BINARY@ unload-module module-x11-publish > /dev/null
24      @PACTL_BINARY@ unload-module module-x11-cork-request > /dev/null
25      @PACTL_BINARY@ unload-module module-device-manager > /dev/null
26      @PACTL_BINARY@ unload-module module-x11-xsmp > /dev/null
27      exit 0
28      ;;
29    start)
30      # Let it continue further down
31      ;;
32    *)
33      echo "Unknown argument $1"
34      exit 1
35      ;;
36    esac
37fi
38
39if [ x"$DISPLAY" != x ] ; then
40
41    @PACTL_BINARY@ load-module module-x11-publish "display=$DISPLAY xauthority=$XAUTHORITY" > /dev/null
42    @PACTL_BINARY@ load-module module-x11-cork-request "display=$DISPLAY xauthority=$XAUTHORITY" > /dev/null
43
44    # KDE plasma versions older than 5.17.0 use module-device-manager's routing API.
45    # Check for current plasma version and load module if it's necessary.
46    if [ x"$KDE_FULL_SESSION" = x"true" ]; then
47        plasmaversion="$(plasmashell -v 2>/dev/null | sed -n 's/^plasmashell \([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\)/\1*1000000+\2*1000+\3/p' | head -1)"
48        if [ -n "$plasmaversion" ] && [ "$(($plasmaversion))" -lt "5017000" ]; then
49            @PACTL_BINARY@ load-module module-device-manager "do_routing=1" > /dev/null
50        fi
51    fi
52
53    if [ x"$SESSION_MANAGER" != x ] ; then
54	@PACTL_BINARY@ load-module module-x11-xsmp "display=$DISPLAY xauthority=$XAUTHORITY session_manager=$SESSION_MANAGER" > /dev/null
55    fi
56fi
57