Tuesday, March 17, 2009

a simple gui for rdesktop

rdesktop is an open source command line client for Windows Terminal Services.
to install it in Fedora, as root: yum install rdesktop

RTKdesktop is a simple gui written in perl-Tk.
it need perl and perl-Tk. as root: yum install perl perl-Tk

here's the code:

#!/usr/bin/perl
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
use Tk;
use File::Basename;
use warnings;

my $window = MainWindow->new;
$window->minsize(qw(300 100));
$window->maxsize(qw(300 100));
$window->title("GRdesktop 1.0");
my $ent = $window -> Entry(-textvariable => \$servername, -width => 24, -borderwidth =>2, -relief => 'sunken') -> pack();
$window->Button(-text => "Connect", -width => 18, -command => \&connection )->pack;
$window->Button(-text => "Quit", -width => 18, -command => \&finito )->pack;

MainLoop;

sub connection {
$cmd = "/usr/bin/rdesktop $servername";
system $cmd;
}

sub finito{
exit;
}

2 comments:

Ondřej Sýkora said...

I try it... In first I install perl, then I make file named rdg and into this file I copy the code. Then I change permission to executable. And then I run it ... but
I get message: "Use of uninitialized value $servername in concatenation (.) or string at ./rdg line 26." and then text help of rdesktop.
I don't know perl. What is wrong? What I have to do?

root said...

Hi Ondřej,

just a formatting mistake.
I fixed and published the correct one.