From 886eab400e2883b9424243b72af3002896781e02 Mon Sep 17 00:00:00 2001 From: Weitian LI Date: Sat, 21 Jun 2014 22:44:06 +0800 Subject: Updated & Added configuration files. Added: * .calendar (BSD calendar) * .config/openbox/ * .config/tint2/ * .rtorrent.rc * .screenrc * .tcsh/, .tcshrc, .tcshrc.local Updated: * .gitignore * .lftp/rc * .tmux.conf --- .config/openbox/pipemenus/obpipemenu-places | 102 ++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100755 .config/openbox/pipemenus/obpipemenu-places (limited to '.config/openbox/pipemenus') diff --git a/.config/openbox/pipemenus/obpipemenu-places b/.config/openbox/pipemenus/obpipemenu-places new file mode 100755 index 0000000..3b73618 --- /dev/null +++ b/.config/openbox/pipemenus/obpipemenu-places @@ -0,0 +1,102 @@ +#!/usr/bin/perl +# Recursively browse filesystem through openbox3 pipe menus +#### Usage: add +# +# to your .config/openbox/menu.xml +#### CAVEAT #### +# This script was hacked on exclusively in stints between the hours of +# 4 and 5 in the morning. Quality may have suffered. +#### +# Script by dircha from ob list on 05/17/04 +# suggested improvements by John Russell on 05/17/04 implemented +# a year later by Kacper Wysocki. +# 05/30/05 - Kacper Wysocki +# - opens files with 'rox', which launches appropriate file handler +# - hidden directories now stay hidden +# - spaces, ampersands in dir- and filenames are escaped +# - newlines at each entry to make output a little readable +# 06/04/05 - Kacper Wysocki +# - use $0 for scriptname +# - use $ENV{'HOME'} as default path +# - now follows symlinks + +use strict; + +# Command to lauch files with +my $cmd = "thunar"; + +my $path = $ARGV[0]; +$path = "$ENV{'HOME'}" if $path eq ""; +my @files = split /\n/, `ls -1p '$path'`; +mk_menu_element($path, @files); + +sub mk_menu_element { + my ($path, @files) = @_; + + print "\n"; + + # "Browse here..." lauches this dir + print "". + "\n\t". + "\n\t\t$cmd '$path'". + "\n\t". + "\n\n". + ""; + + foreach $_ (@files) { + my $length = length $_; + my $last_c = substr $_, $length - 1, 1; + + if ($last_c eq "/") { + print mk_dir_element($path, substr $_, 0, $length - 1); + } elsif ($last_c eq "@") { + print mk_sym_element($path, substr $_, 0, $length - 1); + } else { + print mk_file_element($path, $_); + } + } + print "\n"; +} + +sub mk_dir_element { + my ($path, $name) = @_; + # escape ampersand and space in pathnames + $path =~ s/&/&/g; + $name =~ s/&/&/g; + $path =~ s/ /\\ /g; + $name =~ s/ /\\ /g; + + return "\n"; +} + +sub mk_sym_element { + my ($path, $name) = @_; + # escape ampersand in pathnames + $path =~ s/&/&/g; + $name =~ s/&/&/g; + + # Follow symlinks instead of opening links in rox. + return "\n"; +=cut + return "". + "\n\t". + "\n\t\t$cmd '$path/$name'". + "\n\t" + . "\n\n"; +=cut +} + +sub mk_file_element { + my ($path, $name) = @_; + my $label = $name; + # escape ampersand in pathnames + $path =~ s/&/&/g; + $name =~ s/&/&/g; + + return "". + "\n\t". + "\n\t\t$cmd '$path/$name'". + "\n\t" + . "\n\n"; +} + -- cgit v1.2.2