On Tue, Jun 21, 2016 at 09:03:48PM -0400, Greg Wilson wrote:
> Hi Andrew,
> 
> Two thumbs up - I think this is a really useful teaching aid.  A
> couple of questions:
> 
> 1. Is it possible to make it bidirectional? For example, if I rename
> a file in the GUI view by clicking and typing in a new name, can "mv
> abc.dat xyz.dat" be echoed into the terminal? I can imagine a lot of
> novices using that to figure out what commands would replicate
> operations they're already familiar with.
> 
> 2. Are you able to detect file open/file closed events?  For
> example, if I run 'wc *.txt', is it possible to detect that
> 'abc.txt' and 'def.txt' are being read, and make them blink (or
> something) in the GUI view?
> 
> Thanks again for putting this together - it's really cool.

Hi everyone,

my first thought was this should be easy to script with a few lines of
bash. It turns out to be harder than I expected... In the end I came
up with a simple-ish python script [1] which displays "tree" like
output and watches the filesystem for changes, and one process'es
current working directory. That cwd is highlighted in reverse video.

You run it as 'xterm -e python3 followme.py . -p $$' (xterm, urxvt, konsole
work just as well, gnome-terminal is stupid and has different syntax :()
to have a window with

/home/zbyszek/python/followme/
    test/
        filea
        fileb
    followme.py
    README

One of the directories is highlighted when the shell moves into it.
It's mostly a proof of concept, but it might be useful even in this
form.  The nice thing about doing this in a script is that it can be
updated for swc uses, e.g. to skip .git directory, use some nice
formatting, etc.

One thing that should be changed is the formatting: right now 4 spaces
are used to indent children, but replacing it with unicode tree
characters (├──, └──, etc), would increase readability.

Another thing would be adding the blinking of files "looked
at". Currently inotifywait is used to wait for modifications, and it
could be extended to report access/modify/attrib events. "Blinking"
should be doable without too much trouble.

[1] https://github.com/keszybz/followme

Zbyszek
_______________________________________________
Discuss mailing list
[email protected]
http://lists.software-carpentry.org/listinfo/discuss

Reply via email to