diff options
-rw-r--r-- | perl-install/standalone/net_applet | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/perl-install/standalone/net_applet b/perl-install/standalone/net_applet index f723fee64..07b18f7ef 100644 --- a/perl-install/standalone/net_applet +++ b/perl-install/standalone/net_applet @@ -17,8 +17,7 @@ my ($menu, $timeout); my $onstartupfile = "$ENV{HOME}/.net_applet"; add_icon_path("/usr/share/libDrakX/pixmaps/"); # Allow multiple instances, but only one per user: -my @pids = `ps -u $ENV{USER}` =~ /net_applet/; -@pids > 1 and die "net_applet already running\n"; +is_running('net_applet') > 1 and die "net_applet already running\n"; my $prog_name = "/usr/bin/net_applet"; my $current_md5 = md5file($prog_name); @@ -54,8 +53,7 @@ gtkadd(my $icon = Gtk2::TrayIcon->new("Net_Applet"), ); $eventbox->signal_connect(button_press_event => sub { if ($_[1]->button == 1) { - my @nm_pid = `ps -u $ENV{USER}` =~ /net_monitor/; - @nm_pid > 1 or netMonitor() + is running('net_monitor') > 1 or netMonitor() } $_[1]->button == 3 && $menu and $menu->popup(undef, undef, undef, undef, $_[1]->button, $_[1]->time); }); @@ -72,6 +70,10 @@ Gtk2->main; ugtk2::exit(0); +sub is_running { + my @pid = `ps -u $ENV{USER}` =~ /\Q$_[0]/; + @pid +} sub shouldStart() { my %p = getVarsFromSh($onstartupfile); my $ret = $p{AUTOSTART} eq 'FALSE' ? 0 : 1; |