LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 04-08-2010, 11:29 AM   #1
mkoco
Member
 
Registered: Feb 2008
Location: US, New Jersey
Distribution: Slackware
Posts: 88

Rep: Reputation: 17
rxvt-unicode hacking


For any command-line junkies who favor rxvt-unicode, after years of struggle, here are a couple of things that changed my life:

256-color support and clickable URLs:
http://heipei.net/2009/01/04/rxvt-un...ickable-links/

Disable horizontal scroll mode, i.e. make long commands word-wrap in rxvt-unicode:
http://lists.freebsd.org/pipermail/f...er/026337.html
[Solved by adding an entry for urxvt in /etc/termcap]


Some other useful resources for using the full power of 256 colors ! :
http://graypine.com/data/colorstuff.tar.gz
Include is:
256color.pl - displays all colors in a grid
colortest - displays color, hex name, decimal name

Now truly rxvt-unicode is the ultimate, since xterm (afaik) doesn't have transparency OR click-able links.

Very happy slacker.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 04-08-2010, 01:51 PM   #2
botnet
Member
 
Registered: May 2009
Posts: 158

Rep: Reputation: 40
now if you can get copy/paste to work between urxvt and X applications, i will switch from mrxvt
 
Old 04-08-2010, 04:23 PM   #3
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,203

Rep: Reputation: 292Reputation: 292Reputation: 292
Quote:
Originally Posted by botnet View Post
now if you can get copy/paste to work between urxvt and X applications, i will switch from mrxvt
Try postallite clip manager. It's on slackbuilds.org.
 
Old 04-08-2010, 05:47 PM   #4
T3slider
Senior Member
 
Registered: Jul 2007
Distribution: Slackware64-14.1
Posts: 2,244

Rep: Reputation: 622Reputation: 622Reputation: 622Reputation: 622Reputation: 622Reputation: 622
Quote:
Originally Posted by botnet View Post
now if you can get copy/paste to work between urxvt and X applications, i will switch from mrxvt
From here:

Code:
#! /usr/bin/perl

sub on_sel_grab {
    my $query=quotemeta $_[0]->selection;
    $query=~ s/\n/\\n/g;
    $query=~ s/\r/\\r/g;
    system( "echo -en " . $query . " | xsel -i -b -p" );
}
'Tis what I use, and it works well. Note that you need xsel for that to work. You could probably modify it for xclip as well.
 
Old 04-08-2010, 10:07 PM   #5
botnet
Member
 
Registered: May 2009
Posts: 158

Rep: Reputation: 40
awesome
that works perfectly

thanks

anyway to enable paste into urxvt?

edit: shift+insert does this, sort of.

usually not though,

tried parcellite and autocutsel, same issue, pasting from urxvt is fine, pasting into urxvt does not work as well

Last edited by botnet; 04-08-2010 at 10:40 PM.
 
Old 04-08-2010, 10:49 PM   #6
T3slider
Senior Member
 
Registered: Jul 2007
Distribution: Slackware64-14.1
Posts: 2,244

Rep: Reputation: 622Reputation: 622Reputation: 622Reputation: 622Reputation: 622Reputation: 622
Quote:
Originally Posted by botnet View Post
awesome
that works perfectly

thanks

anyway to enable paste into urxvt?

edit: shift+insert does this, sort of.

usually not though,

tried parcellite and autocutsel, same issue, pasting from urxvt is fine, pasting into urxvt does not work as well
The problem is that the x clipboard uses three selections, not just one. The script above *always* operates on the primary selection. Pasting into urxvt with shift+insert also assumes the primary selection as well. You can try middle-clicking if it doesn't work properly, or run a clipboard manager that can push the other selections into the primary selection.

Sadly the clipboard situation in X/Linux is very messy, with applications choosing to use different selections for no good reason. Though this allows you to maintain multiple selections, unlike in Windows, it makes using the clipboard very tedious. I still think the best solution would be to have only a primary selection while being able to use clipboard managers that store the clipboard history allowing easy switching between selections. But what do I know, I am an end-user and the adoption of the various clipboards into all kinds of Linux applications is too ubiquitous to change at this stage.
 
Old 04-09-2010, 12:36 AM   #7
botnet
Member
 
Registered: May 2009
Posts: 158

Rep: Reputation: 40
i am currently using mrxvt

Mrxvt.macro.Shift+Alt+V: Paste CLIPBOARD
Mrxvt.macro.Shift+Alt+C: Exec !/usr/bin/xclip -o | /usr/bin/xclip -selection clipboard

these lines allow copy/paste between all applications i have come across

sadly, mrxvt has no unicode support
 
Old 04-09-2010, 12:54 AM   #8
T3slider
Senior Member
 
Registered: Jul 2007
Distribution: Slackware64-14.1
Posts: 2,244

Rep: Reputation: 622Reputation: 622Reputation: 622Reputation: 622Reputation: 622Reputation: 622
Quote:
Originally Posted by botnet View Post
i am currently using mrxvt

Mrxvt.macro.Shift+Alt+V: Paste CLIPBOARD
Mrxvt.macro.Shift+Alt+C: Exec !/usr/bin/xclip -o | /usr/bin/xclip -selection clipboard

these lines allow copy/paste between all applications i have come across

sadly, mrxvt has no unicode support
You could do the equivalent with your .Xdefaults file.
Code:
!urxvt.keysym.M-S-v: command:/usr/bin/xclip -selection clipboard -o
To paste, for example. That is untested so it may be incorrect but `man xclip` and `man urxvt` have information for you (search for keysym in urxvt's man page).

[edit] If you want to operate on the clipboard when you copy, you can just change the previous script to use the clipboard instead of the primary selection. Of course xclip would work as well. [/edit]

Last edited by T3slider; 04-09-2010 at 12:55 AM.
 
Old 04-09-2010, 06:30 AM   #9
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,203

Rep: Reputation: 292Reputation: 292Reputation: 292
Quote:
Originally Posted by botnet View Post
sadly, mrxvt has no unicode support
I believe someone is working on unicode. Maybe the mailing list will give more info on progress. I did try it out but most other functions weren't working.
 
Old 04-09-2010, 10:11 AM   #10
mkoco
Member
 
Registered: Feb 2008
Location: US, New Jersey
Distribution: Slackware
Posts: 88

Original Poster
Rep: Reputation: 17
Well, not quite great. This build of rxvt-unicode works well with my newer machines, but is slow with my older ones. I haven't tested it anything else but xmonad, but there is a lot of lag when doing any kind of dynamic resizing/opening of new terminal windows with the 256-color urxvt build.

Edit: Using this script as per your link T3Slider, copy and post works like charm!

Code:
#! /usr/bin/perl

sub on_sel_grab {
    my $query = $_[0]->selection;
    open (my $pipe,'|-','xsel -ibp') or die;
    print $pipe $query;
    close $pipe;
}

Last edited by mkoco; 04-09-2010 at 06:04 PM.
 
Old 04-09-2010, 06:43 PM   #11
mkoco
Member
 
Registered: Feb 2008
Location: US, New Jersey
Distribution: Slackware
Posts: 88

Original Poster
Rep: Reputation: 17
The perl script doesn't cover copying text out of vim running into a terminal window, but the following covers that.

Added this line to my ~/.vimrc:
Code:
vmap <C-c> y:call system("xclip -i -selection clipboard", getreg("\""))<CR>:call system("xclip -i", getreg("\""))<CR>
and copy using C-c.

From: http://vim.wikia.com/wiki/In_line_co...stem_clipboard
 
1 members found this post helpful.
Old 04-10-2010, 02:45 AM   #12
botnet
Member
 
Registered: May 2009
Posts: 158

Rep: Reputation: 40
okay, this is driving me mad

i can copy out of urxvt into, say firefox for example, using the script posted by t3slider, which, unless i am mistaken, replaces the clipboard contents with the primary buffer every time i highlight something in urxvt

i can paste into a new urxvt from firefox using "xsel -x; xsel -o -b | xsel -i; xdotool click 2; xsel -x" as a keybinding in xbindkeys

however, if i highlight something in urxvt, the above keybinding stops working, or rather, continues to only paste what was highlighted, and ignores any subsequent additions to the clipboard (the clipboard will still work normally outside of urxvt)


i simply want both the primary buffer and the X clipboard to always contain the same text, that being, whichever is newest, e.g. highlighted text in urxvt will be available from both, then if i ctrl+C some text in firefox, that text will be in both, and so on.

autocutsel claims to do this, but isn't
parcellite, likewise



(posting this here in hopes someone reads and figures out a solution before i am able to or angrily quit computers)

i did try writing a perl extension, but it either does nothing, or pastes the clipboard content into the parent terminal on launch, depending on how badly i have written it with each edit

Last edited by botnet; 04-10-2010 at 02:49 AM.
 
Old 06-09-2010, 09:53 AM   #13
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,531
Blog Entries: 27

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
Did you ever solve this, botnet? I'm also migrating from mrxvt to urxvt for unicode support (and was very happy with the mrxvt Ctrl+Shift+C or V macros you posted).

First problem, using the SlackBuild urxvt 9.07 on Slackware 13.1 is that the URxvt.keysym.M-S-c: command:<whatever> definition does not seem to work; on pressing Ctrl+Shift a yellow box with "ISO 14755 mode" is displayed after which pressing "c" displays a yellow box with:
Code:
c = □
00000080 = fg 0 bg 1
built-in support font
As an alternative, I tried the variation on the solution given by T3slider in this thread (both listed here) which, AIUI, automatically copies any text selected in urxvt to both X's PRIMARY and CLIPBOARD buffers. Having xclip but not xsel, I modified it like this which copies the selection only to te secondary a.k.a CLIPBOARD bufer but that's OK for me
Code:
#! /usr/bin/perl

sub on_sel_grab {
    my $query = $_[0]->selection;
    open (my $pipe,'|-','/usr/bin/xclip -in -selection secondary') or die;
    print $pipe $query;
    close $pipe;
Testing by starting urxvt, selecting text by positioning the mouse, left button press-and-hold, drag to select then switch to GUI text editor (Mousepad) and Ctrl+V to paste did nothing.

I don't know enough about how urxvt works or perl to even find if the perl script is being run.

BTW, I had no success putting urxvt resource definitions in ~/.Xdefaults but they are effective in ~/.Xresources.

For testing changes to the various config files (/etc/termcap, /etc/inputrc and ~/.Xresources) I do not know what is necessary to fully re-initialise. xrdb -merge /home/c/.Xresources mostly works but does not undo some changes. Logging off and back on does some re-initialisation but there have been some experimental mistakes which seem to have required a reboot to re-initialise -- feels like Windows over again!

During experimentation, some error messages were usefully made visible by starting urxvt from a terminal rather than via a launcher -- such as syntactically incorrect entries in ~/.Xresources which made urxvt abort.
 
Old 06-09-2010, 11:39 AM   #14
T3slider
Senior Member
 
Registered: Jul 2007
Distribution: Slackware64-14.1
Posts: 2,244

Rep: Reputation: 622Reputation: 622Reputation: 622Reputation: 622Reputation: 622Reputation: 622
Quote:
Originally Posted by catkin View Post
First problem, using the SlackBuild urxvt 9.07 on Slackware 13.1 is that the URxvt.keysym.M-S-c: command:<whatever> definition does not seem to work; on pressing Ctrl+Shift a yellow box with "ISO 14755 mode" is displayed after which pressing "c" displays a yellow box with:
Code:
c = □
00000080 = fg 0 bg 1
built-in support font
Ah yes, I forgot about that. Ctrl+Shift is the key combo set for unicode entry in urxvt. I never use it and I haven't used any key combinations that overlap so I had forgotten about it. See "ISO 14755 SUPPORT" in `man urxvt` for more information. I'm not sure if you can rebind that or not, so you may be forced to use a different key combo (not involving Ctrl+Shift) for your binds...
Quote:
Originally Posted by catkin View Post
As an alternative, I tried the variation on the solution given by T3slider in this thread (both listed here) which, AIUI, automatically copies any text selected in urxvt to both X's PRIMARY and CLIPBOARD buffers. Having xclip but not xsel, I modified it like this which copies the selection only to te secondary a.k.a CLIPBOARD bufer but that's OK for me
Code:
#! /usr/bin/perl

sub on_sel_grab {
    my $query = $_[0]->selection;
    open (my $pipe,'|-','/usr/bin/xclip -in -selection secondary') or die;
    print $pipe $query;
    close $pipe;
Testing by starting urxvt, selecting text by positioning the mouse, left button press-and-hold, drag to select then switch to GUI text editor (Mousepad) and Ctrl+V to paste did nothing.

I don't know enough about how urxvt works or perl to even find if the perl script is being run.

BTW, I had no success putting urxvt resource definitions in ~/.Xdefaults but they are effective in ~/.Xresources.

For testing changes to the various config files (/etc/termcap, /etc/inputrc and ~/.Xresources) I do not know what is necessary to fully re-initialise. xrdb -merge /home/c/.Xresources mostly works but does not undo some changes. Logging off and back on does some re-initialisation but there have been some experimental mistakes which seem to have required a reboot to re-initialise -- feels like Windows over again!
.Xdefaults should work just fine. To reload .Xdefaults though you should use `xrdb -load` and not `xrdb -merge` -- that is why some changes are not being undone, I believe. In my .Xdefaults file I have a couple of lines that might help:
Code:
URxvt.perl-lib: /home/username/.urxvt/
URxvt.perl-ext-common: default,selection,clipboard
I store my third-party perl scripts in ~/.urxvt instead of messing up my / filesystem. Obviously I have a perl script called "clipboard" in that folder. I'm not sure if the above is completely accurate since I have a couple of other scripts running as well that I edited out (in particular I'm not sure if selection belongs there) but the rest should be relevant.
 
2 members found this post helpful.
Old 06-10-2010, 03:21 AM   #15
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,531
Blog Entries: 27

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
Thanks T3slider

No time to follow up immediately but will do so.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] TERM=rxvt / rxvt-unicode and ctrl-L irb Slackware 10 06-09-2010 05:09 AM
rxvt unicode problem with fluxbox Josh000 Slackware 16 12-24-2009 03:45 AM
rxvt-unicode fonts proper setup zomane Linux - Desktop 1 04-12-2009 05:02 PM
problem with rxvt-unicode corbis_demon Linux - Software 0 11-27-2007 10:55 AM
Making rxvt-unicode change window title when using ssh tkarkkainen Linux - Software 1 10-15-2007 03:07 PM


All times are GMT -5. The time now is 04:55 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration