TIP torsmo
From Gentoo Linux Wiki
- This page is a candidate for deletion
- Reason given: Torsmo is not under development anymore, use Conky instead
- If you disagree with its deletion, please explain why on its discussion page.
- If you intend to fix it, please remove this notice, but do not remove this notice from articles that you have created yourself.
- Make sure no other pages link here and check the page's history before deleting.
Contents |
[edit] Use Conky
Torsmo is unmaintained, and it's recommended that you use Conky instead, it's based on torsmo but has a lot more features. A lot of things which required external scripts with torsmo are built-in to Conky. There is also an Conky article on this wiki, similar to this one. More information about conky is available at http://conky.sf.net/
[edit] Mail clients and protocols
If you use mutt, use mbox formats, you must add, past the TEXT, this to your ~/.torsmorc:
| File: ~/.torsmorc |
${execi 60 touch ~/mail/inbox}
|
where ~/mail/inbox is your default mail box, otherwise, the mail count will not be updated correctly. (for some reason, mutt does not update the access time, even when you read messages, so you need to do its yourself if you want torsmo to pick up that somethings changed)
if you use IMAP for email, and therefore do not download messages, you can check your mail with torsmo like this: create a script ~/.torsmo_imap in your home directory and put the following in it:
| File: ~/.torsmo_imap |
#!/bin/sh status=`fetchmail -c` total=$(echo "$status" | grep -o "^[0-9]*" - ) seen=$(echo "$status" | sed "s/^[0-9]*[^0-9]*\([0-9]*\).*/\1/") new=$(( $total - $seen )) echo -n $new "/" $total |
change it to be executable:
chmod 775 ~/.torsmo_imap
then set in your ~/.torsmorc, after the TEXT:
| File: ~/.torsmorc |
${execi 180 ~/.torsmo_imap}
|
Or a simpler version, using awk:
| File: ~/.torsmo_imap |
#!/bin/bash
fetchmail -c|grep message \
|awk -F'[ ()]' '{print substr($10,0,length($10)-1) ": " $1 " message" (($1 > 1)?"s":"") " - " $1 - $4 " unread"}'
# Resulting in something like:
# server.tld: 4 messages - 2 unread
|
also, if you do not use fetchmail for any other purpose, you can use the following to check your mail: download the following files: mailchck.py mailchck.conf you must have python installed (and on gentoo, who wouldnt) also, you need perl for the password encryption, so an emerge perl should set you up. then make the python script executable:
chmod 775 mailchck.py
and also, making them hidden might clean up your home directory:
mv mailchck.py .mailchck.py mv mailchck.conf .mailchck.conf
then you have to configure them:
vim .mailchck.conf
the comments are pretty self explanatory, format is host,protocol,user,password,location then just add this to your ~/.torsmorc:
| File: ~/.torsmorc |
${execi 180 ~/.mailchck.py}
|
(of course, if you want it to check it more or less often then 3 minutes, change 180 to some other value, in seconds) special thanks to Adrian Frei, aka Shai'tan, for this script.
Another imap email checking script, this time using ruby and 2 libraries that are included in ruby by default:
| File: checkimap.rb |
#! /usr/bin/env ruby
# by Ardanwen
require "net/imap"
require "base64"
imap = Net::IMAP.new("imapserverhere")
imap.login("username",Base64.decode64("obfuscatedpasswordhere"))
imap.select("inbox")
value = imap.search(["NOT","SEEN"])
if value.empty? == false
printf "#{value.nitems} new mail!"
else
printf "No new mail"
end
imap.disconnect
|
In order to generate an obfuscated version of your password, paste the following line into a console, edit checkimap to contain your obfuscated password and then save and chmod +x it.
ruby -e "require 'base64';puts Base64.encode64('yourpasswordhere')"
Finally, add ${execi 180 checkimap.rb} to the TEXT part of .torsmorc, just like in the python script.
[edit] Adding additional features
[edit] Percentage of used space
if you built torsmo from the cvs ebuild above, you already have some special features, such as: a percent for the used percent of a disk (to match the used bar) envoked with ${fs_used /}
[edit] Bar for the free space
a bar for the free space on the disk envoked with ${fs_bar}
[edit] Display your IP address
you can also get torsmo to display your ip address (this is the address that your computer thinks it has, so if you are inside a NAT, this will be the local address). put this into a script called ~/.torsmo_ip
| File: ~/.torsmo_ip |
#!/bin/sh
/sbin/ifconfig | awk '/P-t-P/ { split($2, x, /:/); print x[2]; exit; }'
|
- change it to be executable: chmod 775 ~/.torsmo_ip
- and make sure to change P-t-P to the identifier that /sbin/ifconfig gives,
P-t-P is for dialup, for networkcards the file will look like this:
| File: ~/.torsmo_ip |
#!/bin/sh
/sbin/ifconfig eth0 | awk '/inet addr/ { split($2, x, /:/); print x[2]; exit; }'
|
then, in your ~/.torsmorc, after the TEXT, put the following:
| File: ~/.torsmorc |
ip: ${execi 180 ~/.torsmo_ip}
|
[edit] Display wireless link quality
Another handy thing you can use torsmo for is to get updates on the quality of your wifi link to your access point. This is done by calling iwconfig from a script called ~/.torsmo_wifi
| File: ~/.torsmo_wifi |
#!/bin/bash /usr/sbin/iwconfig ath0 | grep Link | sed 's/^[ \t]*//;s/[ \t]*$//' # if the above doesn't work for you, try this (I guess it has something to do with the new baselayout): #/usr/sbin/iwconfig ath0 | sed 's/ /\n/g' |grep Quality|sed 's/Quality=//g' |
where ath0 is the name of your wifi card -- other typical names are wlan0 or eth0. Also remember to make it executable using chmod 775 ~/.torsmo_wifi
Finally, in your ~/.torsmorc, put the following:
| File: ~/.torsmorc |
Link: ${exec ~/.torsmo_wifi}
|
[edit] Who is logged
here is a handy tip if you are running an SSH server and like to keep tabs on whos logged on at any given time: put the following stuff into a script named ~/.torsmo_users
| File: ~/.torsmo_users |
#!/bin/sh
who | awk '{print $1}' | uniq -c | wc -l
|
- make it an executable: chmod 775 ~/.torsmo_users
then, in your ~/.torsmorc, after TEXT, search for a nice place to display the current number of logged-in users:
| File: ~/.torsmorc |
Current users: ${execi 8 ~/.torsmo_users}
|
(where the execi 8 command is less resource intensive)
thanks to moritz (www.4momo.de) aka superuser (on gentoo forums) for this tip/script
[edit] Creative color hacks
this was a question asked by a person on gentoo forums:
- can i get torsmo to have a background color?
- the easy answer is no, the better answer is yes, but it will be awfully fake.
What you do:
open up your background image with the gimp:
gimp-2.0 /path/to/background.jpg
and then draw a box in the gimp, fill it with a color, and make it transparent. make sure you put the box in the same place as torsmo draws itself to the root window. then set your background, and it will look very realistically like you have background color for torsmo.
take a look full size image here to see what it looks like
[edit] List of patches and howto apply
this section is naturally deprecated, as if you follow part 1 with the ebuild, its not necesary. however, the patches for both the stable (0.17) and cvs are online, for historical purposes. i will try to keep this page updated with more info: http://www.sover.net/~ljohnstn/
[edit] Credits
- Gentoo Forums topic that is dedicated to information about torsmo, developing patches.
- From the Author: if i update this, ill update it on the tutorial i wrote originally, which was what this is based on. because of this, things may be slightly behind on the wiki (here) if your paranoid, and feeling lucky, check the original tutorial (sorry, text only, i dont have much time on my hands) at torsmo faq and maybe ill have added something --daniel
- Name: Daniel Patterson AKA killfire Email: dbpatterson _at_ exeter _dot_ edu

