Skip to content

Commit a9eb2c7

Browse files
author
H.Merijn Brand - Tux
committed
use configurable copy-url button
1 parent 18b7ec4 commit a9eb2c7

File tree

2 files changed

+27
-25
lines changed

2 files changed

+27
-25
lines changed

lib/PM/CB/GUI.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ sub add_clickable {
465465
sub { $self->{balloon}->detach($text) });
466466
$text->tagBind($tag, '<Button-1>',
467467
sub { browse($self->url($url)) });
468-
$text->tagBind($tag, '<Control-Button-1>',
468+
$text->tagBind($tag, $self->{copy_url} || '<Control-Button-1>',
469469
sub { $text->clipboardAppend($self->url($url)) });
470470
}
471471

pm-cb-g

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -35,30 +35,31 @@ BEGIN {
3535
# /me considers File::HomeDir overly complicated
3636
my $home = $ENV{HOME} || $ENV{USERPROFILE} || $ENV{HOMEPATH};
3737
foreach my $rcf (grep { -s }
38-
"$home/pm-cb.rc", "$home/.pm-cbrc", "$home/.config/pm-cb") {
39-
print "Trying $rcf\n";
40-
(stat $rcf)[2] & 022 and next;
41-
open my $fh, "<", $rcf or next;
42-
print "Reading $rcf\n";
43-
while (<$fh>) {
44-
s/\s*#.*$//;
45-
my ($k, $v) = (m/^\s*([-\w]+)\s*[:=]\s*(.*\S)/) or next;
46-
$conf{ lc $k
47-
=~ s{-}{_}gr
48-
=~ s{[-_]colou?r$}{_color}ir
49-
=~ s{background}{bg}ir
50-
=~ s{foreground}{fg}ir
51-
=~ s{^(?:unicode|utf-?8?)$}{utf8}ir
52-
=~ s{^use_}{}ir
53-
=~ s{font_size}{char_size}ir
54-
=~ s{show_time(?:stamps?)}{show_time}ir
55-
} = $v
56-
=~ s{U\+?([0-9A-Fa-f]{2,7})}{chr hex $1}ger
57-
=~ s{^(?:no|false)$}{0}ir
58-
=~ s{^(?:yes|true)$}{1}ir;
59-
}
60-
exists $conf{show_time} and $conf{no_time} = !delete $conf{show_time};
61-
}
38+
"$home/pm-cb.rc", "$home/.pm-cbrc", "$home/.config/pm-cb") {
39+
(stat $rcf)[2] & 022 and next;
40+
open my $fh, "<", $rcf or next;
41+
while (<$fh>) {
42+
s/\s*#.*$//;
43+
my ($k, $v) = (m/^\s*([-\w]+)\s*[:=]\s*(.*\S)/) or next;
44+
$conf{ lc $k
45+
=~ s{-}{_}gr
46+
=~ s{[-_]colou?r$}{_color}ir
47+
=~ s{background}{bg}ir
48+
=~ s{foreground}{fg}ir
49+
=~ s{^(?:unicode|utf-?8?)$}{utf8}ir
50+
=~ s{^use_}{}ir
51+
=~ s{font_size}{char_size}ir
52+
=~ s{font_family}{char_name}ir
53+
=~ s{show_time(?:stamps?)}{show_time}ir
54+
} = $v
55+
=~ s{U\+?([0-9A-Fa-f]{2,7})}{chr hex $1}ger
56+
=~ s{^(?:no|false)$}{0}ir
57+
=~ s{^(?:yes|true)$}{1}ir;
58+
}
59+
}
60+
exists $conf{show_time} and $conf{no_time} = !delete $conf{show_time};
61+
$conf{font_name} =~ m/\s/ and $conf{font_name} = "{".$conf{font_name}."}";
62+
exists $conf{xmodifiers} && !$conf{xmodifiers} and delete $ENV{XMODIFIERS};
6263

6364
GetOptions(
6465
'a|author_color=s' => \$conf{author_color},
@@ -124,6 +125,7 @@ my $gui = 'PM::CB::GUI'->new({
124125
to_comm => $to_comm,
125126
to_control => $to_control,
126127
control_t => $control_t,
128+
copy_url => $conf{copy_url},
127129
browse_url => $conf{browse_url},
128130
random_url => $conf{random_url}});
129131
$gui->gui;

0 commit comments

Comments
 (0)