Skip to content

Instantly share code, notes, and snippets.

@tsukkee
Created September 15, 2010 17:31
Show Gist options
  • Select an option

  • Save tsukkee/581098 to your computer and use it in GitHub Desktop.

Select an option

Save tsukkee/581098 to your computer and use it in GitHub Desktop.
URxvt.termName: rxvt-256color
URxvt.foreground: White
URxvt.background: Gray10
URxvt.geometry: 130x45
URxvt.scrollBar: false
URxvt.saveLines: 1000
URxvt.font:\
xft:Inconsolata:style=Medium:size=13:antialias=true,\
xft:Osaka:style=Regular-Mono
URxvt.boldFont:\
xft:Inconsolata,\
xft:Osaka:style=Regular-Mono
URxvt.italicFont:\
xft:Inconsolata,\
xft:Osaka:style=Regular-Mono
URxvt.boldItalicFont:\
xft:Inconsolata,\
xft:Osaka:style=Regular-Mono
URxvt.perl-ext-common: default,macosx-clipboard-pbcopy
URxvt.keysym.M-c: perl:macosx-clipboard:copy
URxvt.keysym.M-v: perl:macosx-clipboard:paste
# C-, -> F9
URxvt.keysym.C-0x2c: \033[20~
# C-, -> F10
URxvt.keysym.C-0x2e: \033[21~
URxvt.color4: #a9cdeb
URxvt.color12: #ccfbff
#! perl -w
# http://triplefusion.net/system/macosx-clipboard
# ----------------------------------------------------------------------
# File: macosx-clipboard-pbcopy
# ----------------------------------------------------------------------
#
# All portions of code are copyright by their respective author/s.
# Copyright (c) 2006 Samuel Ljungkvist <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# ----------------------------------------------------------------------
#
# Modification by Matias Larre-Borges <larre-borges.com:devel>:
# To allow this module to work with the rxvt-unicode from macports,
# I had to avoid using Foundation.pm
# Modification by tsukkee
# Original version is attached at below URL
# https://trac.macports.org/ticket/17434
# Usage: put in your .Xdefaults the following lines
# URxvt.perl-ext-common: macosx-clipboard-pbcopy
# URxvt.keysym.M-c: perl:macosx-clipboard:copy
# URxvt.keysym.M-v: perl:macosx-clipboard:paste
use Fcntl ();
use locale;
use utf8;
sub copy {
my ($self) = @_;
open(CLIPBOARD, "| pbcopy ");
print CLIPBOARD $self->selection;
close CLIPBOARD;
()
}
sub paste {
my ($self) = @_;
my ($str);
$str = `pbpaste`;
$str =~ tr/¥n/¥r/;
$self->tt_write($str);
# $self->tt_write($self->locale_encode($str));
()
}
sub on_user_command {
my ($self, $cmd) = @_;
if ($cmd eq "macosx-clipboard:copy") {
$self->copy;
}
if ($cmd eq "macosx-clipboard:paste") {
$self->paste;
}
()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment