Archive for the ‘gnu screen’ Category

Update 20110723 – CentOS 6, Sabayon, Slackware, NetBSD, Etc.

July 23, 2011

Long time no see, haters. Since my last update earlier this year, I’ve been pretty busy. Usual stuff: family, work, and sports injuries.

I have a shiny new Lenovo laptop. One of the reasons I chose this one is because I was able to get a list of the hardware and checked it against lists of supported devices. It’s all supported very well under Linux and the BSDs (Net, Open) I looked at.

First thing I did was reduce the very large NTFS partition someone formatted it with (I never have booted this into Windows 7) so that it’s actually quite small. Then I installed a release candidate for Scientific Linux 6 on it, as that was the first available RHEL6 clone. I’ve since changed that over to CentOS 6 using a net install. And since I have no interest in booting the pre-installed OS, I changed my grub menu.lst to no wait, no options, just load that one in a freaking hurry.

As usual, I found some nits to pick about how certain other things were configured and I had to make some changes to get simple things to work. This goes for software as well as hardware.

First the hardware side of it. I thought the inkjet printer I keep in my room was supported out of the box despite noticing the printer would “eat” up paper upon finishing the job — not fully ejecting it before pulling it back in to the printer. It was only the past few days, though, I realized there was more wrong than met the eye. I needed to make some quick scans and xsane reported back I had no scanner. Hmmm. I checked it via scanimage and it was detected. I also double-checked the drivers and saw that the sane backends for hp and usb were there. I decided to see if the hplip site had a newer RPM than is available in any of the repositories I’ve enabled. I entered the relevant information and downloaded an up-to-date RPM with new drivers. Installing it required removing old RPMs. Then I had to set some permissions so I could use the scanner without escalating my privileges to root. The new hplip RPM also resulted in better printing and no more “eating” paper.

There was a variety of software I installed from the normal as well as third-party repositories. Most of it has been without any trouble — only a couple things from a more bleeding edge repository (EPEL) have conflicted with packages from others. Some of the configuration issues have been simple and straightforward. I’m coming around to accepting pulseaudio, especially as it makes some things easier. My Bluetooth headphones work fine and are able to remotely control playlists in totem. Haven’t tried yet in rhythmbox but mplayer (from rpmforge) needs remuco to work.

Even though I’d be exaggerating to call RHEL6 or its clones bleeding edge, it’s still new enough that repositories lack certain packages that I wanted to install. One solution (other than “wait”):

sudo yum groupinstall 'Development Tools'

I’ve recompiled things that bugged me as well as things that were either unavailable or that I wanted to update. I wanted liferea so I had to compile it myself. Dittos sylpheed (NOT claws) and mew (emacs e-mail client). I also wanted an update of org-mode for emacs, but I’ve also played around with compiling other emacsen. This morning, I decided to try sxemacs.

I wasn’t impressed with the clunky xaw widgetry, let alone the faces available on my laptop (trust me, terminus looked only a little better), and I decided against installing GTK1 headers just to see if that would look any better. Not even some minor color changes helped. I usually run emacs from console anyway because it’s easier to run it in screen and then shell in and out, locally or remotely, as needed. The faces (fonts) bother  me a lot more than the widgets — it’s not about the aesthetics as much as if I can clearly see what the hell I’m doing.

I’m going to try this for a while and see how much work it’ll take to get it working the way I use GNU emacs. Just remembered I forgot to change EDITOR=emacsclient to EDITOR=gnuclient. Also, this (last line!) has to go in the init.el to keep from opening a new sxemacs GUI instance:

(require 'gnuserv)
(gnuserv-start)
(setq gnuserv-frame (selected-frame))

Sheesh! Recompiled –without-x. Much better, too, after removing background color (transparent terminal over black wallpaper).

Now the fun of getting my other emacs stuff to work correctly with this.

I also converted my previous laptop over to CentOS 6. I did a minimal net installation, installed xfce from EPEL, and then added some of my own packages (including dwm and jwm because I decided I don’t care for xfce). My ridiculous Acer Aspire One is still running SL6 and still having issues with the fucking Atheros wireless card. When it starts to flake out on me, I pop in a zyd-based USB wireless adapter. Voila. I should blacklist the module for the Atheros card but, honestly, the AA1 has been such a pain in the ass that I seldom use it. I recently updated XP (30-something packages!) after not even booting it for like half a year and suffered some USB-related issues as a result. The good news is under the RHEL6 clones, all the other AA1’s hardware — including both internal card readers — work properly, without having to boot one side with a card inserted.

Okay. The headline mentions other distros and NetBSD. I’m considering some changes on the other laptop because a lot of stuff I’ve compiled for it would be just as easy from scratch instead of using source RPMs or new source. I tried to get a measure of how many packages are installed by default on a minimal install of various distros. I figure RHEL clones will have the most, followed by Debian, and on the other side of the scale will be Slackware and Gentoo (I haven’t used Sabayon before but I like the option of using a binary or portage depending on my tastes — this is why I’m also considering a BSD and pkgsrc).

There are certain distros I’ve taken off my radar list despite having a fondness for them. As I now use laptops, netbooks, and other portable devices — including portable USB storage — about 90% of the time, encryption is very important to me; one of my parents’ was a victim of identity theft in the past couple years and I was already a bit paranoid about what kind of information could be found in plaintext on my computers. On all my computers, I like the option of installing to, or easily setting up, one encrypted LVM which includes at the very least my /home, /var, /etc, and swap. I used to think it was adequate to encrypt just /home and swap but I’ve changed my mind after auditing “identifying” information available elsewhere on an unencrypted system. For example, plaintext wifi passwords in /etc/wpa_supplicant/wpa_supplicant.conf (or elsewhere on a “non-standard” system) or stuff stored in /tmp. I also think it’s not enough that the “core” of the operating system be protected from threats, such as over the Internet; the biggest vulnerabilities usually stem from applications and user choices, and you can’t reboot those problems away — they’ll still be there if (or because) /home and /usr/local are RW, not read-only. When storage is measured in GB and TB and speedy multi-core processors, it’s harder for me to choose to run my OS in some “embedded” style.

Still on my TODO list is my post about what I use instead of OpenOffice.org. Also, I’ll try to write a post about the minimal install I did with more specifics (need to edit my gnote version of it — wish I could import that into this without reformatting) in the near future. As usual, no promises on time lines.

Micro Core and GNU screen Fix

April 1, 2010

I finally got around to trying my own GNU screen extension in Micro Core. Same result (fail) as the one in the repository. This is because of the way the permissions are set for /dev/tty1. This is something which the development team could address so that ttys are spawned with appropriate permissions in both Tiny Core (which worked for me) as well as Micro Core (which didn’t).

Suggestions were made in the TCL forums that users could exit the shell and then sign back in. This requires that a password first be set for the $USER (whether tc or whatever the user sets via the user cheatcode) and that a user have access to the box to log out and log back in, or even to use the noautologin cheatcode (which would require that to be set in menu.lst as a default if the user doesn’t have direct access and needs a reboot). Since it’s headless and I don’t have direct access so I’m accessing via ssh, I wanted to get this working so that I wouldn’t have to do any of that.

Here’s my own work-around, pending any changes to inittab and /dev/tty* permissions by the development team. Should work with the extension from the repository just as it did for mine (I didn’t see how the repo version was compiled but I presume it was with screen’s defaults).

After making sure /dev/tty1 was owned by a group $USER (either tc or whatever user= is set to) is in (staff for TCL/MCL, even though I’d prefer a separate group, such as tty, for this — what’s the point in being a “multi-user” system if everything is set up for group staff), I chmod’ed /dev/tty1 to g+rw and I was then able to use /dev/tty1 for screen’s /dev/pts/* (which are owned by $USER.staff while screen is running). This can be done on  the fly or set via /opt/bootlocal.sh so it happens during each subsequent boot. Now screen works and it didn’t require logging out and back in, etc., or making changes to the way {Tiny,Micro}Core boots. Should work similarly if ownership is set to $USER (tc or user= cheatcode, adjust the following accordingly) and then mode set u+rw.

Just add to /opt/bootlocal.sh:

chown root.staff /dev/tty1
chmod g+rw /dev/tty1

or

chown tc.staff /dev/tty1
chmod u+rw /dev/tty1

Note: I’m not too gung ho about having to take additional steps to use an app like this. I also won’t vouch there aren’t any potential security issues arising from my suggestions, especially since Tiny/Micro Core have wide-open sudo privileges and (as I mentioned above) nearly everything is set up so group staff owns so much. If your work/use requires some degree or assurance of security, you might want to consider another distro which has more security features  — including logging (which Tiny and Micro Core don’t have) and more available default groups and less cowboy use of sudo privileges — set up and working by default.

UPDATE: Thanks to maro for yet another way to get around the issue by editing /root/.profile so that /dev/tty1 is chown’ed by $TCUSER.staff. Perhaps the development team will address this so there won’t be any need for remastering or making changes via bootlocal.sh or filetool in the future.

TinyCore/MicroCore tty and GNU screen Fun

March 27, 2010

I mentioned in the second of my desktop posts week before last that I ran into a problem using GNU screen in MicroCore; screen just wouldn’t run on the tty as user tc. I finally had time to report the issue and got a bit of quick feedback with possible workarounds.

I have another one. I just compiled my own version in TinyCore on my AA1 and didn’t have any issues — at least not the way I configured it.

 

I know from packaging screen before (for DSL) that it has a variety of configuration options. One of my preferences is –disable-socket-dir so that screen uses a user (~/.screen) socket directory rather than a system one; the reason I prefer that is because I think processes run by users should be confined to their own directories as much as possible. I don’t know if that would fully resolve the way screen works in relation to how ttys are set up in Tiny/MicroCore since my set up on the AA1 is not standard TinyCore practice: I run with a user= cheatcode, I use a prefix of $HOME/local (which is in my mkshrc PATH), etc. Also, I haven’t completely compared /dev/tty* across versions to see if there are other permission issues/variations involved.

I did note that inittab respawns tty under the user= name (not root) at least in TC 2.2, which was the version I booted from hard drive. I’ll check later after the NCAA tournament using -current from USB, or more likely wait until tomorrow.

crunchbang jwmrc, ratpoison screenshot, terminals, etc.

July 19, 2009

I’ve tried three times to post the #! jwmrc but the XML tags render it unreadable. If anyone wants it, just leave a comment and I’ll e-mail it or post it at a forum or something. I’m not using jwm much right now but I have the full #! menu jwm-ized sans the keybindings. I didn’t bother doing the keybindings after all, or change the colors much, because those are all personal preferences.

I really like the way I have this thing configured right now in ratpoison, with the exceptions of Skype and gimp. Not much I can do about that short of filing bug reports for each: “doesn’t open in single window mode.”

What’s this? I see conky plus trayer across the top, screen opened in the emacs terminal instance with my .ratpoisonrc.

screenshot-20090719092317

I set the wallpaper (12kb with intentionally crappy gradients) using nitrogen to see how bad it would look under terminator and if I could still read my stuff in screen. I’m back to using terminator at least for the time being; font rendering in the version of aterm, especially under screen, I downloaded is fucking hideous so that’s another thing to recompile at some point. I usually use a solid background but I noticed when I set aterm to transparent and had an image for the background that the colors were totally distorted, as if I had the wrong resolution set or something. So now my .Xdefaults has transparency off for aterm. One of the things I really fucking hate about terminator — other than being wrapped in python — is that certain combinations of keystrokes are used to control opening and splitting “tabbed” terminals. I’ve tried tabbed terminals before and don’t understand the need for them when you have better tools like screen available.

Invisible: mocp, conkeror, various files and modes in emacs.

That’s it for now. Time to hit the gym.

Update 20090709 pm – installed crunchbang

July 9, 2009

I did some backups this afternoon and installed crunchbang. I made a few partition changes. One thing I almost regretted off the bat was only setting aside only 5GB for / and now it’s about half full. I have separate partitions for /home and /boot as well; this time I decided to go ahead and set up a really large FAT partition (mount point /windows in Linux, D: in Windows) to share data between operating systems. I transferred my music collection and some documents to the FAT partition and set up links (shortcuts) in Windows so everything is basically just as it was before.

screenshot-0001

I know, I know. That’s a little harder than Vivaldi and Schubert.

I have a few nits to pick. I love the fact #! has some of my favorite apps. I went to use naim and it’s configured to open in GNU screen. Fine, I can live with that. But after it showed that it was starting in screen, I did C-a c to open a new terminal instance within screen. Nothing happened. So I tried again. Then I opened another terminal to check. Sure as shit, screen was running but naim was running separate. WTF?! So I shut down naim, attached to the screen session, and tried to start naim again. It detached screen and started running on its own. I quit naim again and tried starting within screen again using the –no-screen flag, got some error messages, and then naim finally started within the screen session rather than outside it. I’ve used naim and screen so much that I know this shouldn’t be happening. I didn’t spend any time beyond that to see what was happening, but I have the most recent sources and I’ll probably go ahead and recompile it myself so that it functions the way I want it to.

Another thing, #! has a few remaining clues that it once offered xfce. I don’t know if some of those things are there as dependencies of something else. I saw libthunar-vfs* and xfburn (brasero is in the base as well) along with a couple libxfce* things. Could be in use, but I’m going to see what happens when I start de-bloating (heh) it this weekend.

Speaking of which, I went quickly through the list to find things to get rid of after installing emacs22-nox. Here’s the starting point. Maybe openoffice.org will fit when I’m done. 

abiword    
abiword-common   
abiword-help   
abiword-plugin-grammar  
abiword-plugin-mathview  
agave    
claws-mail   
claws-mail-html2-viewer  
claws-mail-i18n   
claws-mail-pgpinline  
claws-mail-pgpmime  
claws-mail-trayicon  
dwm    
dwm-tools   
gnumeric   
gnumeric-common   
gnumeric-doc   
gwibber    
inkscape   
jfsutils   
libgoffice-0-6   
libgoffice-0-6-common  
libgweather-common  
libgweather1   
libpurple-bin   
libpurple0   
libthunar-vfs-1-2  
libxfce4util4   
libxfcegui4-4   
linux-headers-2.6.28-13  
linux-headers-2.6.28-13-generic 
linux-headers-generic  
metacity   
metacity-common   
mutt    
mysql-common   
nano    
ndiswrapper-common  
ndiswrapper-utils-1.9  
nvidia-173-modaliases  
nvidia-180-modaliases  
nvidia-71-modaliases  
nvidia-96-modaliases  
nvidia-common   
pidgin    
pidgin-data   
rhythmbox   
tcl8.4    
thunar-data   
vim    
vim-common   
vim-gtk    
vim-gui-common   
vim-runtime   
vim-tiny   
xfburn    
xfsprogs   

 That’s subject to change — I don’t know what some of these (agave?) are and there may have been something else I overlooked as I quickly edited the list. I’ll leave any of those lynch-pin packages that look like they’ll remove half the system with them. I know I don’t need kernel headers. I love vim and mutt but I’d rather leverage emacs for all I can. I also like dwm but I doubt I’ll use it on my AA1, even though I’ll probably install ratpoison sooner than later.

My impressions over all are really positive. Surprisingly positive. I didn’t have a bunch of stupid icons to delete from either the desktop or the menu. I didn’t have to go find dubious codecs or closed source stuff (Skype, Flash) I want. I had a few services to shut off by default but that’s going to happen with just about any distro anymore.

That’s it for today. It’s bedtime.

Update 20090627

June 27, 2009

I’m still unable to run yet (lingering fatigue from the flu combined with a heat wave) so my early morning hours are filled with catching up with work. Screwing around with Fedora has been an anti-priorirty until this morning (at 4:30 no less).

I think I booted into Linux three times all week (checked last: four times – twice on Monday, once Tuesday, once this morning). Spent most of the week working within Windows playing catch-up. I never installed Firefox under XP on my AA1; I’ve been using IE8 and Opera instead. I finally installed xulrunner and conkeror, though, yesterday. May install conkeror under Fedora, too.

Here’s GNU screen running mplayer (streaming smoothjazz.com), emacs opened with probably two dozen more buffers than I’m using or paying attention to (mostly dired — need to see if I can reuse  the same buffer), w3m opened to my blog, and some chatting. This is all within ratpoison, of course. I got rid of that lxpanel thing.

screenshot-20090627060532

I installed GraphicsMagick instead of imagemagick so my file names are automatically set and everything’s handled with simple keystrokes. I saw that GraphicsMagick did the same things as imagemagick only faster and better with fewer libraries. Not sure how true the claims are but I decided it was worth a try. Only difference I had to adjust to was invoking “gm” before imagemagick command names in my scripts and configuration files (e. g., the aliases and commands I have set up in .ratpoisonrc).

Likely to remove some Gnome bloat sooner than later, but still have some apprehension. I wanted to see where pekwm would fit in comparison to ratpoison and fluxbox. It was much closer to fluxbox so I’ll remove it.

window manager resource use
doesn't include additional/related processes
taken at fresh start
ps aux | grep [window manager name]

lucky13      0.1  0.4  10264  4172 ?        S    04:43   0:00 pekwm
lucky13      1.6  0.4  10808  5068 ?        S    04:46   0:00 fluxbox
lucky13      0.2  0.1   5476  1556 ?        S    04:47   0:00 ratpoison

NOTES
-----
pekwm with default theme
fluxbox theme "green tea" and very small menu
ratpoison with custom .ratpoisonrc

Not doing anything drastic today beyond tweaking .emacs and moving old scripts to the AA1. I’ve considered upgrading the AA1 to Windows 7 when it’s released (October 22). I’d like to see that everything’s working better under Linux than it has thus far, which is why I still have XP installed and why I’m still leaning towards Windows 7. Right now there are too many things keeping me from considering running Linux-only on this: having to boot with an SD card inserted to use the reader, crazy wireless shit that’s happened on multiple occasions now (changing SSIDs and even disabling the wireless card), etc.

One final note about the DSL hard drive PDF I’ve not been able to finish yet. I don’t know if or when I’ll get around to it between catching up from being sick to vacation to the simple fact that DSL is dead and I think there are too many better options for those who want a traditional hard drive install. I thought interest would wane since DSL’s development has come to a screeching halt (last time I checked, John Andrews had posted no updates, roadmaps, polls for what direction users wanted DSL to go, etc.), but every day I’m getting hits from DSL forum links and from Google searches related to DSL hard drive installs. So maybe I’ll finish it anyway. Even though it’s about half finished (I want to add new screenshots and other images to make it as easy as possible) I’d rather spend that time writing a guide for something under active development. Maybe I’ll post my own poll about all that and see if there’s any interest either way.

Fedora 10 on AA1 Update: ratpoison and screen

June 22, 2009

Been setting up ratpoison and screen in Fedora 10 this morning since I can’t run yet. Now all my apps will open full screen when I open them in other window managers. Cool!

Here are some screenshots. First up, I ran into a bit of an issue using aterm for the first time ever. Maybe need to recompile? (UPDATE: Doh! No, it’s all good. I just checked my .Xresources and commented out the geometry line. Works now.)

aterm-FAIL-01

Another app I’ve found to be messed up is zile. I installed it yesterday and the replace-string mode isn’t there (neither are others like list-commands); M-x re[tab to complete] resulted in only one (recenter) match. No problem, I’m probably installing emacs (no X) anyway.

The terminal in these shots is xterm. The blue shit on the bottom of these shots is from the gdm theme. Yet another reason to skip that and use a proper console login.

Here’s a shot of “free -mt” (aliased) at fresh boot.  I don’t have resources trimmed yet nearly as much as I want. I can only imagine how bloated that default gdm theme is. One thing I keep noticing about default backgrounds and themes is that they’re not designed for the lowest common denominator — which really is a disservice to users of older, slower, less-able hardware whom Linux advocates have always targeted.

ratpoison-rocks-on-fedora

Hard to believe I had Gnome trimmed down to a similar level. Need to start with fewer services running! Also need to quit using Gnome apps to do little things like an Ubuntu user would; I love that message, though. Haven’t installed imagemagick yet.

Finally, here’s GNU screen in xterm in ratpoison after starting and running a bunch of other stuff.

screen-fedora-001

As you can see, I’m using mksh as my shell. I was going to install pdksh again but I saw the size of the binaries. Less bloated and more functional than bash either way. Guess I’m also kind of biased because of the BSD thing. Maybe I’ll try MirOS one of these days; not sure it would run on an AA1 (MirOS uses a no SMP kernel, Atom is multi-thread) or how much hardware support it would lack (does it have ath yet?).

Have a bit of mucking around with my wrapper and other scripts since aterm’s not working in ratpoison — using mplayer in terminal to playback audio and video since that’s a bit easier on the system than totem and everything else dressed up in GTK+. Not going to start compiling stuff yet even though I want either ratmen or dmenu; I haven’t even looked to see how headers are packaged in Fedora. I’ll probably set up a text-based menu (see Oct ’08 post “More GNU screen Tweaks”) instead before I do anything else.

UPDATE 06:16 US/Central – Installed emacs (nox) and removed zile. Already changed my scripts to use xterm so I’m probably removing aterm and libafterstep and whatever else was installed with it.

emacs-installed-01

Had to manually link emacs-22.3-nox to emacs. My mplayer wrapper also now opens PLS streams in screen.

More Debian AA1 Tweaking, A Lot More To Do

June 14, 2009

Just had a little time to screw around with this fresh Debian Lenny install on the AA1.

I adjusted the volume levels and can record and playback decent audio. However, there are some serious problems with video — I can playback from the webcam in mplayer but anything else I’ve tried to record reports back that /dev/video0 can’t be used (except by cheese). That can wait until I try to install Skype. No Skype, no Debian. So webcam could be a deal breaker. The Debian wiki says it works out of the box, lucky says bullshit.

Speaking of BS, I tried to remove cheese but aptitude wanted to remove all of Gnome desktop along with it. I may take it up on that sooner or later.

And while I’m on the subject of desktops, I installed Xfce and jwm. Only made a few tweaks to the jwmrc to keep the apps in the task tray from taking up all that space and replacing xload with wicd and replacing the window manager name with $HOSTNAME. I’ll keep an eye on wicd and see how much of a drain that is on the system. I can live without it. I’ll tweak the interface later with smaller fonts and change things around to suit my tastes. For now, it’s almost default jwm:

jwm-in-debian

I also installed aterm since it doesn’t have any goofy settings to override like the Xfce terminal and Gnome terminal.I installed GNU screen and zile (might install emacs). You can see I installed mksh, too. RAM use is high because I’ve been running a ton of stuff including synaptic.

Still a lot of stuff to tweak on this. Never enough time. More when I get a chance.

Update: Rebooted after I moved the tray to the top (where it belongs). Here’s a better idea of how much RAM this is eating up at boot. First free is before networking was started, second is after wireless was connected.

jwm-reboot-pre-post-net

That’s with cups, bluetooth, IPv6, etc., so I’m hoping to get that a bit lower at some point.

Added Smaller Window Managers on Aspire One

March 21, 2009

Continuing to configure PCLOS on my AA1, still some hardware issues to iron out. Still trying to reduce system overhead. Had one total lock up earlier when trying to get the card readers to work; also failed to successfully recover from suspending last night. Way to go, Team Linux. Wankers.

Oh yeah, I also found a newer toy of mine that will not work under Linux. I’ll have a separate post about that tomorrow or Monday. It’s a Windows world, baby. Get over it.

Tired of hardware issues — thankfully, XP works fine — so I’m moving on  to less serious things. I really like KDE but I think it’s a bit much. PCLOS doesn’t have much besides KDE, Gnome, Xfce, fluxbox, windowmaker, and OpenBox in their repositories. Gotta take matters in my own hands. I installed X lib headers. Compiled jwm, dwm, ratpoison. Added kdm desktop session files for each. Need to make jwm menu and add some of my old tweaks. Running ratpoison now. Freaking COOL — ratpoison on an Aspire One with its puny keyboard:

screen-20090321173903

Also compiled emacs, naim, and tmux (BSD-licensed alternative for GNU screen) from source. I have to say tmux is more than a BSD-licensed alternative to screen — it seems to better execute the whole multiplexing concept and it’s a lot smaller.

I’m using pdksh from the repositories (because I saw it listed). Default terminal in ratpoison is Eterm (also from repositories). What else? Dillo from the repositories is going to be replaced by dillo from source and patch for tabs.

I mentioned my aggravation at the way this was configured via the automatic set up and that I could end up doing something drastic. I’m not going to add much more since I have the things I want and need (OpenOfffice.org, mplayer for multimedia, browsers, etc.), and I’m probably going to start removing a bunch of stuff in the interim. Longer term, I’m leaning towards a much leaner install of Slackware or NetBSD. That will have to wait at least another week. Just not enough time to deal with it now.

Edit20090322: Just have a minute to update this. I ditched Eterm for aterm, recompiled ratpoison accordingly (it allows compile-time setting of default X terminal). Here’s a shot of a tmux session and a ratpoison window listing.

screenshot-200903220738351

One of the cool things about tmux is that it automatically updates its bottom title bar with the current process’ names. So I could stop top in the fourth (3) instance and its title would change back to ksh.

I compiled elinks unstable branch yesterday. I’ll probably revert to stable sometime this coming week.

BTW, I really hate the wallpaper (five minutes wasted in GIMP) and that font sucks. I’ll install terminus when I get a chance. No time now.

More GNU screen Tweaks

October 7, 2008

I had a little time yesterday afternoon at lunch and last night while watching MNF to work on a few things I’ve had on the back burner. In a nutshell, I’ve wanted to further tie things together in screen with some kind of menuing. GNU screen allows users to set up keybindings to launch new apps in addition to using an escape sequence (ctrl-a : [command]) to launch things.

I wanted to go a step further because I wanted “dynamic” menus that can be easily edited and customized as well as menus that are more oriented towards data than applications. The former is easy enough: just implement a script and modify it as needed. The latter can be as simple or complex as desired. I’m practical, so I went the simple route.

Let me qualify this by saying I know it’s not fancy, it lacks eye candy, and that there are plenty of ways to skin this cat. I’ll also admit my primary impetus for this was a desire to get my streaming audio (pls files) in a list from which I could choose for streaming (and streamripping) without typing “mplayer -playlist path/to/streams/type[tab]” etc. — not the highest priority in my life, but something I’ve wanted for a while. I didn’t want to bother with setting up databases, I didn’t want some WHILE bullshit polling the system to scan for any new files to add to the database, and I wanted to stick with shell scripts without getting into window dressing like dialog. Just get a quick list of what’s available when I select a menu entry and play it in a new screen pseudo-terminal. Easy, no nonsense, little drain on system resources, fast, efficient. In other words, screw amarok and whatever is gnome’s bloat-du-jour.

I wrote a main menu for screen that solves the first issue. I can fill it to my heart’s content with custom commands (it’s sparse now) and use it to call other menus (as I’ve done temporarily until I finish my multimedia script which is now in separate pieces). Note that this was written ksh-specific and may need adjustments in bash or other shells.

—-


#!/bin/sh
# lucky13linux.wordpress.com - Mon Oct  6 21:36:57 CDT 2008

# menu for running apps in screen
# also calls other scripts from $HOME/bin

print 'select application to open '
PS3='app: '

select application in \
	'snownews' \
	'gmail' \
	'mc' \
	'aim' \
	'pork' \
	'epic4' \
	'calcurse' \
	'podcasts' \
	'streams' \
	'playlists' 

do

case $REPLY in
 	 1 ) RUN_THIS="snownews -u" ;;
 	 2 ) RUN_THIS="elinks https://gmail.com" ;;
 	 3 ) RUN_THIS="mc" ;;
 	 4 ) RUN_THIS="naim" ;;
 	 5 ) RUN_THIS="pork" ;;
 	 6 ) RUN_THIS="epic" ;;
 	 7 ) RUN_THIS="calcurse" ;;
 	 8 ) RUN_THIS="$HOME/bin/mypodcasts.sh" ;;
 	 9 ) RUN_THIS="$HOME/bin/myplaylists.sh" ;;
	10 ) RUN_THIS="$HOME/bin/mym3u.sh" ;;
esac

if [[ -n $application ]]; then
	screen -t $application $RUN_THIS
	break
fi
else print "invalid response... try again"
done

—-

This gives me my basic menu and frees keybindings in my .screenrc (which has gotten a little meiotic lately and difficult to remember sometimes without hitting “ctrl-a ?” for help; or typing “alias” periodically to remember all my little shortcuts). The menu is bound to one of the keybindings freed up (ctrl-a e) so it can be launched at will, and it terminates when the new terminal opens with the selection (which means I don’t have a ton of stuff to close and check and everything). The launched instances also tidy themselves up when finished, making “window” management in screen more automatic. In short, it acts a little bit more like a window manager than a terminal multiplexer. Kind of.

My original goal of being able to reduce work/typing to play audio was benefited by my organization of directories, but it’s flexible enough that it can be adapted to less organized files. I try to keep files of the same type in one nested directory. So, as you can see in the next script, my audio is all in one directory and broken down according to podcasts, streams, and songs by genre and artist. Well, you can’t see all that in this particular script. What you can see is that I just had to define one directory and search it for the relevant files. That allows SELECT to format the results in columns of the individual stream files rather than in one column with full paths, allowing more to show up on one page. If you only have a few files, no problem. I have over 40 (and I haven’t copied over the other ones from my other hard drive or backups yet).

—-


#!/bin/sh
# lucky13linux.wordpress.com - Mon Oct  6 13:30:46 CDT 2008  

# this script is ksh-oriented but may work for other shells
# and can be linked to a keybinding in screen to open a menu.

STREAMDIR="$HOME/audio/streams/"

print 'Select stream to play: '
PS3='stream? '
select STREAMFILE in $(ls $STREAMDIR | grep -i pls | sort); do
	if [[ -n $STREAMFILE  ]]; then
		mplayer -playlist $STREAMDIR$STREAMFILE
		break
	else
		print '*** invalid, try again...'
	fi
done

—-

Note that I don’t open this one in yet another screen pseudo-terminal but leave it in the one in which it opens. I initially did but some things open too fast or too slow and the screen numbering order would get wonky.

As I wrote above, I’m probably going to aggregate my multimedia scripts into one script at some point. I wanted to see how many keybindings I would need to do each thing separately. Answer: way too many.

NOTE: This post may be edited for formatting later. I’ll also try to add some screenshots to it later today.

EDITED – Thu Oct 16 2008: corrected part of the if loop in the script for the screenmenu above. I now have more entries in mine and have added additional menus for various things to further customize my system. Additionally, I’ve rebound the w key in screen (ctrl-a w) to open the navigable list of terminals in screen (which is bound by default to ctrl-a “). This still allows for use of ctrl-a-ctrl-w for the same thing the default binding of ctrl-a-w does while making it a little easier to navigate through terminals.

—-


made with: VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Oct  5 2008 12:03:46)
and the vimpress plugin

OpenBSD 4.3 GENERIC#0 i386