Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl -w
- use strict;
- use Gtk2 '-init';
- mk_main_window();
- Gtk2->main;
- sub mk_main_window {
- my $mw = Gtk2::Window->new;
- $mw->signal_connect (destroy => \&close_this_app );
- $mw->set_title ("Monitors");
- my $vbox0 = Gtk2::VBox->new();
- $mw->add($vbox0);
- my $b1 = Gtk2::Button->new("Turn Second Monitor ON");
- $b1->signal_connect(clicked=> \&turn_monitor_on);
- $vbox0->add($b1);
- my $b3 = Gtk2::Button->new("Turn Second Monitor OFF");
- $b3->signal_connect(clicked=> \&turn_monitor_off);
- $vbox0->add($b3);
- $mw->show_all();
- }
- sub turn_monitor_on {
- system("xrandr --output VGA-0 --auto --output DVI-I-0 --auto --right-of VGA-0");
- close_this_app();
- }
- sub turn_monitor_off {
- system("xrandr --output DVI-I-0 --off");
- close_this_app();
- }
- sub close_this_app {
- Gtk2->main_quit;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement