set dconf-editor values programatically
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO9GURib1T8z7lCwjOGLQaGtrueEthgQ8LO42ZX8cOfTqDK4jvDDpKkLFwf2J49kYCMNW7d4ABih_XCb_2UXdq5fPJDkoyg7-8g_YfRUot-XnaXkNYycsNp7lA5_TW9td0FFpLQ2APzKcZ/s1600/1.jpg)
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYQ0N5W1qAOxLP7t7iOM6O6AzbZnkXUy16s7P_CWfOb5UbTQY_aDsc727chyphenhyphen5W4IppVNernMMQeaUFTB_rFzAd95_CDt-tnwN-nBx6JyUp2duGjPaL5-VgNO41AVsA_vu30EJcipdDG409/s400/Clash+Royale+CLAN+TAG%2523URR8PPP.png)
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;
up vote
0
down vote
favorite
Is there a way that I can access and edit dconf-editor values programatically, I mean using phython or bash?
I want to develop a simple tool to edit some window management shortcuts. I know there are tools like compiz which provides this already, but need to have something quick and simple to work best with my requirements.
I there some sort of a API for dconf-editor? or an API for window management keyboard short cuts in general.
Basically I want to edit Switch Windows shortcuts (Alt + Tab) from bash or some other scripting language, i.e, without using a GUI.
Please advice.
unity gnome bash shortcut-keys compiz
add a comment |Â
up vote
0
down vote
favorite
Is there a way that I can access and edit dconf-editor values programatically, I mean using phython or bash?
I want to develop a simple tool to edit some window management shortcuts. I know there are tools like compiz which provides this already, but need to have something quick and simple to work best with my requirements.
I there some sort of a API for dconf-editor? or an API for window management keyboard short cuts in general.
Basically I want to edit Switch Windows shortcuts (Alt + Tab) from bash or some other scripting language, i.e, without using a GUI.
Please advice.
unity gnome bash shortcut-keys compiz
2
I don't know about APIs but did you look at gsettings? For the window manager, you may need to be specific about what you intend doing.
â DK Bose
yesterday
I want to set switch window short cuts using bash or python, i know those can be edited from compiz, dconf-editor, etc. I want to do it from bash or some programming language
â Bmax
yesterday
1
from gi.repository import Gio
:)
â Rinzwind
yesterday
As well asgsettings
, there is adconf
command-line tool that you can use directly from the shell - see What is dconf, what is its function, and how do I use it?
â steeldriver
yesterday
Repeat question askubuntu.com/questions/755020/â¦
â pauljohn32
yesterday
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Is there a way that I can access and edit dconf-editor values programatically, I mean using phython or bash?
I want to develop a simple tool to edit some window management shortcuts. I know there are tools like compiz which provides this already, but need to have something quick and simple to work best with my requirements.
I there some sort of a API for dconf-editor? or an API for window management keyboard short cuts in general.
Basically I want to edit Switch Windows shortcuts (Alt + Tab) from bash or some other scripting language, i.e, without using a GUI.
Please advice.
unity gnome bash shortcut-keys compiz
Is there a way that I can access and edit dconf-editor values programatically, I mean using phython or bash?
I want to develop a simple tool to edit some window management shortcuts. I know there are tools like compiz which provides this already, but need to have something quick and simple to work best with my requirements.
I there some sort of a API for dconf-editor? or an API for window management keyboard short cuts in general.
Basically I want to edit Switch Windows shortcuts (Alt + Tab) from bash or some other scripting language, i.e, without using a GUI.
Please advice.
unity gnome bash shortcut-keys compiz
edited yesterday
asked 2 days ago
Bmax
1314
1314
2
I don't know about APIs but did you look at gsettings? For the window manager, you may need to be specific about what you intend doing.
â DK Bose
yesterday
I want to set switch window short cuts using bash or python, i know those can be edited from compiz, dconf-editor, etc. I want to do it from bash or some programming language
â Bmax
yesterday
1
from gi.repository import Gio
:)
â Rinzwind
yesterday
As well asgsettings
, there is adconf
command-line tool that you can use directly from the shell - see What is dconf, what is its function, and how do I use it?
â steeldriver
yesterday
Repeat question askubuntu.com/questions/755020/â¦
â pauljohn32
yesterday
add a comment |Â
2
I don't know about APIs but did you look at gsettings? For the window manager, you may need to be specific about what you intend doing.
â DK Bose
yesterday
I want to set switch window short cuts using bash or python, i know those can be edited from compiz, dconf-editor, etc. I want to do it from bash or some programming language
â Bmax
yesterday
1
from gi.repository import Gio
:)
â Rinzwind
yesterday
As well asgsettings
, there is adconf
command-line tool that you can use directly from the shell - see What is dconf, what is its function, and how do I use it?
â steeldriver
yesterday
Repeat question askubuntu.com/questions/755020/â¦
â pauljohn32
yesterday
2
2
I don't know about APIs but did you look at gsettings? For the window manager, you may need to be specific about what you intend doing.
â DK Bose
yesterday
I don't know about APIs but did you look at gsettings? For the window manager, you may need to be specific about what you intend doing.
â DK Bose
yesterday
I want to set switch window short cuts using bash or python, i know those can be edited from compiz, dconf-editor, etc. I want to do it from bash or some programming language
â Bmax
yesterday
I want to set switch window short cuts using bash or python, i know those can be edited from compiz, dconf-editor, etc. I want to do it from bash or some programming language
â Bmax
yesterday
1
1
from gi.repository import Gio
:)â Rinzwind
yesterday
from gi.repository import Gio
:)â Rinzwind
yesterday
As well as
gsettings
, there is a dconf
command-line tool that you can use directly from the shell - see What is dconf, what is its function, and how do I use it?â steeldriver
yesterday
As well as
gsettings
, there is a dconf
command-line tool that you can use directly from the shell - see What is dconf, what is its function, and how do I use it?â steeldriver
yesterday
Repeat question askubuntu.com/questions/755020/â¦
â pauljohn32
yesterday
Repeat question askubuntu.com/questions/755020/â¦
â pauljohn32
yesterday
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
For Python, use Gio
module. Specifically, here's an example of two functions I use in my own code (feel free to see how they're used within my Launcher List Indicator):
from gi.repository import Gio
# Define your own class here
# Note that these use `self` for use with classes
# this could be removed otherwise
def gsettings_get(self, schema, path, key):
"""Get value of gsettings schema"""
if path is None:
gsettings = Gio.Settings.new(schema)
else:
gsettings = Gio.Settings.new_with_path(schema, path)
return gsettings.get_value(key)
def gsettings_set(self, schema, path, key, value):
"""Set value of gsettings schema"""
if path is None:
gsettings = Gio.Settings.new(schema)
else:
gsettings = Gio.Settings.new_with_path(schema, path)
if isinstance(value, list):
return gsettings.set_strv(key, value)
if isinstance(value, int):
return gsettings.set_int(key, value)
These functions make getting and setting values easy and similar to the command-line utilities; schema
, path
, and key
values are all strings. For instance, to set Unity launcher position to "Bottom" you would do:
self.gsettings_set( 'com.canonical.Unity.Launcher', 'launcher-position', 'Bottom')
For shell scripts, there are dconf
and gsettings
command-line tools, the later being a front-end to dconf
. The gsettings
command is preferred because it performs safety checks on the input values. Example of usage:
gsettings set com.canonical.Unity.Launcher launcher-position 'Bottom'
You can call these two from python using subprocess.call()
or subprocess.check_output()
, but this has the overhead of spawning extra process, which is unnecessary (And if you're going to do it Pythonic way, do it right via the API).
See also
- Do GUI based application execute shell commands in the background?
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
For Python, use Gio
module. Specifically, here's an example of two functions I use in my own code (feel free to see how they're used within my Launcher List Indicator):
from gi.repository import Gio
# Define your own class here
# Note that these use `self` for use with classes
# this could be removed otherwise
def gsettings_get(self, schema, path, key):
"""Get value of gsettings schema"""
if path is None:
gsettings = Gio.Settings.new(schema)
else:
gsettings = Gio.Settings.new_with_path(schema, path)
return gsettings.get_value(key)
def gsettings_set(self, schema, path, key, value):
"""Set value of gsettings schema"""
if path is None:
gsettings = Gio.Settings.new(schema)
else:
gsettings = Gio.Settings.new_with_path(schema, path)
if isinstance(value, list):
return gsettings.set_strv(key, value)
if isinstance(value, int):
return gsettings.set_int(key, value)
These functions make getting and setting values easy and similar to the command-line utilities; schema
, path
, and key
values are all strings. For instance, to set Unity launcher position to "Bottom" you would do:
self.gsettings_set( 'com.canonical.Unity.Launcher', 'launcher-position', 'Bottom')
For shell scripts, there are dconf
and gsettings
command-line tools, the later being a front-end to dconf
. The gsettings
command is preferred because it performs safety checks on the input values. Example of usage:
gsettings set com.canonical.Unity.Launcher launcher-position 'Bottom'
You can call these two from python using subprocess.call()
or subprocess.check_output()
, but this has the overhead of spawning extra process, which is unnecessary (And if you're going to do it Pythonic way, do it right via the API).
See also
- Do GUI based application execute shell commands in the background?
add a comment |Â
up vote
0
down vote
For Python, use Gio
module. Specifically, here's an example of two functions I use in my own code (feel free to see how they're used within my Launcher List Indicator):
from gi.repository import Gio
# Define your own class here
# Note that these use `self` for use with classes
# this could be removed otherwise
def gsettings_get(self, schema, path, key):
"""Get value of gsettings schema"""
if path is None:
gsettings = Gio.Settings.new(schema)
else:
gsettings = Gio.Settings.new_with_path(schema, path)
return gsettings.get_value(key)
def gsettings_set(self, schema, path, key, value):
"""Set value of gsettings schema"""
if path is None:
gsettings = Gio.Settings.new(schema)
else:
gsettings = Gio.Settings.new_with_path(schema, path)
if isinstance(value, list):
return gsettings.set_strv(key, value)
if isinstance(value, int):
return gsettings.set_int(key, value)
These functions make getting and setting values easy and similar to the command-line utilities; schema
, path
, and key
values are all strings. For instance, to set Unity launcher position to "Bottom" you would do:
self.gsettings_set( 'com.canonical.Unity.Launcher', 'launcher-position', 'Bottom')
For shell scripts, there are dconf
and gsettings
command-line tools, the later being a front-end to dconf
. The gsettings
command is preferred because it performs safety checks on the input values. Example of usage:
gsettings set com.canonical.Unity.Launcher launcher-position 'Bottom'
You can call these two from python using subprocess.call()
or subprocess.check_output()
, but this has the overhead of spawning extra process, which is unnecessary (And if you're going to do it Pythonic way, do it right via the API).
See also
- Do GUI based application execute shell commands in the background?
add a comment |Â
up vote
0
down vote
up vote
0
down vote
For Python, use Gio
module. Specifically, here's an example of two functions I use in my own code (feel free to see how they're used within my Launcher List Indicator):
from gi.repository import Gio
# Define your own class here
# Note that these use `self` for use with classes
# this could be removed otherwise
def gsettings_get(self, schema, path, key):
"""Get value of gsettings schema"""
if path is None:
gsettings = Gio.Settings.new(schema)
else:
gsettings = Gio.Settings.new_with_path(schema, path)
return gsettings.get_value(key)
def gsettings_set(self, schema, path, key, value):
"""Set value of gsettings schema"""
if path is None:
gsettings = Gio.Settings.new(schema)
else:
gsettings = Gio.Settings.new_with_path(schema, path)
if isinstance(value, list):
return gsettings.set_strv(key, value)
if isinstance(value, int):
return gsettings.set_int(key, value)
These functions make getting and setting values easy and similar to the command-line utilities; schema
, path
, and key
values are all strings. For instance, to set Unity launcher position to "Bottom" you would do:
self.gsettings_set( 'com.canonical.Unity.Launcher', 'launcher-position', 'Bottom')
For shell scripts, there are dconf
and gsettings
command-line tools, the later being a front-end to dconf
. The gsettings
command is preferred because it performs safety checks on the input values. Example of usage:
gsettings set com.canonical.Unity.Launcher launcher-position 'Bottom'
You can call these two from python using subprocess.call()
or subprocess.check_output()
, but this has the overhead of spawning extra process, which is unnecessary (And if you're going to do it Pythonic way, do it right via the API).
See also
- Do GUI based application execute shell commands in the background?
For Python, use Gio
module. Specifically, here's an example of two functions I use in my own code (feel free to see how they're used within my Launcher List Indicator):
from gi.repository import Gio
# Define your own class here
# Note that these use `self` for use with classes
# this could be removed otherwise
def gsettings_get(self, schema, path, key):
"""Get value of gsettings schema"""
if path is None:
gsettings = Gio.Settings.new(schema)
else:
gsettings = Gio.Settings.new_with_path(schema, path)
return gsettings.get_value(key)
def gsettings_set(self, schema, path, key, value):
"""Set value of gsettings schema"""
if path is None:
gsettings = Gio.Settings.new(schema)
else:
gsettings = Gio.Settings.new_with_path(schema, path)
if isinstance(value, list):
return gsettings.set_strv(key, value)
if isinstance(value, int):
return gsettings.set_int(key, value)
These functions make getting and setting values easy and similar to the command-line utilities; schema
, path
, and key
values are all strings. For instance, to set Unity launcher position to "Bottom" you would do:
self.gsettings_set( 'com.canonical.Unity.Launcher', 'launcher-position', 'Bottom')
For shell scripts, there are dconf
and gsettings
command-line tools, the later being a front-end to dconf
. The gsettings
command is preferred because it performs safety checks on the input values. Example of usage:
gsettings set com.canonical.Unity.Launcher launcher-position 'Bottom'
You can call these two from python using subprocess.call()
or subprocess.check_output()
, but this has the overhead of spawning extra process, which is unnecessary (And if you're going to do it Pythonic way, do it right via the API).
See also
- Do GUI based application execute shell commands in the background?
edited 9 hours ago
answered 9 hours ago
![](https://i.stack.imgur.com/U1Jy6.jpg?s=32&g=1)
![](https://i.stack.imgur.com/U1Jy6.jpg?s=32&g=1)
Sergiy Kolodyazhnyy
63.3k9127270
63.3k9127270
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1062197%2fset-dconf-editor-values-programatically%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
2
I don't know about APIs but did you look at gsettings? For the window manager, you may need to be specific about what you intend doing.
â DK Bose
yesterday
I want to set switch window short cuts using bash or python, i know those can be edited from compiz, dconf-editor, etc. I want to do it from bash or some programming language
â Bmax
yesterday
1
from gi.repository import Gio
:)â Rinzwind
yesterday
As well as
gsettings
, there is adconf
command-line tool that you can use directly from the shell - see What is dconf, what is its function, and how do I use it?â steeldriver
yesterday
Repeat question askubuntu.com/questions/755020/â¦
â pauljohn32
yesterday