Skip to content

Commit

Permalink
[copy] gpm test irssi#674
Browse files Browse the repository at this point in the history
  • Loading branch information
bw1 committed Nov 16, 2019
1 parent e42ab19 commit f447306
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions scripts/copy.pl
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
use Irssi::TextUI;
use MIME::Base64;

$VERSION = '0.03';
$VERSION = '0.04';
%IRSSI = (
authors => 'vague,bw1',
contact => '[email protected]',
name => 'copy',
description => 'copy a line in a paste buffer',
license => 'Public Domain',
url => 'https://scripts.irssi.org/',
changed => '2019-06-25',
changed => '2019-11-16',
modules => 'MIME::Base64',
commands=> 'copy',
);
Expand Down Expand Up @@ -45,6 +45,7 @@
xsel
screen
print
(gpm)
%9See also%9
https://www.freecodecamp.org/news/tmux-in-practice-integration-with-system-clipboard-bcd72c62ff7b/
http://anti.teamidiot.de/static/nei/*/Code/urxvt/
Expand Down Expand Up @@ -123,9 +124,19 @@ sub paste {
paste_screen($str, $copy_selection);
} elsif ( $copy_method eq 'print' ) {
paste_print($str, $copy_selection);
} elsif ( $copy_method eq 'gpm' ) {
paste_gpm($str, $copy_selection);
}
}

sub paste_gpm {
my ($str, $par)= @_;
my $fn= '/dev/gpmdata';
open my $fa, ">", $fn;
print $fa $str;
close $fa;
}

sub paste_print {
my ($str, $par)= @_;
Irssi::print($str, MSGLEVEL_CLIENTCRAP);
Expand Down Expand Up @@ -227,7 +238,7 @@ sub sig_setup_changed {
Irssi::settings_set_str($IRSSI{name}.'_selection', $cs);
}
my $cm= Irssi::settings_get_str($IRSSI{name}.'_method');
my %md=(xterm=>1, xclip=>1, xsel=>1, screen=>1, print=>1 );
my %md=(xterm=>1, xclip=>1, xsel=>1, screen=>1, print=>1, gpm=>1 );
if (exists $md{$cm} ) {
$copy_method= $cm;
} else {
Expand Down

0 comments on commit f447306

Please sign in to comment.