From d0a40498ae769b62c1177900c35ec0c190286974 Mon Sep 17 00:00:00 2001 From: Dreaded_X Date: Fri, 7 Jun 2019 16:11:20 +0200 Subject: [PATCH] Switched to urxvt --- xresources/.Xdefaults | 40 ++++++++++++++++++++++++++++++ xresources/.urxvt/ext/vtwheel | 46 +++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 xresources/.Xdefaults create mode 100644 xresources/.urxvt/ext/vtwheel diff --git a/xresources/.Xdefaults b/xresources/.Xdefaults new file mode 100644 index 0000000..268fd10 --- /dev/null +++ b/xresources/.Xdefaults @@ -0,0 +1,40 @@ +URxvt.font: xft:SauceCodePro Nerd Font Mono:size=9 +URxvt.scrollBar: false +URxvt.perl-ext-common:vtwheel + +! ----------------------------------------------------------------------------- +! File: gruvbox-dark.xresources +! Description: Retro groove colorscheme generalized +! Author: morhetz +! Source: https://github.com/morhetz/gruvbox-generalized +! Last Modified: 6 Sep 2014 +! ----------------------------------------------------------------------------- + +! hard contrast: *background: #1d2021 +*background: #262626 +! soft contrast: *background: #32302f +*foreground: #ebdbb2 +! Black + DarkGrey +*color0: #282828 +*color8: #928374 +! DarkRed + Red +*color1: #bf4040 +*color9: #fb4934 +! DarkGreen + Green +*color2: #98971a +*color10: #b8bb26 +! DarkYellow + Yellow +*color3: #d79921 +*color11: #fabd2f +! DarkBlue + Blue +*color4: #458588 +*color12: #83a598 +! DarkMagenta + Magenta +*color5: #b16286 +*color13: #d3869b +! DarkCyan + Cyan +*color6: #689d6a +*color14: #8ec07c +! LightGrey + White +*color7: #a89984 +*color15: #ebdbb2 diff --git a/xresources/.urxvt/ext/vtwheel b/xresources/.urxvt/ext/vtwheel new file mode 100644 index 0000000..887c8c5 --- /dev/null +++ b/xresources/.urxvt/ext/vtwheel @@ -0,0 +1,46 @@ +#! perl + +# Implements a scrollwheel just like in good old vt100's mices + +sub simulate_keypress { + my ($self, $type) = @_; #type: 0:up, 1:down + + my $keycode_up = 111; + my $keycode_down = 116; + + my $numlines = 3; + + my $keycode = 0; + if ($type eq 0) { + $keycode = $keycode_up; + } elsif ($type eq 1) { + $keycode = $keycode_down; + } else { + return; + } + + for (my $i = 0 ; $i ne $numlines ; $i++) { + $self->key_press(0,$keycode); + $self->key_release(0,$keycode); + } +} + +sub on_button_release { + my ($self, $event) = @_; + + #my $res_ss = $self->resource("secondaryScroll"); + #warn("ressource ss is <$res_ss>"); + + !$self->current_screen and return (); + + #warn("foo, event: <$event->{button}>\n"); + if ($event->{button} eq "4") { # scroll up + $self->simulate_keypress(0); + return 1; + } elsif ($event->{button} eq "5") { # scroll down + $self->simulate_keypress(1); + return 1; + } + + return (); +}