Find the answer to your Linux question:
Results 1 to 2 of 2
So, I was thinking one day, "Hmm, if there is going to be eyecandy in a distro, it should be cool." What's more cool than a titlebar that fades colors? ...
  1. #1
    Linux User Agent-X's Avatar
    Join Date
    May 2005
    Location
    Dimension X
    Posts
    261

    How could this script be improved?

    So, I was thinking one day, "Hmm, if there is going to be eyecandy in a distro, it should be cool."

    What's more cool than a titlebar that fades colors?
    This would be for GNOME

    color-script.sh

    Code:
    #!/bin/sh
    gconftool-2 -t string -s /desktop/gnome/interface/gtk_color_scheme "fg_color:#000000000000
    bg_color:#eaeae8e8e3e3
    text_color:#000000000000
    base_color:#ffffffffffff
    selected_fg_color:#ffffffffffff
    selected_bg_color:#ffff00000f42"
    sleep 3
    gconftool-2 -t string -s /desktop/gnome/interface/gtk_color_scheme "fg_color:#000000000000
    bg_color:#eaeae8e8e3e3
    text_color:#000000000000
    base_color:#ffffffffffff
    selected_fg_color:#ffffffffffff
    selected_bg_color:#ffff00007611"
    sleep 3
    gconftool-2 -t string -s /desktop/gnome/interface/gtk_color_scheme "fg_color:#000000000000
    bg_color:#eaeae8e8e3e3
    text_color:#000000000000
    base_color:#ffffffffffff
    selected_fg_color:#ffffffffffff
    selected_bg_color:#ffff0000ce93"
    bash $HOME/color-script.sh
    It seems like a good idea, but it keeps taking over the xserver, or perhaps it's just lagging the system. It seems like an awesome idea, but I don't have to look at the same system colors, and they would fluctuate, which would be awesome. I tried doing this, but as said, it was laggy. I recently noticed that the terminal window used to execute the script gets smaller, too, as the colors change. That's weird. I don't know why it's doing that. Maybe some of you could suggest ideas to make this better.

  2. #2
    Trusted Penguin Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,230
    First off, you should use an infinite loop instead of a recursive script. I don't know if Bash optimizes tail recursion, but it any event, your script is more suited to an infinite loop. This basically means:
    Code:
    #!/bin/sh
    
    while 0; do
        gconftool-2 -t string -s /desktop/gnome/interface/gtk_color_scheme "fg_color:#000000000000
        bg_color:#eaeae8e8e3e3
        text_color:#000000000000
        base_color:#ffffffffffff
        selected_fg_color:#ffffffffffff
        selected_bg_color:#ffff00000f42"
        sleep 3
        gconftool-2 -t string -s /desktop/gnome/interface/gtk_color_scheme "fg_color:#000000000000
        bg_color:#eaeae8e8e3e3
        text_color:#000000000000
        base_color:#ffffffffffff
        selected_fg_color:#ffffffffffff
        selected_bg_color:#ffff00007611"
        sleep 3
        gconftool-2 -t string -s /desktop/gnome/interface/gtk_color_scheme "fg_color:#000000000000
        bg_color:#eaeae8e8e3e3
        text_color:#000000000000
        base_color:#ffffffffffff
        selected_fg_color:#ffffffffffff
        selected_bg_color:#ffff0000ce93"
    done
    Also, since only one of your variables actually changes, you would be better off having an array of possible selected_bg_color values and using a counter variable to cycle through them. This makes it easier to add new colors, and means that you only have to change the code once when it changes, as opposed to 3 times.
    DISTRO=Arch
    Registered Linux User #388732

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...