[dev] Re: New pager

From: Christian Neukirchen <chneukirchen_AT_gmail.com>
Date: Tue, 04 Jun 2013 13:55:54 +0200

Nick <suckless-dev_AT_njw.me.uk> writes:

> Thanks for taking a look Christian.
>
> On Tue, Jun 04, 2013 at 12:38:22PM +0200, Christian Neukirchen wrote:
>> > I was fed up reading in mupdf (too paginated and annoying to get
>> > text into), a terminal (too monospaced), or surf (too massive), so
>> > thought I should make something better. So I spent an afternoon
>> > making a pager that you pipe text into, with tcl/tk, and I think
>> > it's quite good (with tk 8.5 - everything is ugly with 8.5). It's
>> > attached.
>>
>> Looks pretty good already.
>>
>> Some ideas:
>> - a tail -f like mode
>
> That's a nice idea. I'll see how simple it is to implement.
>
>> - quick selection of a few fonts (or toggle monospace<->variable width)
>
> I figure if you want monospace fonts you're probably better off with
> less in the terminal. This is focused on reading essays and the
> like.
>
>> - a small scrollbar to indicate position
>
> The window title indicates position (percent through the text),
> which I prefer to a scrollbar, and it's less code.
>
>> - make text width adjustable at runtime
>
> It will shrink according to the window size, it will just never
> increase above the max width (which is roughly 60 characters). Which
> I like for text.

I was just reading a man page, and 60 chars was a big too short for
lines with many uppercase chars (not sure how it calculates the width
exactly).

And I don't have window decorations, that why I didn't see the
position.

Scrollbars are simple with Tk, however:

--- tkread.tcl.1 2013-06-04 13:51:20.713947556 +0200
+++ tkread.tcl 2013-06-04 13:54:55.408723535 +0200
_AT_@ -52,7 +52,9 @@
 }
 
 . configure -bg white
-text .t -font "Times $fontsize" -wrap word -width 60 -padx [expr $fontsize * 2] -bd -1 -bg white -fg $colour
+text .t -font "Times $fontsize" -wrap word -width 60 -padx [expr $fontsize * 2] -bd -1 -bg white -fg $colour -yscrollcommand { .s set }
+scrollbar .s -width 5 -command { .t yview }
+pack .s -fill y -side left
 pack .t -expand yes -fill y
 set text [read stdin]
 if { $::argc > 0 && [lindex $::argv 0] == "-w" } {

-- 
Christian Neukirchen  <chneukirchen_AT_gmail.com>  http://chneukirchen.org
Received on Tue Jun 04 2013 - 13:55:54 CEST

This archive was generated by hypermail 2.3.0 : Tue Jun 04 2013 - 14:00:06 CEST