Reply
Thread Tools
Posts: 5 | Thanked: 0 times | Joined on Jan 2013 @ UK; http://stackoverflow.com/users/737641/a12jun
#1
Hi all, this is my first post on these forums but by no means my first visit! I shall start with a quick introduction so please skip ahead to the question if you so wish.
I'm a graduate software engineer based in the UK, and I acquired my N9 just over a year ago as I was fascinated by the openness of the system and was excited about the possibilities of developing for it. I have been keeping an eye on the forums here just to keep atop of the latest developments and I genuinely enjoy seeing the community support for this device. I'm now looking to develop some simple apps.

* Intro over *

I want to write a simple script which toggles the Colour Profile value between the three options. I'm not sure where to begin but I would like to find out for myself how to do it. I'm assuming that to start off I need to write the toggle script, make it executable and then run it from the UI. If someone could point me in the right direction I can take it from there.

Thanks
 
Posts: 49 | Thanked: 93 times | Joined on Jan 2012 @ Finland
#2
Hi! You can change the colour profiles through a GConf key. Here how it goes:

Code:
gconftool-2 --set --type=string /system/osso/dsm/display/color_profile Muted

gconftool-2 --set --type=string /system/osso/dsm/display/color_profile Neutral

gconftool-2 --set --type=string /system/osso/dsm/display/color_profile Vivid
In addition, you may want to create a shell script (SH) file and implement some kind of toggling logic there, which changes to the next profile each time the script is executed or so. Furthermore, by creating a desktop file (plus your icon file), you can create a launcher icon that is calling your script and toggling the profile.

The following is a simplified example that just sets the colour profile to Muted. It's not doing any toggling and calls gconftool directly instead of calling some smarter script file. Also it uses the system icon of Settings application instead of an own icon file.

The file, let's say named color-profile.desktop, should be created to directory /usr/share/applications/ as a root user.

Code:
[Desktop Entry]
Name=Color Profile
Icon=icon-l-settings
Exec=gconftool-2 --set --type=string /system/osso/dsm/display/color_profile Muted
Type=Application
So now you can implement your idea with some smarter logic!
 

The Following 2 Users Say Thank You to Kallela For This Useful Post:
Posts: 5 | Thanked: 0 times | Joined on Jan 2013 @ UK; http://stackoverflow.com/users/737641/a12jun
#3
Great, thank you. I will try to put something together, but in the meantime could I ask a couple of questions:
  • What is gconftool-2, and how would you know that this is the program you need to use to edit the profile?
  • in the line:
    Code:
    gconftool-2 --set --type=string /system/osso/dsm/display/color_profile Muted
    - what does the "string [......]" do? Is 'string' some sort of operator?

Many thanks

Last edited by a12jun; 2013-01-11 at 13:38.
 
Community Council | Posts: 4,920 | Thanked: 12,867 times | Joined on May 2012 @ Southerrn Finland
#4
Well, gconftool (and it's variants) is a common configuration utility for the gnome environment.
try googling for it
 
Posts: 5 | Thanked: 0 times | Joined on Jan 2013 @ UK; http://stackoverflow.com/users/737641/a12jun
#5
Originally Posted by juiceme View Post
Well, gconftool (and it's variants) is a common configuration utility for the gnome environment.
try googling for it
Yeah I did after I posted the reply! Seems I have a lot to learn But how would I fin out the name of the key to use if I didn't already know it? Is there some way that I can switch on a process monitor log, run the command through the UI, then switch the log off and inspect it to find what was altered?
 
Moderator | Posts: 6,215 | Thanked: 6,400 times | Joined on Nov 2011
#6
Originally Posted by a12jun View Post
Yeah I did after I posted the reply! Seems I have a lot to learn But how would I fin out the name of the key to use if I didn't already know it? Is there some way that I can switch on a process monitor log, run the command through the UI, then switch the log off and inspect it to find what was altered?
gconftool -h would teach you the options available

gconftool -a lists all keys within the directory

gconftool --all-dirs lists all sub-directories within a main directory
 

The Following 2 Users Say Thank You to thedead1440 For This Useful Post:
Posts: 49 | Thanked: 93 times | Joined on Jan 2012 @ Finland
#7
Originally Posted by a12jun View Post
What is gconftool-2, and how would you know that this is the program you need to use to edit the profile
It is a GConf command line tool to read and write values of the stored keys and much more. Maybe you should introduce to yourself with the basics of GConf at first. It is a system to store application preferences, similar to the Windows register. You may also want to check the syntax of the command:

Code:
gconftool-2 --help
Originally Posted by a12jun View Post
what does the "string [......] do? Is 'string' some sort of operator?
String is the datatype of the given key value, i.e. the valid string values of the key /system/osso/dsm/display/color_profile are "Muted", "Neutral" or "Vivid" in this case.

By the way, you probably need to check the currently set colour profile in your script to make the decision what should be the next profile. This is how it is read:

Code:
gconftool-2 --get /system/osso/dsm/display/color_profile
 
Posts: 49 | Thanked: 93 times | Joined on Jan 2012 @ Finland
#8
Originally Posted by a12jun View Post
But how would I fin out the name of the key to use if I didn't already know it?
That requires some detective work, really, as most of the GConf keys are more or less intended for the internal system usage only, so those are most likely documented nowhere.

As thedead1440 already said, you can use gconftool-2 to list the available keys, too. If you prefer a graphical tool, there seems to be an application named GConfik in Nokia Store to browse and edit the key values from an UI. I haven't tried that app myself, though. Googling may give you answers how to monitor real time changes to the GConf key values.

The colour profiles themselves are defined in /etc/mce/mce.ini and one could edit the existing profiles and add new ones there. However, I advice against that unless you really know what you are doing and understand the risks if messing up that file.
 
Posts: 5 | Thanked: 0 times | Joined on Jan 2013 @ UK; http://stackoverflow.com/users/737641/a12jun
#9
Ok. I had already tried a
Code:
gconftool-2 -R /system | grep Mute
which gave me the right key name, but if I didn't know what I was looking for I guess it would just take some investigating.
Anyway, thanks for the help, I'll just crack on and try and get some bits working.
 
coderus's Avatar
Posts: 6,436 | Thanked: 12,699 times | Joined on Nov 2011 @ Ängelholm, Sweden
#10
i will suggest to play with GConfik
__________________
Telegram | Openrepos | GitHub | Revolut donations
 
Reply

Tags
fail university, rofl_

Thread Tools

 
Forum Jump


All times are GMT. The time now is 21:20.