Showing posts with label Mint. Show all posts
Showing posts with label Mint. Show all posts

More fortunes for Mint

If you like to see some funny quotes when opening a new shell terminal, you can enable the fortune-mint script that will be launched automatically.
By default, this script only shows non-offensive quotes and only three different types of animals: the moose, the tux and the koala.
But the cowsay package provides a whole bunch of pictures that can be used.
Cow files in /usr/share/cowsay/cows:
apt beavis.zen bong bud-frogs bunny calvin cheese cock cower daemon default
dragon dragon-and-cow duck elephant elephant-in-snake eyes flaming-sheep
ghostbusters gnu head-in hellokitty kiss kitty koala kosh luke-koala
mech-and-cow meow milk moofasa moose mutilated pony pony-smaller ren sheep
skeleton snowman sodomized-sheep stegosaurus stimpy suse three-eyes turkey
turtle tux unipony unipony-smaller vader vader-koala www

The following patch will enable all these that you have installed in your system, as well as all different eye and tongue styles. If you don't like offensive quotes, you'll have to take off the -a parameter from the fortune command in the last line of the patch below.

Install instructions

Paste the following into a textfile, for example mint-fortune.patch
4c4
<     RANGE=3
---
>     declare -a cows=( $(cowsay -l | grep -v "Cow files in") )
6,17c6,7
<     let "number %= $RANGE"
<     case $number in
<         0)
<             cow="moose"
<             ;;
<         1)
<             cow="tux"
<             ;;
<         2)
<             cow="koala"
<             ;; 
<     esac
---
>     let "number %= ${#cows[*]}"
>     cow=${cows[$number]}
19c9
<     RANGE=2
---
>     declare -a says=( say think )
21,30c11,19
<     let "number %= $RANGE"
<     case $number in
<         0)
<             command="/usr/games/cowsay"
<             ;;
<         1)
<             command="/usr/games/cowthink"
<             ;;
<     esac
<     /usr/games/fortune | $command -f $cow
---
>     let "number %= ${#says[*]}"
>     command="/usr/games/cow${says[$number]}"
> 
>     declare -a states=( "" -b -d -g -p -s -t -w -y )
>     number=$RANDOM
>     let "number %= ${#states[*]}"
>     state=${states[$number]}
> 
>     /usr/games/fortune -a | $command $state -f $cow

Then apply this patch to the original script (a backup will be created) and enable the fortune-teller:
sudo patch -b /usr/bin/mint-fortune mint-fortune.patch
gconftool-2 --set /desktop/linuxmint/terminal/show_fortunes true --type bool

Provide your own cows

You can create your own cow files, just have a look at the manual of the cowsay command. Or just copy the ones I prepared from here into any folder you want.
You could just copy them into the system folder /usr/share/cowsay/cows, but if you want to keep them separated, you can instruct cowsay to look for you ones too (for example in your folder ~/Documents/cows:
mycows=~/Documents/cows ; sudo sed -i.orig 's|/usr/bin/mint-fortune|export COWPATH=/usr/share/cowsay/cows:'$mycows'\n\0|' /etc/bash.bashrc

Example of a Star Wars scene as cow

 _____________
< Hello world >
 -------------
          \
           \                .==.
            \              ()oo()-.
             \  .---.       ;--; /
              .'_:___". _..'.  __'.
              |__ --==|'-''' \'...;
              [  ]  :[|       |---\
              |__| I=[|     .'    '.
              / / ____|     :       '._
             |-/.____.'      | :       :
            /___\ /___\      '-'._----' 

Change LibreOffice progress bar color

Newest LibreOffice splash screen shows a orange-redish colour bar instead of a green one like it was some versions ago. I guess they changed it to integrate better with Unity default colours. But I'm using Linux Mint, so I liked the green one more. The other day, I just stumbled about the /etc/libreoffice/sofficerc configuration file, which defines some variables for the startup and there it is, the ProgressBarColor parameter.

Install instructions

The following instructions change the color from the shell command line, but you could also just edit the file with your favourite text editor (with root permissions).
# Put the color value into a variable
pbcolor=160,195,124

sudo sed -r -i.bak "s/(ProgressBarColor=)[0-9]{1,3},[0-9]{1,3},[0-9]{1,3}/\1${pbcolor}/" /etc/libreoffice/sofficerc

# Check that everything went fine (otherwise you can restore the backup file).
cat /etc/libreoffice/sofficerc
You can find the right colors for example with the Gimp image editor.

Mint Update Manager does not show Changelogs

If you are using Linux Mint, you might have noticed that the latest versions ship with an Update Manager that is able only to show you Changelogs of the packages from the Mint repositories and often they are cut off.

After searching through bug reports and forums finally I prepared a change of the underlying Python code which resolves the issue.

I hope they will integrate similar changes in the next version.

For more details you can have a look at these bug reports, where I got ideas and copied parts:

Install instructions

You can download the needed difference file from here, or just copy and paste the following into a file named mintUpdate.py.diff:
87c87,91
<                 changelog = source
---
>                 changes = source.split("\n")
>                 for change in changes:
>                     change = change.strip()
>                     if change.startswith("*"):
>                         changelog = changelog + change + "\n"
93c97,101
<                     changelog = source
---
>                     changes = source.split("\n")
>                     for change in changes:
>                         change = change.strip()
>                         if change.startswith("*"):
>                             changelog = changelog + change + "\n"
98,102c106,111
<                 source = commands.getstatusoutput("apt-get changelog " + self.source_package) 
<                 if source[0] != 0 or source[1].startswith("Err Changelog of"):
<                     changelog = _("No changelog available") + "\n" + _("Click on Edit->Software Sources and tick the 'Source code' option to enable access to the changelogs")
<                 else:
<                     changelog = source[1]
---
>                 source = commands.getoutput("aptitude changelog " + self.source_package)                    
>                 changes = source.split("urgency=")[1].split("\n")
>                 for change in changes:
>                     change = change.strip()
>                     if change.startswith("*"):
>                         changelog = changelog + change + "\n"
Then you can apply the patch with this command, it will leave a copy of the original script:
sudo patch -lb /usr/lib/linuxmint/mintUpdate/mintUpdate.py mintUpdate.py.diff
It has been created and checked with version 4.3.8.