nixers
URLs and terminal behavior - Printable Version
+- nixers (https://nixers.net)
+-- Forum: Operating Systems & Administration (https://nixers.net/Forum-Operating-Systems-Administration)
+--- Forum: GNU/Linux (https://nixers.net/Forum-GNU-Linux)
+--- Thread: URLs and terminal behavior (/Thread-URLs-and-terminal-behavior)


URLs and terminal behavior - Evolution - 23-07-2012

I want to be able to save clicked links to a variable and then execute a bash script immediately afterwords.

This is so I can do things like open youtube videos posted in irc within mplayer, images with feh etc.


RE: URLs and terminal behavior - yrmt - 23-07-2012

You can use the .Xdefault:


``URxvt*perl-ext-common: default,matcher
URxvt*urlLauncher: /usr/local/bin/chrome
URxvt*matcher.button: 1``

Replace chrome with your script.


RE: URLs and terminal behavior - Evolution - 23-07-2012

Hm I have something similar but as urxvt absolutely hated me and refused to work I stopped using it.
(Links were unclickable, it wouldn't create tabs)



URxvt*perl-ext: default
URxvt*matcher.button: 1
URxvt*urlLauncher: firefox

!urxvt.matcher.pattern.0: \\b(?:(?:https?|ftp|news|file):\/\/|mailto:)[ab-zA-Z0-9\-\@;\/?:&=%\$_.+!*\x27(),~#]+ [ab-zA-Z0-9\-\@;\/?:&=%\$_+!*\x27()~]
URxvt*matcher.pattern.0: \\b(?:(?:https?|ftp):\/\/|mailto:)[\\w\-\@;\/?:&=%\$_.+!*\x27(),~#]+ [\\w\-\@;\/?:&=%\$_+!*\x27()~]
URxvt*matcher.pattern.1: \\bwww\\.[\\w-]+\\.[\\w./?&@#-]*[\\w/-]

!!! This one matches image URLs and open them in FEH
URxvt*matcher.pattern.2: \\bhttps?:\/\/[\\w-.]*\/[\\w./?&@#-]*.(jpg|jpeg|png)
URxvt*matcher.launcher.2: feh $0

!!! Open youtubeliks in your own youtubescript
URxvt*matcher.pattern.3: \\bhttp:\/\/(www.youtube|youtube).com\/watch\\?v=([\\w-]*)
URxvt*matcher.launcher.3: /usr/bin/ytlaunch $2


RE: URLs and terminal behavior - crshd - 23-07-2012

If you say "refused to work", do you mean work in general, or _this config_ refused to work? Because if it works, I'm going to use it.


RE: URLs and terminal behavior - Evolution - 23-07-2012

(23-07-2012, 10:52 PM)crshd Wrote: If you say "refused to work", do you mean work in general, or _this config_ refused to work? Because if it works, I'm going to use it.

The feh bit works fine, you can click links to images right in irc and it will open.

Can't say much about the youtube matcher, it seems to either cutout the code after watch?v and open it in firefox or open the entire link in firefox.

This is the actual youtube-in-mplayer command:
mplayer -cookies -cookies-file /tmp/cookie.txt $(youtube-dl -g –cookies /tmp/cookie.txt “$2”) (this replaces /usr/bin/ytlaunch $2)

$2 is supposed to correspond with matcher.pattern.2


RE: URLs and terminal behavior - crshd - 23-07-2012

Actually I never really cared much about playing youtube videos in mplayer. It always seemed like it's more pain than gain. Last time I've tried it, none of the youtube-in-mplayer scripts seemed to work.

But I might play around with it again.


RE: URLs and terminal behavior - Evolution - 24-07-2012

(23-07-2012, 11:58 PM)crshd Wrote: Actually I never really cared much about playing youtube videos in mplayer. It always seemed like it's more pain than gain. Last time I've tried it, none of the youtube-in-mplayer scripts seemed to work.

But I might play around with it again.

Don't really need a script, besides mplayer all you need is youtube-dl from there you can use the command I posted above, just substitute the variable for a url.


RE: URLs and terminal behavior - yrmt - 24-07-2012

(23-07-2012, 11:58 PM)crshd Wrote: Actually I never really cared much about playing youtube videos in mplayer. It always seemed like it's more pain than gain. Last time I've tried it, none of the youtube-in-mplayer scripts seemed to work.

But I might play around with it again.

Have you tried this -> http://pastebin.com/eWLM1Wgm awesome perl script ?


RE: URLs and terminal behavior - Alexander - 24-07-2012

(24-07-2012, 06:43 AM)Beastie Wrote: Have you tried this -> http://pastebin.com/eWLM1Wgm awesome perl script ?
That one is awesome.
I use it all the time.


RE: URLs and terminal behavior - crshd - 25-07-2012

That script is great. But I have issues with audio and video being out of sync. I suppose that's not the script's fault, though.


RE: URLs and terminal behavior - yrmt - 25-07-2012

(25-07-2012, 01:40 AM)crshd Wrote: That script is great. But I have issues with audio and video being out of sync. I suppose that's not the script's fault, though.

I guess because I didn't get any problems like that.


RE: URLs and terminal behavior - crshd - 25-07-2012

No, it can't be the script's fault. All it does is grab the actual video URL. Playback after that is handled by Mplayer.