Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use Gtk2 ('-init');
- use threads ('yield', 'stack_size', 262144, 'exit', 'threads_only', 'stringify');
- $icon = 'Gtk2::StatusIcon'->new;
- $icon->set_from_stock('gtk-home');
- $icon->set_visible(1);
- $icon->signal_connect('button-release-event', sub {
- show_icon_menu();
- });
- $icon->set_tooltip('Click for menu...');
- sub show_icon_menu {
- $menu = 'Gtk2::Menu'->new;
- $item15 = 'Gtk2::ImageMenuItem'->new(q[File Manager]);
- $pixbuf = 'Gtk2::Gdk::Pixbuf'->new_from_file_at_size( q[/usr/share/icons/Tango-Original/16x16/apps/file-manager.png], 16, 16);
- $img = 'Gtk2::Image'->new_from_pixbuf($pixbuf);
- $item15->show;
- $item15->signal_connect('activate', sub {
- 'threads'->create(sub {
- system q[pcmanfm];
- });}
- );
- $item15->set_image($img);
- $menu->append($item15);
- $item16 = 'Gtk2::ImageMenuItem'->new(q[Terminal]);
- $pixbuf = 'Gtk2::Gdk::Pixbuf'->new_from_file_at_size( q[/usr/share/icons/Tango-Original/16x16/apps/terminal.png], 16, 16);
- $img = 'Gtk2::Image'->new_from_pixbuf($pixbuf);
- $item16->show;
- $item16->signal_connect('activate', sub {
- 'threads'->create(sub {
- system q[lxterminal];
- });}
- );
- $item16->set_image($img);
- $menu->append($item16);
- $item17 = 'Gtk2::ImageMenuItem'->new(q[Web Browser]);
- $pixbuf = 'Gtk2::Gdk::Pixbuf'->new_from_file_at_size( q[/usr/share/icons/Tango-Original/16x16/apps/web-browser.png], 16, 16);
- $img = 'Gtk2::Image'->new_from_pixbuf($pixbuf);
- $item17->show;
- $item17->signal_connect('activate', sub {
- 'threads'->create(sub {
- system q[firefox];
- });}
- );
- $item17->set_image($img);
- $menu->append($item17);
- $item18 = 'Gtk2::ImageMenuItem'->new(q[Text Editor]);
- $pixbuf = 'Gtk2::Gdk::Pixbuf'->new_from_file_at_size( q[/usr/share/icons/Tango-Original/16x16/apps/text-editor.png], 16, 16);
- $img = 'Gtk2::Image'->new_from_pixbuf($pixbuf);
- $item18->show;
- $item18->signal_connect('activate', sub {
- 'threads'->create(sub {
- system q[lxterminal -e vi];
- });}
- );
- $item18->set_image($img);
- $menu->append($item18);
- $separator = Gtk2::SeparatorMenuItem->new;
- $menu->append($separator);
- # # # # # # # # # # # # # # # # # # # # Accessories # # # # # # # # # # # # # # # # # # # #
- $all_apps = 'Gtk2::Menu'->new->new;
- $category0 = 'Gtk2::ImageMenuItem'->new(q[Accessories]);
- $pixbuf = 'Gtk2::Gdk::Pixbuf'->new_from_file_at_size( q[/usr/share/icons/Tango-Original/16x16/categories/applications-accessories.png], 16, 16);
- $img = 'Gtk2::Image'->new_from_pixbuf($pixbuf);
- $category0->set_image($img);
- $725 = 'Gtk2::ImageMenuItem'->new(q[7-Zip FM]);
- $pixbuf = 'Gtk2::Gdk::Pixbuf'->new_from_file_at_size( q[/usr/share/icons/hicolor/32x32/apps/p7zip.png], 16, 16);
- $img = 'Gtk2::Image'->new_from_pixbuf($pixbuf);
- $725->show;
- $725->signal_connect('activate', sub {
- 'threads'->create(sub {
- system q[7zFM];
- });}
- );
- $725->set_image($img);
- $all_apps->append($725);
- $file22 = 'Gtk2::ImageMenuItem'->new(q[File Manager]);
- $pixbuf = 'Gtk2::Gdk::Pixbuf'->new_from_file_at_size( q[/usr/share/icons/Tango-Original/16x16/apps/system-file-manager.png], 16, 16);
- $img = 'Gtk2::Image'->new_from_pixbuf($pixbuf);
- $file22->show;
- $file22->signal_connect('activate', sub {
- 'threads'->create(sub {
- system q[pcmanfm];
- });}
- );
- $file22->set_image($img);
- $all_apps->append($file22);
- $lxterminal24 = 'Gtk2::ImageMenuItem'->new(q[LXTerminal]);
- $pixbuf = 'Gtk2::Gdk::Pixbuf'->new_from_file_at_size( q[/usr/share/pixmaps/lxterminal.png], 16, 16);
- $img = 'Gtk2::Image'->new_from_pixbuf($pixbuf);
- $lxterminal24->show;
- $lxterminal24->signal_connect('activate', sub {
- 'threads'->create(sub {
- system q[lxterminal];
- });}
- );
- $lxterminal24->set_image($img);
- $all_apps->append($lxterminal24);
- $xarchiver23 = 'Gtk2::ImageMenuItem'->new(q[Xarchiver]);
- $pixbuf = 'Gtk2::Gdk::Pixbuf'->new_from_file_at_size( q[/usr/share/icons/hicolor/16x16/apps/xarchiver.png], 16, 16);
- $img = 'Gtk2::Image'->new_from_pixbuf($pixbuf);
- $xarchiver23->show;
- $xarchiver23->signal_connect('activate', sub {
- 'threads'->create(sub {
- system q[xarchiver];
- });}
- );
- $xarchiver23->set_image($img);
- $all_apps->append($xarchiver23);
- $category0->set_submenu($all_apps);
- $menu->append($category0);
- # # # # # # # # # # # # # # # # # # # # Network # # # # # # # # # # # # # # # # # # # #
- $all_apps = 'Gtk2::Menu'->new->new;
- $category6 = 'Gtk2::ImageMenuItem'->new(q[Network]);
- $pixbuf = 'Gtk2::Gdk::Pixbuf'->new_from_file_at_size( q[/usr/share/icons/Tango/16x16/categories/applications-internet.png], 16, 16);
- $img = 'Gtk2::Image'->new_from_pixbuf($pixbuf);
- $category6->set_image($img);
- $avahi33 = 'Gtk2::ImageMenuItem'->new(q[Avahi VNC Server Browser]);
- $pixbuf = 'Gtk2::Gdk::Pixbuf'->new_from_file_at_size( q[/usr/share/icons/Tango-Original/16x16/devices/network-wired.png], 16, 16);
- $img = 'Gtk2::Image'->new_from_pixbuf($pixbuf);
- $avahi33->show;
- $avahi33->signal_connect('activate', sub {
- 'threads'->create(sub {
- system q[/usr/bin/bvnc];
- });}
- );
- $avahi33->set_image($img);
- $all_apps->append($avahi33);
- $avahi34 = 'Gtk2::ImageMenuItem'->new(q[Avahi SSH Server Browser]);
- $pixbuf = 'Gtk2::Gdk::Pixbuf'->new_from_file_at_size( q[/usr/share/icons/Tango-Original/16x16/devices/network-wired.png], 16, 16);
- $img = 'Gtk2::Image'->new_from_pixbuf($pixbuf);
- $avahi34->show;
- $avahi34->signal_connect('activate', sub {
- 'threads'->create(sub {
- system q[/usr/bin/bssh];
- });}
- );
- $avahi34->set_image($img);
- $all_apps->append($avahi34);
- $firefox35 = 'Gtk2::ImageMenuItem'->new(q[Firefox]);
- $pixbuf = 'Gtk2::Gdk::Pixbuf'->new_from_file_at_size( q[/usr/share/icons/hicolor/16x16/apps/firefox.png], 16, 16);
- $img = 'Gtk2::Image'->new_from_pixbuf($pixbuf);
- $firefox35->show;
- $firefox35->signal_connect('activate', sub {
- 'threads'->create(sub {
- system q[firefox];
- });}
- );
- $firefox35->set_image($img);
- $all_apps->append($firefox35);
- $pidgin36 = 'Gtk2::ImageMenuItem'->new(q[Pidgin Internet Messenger]);
- $pixbuf = 'Gtk2::Gdk::Pixbuf'->new_from_file_at_size( q[/usr/share/icons/hicolor/16x16/apps/pidgin.png], 16, 16);
- $img = 'Gtk2::Image'->new_from_pixbuf($pixbuf);
- $pidgin36->show;
- $pidgin36->signal_connect('activate', sub {
- 'threads'->create(sub {
- system q[pidgin];
- });}
- );
- $pidgin36->set_image($img);
- $all_apps->append($pidgin36);
- $category6->set_submenu($all_apps);
- $menu->append($category6);
- # # # # # # # # # # # # # # # # # # # # Others # # # # # # # # # # # # # # # # # # # #
- $all_apps = 'Gtk2::Menu'->new->new;
- $category8 = 'Gtk2::ImageMenuItem'->new(q[Others]);
- $pixbuf = 'Gtk2::Gdk::Pixbuf'->new_from_file_at_size( q[/usr/share/icons/Tango/16x16/categories/applications-other.png], 16, 16);
- $img = 'Gtk2::Image'->new_from_pixbuf($pixbuf);
- $category8->set_image($img);
- $openbox40 = 'Gtk2::ImageMenuItem'->new(q[Openbox]);
- $pixbuf = 'Gtk2::Gdk::Pixbuf'->new_from_file_at_size( q[/usr/share/pixmaps/openbox.png], 16, 16);
- $img = 'Gtk2::Image'->new_from_pixbuf($pixbuf);
- $openbox40->show;
- $openbox40->signal_connect('activate', sub {
- 'threads'->create(sub {
- system q[openbox];
- });}
- );
- $openbox40->set_image($img);
- $all_apps->append($openbox40);
- $category8->set_submenu($all_apps);
- $menu->append($category8);
- # # # # # # # # # # # # # # # # # # # # Settings # # # # # # # # # # # # # # # # # # # #
- $all_apps = 'Gtk2::Menu'->new->new;
- $category9 = 'Gtk2::ImageMenuItem'->new(q[Settings]);
- $pixbuf = 'Gtk2::Gdk::Pixbuf'->new_from_file_at_size( q[/usr/share/pixmaps/openbox.png], 16, 16);
- $img = 'Gtk2::Image'->new_from_pixbuf($pixbuf);
- $category9->set_image($img);
- $adobe44 = 'Gtk2::ImageMenuItem'->new(q[Adobe Flash Player]);
- $pixbuf = 'Gtk2::Gdk::Pixbuf'->new_from_file_at_size( q[/usr/share/icons/hicolor/16x16/apps/flash-player-properties.png], 16, 16);
- $img = 'Gtk2::Image'->new_from_pixbuf($pixbuf);
- $adobe44->show;
- $adobe44->signal_connect('activate', sub {
- 'threads'->create(sub {
- system q[flash-player-properties];
- });}
- );
- $adobe44->set_image($img);
- $all_apps->append($adobe44);
- $disk47 = 'Gtk2::ImageMenuItem'->new(q[Disk Utility]);
- $pixbuf = 'Gtk2::Gdk::Pixbuf'->new_from_file_at_size( q[/usr/share/icons/hicolor/16x16/apps/palimpsest.png], 16, 16);
- $img = 'Gtk2::Image'->new_from_pixbuf($pixbuf);
- $disk47->show;
- $disk47->signal_connect('activate', sub {
- 'threads'->create(sub {
- system q[palimpsest];
- });}
- );
- $disk47->set_image($img);
- $all_apps->append($disk47);
- $obtheme48 = 'Gtk2::ImageMenuItem'->new(q[ObTheme]);
- $img = 'Gtk2::Image'->new_from_stock('gtk-missing-image', 'menu');
- $obtheme48->show;
- $obtheme48->signal_connect('activate', sub {
- 'threads'->create(sub {
- system q[obtheme];
- });}
- );
- $obtheme48->set_image($img);
- $all_apps->append($obtheme48);
- $openbox43 = 'Gtk2::ImageMenuItem'->new(q[Openbox Configuration Manager]);
- $pixbuf = 'Gtk2::Gdk::Pixbuf'->new_from_file_at_size( q[/usr/share/pixmaps/obconf.png], 16, 16);
- $img = 'Gtk2::Image'->new_from_pixbuf($pixbuf);
- $openbox43->show;
- $openbox43->signal_connect('activate', sub {
- 'threads'->create(sub {
- system q[obconf];
- });}
- );
- $openbox43->set_image($img);
- $all_apps->append($openbox43);
- $panel46 = 'Gtk2::ImageMenuItem'->new(q[Panel tint2]);
- $pixbuf = 'Gtk2::Gdk::Pixbuf'->new_from_file_at_size( q[/usr/share/pixmaps/tint2conf.png], 16, 16);
- $img = 'Gtk2::Image'->new_from_pixbuf($pixbuf);
- $panel46->show;
- $panel46->signal_connect('activate', sub {
- 'threads'->create(sub {
- system q[tint2conf];
- });}
- );
- $panel46->set_image($img);
- $all_apps->append($panel46);
- $preferred45 = 'Gtk2::ImageMenuItem'->new(q[Preferred Applications]);
- $pixbuf = 'Gtk2::Gdk::Pixbuf'->new_from_file_at_size( q[/usr/share/icons/Tango-Original/16x16/categories/preferences-desktop.png], 16, 16);
- $img = 'Gtk2::Image'->new_from_pixbuf($pixbuf);
- $preferred45->show;
- $preferred45->signal_connect('activate', sub {
- 'threads'->create(sub {
- system q[libfm-pref-apps];
- });}
- );
- $preferred45->set_image($img);
- $all_apps->append($preferred45);
- $category9->set_submenu($all_apps);
- $menu->append($category9);
- # # # # # # # # # # # # # # # # # # # # System # # # # # # # # # # # # # # # # # # # #
- $all_apps = 'Gtk2::Menu'->new->new;
- $category10 = 'Gtk2::ImageMenuItem'->new(q[System]);
- $pixbuf = 'Gtk2::Gdk::Pixbuf'->new_from_file_at_size( q[/usr/share/icons/Tango/16x16/categories/applications-system.png], 16, 16);
- $img = 'Gtk2::Image'->new_from_pixbuf($pixbuf);
- $category10->set_image($img);
- $avahi51 = 'Gtk2::ImageMenuItem'->new(q[Avahi Zeroconf Browser]);
- $pixbuf = 'Gtk2::Gdk::Pixbuf'->new_from_file_at_size( q[/usr/share/icons/Tango-Original/16x16/devices/network-wired.png], 16, 16);
- $img = 'Gtk2::Image'->new_from_pixbuf($pixbuf);
- $avahi51->show;
- $avahi51->signal_connect('activate', sub {
- 'threads'->create(sub {
- system q[/usr/bin/avahi-discover];
- });}
- );
- $avahi51->set_image($img);
- $all_apps->append($avahi51);
- $category10->set_submenu($all_apps);
- $menu->append($category10);
- # # # # # # # # # # # # # # # # # # # # Menutray # # # # # # # # # # # # # # # # # # # #
- $all_apps = 'Gtk2::Menu'->new->new;
- $category11 = 'Gtk2::MenuItem'->new(q[Menutray]);
- $edit54 = 'Gtk2::ImageMenuItem'->new(q[Edit menutray menu]);
- $img = 'Gtk2::Image'->new_from_stock('gtk-missing-image', 'menu');
- $edit54->show;
- $edit54->signal_connect('activate', sub {
- 'threads'->create(sub {
- system q[lxterminal -e vi /root/.config/menutray/menutray.pl];
- });}
- );
- $edit54->set_image($img);
- $all_apps->append($edit54);
- $edit55 = 'Gtk2::ImageMenuItem'->new(q[Edit menutray schema]);
- $img = 'Gtk2::Image'->new_from_stock('gtk-missing-image', 'menu');
- $edit55->show;
- $edit55->signal_connect('activate', sub {
- 'threads'->create(sub {
- system q[lxterminal -e vi /root/.config/menutray/menutray.schema];
- });}
- );
- $edit55->set_image($img);
- $all_apps->append($edit55);
- $edit56 = 'Gtk2::ImageMenuItem'->new(q[Edit menutray configuration]);
- $img = 'Gtk2::Image'->new_from_stock('gtk-missing-image', 'menu');
- $edit56->show;
- $edit56->signal_connect('activate', sub {
- 'threads'->create(sub {
- system q[lxterminal -e vi /root/.config/menutray/menutray.conf];
- });}
- );
- $edit56->set_image($img);
- $all_apps->append($edit56);
- $category11->set_submenu($all_apps);
- $menu->append($category11);
- $separator = Gtk2::SeparatorMenuItem->new;
- $menu->append($separator);
- $item59 = 'Gtk2::ImageMenuItem'->new(q[Regenerate]);
- $img = 'Gtk2::Image'->new_from_stock('gtk-refresh', 'menu');
- $item59->show;
- $item59->signal_connect('activate', sub { `menutray -i`;
- 'threads'->exit;
- });
- $item59->set_image($img);
- $menu->append($item59);
- $quit = 'Gtk2::ImageMenuItem'->new('Quit');
- $img = 'Gtk2::Image'->new_from_stock('gtk-quit', 'menu');
- $quit->show;
- $quit->signal_connect('activate', sub { 'threads'->exit; exit; });
- $quit->set_image($img);
- $menu->append($quit);
- $menu->show_all;
- $menu->popup(undef, undef, sub {
- return Gtk2::StatusIcon::position_menu($menu, 0, 0, $icon);
- }
- , [1, 1], 0, 0);
- }
- 'Gtk2'->main;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement