特殊:Badtitle/NS100:Torsmo:修订间差异
小 新页面: {{From|https://help.ubuntu.com/community/Torsmo}} {{Languages|UbuntuHelp:Torsmo}} === Install Package === First we have to install the package: <pre><nowiki> apt-get install torsmo </now... |
小无编辑摘要 |
||
第2行: | 第2行: | ||
{{Languages|UbuntuHelp:Torsmo}} | {{Languages|UbuntuHelp:Torsmo}} | ||
=== Install Package === | === Install Package === | ||
First we have to install the package: | First we have to install the package: | ||
<pre><nowiki> | <pre><nowiki> | ||
apt-get install torsmo | apt-get install torsmo | ||
</nowiki></pre> | </nowiki></pre> | ||
=== Make Configuration File === | === Make Configuration File === | ||
Move to user directory, unzip the example and rename it: | Move to user directory, unzip the example and rename it: | ||
<pre><nowiki> | <pre><nowiki> | ||
第20行: | 第17行: | ||
torsmo | torsmo | ||
</nowiki></pre> | </nowiki></pre> | ||
=== Display your ip-address === | === Display your ip-address === | ||
You can get torsmo to display your ip-address. Put this into a script called ~/.torsmo_ip | You can get torsmo to display your ip-address. Put this into a script called ~/.torsmo_ip | ||
File: ~/.torsmo_ip | File: ~/.torsmo_ip | ||
<pre><nowiki> | <pre><nowiki> | ||
第37行: | 第30行: | ||
And make sure to change "P-t-P" to the identifier that /sbin/ifconfig gives, | And make sure to change "P-t-P" to the identifier that /sbin/ifconfig gives, | ||
"P-t-P" is for dialup, "inet addr" for networkcards. So the file will look like this: | "P-t-P" is for dialup, "inet addr" for networkcards. So the file will look like this: | ||
File: ~/.tormo_ip | File: ~/.tormo_ip | ||
<pre><nowiki> | <pre><nowiki> | ||
第45行: | 第37行: | ||
Where "eth0" is the networkcard of which you want to display the ip-address. | Where "eth0" is the networkcard of which you want to display the ip-address. | ||
Then, in your ~/.torsmorc, after the TEXT, put the following: | Then, in your ~/.torsmorc, after the TEXT, put the following: | ||
File: ~/.torsmorc | File: ~/.torsmorc | ||
<pre><nowiki> | <pre><nowiki> | ||
ip: ${execi 180 ~/.torsmo_ip} | ip: ${execi 180 ~/.torsmo_ip} | ||
</nowiki></pre> | </nowiki></pre> | ||
=== Weather Display === | === Weather Display === | ||
Local weather condition can also be displayed. Write a script named tweather.sh: | Local weather condition can also be displayed. Write a script named tweather.sh: | ||
File: ~/tweather.sh | File: ~/tweather.sh | ||
<pre><nowiki> | <pre><nowiki> | ||
第62行: | 第50行: | ||
file=/tmp/weather.txt | file=/tmp/weather.txt | ||
location=http://weather.yahoo.com/forecast/$link | location=http://weather.yahoo.com/forecast/$link | ||
lynx -accept_all_cookies -dump $location > $file | lynx -accept_all_cookies -dump $location > $file | ||
begin=`cat -n $file | grep "Currently" | cut -d ' ' -f5` | begin=`cat -n $file | grep "Currently" | cut -d ' ' -f5` | ||
end=`expr $begin + 40` | end=`expr $begin + 40` | ||
head -n $end $file > tmp.t | head -n $end $file > tmp.t | ||
tail -n 41 tmp.t > $file | tail -n 41 tmp.t > $file | ||
case $1 in | case $1 in | ||
Today) head -n 6 $file | sed '3d' ;; | Today) head -n 6 $file | sed '3d' ;; | ||
第77行: | 第62行: | ||
num=`expr $end - $begin - 1` | num=`expr $end - $begin - 1` | ||
end2=`expr $begin + 7` | end2=`expr $begin + 7` | ||
head -n $end2 $file > tmp.t | head -n $end2 $file > tmp.t | ||
tail -n 3 tmp.t | sed 's/sky/\n sky/' | sed '4d' ;; | tail -n 3 tmp.t | sed 's/sky/\n sky/' | sed '4d' ;; | ||
*) exit ;; | |||
esac | esac | ||
rm tmp.t | rm tmp.t | ||
rm $file | rm $file | ||
第88行: | 第71行: | ||
And place this, somewhere below TEXT in your .torsmorc | And place this, somewhere below TEXT in your .torsmorc | ||
<pre><nowiki> | <pre><nowiki> | ||
${color grey}Weather: | ${color grey}Weather: | ||
$color${execi 1800 /home/username/tweather.sh Today} | $color${execi 1800 /home/username/tweather.sh Today} | ||
第95行: | 第77行: | ||
</nowiki></pre> | </nowiki></pre> | ||
"city" can be renamed to your city. Look at the weather condition of your city at weather.yahoo.com, take the last part of the link and put it in the script after "link". | "city" can be renamed to your city. Look at the weather condition of your city at weather.yahoo.com, take the last part of the link and put it in the script after "link". | ||
Note: Make sure "lynx" is installed. | Note: Make sure "lynx" is installed. | ||
<pre><nowiki> | <pre><nowiki> | ||
apt-get install lynx | apt-get install lynx | ||
</nowiki></pre> | </nowiki></pre> | ||
=== Logged-in Users === | === Logged-in Users === | ||
Here is a script if you are running an SSH server and like to keep tabs on whos logged on at any given time. | Here is a script if you are running an SSH server and like to keep tabs on whos logged on at any given time. | ||
Put the following code into a script named ~/.torsmo_users: | Put the following code into a script named ~/.torsmo_users: | ||
File: ~/.torsmo_users | File: ~/.torsmo_users | ||
<pre><nowiki> | <pre><nowiki> | ||
第115行: | 第91行: | ||
Make it an executable: | Make it an executable: | ||
<pre><nowiki> | <pre><nowiki> | ||
chmod 775 ~/.torsmo_users | chmod 775 ~/.torsmo_users | ||
</nowiki></pre> | </nowiki></pre> | ||
Then, in your ~/.torsmorc, after TEXT, search for a nice place to display the current number of logged-in users: | Then, in your ~/.torsmorc, after TEXT, search for a nice place to display the current number of logged-in users: | ||
File: ~/.torsmorc | File: ~/.torsmorc | ||
<pre><nowiki> | <pre><nowiki> | ||
Current users: ${execi 8 ~/.torsmo_users} | Current users: ${execi 8 ~/.torsmo_users} | ||
</nowiki></pre> | </nowiki></pre> | ||
=== KNOWN PROBLEMS === | === KNOWN PROBLEMS === | ||
Taken from the http://torsmo.sourceforge.net/ site of the writers of this program: | Taken from the http://torsmo.sourceforge.net/ site of the writers of this program: | ||
"Drawing to root or some other desktop window directly doesn't work with all window managers. Especially doesn't work well with Gnome and it has been reported that it doesn't work with KDE either. Nautilus can be disabled from drawing to desktop with program gconf-editor. Uncheck show_desktop in /apps/nautilus/preferences/. There is -w switch in torsmo to set some specific window id. You might find xwininfo -tree useful to find the window to draw to. You can also use -o argument which makes torsmo to create its own window." | "Drawing to root or some other desktop window directly doesn't work with all window managers. Especially doesn't work well with Gnome and it has been reported that it doesn't work with KDE either. Nautilus can be disabled from drawing to desktop with program gconf-editor. Uncheck show_desktop in /apps/nautilus/preferences/. There is -w switch in torsmo to set some specific window id. You might find xwininfo -tree useful to find the window to draw to. You can also use -o argument which makes torsmo to create its own window." | ||
What I did, to make it work well, is: | What I did, to make it work well, is: | ||
Uncheck the show_desktop in /apps/nautilus/preferences/ | Uncheck the show_desktop in /apps/nautilus/preferences/ | ||
第142行: | 第112行: | ||
</nowiki></pre> | </nowiki></pre> | ||
This is my [http://www.ju87.nl/torsmo/.torsmorc .torsmorc] | This is my [http://www.ju87.nl/torsmo/.torsmorc .torsmorc] | ||
[[category:CategoryDocumentation]] | [[category:CategoryDocumentation]] | ||
[[category:UbuntuHelp]] | [[category:UbuntuHelp]] |
2007年11月30日 (五) 21:46的版本
文章出处: |
{{#if: | {{{2}}} | https://help.ubuntu.com/community/Torsmo }} |
点击翻译: |
English {{#ifexist: {{#if: UbuntuHelp:Torsmo | UbuntuHelp:Torsmo | {{#if: | :}}Torsmo}}/af | • {{#if: UbuntuHelp:Torsmo|Afrikaans| [[::Torsmo/af|Afrikaans]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Torsmo | UbuntuHelp:Torsmo | {{#if: | :}}Torsmo}}/ar | • {{#if: UbuntuHelp:Torsmo|العربية| [[::Torsmo/ar|العربية]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Torsmo | UbuntuHelp:Torsmo | {{#if: | :}}Torsmo}}/az | • {{#if: UbuntuHelp:Torsmo|azərbaycanca| [[::Torsmo/az|azərbaycanca]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Torsmo | UbuntuHelp:Torsmo | {{#if: | :}}Torsmo}}/bcc | • {{#if: UbuntuHelp:Torsmo|جهلسری بلوچی| [[::Torsmo/bcc|جهلسری بلوچی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Torsmo | UbuntuHelp:Torsmo | {{#if: | :}}Torsmo}}/bg | • {{#if: UbuntuHelp:Torsmo|български| [[::Torsmo/bg|български]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Torsmo | UbuntuHelp:Torsmo | {{#if: | :}}Torsmo}}/br | • {{#if: UbuntuHelp:Torsmo|brezhoneg| [[::Torsmo/br|brezhoneg]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Torsmo | UbuntuHelp:Torsmo | {{#if: | :}}Torsmo}}/ca | • {{#if: UbuntuHelp:Torsmo|català| [[::Torsmo/ca|català]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Torsmo | UbuntuHelp:Torsmo | {{#if: | :}}Torsmo}}/cs | • {{#if: UbuntuHelp:Torsmo|čeština| [[::Torsmo/cs|čeština]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Torsmo | UbuntuHelp:Torsmo | {{#if: | :}}Torsmo}}/de | • {{#if: UbuntuHelp:Torsmo|Deutsch| [[::Torsmo/de|Deutsch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Torsmo | UbuntuHelp:Torsmo | {{#if: | :}}Torsmo}}/el | • {{#if: UbuntuHelp:Torsmo|Ελληνικά| [[::Torsmo/el|Ελληνικά]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Torsmo | UbuntuHelp:Torsmo | {{#if: | :}}Torsmo}}/es | • {{#if: UbuntuHelp:Torsmo|español| [[::Torsmo/es|español]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Torsmo | UbuntuHelp:Torsmo | {{#if: | :}}Torsmo}}/fa | • {{#if: UbuntuHelp:Torsmo|فارسی| [[::Torsmo/fa|فارسی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Torsmo | UbuntuHelp:Torsmo | {{#if: | :}}Torsmo}}/fi | • {{#if: UbuntuHelp:Torsmo|suomi| [[::Torsmo/fi|suomi]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Torsmo | UbuntuHelp:Torsmo | {{#if: | :}}Torsmo}}/fr | • {{#if: UbuntuHelp:Torsmo|français| [[::Torsmo/fr|français]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Torsmo | UbuntuHelp:Torsmo | {{#if: | :}}Torsmo}}/gu | • {{#if: UbuntuHelp:Torsmo|ગુજરાતી| [[::Torsmo/gu|ગુજરાતી]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Torsmo | UbuntuHelp:Torsmo | {{#if: | :}}Torsmo}}/he | • {{#if: UbuntuHelp:Torsmo|עברית| [[::Torsmo/he|עברית]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Torsmo | UbuntuHelp:Torsmo | {{#if: | :}}Torsmo}}/hu | • {{#if: UbuntuHelp:Torsmo|magyar| [[::Torsmo/hu|magyar]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Torsmo | UbuntuHelp:Torsmo | {{#if: | :}}Torsmo}}/id | • {{#if: UbuntuHelp:Torsmo|Bahasa Indonesia| [[::Torsmo/id|Bahasa Indonesia]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Torsmo | UbuntuHelp:Torsmo | {{#if: | :}}Torsmo}}/it | • {{#if: UbuntuHelp:Torsmo|italiano| [[::Torsmo/it|italiano]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Torsmo | UbuntuHelp:Torsmo | {{#if: | :}}Torsmo}}/ja | • {{#if: UbuntuHelp:Torsmo|日本語| [[::Torsmo/ja|日本語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Torsmo | UbuntuHelp:Torsmo | {{#if: | :}}Torsmo}}/ko | • {{#if: UbuntuHelp:Torsmo|한국어| [[::Torsmo/ko|한국어]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Torsmo | UbuntuHelp:Torsmo | {{#if: | :}}Torsmo}}/ksh | • {{#if: UbuntuHelp:Torsmo|Ripoarisch| [[::Torsmo/ksh|Ripoarisch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Torsmo | UbuntuHelp:Torsmo | {{#if: | :}}Torsmo}}/mr | • {{#if: UbuntuHelp:Torsmo|मराठी| [[::Torsmo/mr|मराठी]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Torsmo | UbuntuHelp:Torsmo | {{#if: | :}}Torsmo}}/ms | • {{#if: UbuntuHelp:Torsmo|Bahasa Melayu| [[::Torsmo/ms|Bahasa Melayu]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Torsmo | UbuntuHelp:Torsmo | {{#if: | :}}Torsmo}}/nl | • {{#if: UbuntuHelp:Torsmo|Nederlands| [[::Torsmo/nl|Nederlands]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Torsmo | UbuntuHelp:Torsmo | {{#if: | :}}Torsmo}}/no | • {{#if: UbuntuHelp:Torsmo|norsk| [[::Torsmo/no|norsk]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Torsmo | UbuntuHelp:Torsmo | {{#if: | :}}Torsmo}}/oc | • {{#if: UbuntuHelp:Torsmo|occitan| [[::Torsmo/oc|occitan]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Torsmo | UbuntuHelp:Torsmo | {{#if: | :}}Torsmo}}/pl | • {{#if: UbuntuHelp:Torsmo|polski| [[::Torsmo/pl|polski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Torsmo | UbuntuHelp:Torsmo | {{#if: | :}}Torsmo}}/pt | • {{#if: UbuntuHelp:Torsmo|português| [[::Torsmo/pt|português]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Torsmo | UbuntuHelp:Torsmo | {{#if: | :}}Torsmo}}/ro | • {{#if: UbuntuHelp:Torsmo|română| [[::Torsmo/ro|română]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Torsmo | UbuntuHelp:Torsmo | {{#if: | :}}Torsmo}}/ru | • {{#if: UbuntuHelp:Torsmo|русский| [[::Torsmo/ru|русский]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Torsmo | UbuntuHelp:Torsmo | {{#if: | :}}Torsmo}}/si | • {{#if: UbuntuHelp:Torsmo|සිංහල| [[::Torsmo/si|සිංහල]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Torsmo | UbuntuHelp:Torsmo | {{#if: | :}}Torsmo}}/sq | • {{#if: UbuntuHelp:Torsmo|shqip| [[::Torsmo/sq|shqip]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Torsmo | UbuntuHelp:Torsmo | {{#if: | :}}Torsmo}}/sr | • {{#if: UbuntuHelp:Torsmo|српски / srpski| [[::Torsmo/sr|српски / srpski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Torsmo | UbuntuHelp:Torsmo | {{#if: | :}}Torsmo}}/sv | • {{#if: UbuntuHelp:Torsmo|svenska| [[::Torsmo/sv|svenska]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Torsmo | UbuntuHelp:Torsmo | {{#if: | :}}Torsmo}}/th | • {{#if: UbuntuHelp:Torsmo|ไทย| [[::Torsmo/th|ไทย]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Torsmo | UbuntuHelp:Torsmo | {{#if: | :}}Torsmo}}/tr | • {{#if: UbuntuHelp:Torsmo|Türkçe| [[::Torsmo/tr|Türkçe]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Torsmo | UbuntuHelp:Torsmo | {{#if: | :}}Torsmo}}/vi | • {{#if: UbuntuHelp:Torsmo|Tiếng Việt| [[::Torsmo/vi|Tiếng Việt]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Torsmo | UbuntuHelp:Torsmo | {{#if: | :}}Torsmo}}/yue | • {{#if: UbuntuHelp:Torsmo|粵語| [[::Torsmo/yue|粵語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Torsmo | UbuntuHelp:Torsmo | {{#if: | :}}Torsmo}}/zh | • {{#if: UbuntuHelp:Torsmo|中文| [[::Torsmo/zh|中文]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Torsmo | UbuntuHelp:Torsmo | {{#if: | :}}Torsmo}}/zh-hans | • {{#if: UbuntuHelp:Torsmo|中文(简体)| [[::Torsmo/zh-hans|中文(简体)]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Torsmo | UbuntuHelp:Torsmo | {{#if: | :}}Torsmo}}/zh-hant | • {{#if: UbuntuHelp:Torsmo|中文(繁體)| [[::Torsmo/zh-hant|中文(繁體)]]}}|}} |
{{#ifeq:UbuntuHelp:Torsmo|:Torsmo|请不要直接编辑翻译本页,本页将定期与来源同步。}} |
{{#ifexist: :Torsmo/zh | | {{#ifexist: Torsmo/zh | | {{#ifeq: {{#titleparts:Torsmo|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:Torsmo|1|-1|}} | zh | | }}
Install Package
First we have to install the package:
apt-get install torsmo
Make Configuration File
Move to user directory, unzip the example and rename it:
cp /usr/share/doc/torsmo/examples/torsmorc.example.gz ~/ gunzip torsmorc.example.gz mv torsmorc.example.gz .torsmorc
As user you are able to start torsmo by typing:
torsmo
Display your ip-address
You can get torsmo to display your ip-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, "inet addr" for networkcards. So the file will look like this: File: ~/.tormo_ip
#!/bin/sh /sbin/ifconfig eth0 | awk '/inet addr/ { split($2, x, /:/); print x[2]; exit; }'
Where "eth0" is the networkcard of which you want to display the ip-address. Then, in your ~/.torsmorc, after the TEXT, put the following: File: ~/.torsmorc
ip: ${execi 180 ~/.torsmo_ip}
Weather Display
Local weather condition can also be displayed. Write a script named tweather.sh: File: ~/tweather.sh
#!/bin/bash city="Rotterdam" link=NLXX0015_c.html?force_units=1 file=/tmp/weather.txt location=http://weather.yahoo.com/forecast/$link lynx -accept_all_cookies -dump $location > $file begin=`cat -n $file | grep "Currently" | cut -d ' ' -f5` end=`expr $begin + 40` head -n $end $file > tmp.t tail -n 41 tmp.t > $file case $1 in Today) head -n 6 $file | sed '3d' ;; Tomorrow) begin=`cat -n $file | grep 'Today Tomorrow' | cut -d ' ' -f5` end=`cat -n $file | grep 'Extended' | cut -d ' ' -f5` num=`expr $end - $begin - 1` end2=`expr $begin + 7` head -n $end2 $file > tmp.t tail -n 3 tmp.t | sed 's/sky/\n sky/' | sed '4d' ;; *) exit ;; esac rm tmp.t rm $file
And place this, somewhere below TEXT in your .torsmorc
${color grey}Weather: $color${execi 1800 /home/username/tweather.sh Today} $color Tomorrow: $color${execi 1800 /home/username/tweather.sh Tomorrow}
"city" can be renamed to your city. Look at the weather condition of your city at weather.yahoo.com, take the last part of the link and put it in the script after "link". Note: Make sure "lynx" is installed.
apt-get install lynx
Logged-in Users
Here is a script if you are running an SSH server and like to keep tabs on whos logged on at any given time. Put the following code 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}
KNOWN PROBLEMS
Taken from the http://torsmo.sourceforge.net/ site of the writers of this program: "Drawing to root or some other desktop window directly doesn't work with all window managers. Especially doesn't work well with Gnome and it has been reported that it doesn't work with KDE either. Nautilus can be disabled from drawing to desktop with program gconf-editor. Uncheck show_desktop in /apps/nautilus/preferences/. There is -w switch in torsmo to set some specific window id. You might find xwininfo -tree useful to find the window to draw to. You can also use -o argument which makes torsmo to create its own window." What I did, to make it work well, is: Uncheck the show_desktop in /apps/nautilus/preferences/
Menu Bar: Applications > System Tools > Configuration Editor
Start Torsmo when I log in:
Menu Bar: System > Preferences > Sessions Go to the "Startup Programs"-tab > Add > Startup Command: torsmo
This is my .torsmorc