Skip to content

Commit

Permalink
fix issue 1 on the bug tracker: possibility to use XA_CLIPBOARD
Browse files Browse the repository at this point in the history
  • Loading branch information
trapd00r committed Apr 8, 2011
1 parent d937b4f commit 70ff6e9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
3 changes: 2 additions & 1 deletion clipbored
@@ -1,6 +1,6 @@
#!/usr/bin/perl
our $APP = 'clipbored';
our $VERSION = '1.2.3';
our $VERSION = '1.2.4';
use strict;
use Getopt::Long;
use Pod::Usage;
Expand Down Expand Up @@ -220,6 +220,7 @@ These are recognized:
CLIPBORED_DMENU_SELECT_BG selected item foreground color in HEX
CLIPBORED_DMENU_FONT font that will be used
CLIPBORED_DMENU_LINES how many lines that will be shown in vertical mode
CLIPBORED_X_SELECTION X buffer to use: primary, secondary, clipboard
=head1 AUTHOR
Expand Down
18 changes: 9 additions & 9 deletions scripts/dmenuclip
Expand Up @@ -25,28 +25,28 @@ my $list_mode = (exists $ENV{CLIPBORED_DMENU_LISTMODE})
? dmenu_mode($ENV{CLIPBORED_DMENU_LISTMODE})
: dmenu_mode('vertical');

my $x_buffer = (exists $ENV{CLIPBORED_X_SELECTION})
? $ENV{CLIPBORED_X_SELECTION}
: 'primary';


# If defined, we want vertical mode
if(exists($ENV{CLIPBORED_DMENU_LINES})) {
$list_mode = "-l $ENV{CLIPBORED_DMENU_LINES}";
}

sub dmenu_mode {
my $what = shift;

if($what eq 'vertical') {
return("-l 15");
}
else {
return("");
}
return ($_[0] eq 'vertical') ? '-l 15' : '';
}

$normal_bg =~ s/^(#)/\\$1/;
$normal_fg =~ s/^(#)/\\$1/;
$select_bg =~ s/^(#)/\\$1/;
$select_fg =~ s/^(#)/\\$1/;


my $dmenu = "dmenu -i -b $list_mode "
. "-nb $normal_bg -nf $normal_fg -sb $select_bg -sf $select_fg";

system("printf \"\$(\\tac $xsels|$dmenu -fn $font -p dmenuclip)\"|xclip -i -l 0|xclip -o");
my $dmenu_cmd = qq[\$(tac $xsels | $dmenu -fn $font -p dmenuclip)];
system("printf $dmenu_cmd | xclip -selection $x_buffer -i -l 0 | xclip -o");
5 changes: 4 additions & 1 deletion scripts/dmenurl
Expand Up @@ -20,6 +20,9 @@ my $select_fg = (exists $ENV{CLIPBORED_DMENU_SELECT_FG})
? $ENV{CLIPBORED_DMENU_SELECT_FG}
: "#ffffff";

my $x_buffer = (exists $ENV{CLIPBORED_X_SELECTION})
? $ENV{CLIPBORED_X_SELECTION}
: 'primary';

my $list_mode = (exists $ENV{CLIPBORED_DMENU_LISTMODE})
? dmenu_mode($ENV{CLIPBORED_DMENU_LISTMODE})
Expand Down Expand Up @@ -69,6 +72,6 @@ do {
exit(1);
} if(!defined($xclip));

$xclip = "$xclip -i -l 0|$xclip -o";
$xclip = "$xclip -selection $x_buffer -i -l 0|$xclip -o";

system("printf '$urls_to_print'|$dmenu -p url|$xclip");

0 comments on commit 70ff6e9

Please sign in to comment.