aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xdwim3
1 files changed, 3 insertions, 0 deletions
diff --git a/dwim b/dwim
index a536abb..d5c8646 100755
--- a/dwim
+++ b/dwim
@@ -107,6 +107,9 @@ sub path {
return $n if $n =~ /^\// or $n =~ /^~/;
my $d = `xtitle`;
chomp $d;
+ $d =~ s/.*\(([^(]+)\)$/$1/;
+ $d =~ s,^~([^/]+),/home/$1,;
+ $d =~ s,^~,/home/$ENV{USER},;
die "couldn't retrieve current directory\n"
if ! -d $d and ! -d ($d = dirname($d));
return "$d/$n";