workaround rxvt-unicode bug
This commit is contained in:
parent
a80be3b6ea
commit
79d255272d
@ -1,32 +0,0 @@
|
|||||||
#! perl
|
|
||||||
|
|
||||||
use v5.20;
|
|
||||||
use strict;
|
|
||||||
use warnings;
|
|
||||||
no warnings "experimental";
|
|
||||||
|
|
||||||
our @resources = (
|
|
||||||
qw(
|
|
||||||
background foreground cursorColor
|
|
||||||
pointerColor pointerColor2
|
|
||||||
highlight borderColor
|
|
||||||
font geometry
|
|
||||||
),
|
|
||||||
map { "color$_" } 0..15
|
|
||||||
);
|
|
||||||
|
|
||||||
sub on_start {
|
|
||||||
my %fallbacks = (
|
|
||||||
borderColor => "background",
|
|
||||||
cursorColor => "foreground");
|
|
||||||
|
|
||||||
for (@resources) {
|
|
||||||
my $val = $TERM->x_resource($_);
|
|
||||||
my $default = $TERM->x_resource($fallbacks{$_});
|
|
||||||
if (not $val and $default){
|
|
||||||
$val = $default
|
|
||||||
}
|
|
||||||
say "$_: " . $val;
|
|
||||||
}
|
|
||||||
exit;
|
|
||||||
}
|
|
@ -17,16 +17,21 @@ my $libdir = dirname(__FILE__);
|
|||||||
|
|
||||||
our @terms = ();
|
our @terms = ();
|
||||||
|
|
||||||
sub reload_all {
|
sub get_xresources {
|
||||||
my @lines = `urxvt --perl-lib $libdir -pe config-print 2>&1`;
|
my @entries = `xrdb -query`;
|
||||||
my %resource;
|
my %resources;
|
||||||
for (@lines) {
|
for (@entries) {
|
||||||
$resource{$1} = $2 if (/(.*?): (.*)/);
|
$resources{$2} = $3 if /^(URxvt)?\*([^:]+):\t+(.*)/;
|
||||||
}
|
}
|
||||||
|
$resources{borderColor} //= $resources{background};
|
||||||
|
$resources{cursorColor} //= $resources{foreground};
|
||||||
|
return %resources;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub build_command {
|
||||||
|
my %resources = @_;
|
||||||
my $cmd = "";
|
my $cmd = "";
|
||||||
my $i = 0;
|
for (keys %resources) {
|
||||||
RESOURCE:
|
|
||||||
for (keys %resource) {
|
|
||||||
my $key;
|
my $key;
|
||||||
given ($_) {
|
given ($_) {
|
||||||
$key = "4;$1" when (/color(\d+)/);
|
$key = "4;$1" when (/color(\d+)/);
|
||||||
@ -39,16 +44,22 @@ RESOURCE:
|
|||||||
$key = 708 when "borderColor";
|
$key = 708 when "borderColor";
|
||||||
$key = 710 when "font";
|
$key = 710 when "font";
|
||||||
when ("geometry") {
|
when ("geometry") {
|
||||||
if (my ($col, $row) = $resource{$_} =~ /(\d+)x(\d+)/) {
|
if (my ($col, $row) = $resources{$_} =~ /(\d+)x(\d+)/) {
|
||||||
$cmd .= "\e[8;${row};${col}t";
|
$cmd .= "\e[8;${row};${col}t";
|
||||||
}
|
}
|
||||||
next RESOURCE;
|
next RESOURCE;
|
||||||
}
|
}
|
||||||
default { next RESOURCE }
|
default { next RESOURCE }
|
||||||
}
|
}
|
||||||
my $val = $resource{$_};
|
my $val = $resources{$_};
|
||||||
$cmd .= "\e]$key;$val\a";
|
$cmd .= "\e]$key;$val\a";
|
||||||
}
|
}
|
||||||
|
return $cmd;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub reload_all {
|
||||||
|
my %resources = get_xresources;
|
||||||
|
my $cmd = build_command(%resources);
|
||||||
for (@terms) {
|
for (@terms) {
|
||||||
$_->cmd_parse($cmd);
|
$_->cmd_parse($cmd);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user