Skip to content

Instantly share code, notes, and snippets.

@jhenstridge
Last active November 19, 2018 12:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jhenstridge/7c1518dfb264014e28558fd03a1ed68a to your computer and use it in GitHub Desktop.
Save jhenstridge/7c1518dfb264014e28558fd03a1ed68a to your computer and use it in GitHub Desktop.
Snap desktop application theming experiment
  1. Build all snaps

  2. Install all snaps

  3. Connect interfaces:

    snap connect gtk3-demo:gtk3-themes ubuntu-themes:gtk3-themes
    snap connect gtk3-demo:icon-themes ubuntu-themes:icon-themes
    snap connect gtk3-demo:gtk3-themes adwaita-theme:gtk3-themes
    snap connect gtk3-demo:icon-themes adwaita-theme:icon-themes
    snap connect gtk3-demo:gtk3-themes evopop-theme:gtk3-themes
  4. Run demo app with different themes:

    GTK_THEME=EvoPop snap run gtk3-demo
    GTK_THEME=Adwaita snap run gtk3-demo
name: adwaita-theme
version: '0.1'
architectures:
- all
summary: "Adwaita: GNOME's default theme"
description: |
This is my-snap's description. You have a paragraph or two to tell the
most important story about your snap. Keep it under 100 words though,
we live in tweetspace and your description wants to look good in the snap
store.
grade: devel # must be 'stable' to release into candidate/stable channels
confinement: strict
slots:
gtk3-themes:
interface: content
source:
read:
- $SNAP/themes/Adwaita
- $SNAP/themes/Adwaita-dark
icon-themes:
interface: content
source:
read:
- $SNAP/icons/Adwaita
parts:
adwaita-theme:
plugin: nil
stage-packages:
- adwaita-icon-theme-full
- gnome-themes-standard-data
build-packages:
- gtk-update-icon-cache
install: |
set -eux
for dir in $SNAPCRAFT_PART_INSTALL/usr/share/icons/*; do
if [ -f "$dir/index.theme" ]; then
gtk-update-icon-cache --force "$dir"
fi
done
organize:
usr/share/themes: themes
usr/share/icons: icons
stage:
- icons/Adwaita
- themes/*/gtk-3*
name: evopop-theme
version: '2.9.99'
architectures:
- all
summary: EvoPop is a modern desktop theme suite.
description: |
EvoPop is a modern desktop theme suite. Its design is mostly flat
with a minimal use of shadows for depth. Requires Gtk 3.20 to
function properly. The theme is primarily build for the Solus
Project.
grade: devel # must be 'stable' to release into candidate/stable channels
confinement: strict
slots:
gtk3-themes:
interface: content
source:
read:
- $SNAP/themes/EvoPop
- $SNAP/themes/EvoPop-Azure
parts:
evopop-gtk-theme:
source: https://github.com/solus-project/evopop-gtk-theme.git
source-type: git
plugin: dump
organize:
EvoPop: themes/EvoPop
EvoPop-Azure: themes/EvoPop-Azure
stage:
- themes/*/gtk-3*
name: gtk3-demo
version: '0.1'
summary: Single-line elevator pitch for your amazing snap # 79 char long summary
description: |
This is my-snap's description. You have a paragraph or two to tell the
most important story about your snap. Keep it under 100 words though,
we live in tweetspace and your description wants to look good in the snap
store.
grade: devel # must be 'stable' to release into candidate/stable channels
confinement: strict
plugs:
gnome-3-26-1604:
interface: content
target: $SNAP/gnome-platform
default-provider: gnome-3-26-1604:gnome-3-26-1604
gtk3-themes:
interface: content
target: $SNAP/share/themes
icon-themes:
interface: content
target: $SNAP/share/icons
apps:
gtk3-demo:
command: bin/desktop-launch $SNAP/bin/run-gtk3-demo.sh
plugs:
- desktop
- wayland
- x11
- gtk3-themes
- icon-themes
parts:
app:
after:
- desktop-gnome-platform
plugin: nil
build-attributes:
- no-system-libraries
stage-packages:
- gtk-3-examples
install: |
set -ex
mkdir -p $SNAPCRAFT_PART_INSTALL/share/themes
mkdir -p $SNAPCRAFT_PART_INSTALL/share/icons
mkdir $SNAPCRAFT_PART_INSTALL/bin
echo '#!/bin/sh' > $SNAPCRAFT_PART_INSTALL/bin/run-gtk3-demo.sh
echo 'export XDG_DATA_DIRS="$SNAP/share:$XDG_DATA_DIRS"' >> $SNAPCRAFT_PART_INSTALL/bin/run-gtk3-demo.sh
echo 'exec $SNAP/usr/bin/gtk3-demo' >> $SNAPCRAFT_PART_INSTALL/bin/run-gtk3-demo.sh
chmod a+x $SNAPCRAFT_PART_INSTALL/bin/run-gtk3-demo.sh
stage:
- usr/bin/gtk3-demo
- bin/run-gtk3-demo.sh
- share/icons
- share/themes
name: ubuntu-themes
version: '0.1' # just for humans, typically '1.2+git' or '1.3.2'
architectures:
- all
summary: Ubuntu Light Themes (Ambiance and Radiance)
description: |
Includes matching Ambiance and Radiance themes
* Ambiance is a light-on-dark theme
* Radiance is a dark-on-light theme
Introduced as the default themes in Ubuntu 10.04 LTS.
grade: devel
confinement: strict
slots:
gtk3-themes:
interface: content
source:
read:
- $SNAP/themes/Ambiance
- $SNAP/themes/Radiance
icon-themes:
interface: content
source:
read:
- $SNAP/icons/ubuntu-mono-dark
- $SNAP/icons/ubuntu-mono-light
- $SNAP/icons/Humanity
- $SNAP/icons/Humanity-Dark
parts:
light-themes:
plugin: nil
stage-packages:
- light-themes
build-packages:
- gtk-update-icon-cache
install: |
set -eux
for dir in $SNAPCRAFT_PART_INSTALL/usr/share/icons/*; do
if [ -f "$dir/index.theme" ]; then
gtk-update-icon-cache --force "$dir"
fi
done
organize:
usr/share/themes: themes
usr/share/icons: icons
stage:
- icons/ubuntu-mono-dark
- icons/ubuntu-mono-light
- icons/Humanity
- icons/Humanity-Dark
- themes/*/gtk-3*
@Cracvan
Copy link

Cracvan commented Nov 19, 2018

Gracias

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment