Fortune
来自Ubuntu中文
跳到导航跳到搜索
Fortunoid is a Plasma Widget that serves as a frontend GUI for the fortune package.
Installing the Fortunoid widget package by
sudo apt-get install plasma-widget-fortunoid
will also install the fortune package. If only the fortune package is desired (which can be run in a command-line terminal), it can be installed by itself:
sudo apt-get install fortune
The fortune module can be customized.
- The quotations themselves are stored in the /usr/share/games/fortunes folders.
- There are multiple categories of quotations, and the file for each category can be edited directly.
- When using the command-line, categories of quotations can be selected merely by specifying them. Example:
fortune zippy science
- There are many options for the command-line fortune utility (see here). Any or all of these command-line options can be entered as an argument in the Fortunoid widget.
Adding categories of fortunes (fortune modules)
- See this list of the original fortune modules (categories).
- Other modules can often be found by a Google search for fortune-mod.
- Wikiquotes is an online repository for quotations. A webpage can easily be copied to a text file, for conversion into a fortune data file (see below). An example page is Wikiquotes -- Zen proverbs.
- See this brief tutorial.
- Make sure fortune-mod is installed:
sudo apt-get install fortune-mod
- Change to the fortune directory:
cd /usr/share/games/fortunes
- Edit a category text file with quotations separated by % symbols:
I reject your reality and substitute my own... % This is one of those "What the hell am I doing?" moments, over! % We got a robot in the water, he's stuffed with tuna and it's just another day here at Mythbusters.
For example, save this text file as newcategory1.
- There is also a UTF-8 file which is merely a symbolic link to the text file:
sudo ln -s newcategory1 newcategory1.u8
- Convert the text file into a data file for use by fortune.
sudo strfile newcategory1 newcategory1.dat
- Select newcategory1 as a command-line option or as an argument in Fortunoid.