LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 04-17-2015, 05:08 AM   #1
McSinyx
LQ Newbie
 
Registered: Jul 2014
Location: Hanoi, Vietnam
Distribution: Debian
Posts: 12

Rep: Reputation: Disabled
Need a command output active gtk2 theme to a shell variable


Hi guys,

Like the title said, I need it for my script.

Thanks for checking me out.
McSinyx
 
Old 04-17-2015, 11:59 AM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,883
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
I don't know gtk2 much at all. Is there a file which contains your theme? You could grep that file, filter the output and channel that to an environment variable.
 
Old 04-19-2015, 03:38 AM   #3
McSinyx
LQ Newbie
 
Registered: Jul 2014
Location: Hanoi, Vietnam
Distribution: Debian
Posts: 12

Original Poster
Rep: Reputation: Disabled
Oh hey, sorry if I ain't made it clear. When I said 'active gtk2 theme' I actually meaned 'active gtk2 theme name'.

I'm making a xfwm theme and having troule with gtk color picking up, so I need to get the color manually. That's why I need to know What is the name of the active gtk2 theme to find it's gtkrc to get the color.
 
Old 04-19-2015, 06:03 AM   #4
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
it is just like rtmistler said.
on my system:
Code:
export MYTHEME="$( grep gtk-theme $GTK2_RC_FILES | cut -d '"' -f 2)"
the theme folder's name and the theme's name don't always match, but this gives you the actual theme's name.

if you actually need the folder, um, more tricky.

i suggest you check out gtk2 documentation. it's very dry and dev-oriented.

edit:
try "env" or "printenv", maybe you don't have to reinvent the wheel.

Last edited by ondoho; 04-19-2015 at 06:07 AM.
 
  


Reply



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
Output a C variable with a shell command paliga Programming 4 07-20-2010 06:10 AM
shell script: saving output from command into a variable grcunning Linux - Newbie 7 01-26-2010 11:43 AM
Write output or command to variable (shell) kernel_geek Programming 9 03-12-2007 04:45 AM
shell scipting: append output of a command to a variable jonhewer Linux - Newbie 10 08-24-2005 05:42 AM
Assigning the output of one command to a variable (shell) guru_stew Programming 5 08-03-2003 06:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 11:45 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
Open Source Consulting | Domain Registration