8

I am using gnome tweak tools on my system which is Ubuntu 12.04 with a few users set. I want to change the text scaling factor for all the user accounts.

If I use gsettings set org.gnome.desktop.interface text-scaling-factor 0.7 does the job fine but only for the user that is issuing the command. The rest of the users retain their settings which I don't want.

I want to do this from CLI since I am trying to incorporate this later to puppet.

user.dz
  • 48,105
kostasp
  • 145

2 Answers2

10

Change defaults by editing the original schemas

  1. Change default value in Glib schema

     sudo nano /usr/share/glib-2.0/schemas/org.gnome.desktop.interface.gschema.xml
    

    Like:

         <key type="d" name="text-scaling-factor">
         <range min="0.5" max="3.0"/>
         <default>0.7</default>
         <summary>Text scaling factor</summary>
         <description>Factor used to enlarge or reduce text display, without changing font size.</description>
         </key>
    
  2. Compile schemas

     sudo glib-compile-schemas /usr/share/glib-2.0/schemas
    

Changing defaults by creating an override file

Otherwise, because you want an easy way for puppet.

  1. You can create a dconf override file:

     sudo nano /usr/share/glib-2.0/schemas/30_my-text-factor.gschema.override
    
  2. Append override keys & values to it, example:

     [org.gnome.desktop.interface]
     text-scaling-factor=0.7
    
  3. Compile schemas

     sudo glib-compile-schemas /usr/share/glib-2.0/schemas
    

The new users and the users uses default (They never changed value or they have reset it) will get the new value effective.

Force all users to use defaults using a lock file

If you want to force users to use default value (their customized value has no effect), add a dconf lock:

  1. Add new lock file or change an existing one at:

     /etc/dconf/db/gdm.d/locks/
    
  2. Append this line to it:

     /org/gnome/desktop/interface/text-scaling-factor
    

References:

user.dz
  • 48,105
  • Thank a lot. this works as dreamed. My only issue is that i want to do this from puppet which means i need to make a template out of it and change the value through a variable. Need to try it but it looks feasible. – kostasp May 22 '14 at 10:15
  • @kostasp, then it is better to make an override file instead of changing original schema file /usr/share/glib-2.0/schemas/org.gnome.desktop.interface.gschema.xml. See examples: ls /usr/share/glib-2.0/schemas/*.gschema.override – user.dz May 22 '14 at 13:54
  • This didn't work for me - I posted a question with my problem here: https://askubuntu.com/questions/723267/gconf-override-schema-error-can-no-parse-as-value-of-type-d – Robin Winslow Jan 20 '16 at 09:21
  • @RobinWinslow , thank you , I made a mistake. The value should be without quotation marks. you could delete the other question as there is no need for different answer. – user.dz Jan 20 '16 at 10:17
  • 1
    Ah thanks! I swear I tried that. Never mind. I'm going to leave my question there 'cos I think it adds value by mentioning this error message. Someone might google that same error message (as I tried to do) and find my question. – Robin Winslow Jan 20 '16 at 10:32
  • @RobinWinslow , good, Me too in doubt, if you check my answer edit history, you see that it was without those marks, and for some reasons I added them later (I forgot why). Btw, if it helps you, you may consider some up votes here for Q & A :), plz make a look on https://askubuntu.com/help/why-vote – user.dz Jan 20 '16 at 10:41
  • Upvoted. Yeah I know why I should vote, I just forgot to. – Robin Winslow Jan 20 '16 at 10:43
1

I sort of found a working solution working for one user at a time. It looks like if use:

su user_name bash -c 'gsetting set org.gnome.desktop.interface text-scaling-factor 0.7'

It fails because of:

x11 connection rejected because of wrong authentication

This is because X win cookie is not carried over. So tried the following steps:

root:~#echo $DISPLAY
root output:~#localhost:10.0
root:~#xauth list
output:~#
eglisa-bh/unix:12 MIT-MAGIC-COOKIE-1 9435aa7eb876e2edf3e4f29bbe90f42a
eglisa-bh/unix:10 MIT-MAGIC-COOKIE-1 5e987f3ce693dd4789fgc5c012067f31
root:~#su - student
student:~#DISPLAY=localhost:10.0; export DISPLAY
student:~#xauth add eglisa-bh/unix:10 MIT-MAGIC-COOKIE-1
5e987f3ce693dd4789fgc5c017f31

Does the trick and then by running again:

su user_name bash -c 'gsetting set org.gnome.desktop.interface text-scaling-factor 0.7'

The text scale changes to 0.7 as wanted.

I've tried messing with sudo as well by adding inside the sudoers file:

Defaults env_keep +="DISPLAY XAUTHORIZATION XAUTHORITY"

But this also didn't work. If there is any easier way I would really appreciate it.

user.dz
  • 48,105
kostasp
  • 145