Customize Ubuntu through the command line. a custom look for different setups :D
Tags: ubuntu, automation, bash, gnome
Published: 2023-12-17 11:22:55


So I switch setups often from one desk to another or even home and work setups, usually, I use another monitor and I am used to making the monitor on the left at home with the dock at the left too whereas my laptop screen is secondary but at work, it's completely different.

each time I change my desk I have to reconfigure my screen which is a bit boring.. what I am doing now is completely different I made an alias for a command that I launch when I switch setups to set my dock & screen positions.

in the next lines, i ll show you how to set your dock position from the command line using the ultimate gnome command **gsettings** and i'll keep the rest for your own situation to handle freely !

##### 1. type gsetting help and let us discover it !

```
$❯ gsettings help

Usage:
  gsettings --version
  gsettings [--schemadir SCHEMADIR] COMMAND [ARGS…]

Commands:
  help                      Show this information
  list-schemas              List installed schemas
  list-relocatable-schemas  List relocatable schemas
  list-keys                 List keys in a schema
  list-children             List children of a schema
  list-recursively          List keys and values, recursively
  range                     Queries the range of a key
  describe                  Queries the description of a key
  get                       Get the value of a key
  set                       Set the value of a key
  reset                     Reset the value of a key
  reset-recursively         Reset all values in a given schema
  writable                  Check if a key is writable
  monitor                   Watch for changes
```
 

##### 2. as you can see here we need to specify a command and some args for it , first thing to do is to list the **Schemas** which will help us see all the customizable items !

```
$❯ gsettings list-schemas
com.canonical.Unity.Lenses
com.canonical.unity.desktop.background
com.canonical.unity.desktop.interface
com.canonical.unity.desktop.screensaver
com.mattjakeman.ExtensionManager
com.ubuntu.SoftwareProperties
com.ubuntu.login-screen
...
...
```

##### 3. its a big list so lets use grep to find the schema we want , for example lets grep **dock**

```
$❯ gsettings list-schemas |  grep dock
org.gnome.shell.extensions.dash-to-dock
```

##### 4. Oh so our schema is named **org.gnome.shell.extensions.dash-to-dock** , now we will need to list its keys , because each schema has its own keys and values settings and we will change the values depending on what we want 

```
$❯ gsettings list-keys org.gnome.shell.extensions.dash-to-dock
activate-single-window
animate-show-apps
animation-time
...
...
```

##### 5. the list is long here too , we can grep the **position** or **dock** key 

```
$❯ gsettings list-keys org.gnome.shell.extensions.dash-to-dock | grep dock 
dock-fixed
dock-position
```

##### 6. lets get the current value for **dock-position** key

```
$❯ gsettings get org.gnome.shell.extensions.dash-to-dock dock-position
'RIGHT'
```

##### 7. its set on the right , so lets changed it to left 

```
❯ gsettings set org.gnome.shell.extensions.dash-to-dock dock-position 'LEFT'
```


##### 8. And voila ! its on the left :D 

you can list all schemas and their keys and find what you want to customize ! it has everything you usually change through settings .

Good luck