summaryrefslogtreecommitdiffstats
path: root/tools/mousedrake
blob: a583044f7c7cfc17431c84a47ff3770abdab7ef3 (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
#!/usr/bin/perl

use lib qw(/usr/lib/libDrakX);

# i18n: IMPORTANT: to get correct namespace (drakx-kbd-mouse-x11 instead of libDrakX)
BEGIN { unshift @::textdomains, 'drakx-kbd-mouse-x11' }

use standalone;     #- warning, standalone must be loaded very first, for 'explanations'

use common;
use interactive;
use modules;
use mouse;
use c;


$ugtk2::wm_icon = "/usr/share/mcc/themes/default/mousedrake-mdk.png";
my $in = 'interactive'->vnew('su');

my $modules_conf = modules::any_conf->read;

my $mouse = mouse::read();

if (!$::noauto) {
    my $probed_mouse = mouse::detect($modules_conf);
    $mouse = $probed_mouse if !$mouse->{Protocol} || !$probed_mouse->{unsafe};
}

if (!$mouse || !$::auto) {
    $mouse ||= mouse::fullname2mouse('Universal|Any PS/2 & USB mice');
    mouse::select($in, $mouse) or $in->exit(0);
}

mouse::write_conf($in->do_pkgs, $modules_conf, $mouse, 1);

system('service', 'gpm', 'restart') if -e '/var/lock/subsys/gpm';

$in->exit(0);