From 4a90cf98b35fa475c9098709bf49023764ee8e9d Mon Sep 17 00:00:00 2001 From: morty Date: Wed, 17 Nov 2010 11:46:15 +0100 Subject: [PATCH 1/1] Hide on minimize --- snom.pl | 14 ++++++++++++++ 1 file changed, 14 insertions(+) mode change 100755 => 100644 snom.pl diff --git a/snom.pl b/snom.pl old mode 100755 new mode 100644 index 608e62f..bc0cdac --- a/snom.pl +++ b/snom.pl @@ -113,6 +113,8 @@ my $window = Gtk2::Window->new('toplevel'); $window->set_title("snom"); $window->signal_connect(delete_event => \&CloseAppWindow); $window->signal_connect(destroy => sub { Gtk2->main_quit; }); + + my $kphandler = $window->signal_connect(key_press_event => \&KBDInput); $window->set_border_width(15); $window->set_resizable(FALSE); @@ -234,6 +236,15 @@ sub activate_icon_cb { } } +sub minimize_to_try{ + my ($w, $event) = @_; + if ($event->changed_mask & [ 'iconified', ]){ + $window->hide(); + # Needs to be deiconified after hiding, otherwise show will not behave as expected. + $window->deiconify(); + } +} + my $status_icon = Gtk2::StatusIcon->new_from_file($Bin.'/snom.ico'); my $menu = Gtk2::Menu->new(); @@ -245,6 +256,9 @@ $status_icon->set_tooltip('Snom Tray'); $status_icon->signal_connect('activate', \&activate_icon_cb); $status_icon->signal_connect('popup-menu', \&popup_menu_cb, $menu); $status_icon->set_visible(1); + +$window->signal_connect('window-state-event',\&minimize_to_try); + ########################################################################333 $window->add($mainbox); -- 2.39.5