I love a quote. Now I want every time my computer starts, the quote to be on the screen, like a welcome note.Is there any way to do that in ubuntu 13.04?
You could pop up a simple zenity dialog on login with the content of your quote.
Put the following code into a script then add that script to your "Startup Applications"
zenity --info --text=$quote --title="A Quote"
fortune-mod package (
sudo apt-get install fortune-mod) then you can integrate the
fortune command into your script like this:
zenity --info --text="$(fortune literature)" --title="A Quote" --no-wrap
You can just add that command to your Startup Applications without putting it in a script.
literature option is used to specify that you want a quote specifically, otherwise it will give you jokes, riddles and other 'fortunes'.
Note: some of the fortunes are quite long, use
--text="$(fortune -s literature)" instead of
--text="$(fortune literature)" in the command above to print short quotes only.
Fortune also has many different options to customize the type of quotes you'll get (literature, riddles, etc.) See the fortune man page for more information. To use those options, just change
fortune in the command above to
If you want to fancy things up (like show a transparent quote on your wallpaper, type in some reminders etc...):
- Open terminal by pressing Ctrl+Alt+T
- Go to "Edit > Profiles > New".
- Give it a name (eg, "quote_of_the_day") and click Create.
- Click Edit, go to the colors tab and uncheck "use colors from ...".
- Select a text color which will be visible on your desktop wallpaper.
- Go to background tab and select Transparent Background and set it to None.
- Under Scrolling tab choose "Scrollbar is: Disabled".
- You can change font and size from general tab.
- Here you may also change columns and rows to about 50 and 5 respectively.
- Go to Title and Command and choose keep initial title from the combo box.
Now you've made a terminal profile for the quotes display.
Next we will make a compiz setting to put it in our desktop background and remove those shadows and decorations.
- Open Compiz Config by typing in terminal
ccsm(assuming you have it installed)
- Click Window Rules and do the following:
- Click Place Windows and do the following:
- Note: the 600 x and 100 y positions should be changed according to your screen resolution. (this puts it somewhere in the top right corner)
- Go to Window Decoration and do the following:
Now copy and paste the below script in to gedit and save it as quote_script.py
import commands from time import sleep import random quotefile = "/home/user/Documents/.../quotes.txt" interval = 10 with open(quotefile,'rb') as data: quotes = data.readlines() print "\x1b[?25l"+random.choice(quotes)[:-1] sleep(interval) exit()
Change quotefile and interval to suit your file location and quote display time.
Go to startup applications by typing in terminal : gnome-session-properties. Add a new one by clicking add and type in:
gnome-terminal --window-with-profile=quote_of_the_day -e "python /home/user/Documents/.../quote_script.py"
Show random quotes at login
That's it! You may try logging out and in again to see the result.
- Experiment with terminal column and row values; Position values, interval, font colors etc. Remember to put quotes in quotes.txt file line by line.
Let say that you have all your quotes in one file called
quotes.txt (each quote on one line) saved somewhere, let say in
~/Documents. Then, using terminal you can do:
Create a new file/script
mkdir -p ~/bin #this command will make a bin directory in your home folder if you don't already have it gedit ~/bin/greetings.sh
If you want to get a desktop notification, put next 2 lines inside:
#!/bin/bash quotes="$HOME/Documents/quotes.txt" random_line=$(shuf -i 1-$(wc -l < $quotes) -n 1) quote=$(sed -n -e "$random_line"p $quotes) notify-send "Quote of the day" "$quote"
Alternatively, if you want a popup (message box) to show up, use
zenity --info --title "Quote of the day" --text "$quote"
Save the file and close it.
Make the file exacutable:
chmod +x ~/bin/greetings.sh
Search in Dash for Startup Applications, open it and click Add.
- Under name type "Show my name and date" or something you will recognise.
- Under command type:
$USERwith your user name).
- Under comment (if you want), type a brief description.
Multiple answers here, none was simple enough for me.
I ended up installing Variety, which can nicely write random quotes on wallpapers for different sources, in my case from a local file.