From fb8cf59dd65f858d3500adc2b815170852e54318 Mon Sep 17 00:00:00 2001 From: chacha Date: Sun, 22 Mar 2026 21:39:47 +0100 Subject: [PATCH] fix urxvt copy/past --- Dockerfile | 16 ++- Jenkinsfile | 3 +- desktop | 1 + internal/rootfs/etc/skel/.Xresources | 7 +- internal/rootfs/usr/lib/urxvt/perl/clipboard | 122 ++++++++++++++++--- 5 files changed, 125 insertions(+), 24 deletions(-) diff --git a/Dockerfile b/Dockerfile index 085b976..6a25c9a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -59,11 +59,23 @@ RUN (zcat /usr/src/unionfs-2.2.3_for_2.6.24.diff.gz | patch -p1) && \ make oldconfig &&\ make-kpkg --initrd --arch $ARCH kernel_headers kernel_image modules_image +# Modified urxvt terminal +WORKDIR /usr/src +RUN apt-get build-dep -y rxvt-unicode && \ + apt-get source rxvt-unicode &&\ + cd rxvt-unicode-* && \ + cp debian/rules debian/rules.orig && \ + cp debian/changelog debian/changelog.orig && \ + sed -i '/\.\/configure/ s/$/ --disable-iso14755/' debian/rules && \ + sed -i '1s/^\([^)]* (\)\([^)]*\)\(.*\)$/\1\2+retrodebian1\3/' debian/changelog && \ + dpkg-buildpackage -us -uc -b + # Building userspace libs # 3Dfx -COPY buildglidepkg.sh /usr/src/ +WORKDIR /usr/src +COPY buildglidepkg.sh ./ RUN apt-get install -y nasm && \ - chmod +x /usr/src/buildglidepkg.sh + chmod +x buildglidepkg.sh # cvg / voodoo2 WORKDIR /usr/src/glide # glide2x diff --git a/Jenkinsfile b/Jenkinsfile index b2aab44..8f96377 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -131,7 +131,7 @@ pipeline { cp -R /usr/share/live-helper/templates/* config/templates/ sed -i \ -e 's|^menu vshift.*|menu vshift 40|' \ - -e 's|^menu hshift.*|menu hshift 60|' \ + -e 's|^menu hshift.*|menu hshift 90|' \ -e 's|^menu width.*|menu width 60|' \ -e 's|^menu color sel.*|menu color sel * #ff82c059 #c01f1f1f none|' \ -e 's|^menu color unsel.*|menu color unsel * #8082c059 #c01f1f1f none|' \ @@ -148,6 +148,7 @@ pipeline { cp /root/update-initramfs.sh config/chroot_local-hooks cp /root/zzz-config-live.sh config/chroot_local-hooks cp /root/linux-image-*.deb config/chroot_local-packages/ + cp /root/rxvt-unicode_*.deb config/chroot_local-packages/ cp /root/device3dfx-*.deb config/chroot_local-packages/ cp /root/squashfs-modules-*.deb config/chroot_local-packages/ cp /root/libglide*-cvg*_i386.deb config/chroot_local-packages/ diff --git a/desktop b/desktop index 36300a1..0ce7478 100644 --- a/desktop +++ b/desktop @@ -64,3 +64,4 @@ gksu xscreensaver beep xclip +xsel diff --git a/internal/rootfs/etc/skel/.Xresources b/internal/rootfs/etc/skel/.Xresources index 01a7e42..9d274c3 100644 --- a/internal/rootfs/etc/skel/.Xresources +++ b/internal/rootfs/etc/skel/.Xresources @@ -6,8 +6,11 @@ URxvt*scrollBar: false URxvt*internalBorder: 6 URxvt.perl-ext-common: clipboard -URxvt.keysym.Mod4-c: perl:clipboard:copy -URxvt.keysym.Mod4-v: perl:clipboard:paste +URxvt.keysym.C-S-c: perl:clipboard:copy +URxvt.keysym.C-S-v: perl:clipboard:paste +URxvt.clipboard.autocopy: true +URxvt.clipboard.copycmd: xclip -i -selection clipboard +URxvt.clipboard.pastecmd: xclip -o -selection clipboard XTerm*faceName: DejaVu Sans Mono XTerm*faceSize: 9 diff --git a/internal/rootfs/usr/lib/urxvt/perl/clipboard b/internal/rootfs/usr/lib/urxvt/perl/clipboard index e78b331..0e73fa5 100644 --- a/internal/rootfs/usr/lib/urxvt/perl/clipboard +++ b/internal/rootfs/usr/lib/urxvt/perl/clipboard @@ -1,31 +1,115 @@ #! perl -w +# Author: Bert Muennich +# Website: http://www.github.com/muennich/urxvt-perls +# License: GPLv2 -# Usage: -# URxvt.perl-ext-common: clipboard -# URxvt.keysym.Mod4-c: perl:clipboard:copy -# URxvt.keysym.Mod4-v: perl:clipboard:paste +# Use keyboard shortcuts to copy the selection to the clipboard and to paste +# the clipboard contents (optionally escaping all special characters). +# Requires xsel to be installed! -# consult command "xmodmap" to see what your modifier mapped into. +# Usage: put the following lines in your .Xdefaults/.Xresources: +# URxvt.perl-ext-common: ...,clipboard +# URxvt.keysym.M-c: perl:clipboard:copy +# URxvt.keysym.M-v: perl:clipboard:paste +# URxvt.keysym.M-C-v: perl:clipboard:paste_escaped + +# Options: +# URxvt.clipboard.autocopy: If true, PRIMARY overwrites clipboard + +# You can also overwrite the system commands to use for copying/pasting. +# The default ones are: +# URxvt.clipboard.copycmd: xsel -ib +# URxvt.clipboard.pastecmd: xsel -ob +# If you prefer xclip, then put these lines in your .Xdefaults/.Xresources: +# URxvt.clipboard.copycmd: xclip -i -selection clipboard +# URxvt.clipboard.pastecmd: xclip -o -selection clipboard +# On Mac OS X, put these lines in your .Xdefaults/.Xresources: +# URxvt.clipboard.copycmd: pbcopy +# URxvt.clipboard.pastecmd: pbpaste + +# The use of the functions should be self-explanatory! + +use strict; + +sub on_start { + my ($self) = @_; + + $self->{copy_cmd} = $self->x_resource('clipboard.copycmd') || 'xsel -ib'; + $self->{paste_cmd} = $self->x_resource('clipboard.pastecmd') || 'xsel -ob'; + + if ($self->x_resource('clipboard.autocopy') eq 'true') { + $self->enable(sel_grab => \&sel_grab); + } + + () +} sub copy { - my ($self) = @_; - my $pid = open( pout, "| xsel -ib" ) or die "fork"; - print pout $self->selection; - close(pout) or die "close"; + my ($self) = @_; + + if (open(CLIPBOARD, "| $self->{copy_cmd}")) { + my $sel = $self->selection(); + utf8::encode($sel); + print CLIPBOARD $sel; + close(CLIPBOARD); + } else { + print STDERR "error running '$self->{copy_cmd}': $!\n"; + } + + () } sub paste { - my ($self) = @_; - my $content = `xsel -ob` ; - $self->tt_write ($content); + my ($self) = @_; + + my $str = `$self->{paste_cmd}`; + if ($? == 0) { + $self->tt_paste($str); + } else { + print STDERR "error running '$self->{paste_cmd}': $!\n"; + } + + () +} + +sub paste_escaped { + my ($self) = @_; + + my $str = `$self->{paste_cmd}`; + if ($? == 0) { + $str =~ s/([!#\$%&\*\(\) ='"\\\|\[\]`~,<>\?])/\\\1/g; + $self->tt_paste($str); + } else { + print STDERR "error running '$self->{paste_cmd}': $!\n"; + } + + () +} + +sub on_action { + my ($self, $action) = @_; + + on_user_command($self, "clipboard:" . $action); } sub on_user_command { - my ($self, $cmd) = @_; - if ($cmd eq "clipboard:copy") { - $self->copy; - } - if ($cmd eq "clipboard:paste") { - $self->paste; - } + my ($self, $cmd) = @_; + + if ($cmd eq "clipboard:copy") { + $self->copy; + } elsif ($cmd eq "clipboard:paste") { + $self->paste; + } elsif ($cmd eq "clipboard:paste_escaped") { + $self->paste_escaped; + } + + () +} + +sub sel_grab { + my ($self) = @_; + + $self->copy; + + () } \ No newline at end of file