Browse Source

fleshed out script and instructions for gresource extraction, modification, and compilation

master
Adam Piontek 5 months ago
parent
commit
966eda3169
4 changed files with 62 additions and 5 deletions
  1. +33
    -0
      README.md
  2. +28
    -4
      extract-gresource.sh
  3. +0
    -0
      flat-remix-73k/mygdm3.gresource
  4. +1
    -1
      flat-remix-73k/mygdm3.gresource.xml

+ 33
- 0
README.md View File

@@ -0,0 +1,33 @@
# gdm3-theme-mod

Process for modifying gdm3 theme on Ubuntu 20.04

## Identifying active theme, Installing custom theme

Ubuntu allows different gdm3 themes set as alternatives.

- View them with `update-alternatives --query gdm3-theme.gresource`
- Set the one you want with `update-alternatives --set gdm3-theme.gresource [/path/to/file.gresource]`
- Install a new one with `update-alternatives --install /usr/share/gnome-shell/gdm3-theme.gresource gdm3-theme.gresource [/path/to/new/custom.gresource] 0`

## Modifications

To modify an existing theme, first set `gst` and `workdir` variables in `extract-gresource.sh` script, then run the commands to extract the gresource file contents, and to generate the gresource contents xml.

To allow the modified theme to use an external CSS file for easier modifications, copy `theme/gdm3.css` up a level for editing, then replace the `theme/gdm3.css` contents with:

```css
@import url(file:///usr/local/share/gnome-shell/theme/mygdm3/mygdm3.css);
```

Set the `file://[path]` to a path where you want to store the new, external css file.

## Generate new gresource

Command to generate the new gresource from these extracted contents + xml file:

```shell
glib-compile-resources --target ${xmlfile%.*} --sourcedir $workdir/theme $xmlfile
```

Then copy the resulting gresource file to the location you want to set with `update-alternatives` and ensure the external css is at the location set in the `theme/gdm3.css` css `@import`

+ 28
- 4
extract-gresource.sh View File

@@ -1,10 +1,13 @@
#!/bin/sh

# get current: `update-alternatives --query gdm3-theme.gresource`

# source gresource file to extract:
gst=/usr/share/themes/Flat-Remix/gnome-shell/gnome-shell-theme.gresource
workdir=/home/adam/dev/gnome-shell-theme/tmp
# target dir to which to extract gresource contents:
workdir=~/dev/gdm3-theme-mod/flat-remix-73k
# xml file for new gresource
xmlfile=$workdir/mygdm3.gresource.xml

# create directory layout
for r in `gresource list $gst`; do
r=${r#\/org\/gnome\/shell/}
if [ ! -d $workdir/${r%/*} ]; then
@@ -12,6 +15,27 @@ for r in `gresource list $gst`; do
fi
done

# extract the files
for r in `gresource list $gst`; do
gresource extract $gst $r >$workdir/${r#\/org\/gnome\/shell/}
gresource extract $gst $r >$workdir/${r#\/org\/gnome\/shell/}
done

### Generate XML file ###
# start:
cat > $xmlfile <<- EOM
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/shell/theme">
EOM

# generate file list
find $workdir/theme -type f | sort | \
while read line; do
echo "${line/$workdir\/theme\//\ \ \ \ <file>}</file>"
done >> $xmlfile

# end:
cat >> $xmlfile <<- EOM
</gresource>
</gresources>
EOM

flat-remix-73k/theme/_mod_.gresource → flat-remix-73k/mygdm3.gresource View File


flat-remix-73k/theme/_mod_.gresource.xml → flat-remix-73k/mygdm3.gresource.xml View File

@@ -39,4 +39,4 @@
<file>toggle-on.svg</file>
<file>view-grid-symbolic.svg</file>
</gresource>
</gresources>
</gresources>

Loading…
Cancel
Save