dotfiles

Cross platform dotfiles for linux, mac and windows

commit a029f9e8bc129b27171047593628bad418e5c72a
parent 487b6a653d44ad6409fecdeb9d3f193b7fab144e
Author: Bharatvaj H <bharatvajph@gmail.com>
Date: Sun, 28 Oct 2018 01:24:13 +0530

Added urxvt new-window plugin and updated .Xdefaults for ubuntu
2 files changed, 41 insertions(+), 2 deletions(-)
M
.Xdefaults.ubuntu
|
5
+++--
A
.urxvt/ext/new-window
|
38
++++++++++++++++++++++++++++++++++++++
diff --git a/.Xdefaults.ubuntu b/.Xdefaults.ubuntu
@@ -5,8 +5,9 @@ URxvt*boldFont: xft:Fira Mono:bolf:pixelsize=14
 URxvt*saveLines: 12000
 URxvt*scrollBar: false
 URxvt*scrollstyle: rxvt
-URxvt*perl-ext-common: default,matcher
-URxvt*urlLauncher: firefox
+URxvt*perl-ext-common: default,matcher,new-window
+URxvt*urlLauncher: chromium
+URxvt.keysym.C-N: perl:new-window
 URxvt*matcher.button: 1
 
 URxvt*colorUL: #86a2be
diff --git a/.urxvt/ext/new-window b/.urxvt/ext/new-window
@@ -0,0 +1,38 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+use Cwd;
+
+# Opening a new window.
+# Fixed version of script from
+# http://lists.schmorp.de/pipermail/rxvt-unicode/2012q3/001609.html
+# by José Romildo Malaquias <malaquias at gmail.com>
+# References: man 3 urxvtperl
+# Debugging:   urxvt --perl-lib ${HOME}/.urxvt -pe new-window
+# Example config: URxvt.keysym.Control-Shift-N: perl:new-window
+
+sub new_window
+{
+    my ($self) = @_;
+    my $ccwd = readlink("/proc/".$self->{child_pid}."/cwd");
+    new urxvt::term $self->env, $urxvt::RXVTNAME, -cd => $ccwd;
+}
+
+sub on_child_start {
+    my ($self,$pid) = @_;
+
+    $self->{child_pid} = $pid;  # keep for later determining our shells
+                                # CWD for relative path names
+    ()
+}
+
+
+sub on_user_command
+{
+    my ($self, $cmd) = @_;
+
+    if ($cmd eq "new-window") {
+        new_window($self);
+    }
+}