summaryrefslogtreecommitdiffstats
path: root/debian/source_gnome-shell.py
blob: 3e48b8c06f85069cac7f2f180b7d088001d7506b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from apport.hookutils import *
import os

def is_process_running(proc):
    '''
    Determine if process has a registered process id
    '''
    log = command_output(['pidof', proc])
    if not log or log[:5] == "Error" or len(log)<1:
        return False
    return True

def add_info(report):
    attach_related_packages(report, ['mutter-common'])

    attach_gsettings_package(report, 'gnome-shell-common')
    attach_gsettings_package(report, 'gsettings-desktop-schemas')
    attach_gsettings_package(report, 'mutter-common')
    attach_gsettings_schema(report, 'org.gnome.settings-daemon.plugins.color')
    attach_gsettings_schema(report, 'org.gnome.settings-daemon.peripherals.mouse')
    attach_gsettings_schema(report, 'org.gnome.settings-daemon.peripherals.touchscreen')

    try:
        monitors = os.path.join(os.environ['XDG_CONFIG_HOME'], 'monitors.xml')
    except KeyError:
        monitors = os.path.expanduser('~/.config/monitors.xml')

    attach_file_if_exists(report, monitors, 'monitors.xml')

    result = ''

    dm_list = apport.hookutils.command_output(['sh', '-c', 
	'apt-cache search \"display manager\" | cut -d \' \' -f1 | grep -E \"dm$|gdm3\"'])

    for line in dm_list.split('\n'):
        if (is_process_running(line)):
            result = line
            break

    report['DisplayManager'] = result

    if command_available('journalctl') and os.path.exists('/run/systemd/system'):
        report['ShellJournal'] = command_output(['journalctl',
                                                 '/usr/bin/gnome-shell',
                                                 '-b', '-o', 'short-monotonic',
                                                 '--lines', '3000'])