2
* Copyright 2007, Intel Corporation
4
* This file is part of PowerTOP
6
* This program file is free software; you can redistribute it and/or modify it
7
* under the terms of the GNU General Public License as published by the
8
* Free Software Foundation; version 2 of the License.
10
* This program is distributed in the hope that it will be useful, but WITHOUT
11
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15
* You should have received a copy of the GNU General Public License
16
* along with this program in a file named COPYING; if not, write to the
17
* Free Software Foundation, Inc.,
18
* 51 Franklin Street, Fifth Floor,
19
* Boston, MA 02110-1301 USA
22
* Arjan van de Ven <arjan@linux.intel.com>
30
#include <sys/types.h>
37
static void activate_noTV(void)
39
system("xrandr --auto &> /dev/null");
40
system("xrandr --output TV --off &> /dev/null");
43
void suggest_xrandr_TV_off(void)
47
int has_tv_active = 0;
53
memset(line, 0, 1024);
54
file = popen("xrandr 2> /dev/null", "r");
55
if (!file || feof(file)) {
60
if (fgets(line, 1024, file)==NULL)
63
if (line[0]=='T' && line[1]=='V' && line[2]==' ')
68
if (strchr(line,'*') && has_tv)
75
add_suggestion(_("Suggestion: disable TV out via: \n"
76
" xrandr --output TV --off \n"
77
"or press the V key."),
78
35, 'V', _(" V - Disable TV out "), activate_noTV);
79
/* check this only once if no suggestion needed */