How to make Unity launcher change colour over time ?
Asked
Active
Viewed 117 times
1 Answers
2
Intruduction
The script bellow loops over hex values of colors incrementally. It can be started at login or can be ran manually when one wishes so
Getting the Script
One can copy the source code from this post directly or through github using the following steps:
sudo apt-get install git
cd /opt ; sudo git clone https://github.com/SergKolo/sergrep.git
sudo chmod -R +x sergrep
The script file will be /opt/sergrep/unity_launcher_rainbow.sh
To make the script start automatically on every login, refer to How do I start applications automatically on login? . Provide /opt/sergrep/unity_launcher_rainbow.sh
(full path) as the command
Script Source
#!/usr/bin/env bash
#
###########################################################
# Author: Serg Kolo , contact: 1047481448@qq.com
# Date: March 20,2016
# Purpose: Color changer script for Ubuntu Unity launcher
# Written for:
# Tested on: Ubuntu 14.04
###########################################################
# Copyright: Serg Kolo , 2016
#
# Permission to use, copy, modify, and distribute this software is hereby granted
# without fee, provided that the copyright notice above and this permission statement
# appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
ARGV0="$0"
ARGC=$#
main()
{
renice -n 10 $$ > /dev/null
num=0;
while true
do
set_unity_launcher_color $(printf '%6.6xff' $num)
num=$(($num+510))
if [ $num -eq 16777215 ]
then num=0
fi
sleep 0.05
done
}
set_unity_launcher_color()
{
schema="org.compiz.unityshell" # relocatable schema
path="/org/compiz/profiles/unity/plugins/unityshell/" #must end with /
key="background-color"
hex_string=$1
gsettings set "$schema":"$path" "$key" "'#$hex_string'"
}
main

Sergiy Kolodyazhnyy
- 105,154
- 20
- 279
- 497
cron
daemon to run it periodically. – Danibix Apr 09 '16 at 20:54sleep 0.05
to make it loop reasonably fast. You have a good idea, though :) – Sergiy Kolodyazhnyy Apr 09 '16 at 21:02