Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 69 lines (53 sloc) 1.789 kb
fb8cd188 »
2010-04-16 Pick and choose urls - could be used as simple bookmarking, browser i…
1 #!/usr/bin/perl
2 use strict;
3
15596ef8 »
2010-09-25 scripts/dmenurl: Allow configuration from ENV vars due to feature req…
4 my $xsels = "$ENV{XDG_DATA_HOME}/clipbored/clips";
5
6 my $font = (exists $ENV{CLIPBORED_DMENU_FONT})
7 ? $ENV{CLIPBORED_DMENU_FONT}
8 : '-*-fixed-*-*-*-*-15-*-*-*-*-*-*-*';
9 my $normal_bg = (exists $ENV{CLIPBORED_DMENU_NORMAL_BG})
10 ? $ENV{CLIPBORED_DMENU_NORMAL_BG}
11 : "#1c1c1c";
12 my $normal_fg = (exists $ENV{CLIPBORED_DMENU_NORMAL_FG})
13 ? $ENV{CLIPBORED_DMENU_NORMAL_FG}
14 : "#ffffff";
15 my $select_bg = (exists $ENV{CLIPBORED_DMENU_SELECT_BG})
16 ? $ENV{CLIPBORED_DMENU_SELECT_BG}
17 : "#484848";
18 my $select_fg = (exists $ENV{CLIPBORED_DMENU_SELECT_FG})
19 ? $ENV{CLIPBORED_DMENU_SELECT_FG}
20 : "#ffffff";
21
70ff6e9e »
2011-04-08 fix issue 1 on the bug tracker: possibility to use XA_CLIPBOARD
22 my $x_buffer = (exists $ENV{CLIPBORED_X_SELECTION})
23 ? $ENV{CLIPBORED_X_SELECTION}
24 : 'primary';
95a1d758 »
2010-09-26 scripts/*: Seems dmenu now supports vertical mode by default, so fmen…
25
26 my $list_mode = (exists $ENV{CLIPBORED_DMENU_LISTMODE})
27 ? dmenu_mode($ENV{CLIPBORED_DMENU_LISTMODE})
28 : dmenu_mode('vertical');
29
30 # If defined, we want vertical mode
31 if(exists($ENV{CLIPBORED_DMENU_LINES})) {
32 $list_mode = "-l $ENV{CLIPBORED_DMENU_LINES}";
33 }
34
35 sub dmenu_mode {
36 my $what = shift;
740ae7b4 »
2011-04-28 dmenurl: fix and close #2
37 return ($what eq 'vertical') ? '-l 15' : '';
95a1d758 »
2010-09-26 scripts/*: Seems dmenu now supports vertical mode by default, so fmen…
38 }
39
740ae7b4 »
2011-04-28 dmenurl: fix and close #2
40 s/^(#)/\\$1/ for ($normal_fg, $normal_bg, $select_fg, $select_bg);
15596ef8 »
2010-09-25 scripts/dmenurl: Allow configuration from ENV vars due to feature req…
41
95b33c54 »
2011-04-29 scripts/dmenurl: pass font argument to dmenu (closes #3)
42 my $dmenu = "dmenu -i -b $list_mode"
43 . " -nb $normal_bg -nf $normal_fg -sb $select_bg -sf $select_fg"
44 . " -fn $font";
15596ef8 »
2010-09-25 scripts/dmenurl: Allow configuration from ENV vars due to feature req…
45
1a5ddb58 »
2010-07-30 scripts/dmenurl: rewrite
46
47 open(my $r_clips, '<', $xsels) or die("Cant open $xsels: $!");
48 my @cliplist = <$r_clips>;
49 close($r_clips);
fb8cd188 »
2010-04-16 Pick and choose urls - could be used as simple bookmarking, browser i…
50
51 my @urls;
63c7168d »
2010-09-20 dmenurl: made it less sucky and it now extracts urls like it should
52 for my $clip(@cliplist) {
740ae7b4 »
2011-04-28 dmenurl: fix and close #2
53 if($clip =~ m{(https?://[-/.\w]+)}) {
63c7168d »
2010-09-20 dmenurl: made it less sucky and it now extracts urls like it should
54 push(@urls, $1);
55 }
fb8cd188 »
2010-04-16 Pick and choose urls - could be used as simple bookmarking, browser i…
56 }
1a5ddb58 »
2010-07-30 scripts/dmenurl: rewrite
57 my $urls_to_print = join('\n', reverse(@urls));
fb8cd188 »
2010-04-16 Pick and choose urls - could be used as simple bookmarking, browser i…
58
63c7168d »
2010-09-20 dmenurl: made it less sucky and it now extracts urls like it should
59 chomp(my $xclip = `which xclip`);
fb8cd188 »
2010-04-16 Pick and choose urls - could be used as simple bookmarking, browser i…
60
63c7168d »
2010-09-20 dmenurl: made it less sucky and it now extracts urls like it should
61 do {
62 print STDERR "No xclip found. Please install.\n";
63 exit(1);
64 } if(!defined($xclip));
65
70ff6e9e »
2011-04-08 fix issue 1 on the bug tracker: possibility to use XA_CLIPBOARD
66 $xclip = "$xclip -selection $x_buffer -i -l 0|$xclip -o";
fb8cd188 »
2010-04-16 Pick and choose urls - could be used as simple bookmarking, browser i…
67
a493e41d »
2011-01-06 dmenurl: use single quotes; dont interpolate crap in urls
68 system("printf '$urls_to_print'|$dmenu -p url|$xclip");
Something went wrong with that request. Please try again.