LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-18-2010, 03:57 PM   #1
QueenZ
Member
 
Registered: Sep 2008
Distribution: openSUSE, Ubuntu
Posts: 372
Blog Entries: 2

Rep: Reputation: 32
How to load a GTK 2.x theme with a command line or shell script?


I would like to know how i can load a gtk theme with a terminal command line or with a shell script if possible.

Thanks!
 
Old 07-18-2010, 04:18 PM   #2
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: Slackware
Posts: 7,623

Rep: Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948
Code:
ln -sf /path/to/theme/gtk-2.0/gtkrc ~/.gtkrc-2.0
 
Old 07-18-2010, 04:32 PM   #3
arizonagroovejet
Senior Member
 
Registered: Jun 2005
Location: England
Distribution: openSUSE, Fedora, CentOS
Posts: 1,093

Rep: Reputation: 197Reputation: 197
I'd go with this:

Code:
gconftool-2 --set /desktop/gnome/interface/gtk_theme --type string 'Clearlooks Brave Dark'

To find gconf keys for other stuff like the icon theme open gconf-editor and look under desktop > gnome > interface
 
Old 07-18-2010, 04:44 PM   #4
QueenZ
Member
 
Registered: Sep 2008
Distribution: openSUSE, Ubuntu
Posts: 372
Blog Entries: 2

Original Poster
Rep: Reputation: 32
arizonagroovejet, that means i have to have GNOME installed to use gconftool...

I didn't quite understood dugan's method.. doesn't that just install the theme?? not apply it.
 
Old 07-18-2010, 04:47 PM   #5
arizonagroovejet
Senior Member
 
Registered: Jun 2005
Location: England
Distribution: openSUSE, Fedora, CentOS
Posts: 1,093

Rep: Reputation: 197Reputation: 197
I assumed you were using GNOME and that by 'load a gtk theme' you meant set it as your current theme in GNOME. Evidently I was wrong.

What do you mean by 'load a gtk theme'?

I don't understand dugan's suggestion either.
 
Old 07-18-2010, 04:48 PM   #6
QueenZ
Member
 
Registered: Sep 2008
Distribution: openSUSE, Ubuntu
Posts: 372
Blog Entries: 2

Original Poster
Rep: Reputation: 32
i tried ln -sf /usr/share/themes/Clearlooks/gtk-2.0/gtkrc ~/.gtkrc-2.0 it didn't apply it
 
Old 07-18-2010, 04:50 PM   #7
QueenZ
Member
 
Registered: Sep 2008
Distribution: openSUSE, Ubuntu
Posts: 372
Blog Entries: 2

Original Poster
Rep: Reputation: 32
arizonagroovejet, there are other desktop environments out there that use GTK toolkit not just GNOME... so i need something that would work for all of them..
 
Old 07-18-2010, 04:57 PM   #8
arizonagroovejet
Senior Member
 
Registered: Jun 2005
Location: England
Distribution: openSUSE, Fedora, CentOS
Posts: 1,093

Rep: Reputation: 197Reputation: 197
So you're looking for a single command that will change the theme in any desktop environment that uses GTK? If so I think you're looking for something that doesn't exist. GNOME uses gnome-settings-daemon to change the theme currently in use. Other desktop environments will use something else.


Now I think about it I'm guessing dugan's suggestion might work if you log out and in again, but I've not tried.
 
Old 07-18-2010, 05:01 PM   #9
QueenZ
Member
 
Registered: Sep 2008
Distribution: openSUSE, Ubuntu
Posts: 372
Blog Entries: 2

Original Poster
Rep: Reputation: 32
hmm... i guess... by the way, when i change the theme like you described, the gtk theme changed except for the window borders (try it). why is that and how can i change them too?
 
Old 07-18-2010, 05:05 PM   #10
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: Slackware
Posts: 7,623

Rep: Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948
Quote:
Originally Posted by QueenZ View Post
I didn't quite understood dugan's method.. doesn't that just install the theme?? not apply it.
It applies the theme to all applications started afterwards.

It certainly does not install the theme.

Quote:
Originally Posted by QueenZ View Post
arizonagroovejet, there are other desktop environments out there that use GTK toolkit not just GNOME... so i need something that would work for all of them..
Use a GTK theme switcher then. gtk-chtheme and LXAppearance are both good ones.

Last edited by dugan; 07-18-2010 at 05:07 PM.
 
Old 07-18-2010, 05:09 PM   #11
QueenZ
Member
 
Registered: Sep 2008
Distribution: openSUSE, Ubuntu
Posts: 372
Blog Entries: 2

Original Poster
Rep: Reputation: 32
thanks for the clarifications dugan. gtk-chtheme sounds good.

did i use that command right?

Quote:
ln -sf /usr/share/themes/Clearlooks/gtk-2.0/gtkrc ~/.gtkrc-2.

Last edited by QueenZ; 07-18-2010 at 05:10 PM.
 
Old 07-18-2010, 05:12 PM   #12
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: Slackware
Posts: 7,623

Rep: Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948Reputation: 2948
Code:
ln -sf /path/to/theme/gtk-2.0/gtkrc ~/.gtkrc-2.0
Code:
ln -sf /usr/share/themes/Clearlooks/gtk-2.0/gtkrc ~/.gtkrc-2.
No, the trailing zero is important.

EDIT: A much more foolproof method would be to create a ~/.gtkrc-2.0 file with the following contents:

Code:
include "/path/to/theme/gtk-2.0/gtkrc"
When you start with the gtk theme switchers, you'll find that they work by doing a variation on the above.

Last edited by dugan; 07-18-2010 at 05:27 PM.
 
1 members found this post helpful.
Old 08-06-2010, 08:53 AM   #13
QueenZ
Member
 
Registered: Sep 2008
Distribution: openSUSE, Ubuntu
Posts: 372
Blog Entries: 2

Original Poster
Rep: Reputation: 32
ok, i tried doing this dugan but it didn't work... i did as you said and now my gtkrc-2.0 file contains this

Quote:
include "/usr/share/themes/Clearlooks/gtk-2.0/gtkrc"
but my theme has not changed. and applications that i start afterwards are still in the old theme. i tried logging out and back in and still Clearlooks is not my theme even if my gtkrc-2.0 file says so..

Quote:
queenz@martin-lucid:~$ ls -al
-rw-r--r-- 1 queenz queenz 53 2010-08-06 15:43 .gtkrc-2.0
I also made sure that /usr/share/themes/Clearlooks/gtk-2.0/gtkrc exists and it does but my theme is not changed still...

Please try it yourself and tell me if it works for you..

What am i doing wrong?

Last edited by QueenZ; 08-06-2010 at 08:54 AM.
 
Old 08-06-2010, 09:07 AM   #14
QueenZ
Member
 
Registered: Sep 2008
Distribution: openSUSE, Ubuntu
Posts: 372
Blog Entries: 2

Original Poster
Rep: Reputation: 32
EDIT: It worked on my new Ubuntu which was just installed, i will see why it didn't work on my old ubuntu which has been used for some good time..
 
Old 08-06-2010, 09:14 AM   #15
QueenZ
Member
 
Registered: Sep 2008
Distribution: openSUSE, Ubuntu
Posts: 372
Blog Entries: 2

Original Poster
Rep: Reputation: 32
Oh i see what's happening, GNOME is forcing it's own theme on it and gtkrc-2.0 says another theme so it's like this GNOME tries to apply Ambiance and gtkrc-2.0 tries to apply Clearlooks lol...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to pass command-line parameter to shell script? Kropotkin Linux - Newbie 12 07-25-2011 10:24 AM
shell script read line from file, use it in command DiGiGoth Programming 5 08-31-2008 12:08 PM
command or shell script to print line range from file minil Programming 3 12-28-2005 09:05 AM
How to execute a command line in a shell script orgazmo Programming 5 05-09-2005 10:16 AM
Shell Script to read 500files from the command line saravanan1979 Programming 1 09-22-2004 10:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration