#!/usr/bin/perl # # scrollbtn (for urxvt) # # (c) 2007 Copyright Erik Scharwaechter , and , if the # key (usually "Alt") is pressed. This is useful in some # console applications that allow scrolling with the arrow keys, # like ncmpc. # # Released under the terms of the DWTFYWWI license by # Ævar Arnfjörð Bjarmason (http://tools.wikimedia.de/~avar/COPYING). # # INSTALL: Copy script to /usr/lib/urxvt/perl/ and append "scrollbtn" # to "perl-ext-common" in your Xdefaults file. # # Change the following settings, if the script doesn't work for you. # You can get the button ids with xev. # my $btn_up = 4; # Scroll Up my $btn_down = 5; # Scroll Down my $btn_enter = 2; # Scroll Click sub on_button_release { my ($self, $event) = @_; my $newmask = $event->{state} ^ $self->ModMetaMask; if (($event->{state} & $self->ModMetaMask)) { if ($event->{button} == $btn_up) { $self->{term}->key_press($newmask, 98); return 1; } elsif ($event->{button} == $btn_down) { $self->{term}->key_press($newmask, 104); return 1; } elsif ($event->{button} == $btn_enter) { $self->{term}->key_press($newmask, 36); return 1; } } () }