Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
November 13, 2010
executable file 71 lines (58 sloc) 1.634 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
#!/usr/bin/env perl
use strict;
use warnings;
use autodie;
use File::Basename;

# dbbolton
# danielbarrettbolton@gmail.com

my $filemanager = "thunar";
my $bookmarks_file = "$ENV{HOME}/.gtk-bookmarks";
open(my $in, "<", "$bookmarks_file");

my @lines = <$in>;
chomp(@lines);

# Heading #############################
print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
    . "<openbox_pipe_menu>\n"

# Default bookmarks in thunar #########
    . "<item label=\"".$ENV{USER}."\">\n"
    . " <action name=\"Execute\">\n"
    . " <execute>\n"
    . " ".$filemanager." $ENV{HOME} \n"
    . " </execute>\n"
    . " </action>\n"
    . "</item>\n"

    . "<item label=\"Trash\">\n"
    . " <action name=\"Execute\">\n"
    . " <execute>\n"
    . " ".$filemanager." trash:// \n"
    . " </execute>\n"
    . " </action>\n"
    . "</item>\n"

    . "<item label=\"Desktop\">\n"
    . " <action name=\"Execute\">\n"
    . " <execute>\n"
    . " ".$filemanager." /home/$ENV{USER}/Desktop \n"
    . " </execute>\n"
    . " </action>\n"
    . "</item>\n"

    . "<item label=\"File System\">\n"
    . " <action name=\"Execute\">\n"
    . " <execute>\n"
    . " ".$filemanager." / \n"
    . " </execute>\n"
    . " </action>\n"
    . "</item>\n"

    . "<separator />\n";

# User-specified bookmarks ############
for (@lines) {
    my $label = basename $_;
    
    print "<item label=\"".$label."\">\n"
        . " <action name=\"Execute\">\n"
        . " <execute>\n"
        . " ".$filemanager." ".$_."\n"
        . " </execute>\n"
        . " </action>\n"
        . "</item>\n";
}
print "</openbox_pipe_menu>\n";
close $in;

Something went wrong with that request. Please try again.