No one told me about this!
Jul. 29th, 2010 03:37 pm![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
![[community profile]](https://www.dreamwidth.org/img/silk/identity/community.png)
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
So I wanted to ask people their favourite things to do with screen, and to share their .screenrc files, where they've modified them in interesting ways.
I still remember that happy day when I discovered that screen could monitor a background window, and tell me when it changed or stopped changing. The latter was the revolutionary one, for me; I could start something enormous compiling, and then neglect it, secure in the conviction screen would let me know when it finished. If your keybindings are standard, "ctrl-a, _" will monitor for silence, and "ctrl-a, m" will monitor for change/movement.
My screenrc is very lightly customized, a relic of my old machine which would barf and die if asked to update screen too often, but I like it. The interesting entry is
caption always "%{= kw} %-Lw [%n-%f %t] %+Lw %?@%u%?%? [%h]%?"This gives me a strip at the bottom of the session which lists my windows by name and number, ferrinstance, at this moment:
[0-$ bash] 1$ newsbeuter 2-$ mutt 3$ rtorrentwhere the active window is in square brackets. Mutt has a hyphen after the window because it's the last active window, and the one I'd go to if I used "ctrl-a a" to return to my previous. If one of my windows had produced an alert, I'd get a "!".
You can do some really crazy stuff with the caption command, although the syntax is so arcane it requires years of study. I'm pretty sure most people copy someone else's and fiddle with it to get what they want, rather than attempt to write one from scrap.
no subject
Date: 2010-07-29 11:27 pm (UTC)I use "randomplay" to play music (randomly, naturally). Unfortunately, it isn't one of those command-line apps where you can send commands to the daemon by typing a new command. It's a curses app, where you type commands in the terminal it's running in. However, I discovered a little-known thing about screen: one can pipe characters to its command buffer. Which means that one can write a script to send commands to a curses app which is running inside screen. Which means that one can use something like "xbindkeys" to bind a function key to call a script to send commands to a curses app running in screen! Yes, it all sounds a bit like "The House that Jack Built", but it means that I can use my nice multimedia keyboard to control my music-playing, rather than having to grovel around with multiple mouse-clicks when I want to pause my music because the phone rings.
This is the screen session for randomplay:
This is the "sendplay" script:
And here are the relevant bindings in my .xbindkeysrc:
no subject
Date: 2010-07-30 12:40 pm (UTC)no subject
Date: 2010-07-30 04:13 pm (UTC)