[solved] mint-fortune in Mint 12

Forum rules
Before you post please read how to get help

[solved] mint-fortune in Mint 12

Postby gammelsmurf1 on Sat Dec 03, 2011 1:47 pm

The thing is I couldn't see the nit-wit fortunes when I opened a terminal.
After a little search on How-To, I changed a bit in mint-fortune bash script
Code: Select all
sudo gedit /usr/bin/mint-fortune

And commented out the control function, whether you wished the fortunes or not.
Code: Select all
if [ -x "/usr/bin/gconftool-2" ]; then
    #showfortunes=`gconftool-2 --get /desktop/linuxmint/terminal/show_fortunes 2>/dev/null`
    #if [ "$showfortunes" == "true" ]; then       
        show_fortune
    #fi
fi

And now i've got 'Husse' giving me some nice fortune cookies when I open Terminal. :)

Now the question: How to make this work like it supposed to, i.e in Gconf/mintDesktop configuration?
Last edited by gammelsmurf1 on Mon Dec 05, 2011 10:06 am, edited 1 time in total.
User avatar
gammelsmurf1
Level 1
Level 1
 
Posts: 35
Joined: Thu Aug 25, 2011 5:43 am
Location: Sverige

Linux Mint is funded by ads and donations.
 

Re: mint-fortune in Mint 12

Postby Oscar799 on Sat Dec 03, 2011 2:05 pm

I did it with gconf editor
desktop>linuxmint>terminal make sure the box to the right of "show_fortunes",directly under "value" is checked
Image
"Don't fix it if it ain't broken,don't break it if you can't fix it" Husse
Registered Linux User #511789
User avatar
Oscar799
Level 18
Level 18
 
Posts: 8941
Joined: Tue Aug 11, 2009 9:21 am
Location: United Kingdom

Re: mint-fortune in Mint 12

Postby gammelsmurf1 on Sat Dec 03, 2011 2:43 pm

So it would seem, but now I can't revert.
And it looks like it's 'mateconf' editor and not gconf editor that's installed.
Attachments
MateConf.png
MateConf.png (59.23 KiB) Viewed 1189 times
User avatar
gammelsmurf1
Level 1
Level 1
 
Posts: 35
Joined: Thu Aug 25, 2011 5:43 am
Location: Sverige

Re: mint-fortune in Mint 12

Postby Oscar799 on Sat Dec 03, 2011 2:45 pm

Looks like you need to get a check mark into that box under "Varde"
Image
"Don't fix it if it ain't broken,don't break it if you can't fix it" Husse
Registered Linux User #511789
User avatar
Oscar799
Level 18
Level 18
 
Posts: 8941
Joined: Tue Aug 11, 2009 9:21 am
Location: United Kingdom

Re: mint-fortune in Mint 12

Postby gammelsmurf1 on Sat Dec 03, 2011 2:55 pm

Oscar799 wrote:Looks like you need to get a check mark into that box under "Varde"

Ooh, i've got it to work when changed in the mint-fortune bash script.
So...
Fortunes is showin up despite both gconf and mateconf gives me false value

Code: Select all
/ "That is the magic sudo command. So put \
| sudo in front of the command and it'll  |
| work."                                  |
|                                         |
\ Husse Jul 20 2007                       /
 -----------------------------------------
  \
   \   \_\_    _/_/
    \      \__/
           (oo)\_______
           (__)\       )\/\
               ||----w |
               ||     ||
~ $ mateconftool-2 -g /desktop/linuxmint/terminal/show_fortunes
false

~ $ gconftool-2 -g /desktop/linuxmint/terminal/show_fortunes
false
User avatar
gammelsmurf1
Level 1
Level 1
 
Posts: 35
Joined: Thu Aug 25, 2011 5:43 am
Location: Sverige

Re: mint-fortune in Mint 12

Postby Oscar799 on Sun Dec 04, 2011 1:31 pm

Someone mentioned this on another thread

Menu>Other>DesktopSettings>Terminal there is a checkbox for "Show Fortunes" there....
Image
"Don't fix it if it ain't broken,don't break it if you can't fix it" Husse
Registered Linux User #511789
User avatar
Oscar799
Level 18
Level 18
 
Posts: 8941
Joined: Tue Aug 11, 2009 9:21 am
Location: United Kingdom

Re: mint-fortune in Mint 12

Postby gammelsmurf1 on Mon Dec 05, 2011 10:05 am

Well, thx for all your effort but I managed to fix it in a different way. The issue here was that a simple blank and a couple of " " was making the default script for mint-fortune non-aware if the checkbox was ticked or not. So if anyone has the same issue, I make my version available here:

Code: Select all
#!/bin/bash

function show_fortune {
    RANGE=4
    number=$RANDOM
    let "number %= $RANGE"
    case $number in
        0)
            cow="moose"
            ;;
        1)
            cow="tux"
            ;;
        2)
            cow="koala"
            ;;   
   3)
       cow="bunny"
       ;;   
    esac

    RANGE=2
    number=$RANDOM
    let "number %= $RANGE"
    case $number in
        0)
            command="/usr/games/cowsay"
            ;;
        1)
            command="/usr/games/cowthink"
            ;;
    esac
    /usr/games/fortune | $command -f $cow
}

if [ -x "/usr/bin/mateconftool-2" ]; then

    SHOWFORTUNES=$(mateconftool-2 --get /desktop/linuxmint/terminal/show_fortunes) 2> /dev/null
#echo "$SHOWFORTUNES"

    if [ $SHOWFORTUNES == "true" ]; then
   show_fortune
   #else
   #fortune
    fi
fi

And be aware that the checkbox in Menu>Other>DesktopSettings>Terminal change the value in `mateconftool-2` and not `gconftool-2`, at least in my system.

It took some time, trial and error, but in the end I know a lot more about BASH and scripting, so that's a good thing.

I change this as solved...
User avatar
gammelsmurf1
Level 1
Level 1
 
Posts: 35
Joined: Thu Aug 25, 2011 5:43 am
Location: Sverige

Linux Mint is funded by ads and donations.
 

Return to Scripts & Bash

Who is online

Users browsing this forum: No registered users and 2 guests