ftp -o - https://jcs.org/move_in | sh -
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

urxvt: add warn_on_close to be like terminal on macOS

+98 -1
+1 -1
.Xresources
··· 109 109 URxvt.matcher.rend.0: Uline 110 110 111 111 ! disable paste warning 112 - URxvt.perl-ext: -confirm-paste,ls_l 112 + URxvt.perl-ext: -confirm-paste,ls_l,warn_on_close 113 113 114 114 SshAskpass*inputTimeout: 15 115 115
+38
.urxvt/ext/ls_l
··· 1 + #!/usr/bin/perl 2 + # 3 + # right-clicking on a filename in what looks like an `ls -l` listing will 4 + # paste the escaped value of that filename 5 + # 6 + # Copyright (c) 2024 joshua stein <jcs@jcs.org> 7 + # 8 + # Permission to use, copy, modify, and distribute this software for any 9 + # purpose with or without fee is hereby granted, provided that the above 10 + # copyright notice and this permission notice appear in all copies. 11 + # 12 + # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 13 + # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 14 + # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 15 + # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 16 + # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 17 + # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 18 + # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 19 + # 20 + 21 + sub on_button_press { 22 + my ($self, $event) = @_; 23 + 24 + if ($event->{button} == 3) { 25 + my $line = $self->line($event->{row}); 26 + my $off = $line->offset_of($event->{row}, $event->{col}); 27 + 28 + if ($line->t =~ /^[d-]......... .+? [A-Z][a-z][a-z] [\d ]\d (\d\d:\d\d| \d\d\d\d) (.+)/) { 29 + if ($-[2] <= $off && $+[2] >= $off) { 30 + $self->{term}->tt_write(quotemeta($2)); 31 + } 32 + } 33 + 34 + return 1; 35 + } 36 + 37 + () 38 + }
+59
.urxvt/ext/warn_on_close
··· 1 + #!/usr/bin/perl 2 + # 3 + # Copyright (c) 2025 joshua stein <jcs@jcs.org> 4 + # 5 + # Permission to use, copy, modify, and distribute this software for any 6 + # purpose with or without fee is hereby granted, provided that the above 7 + # copyright notice and this permission notice appear in all copies. 8 + # 9 + # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 + # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 + # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 + # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 + # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 + # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 + # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 + # 17 + 18 + sub on_child_start { 19 + my ($self, $pid) = @_; 20 + $self->{shell_pid} = $pid; 21 + } 22 + 23 + sub on_wm_delete_window { 24 + my ($self, $event) = @_; 25 + 26 + # find tty of shell pid 27 + my @tty = map { my $f = "/dev/" . $_; chomp($f); $f } 28 + grep { !/^TTY/ } 29 + `ps -o tty -p $self->{shell_pid}`; 30 + 31 + # find any other pids on this tty other than the shell 32 + my @running = map { /^(\d+) (.+)/ ? $2 : () } 33 + grep { /^\d+ / && !/^$self->{shell_pid} / } 34 + `ps -t $tty[0] -o pid,command`; 35 + 36 + if ($#running > -1) { 37 + open my $fh, "-|", 38 + "Xdialog", 39 + "--center", 40 + "--title", "urxvt", 41 + "--cancel-label", "No", 42 + "--ok-label", "Yes", 43 + "--yesno", 44 + ($#running == 0 ? "Process" : "Processes") . 45 + " still running here, close anyway?\\n\\n" . 46 + join("\\n", @running), 47 + scalar (12 + ($#running * 3)), 48 + "100" 49 + or die $!; 50 + my $ret = close($fh); 51 + if ($ret == 1) { 52 + # successful close, i pressed ok, close window 53 + return 0; 54 + } 55 + return 1; 56 + } 57 + 58 + return 0; 59 + }