Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Commit

Permalink
GNOME Shell theming support (#679)
Browse files Browse the repository at this point in the history
Signed-off-by: tfuxu <[email protected]>
Co-authored-by: 0xMRTT <[email protected]>
Co-authored-by: 0xMRTT <[email protected]>
Co-authored-by: daudix-UFO <[email protected]>
  • Loading branch information
4 people committed May 4, 2023
1 parent 905b314 commit e412a2c
Show file tree
Hide file tree
Showing 85 changed files with 3,991 additions and 773 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

with:
submodules: recursive

- name: Install dependencies
run: |
dnf -y install docker
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "data/submodules"]
path = data/submodules
url = https://github.com/GradienceTeam/Submodules
4 changes: 4 additions & 0 deletions HACKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,15 @@ flatpak install org.gnome.Sdk//44 org.gnome.Platform//44
```shell
git clone https://github.com/GradienceTeam/Gradience.git
cd Gradience
git submodule update --init --recursive
flatpak-builder --install --user --force-clean repo/ build-aux/flatpak/com.github.GradienceTeam.Gradience.json
```

##### System installation
```shell
git clone https://github.com/GradienceTeam/Gradience.git
cd Gradience
git submodule update --init --recursive
flatpak-builder --install --system --force-clean repo/ build-aux/flatpak/com.github.GradienceTeam.Gradience.json
```

Expand Down Expand Up @@ -84,6 +86,7 @@ pip install -r requirements.txt
```shell
git clone https://github.com/GradienceTeam/Gradience.git
cd Gradience
git submodule update --init --recursive
meson setup builddir
meson configure builddir -Dprefix=/usr/local
sudo ninja -C builddir install
Expand All @@ -94,6 +97,7 @@ sudo ninja -C builddir install
```shell
git clone https://github.com/GradienceTeam/Gradience.git
cd Gradience
git submodule update --init --recursive
meson setup builddir
meson configure builddir -Dprefix="$(pwd)/builddir"
ninja -C builddir install
Expand Down
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,15 @@ Use [this guide](https://github.com/lassekongo83/adw-gtk3/blob/main/gtk4.md) to


## 🔄 Revert Theming
1. Open Preferences window

> **Note**
> You can press on the menu button in the headerbar and press `Reset Applied Color Scheme`
> ![Main Gradience menu](https://raw.githubusercontent.com/GradienceTeam/Design/main/Screenshots/hamburger_menu.png)
![Main Gradience Menu](https://i.imgur.com/bJMNX6d.png)

2. Go to Theming tab

3. In _Reset & Restore Presets_ group, click Reset button for either GTK 3 or Libadwaita applications

![Reset & Restore Presets Group](https://i.imgur.com/SynxTJT.png)

<details>
<summary>🪛️ Manual revert</summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
"--device=dri",
"--socket=fallback-x11",
"--socket=wayland",
"--talk-name=org.freedesktop.Flatpak",
"--filesystem=~/.local/share/gnome-shell/extensions",
"--filesystem=xdg-data/flatpak/overrides:create",
"--filesystem=xdg-cache/gradience:create",
"--filesystem=xdg-data/themes:create",
"--filesystem=xdg-config/gtk-3.0",
"--filesystem=xdg-config/gtk-4.0",
"--filesystem=xdg-run/gvfsd",
Expand Down
4 changes: 4 additions & 0 deletions build-aux/flatpak/com.github.GradienceTeam.Gradience.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
"--device=dri",
"--socket=fallback-x11",
"--socket=wayland",
"--talk-name=org.freedesktop.Flatpak",
"--filesystem=~/.local/share/gnome-shell/extensions",
"--filesystem=xdg-data/flatpak/overrides:create",
"--filesystem=xdg-cache/gradience:create",
"--filesystem=xdg-data/themes:create",
"--filesystem=xdg-config/gtk-3.0",
"--filesystem=xdg-config/gtk-4.0",
"--filesystem=xdg-run/gvfsd",
Expand Down
60 changes: 37 additions & 23 deletions build-aux/flatpak/pypi-dependencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"sources": [
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/39/f6/7c1e3a2a54f18b67c5bd092c25ac7327083d4b3b15731b98a9c193df2db9/anyascii-0.3.1-py3-none-any.whl",
"sha256": "8707d3185017435933360462a65e2c70a4818490745804f38a5ca55e59eb56a0"
"url": "https://files.pythonhosted.org/packages/4f/7b/a9a747e0632271d855da379532b05a62c58e979813814a57fa3b3afeb3a4/anyascii-0.3.2-py3-none-any.whl",
"sha256": "3b3beef6fc43d9036d3b0529050b0c48bfad8bc960e9e562d7223cfb94fe45d4"
}
]
},
Expand All @@ -24,6 +24,11 @@
"pip3 install --verbose --exists-action=i --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} \"material-color-utilities-python\" --no-build-isolation"
],
"sources": [
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/d8/29/bd8de07107bc952e0e2783243024e1c125e787fd685725a622e4ac7aeb3c/regex-2023.3.23.tar.gz",
"sha256": "dc80df325b43ffea5cdea2e3eaa97a44f3dd298262b1c7fe9dbb2a9522b956a7"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/bc/07/830784e061fb94d67649f3e438ff63cfb902dec6d48ac75aeaaac7c7c30e/Pillow-9.4.0.tar.gz",
Expand All @@ -33,11 +38,6 @@
"type": "file",
"url": "https://files.pythonhosted.org/packages/31/65/a8e0f3e2bad0d4eabeb1931b22cdae08344a955f28022dc83420a128683c/material_color_utilities_python-0.1.5-py2.py3-none-any.whl",
"sha256": "48abd8695a1355ab3ad43fe314ca8664c66282a86fbf94a717571273bf422bdf"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/27/b5/92d404279fd5f4f0a17235211bb0f5ae7a0d9afb7f439086ec247441ed28/regex-2022.10.31.tar.gz",
"sha256": "a3a98921da9a1bf8457aeee6a551948a83601689e5ecdd736894ea9bbec77e83"
}
]
},
Expand All @@ -50,18 +50,13 @@
"sources": [
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/bc/07/830784e061fb94d67649f3e438ff63cfb902dec6d48ac75aeaaac7c7c30e/Pillow-9.4.0.tar.gz",
"sha256": "a1c2d7780448eb93fbcc3789bf3916aa5720d942e37945f4056680317f1cd23e"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/9d/3a/e39436efe51894243ff145a37c4f9a030839b97779ebcc4f13b3ba21c54e/cssselect2-0.7.0-py3-none-any.whl",
"sha256": "fd23a65bfd444595913f02fc71f6b286c29261e354c41d722ca7a261a49b5969"
"url": "https://files.pythonhosted.org/packages/f4/24/2a3e3df732393fed8b3ebf2ec078f05546de641fe1b667ee316ec1dcf3b7/webencodings-0.5.1-py2.py3-none-any.whl",
"sha256": "a0af1213f3c2226497a97e2b3aa01a7e4bee4f403f95be16fc9acd2947514a78"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/06/5a/e11cad7b79f2cf3dd2ff8f81fa8ca667e7591d3d8451768589996b65dec1/lxml-4.9.2.tar.gz",
"sha256": "2455cfaeb7ac70338b3257f41e21f0724f4b5b0c0e7702da67ee6c3640835b67"
"url": "https://files.pythonhosted.org/packages/bc/07/830784e061fb94d67649f3e438ff63cfb902dec6d48ac75aeaaac7c7c30e/Pillow-9.4.0.tar.gz",
"sha256": "a1c2d7780448eb93fbcc3789bf3916aa5720d942e37945f4056680317f1cd23e"
},
{
"type": "file",
Expand All @@ -70,8 +65,8 @@
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/ee/cd/8b19f6299541862deea19b26a9efe269ff843fa15a9fd833ff0fec2ac22c/svglib-1.4.1.tar.gz",
"sha256": "48c24706c23bb4262173b6fa49eabb10afa15b8412f14283120549517ccfa314"
"url": "https://files.pythonhosted.org/packages/06/5a/e11cad7b79f2cf3dd2ff8f81fa8ca667e7591d3d8451768589996b65dec1/lxml-4.9.2.tar.gz",
"sha256": "2455cfaeb7ac70338b3257f41e21f0724f4b5b0c0e7702da67ee6c3640835b67"
},
{
"type": "file",
Expand All @@ -80,8 +75,13 @@
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/f4/24/2a3e3df732393fed8b3ebf2ec078f05546de641fe1b667ee316ec1dcf3b7/webencodings-0.5.1-py2.py3-none-any.whl",
"sha256": "a0af1213f3c2226497a97e2b3aa01a7e4bee4f403f95be16fc9acd2947514a78"
"url": "https://files.pythonhosted.org/packages/9d/3a/e39436efe51894243ff145a37c4f9a030839b97779ebcc4f13b3ba21c54e/cssselect2-0.7.0-py3-none-any.whl",
"sha256": "fd23a65bfd444595913f02fc71f6b286c29261e354c41d722ca7a261a49b5969"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/56/5b/53ca0fd447f73423c7dc59d34e523530ef434481a3d18808ff7537ad33ec/svglib-1.5.1.tar.gz",
"sha256": "3ae765d3a9409ee60c0fb4d24c2deb6a80617aa927054f5bcd7fc98f0695e587"
}
]
},
Expand All @@ -106,15 +106,29 @@
"pip3 install --verbose --exists-action=i --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} \"Jinja2\" --no-build-isolation"
],
"sources": [
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/95/7e/68018b70268fb4a2a605e2be44ab7b4dd7ce7808adae6c5ef32e34f4b55a/MarkupSafe-2.1.2.tar.gz",
"sha256": "abcabc8c2b26036d62d4c746381a6f7cf60aafcc653198ad678306986b09450d"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/bc/c3/f068337a370801f372f2f8f6bad74a5c140f6fda3d9de154052708dd3c65/Jinja2-3.1.2-py3-none-any.whl",
"sha256": "6088930bfe239f0e6710546ab9c19c9ef35e29792895fed6e6e31a023a182a61"
},
}
]
},
{
"name": "python3-libsass",
"buildsystem": "simple",
"build-commands": [
"pip3 install --verbose --exists-action=i --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} \"libsass\" --no-build-isolation"
],
"sources": [
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/1d/97/2288fe498044284f39ab8950703e88abbac2abbdf65524d576157af70556/MarkupSafe-2.1.1.tar.gz",
"sha256": "7f91197cc9e48f989d12e4e6fbc46495c446636dfc81b9ccf50bb0ec74b91d4b"
"url": "https://files.pythonhosted.org/packages/55/14/f1d9578dce39f890ae3c0f93db8a23e89d2a1403da81d307ffb429df7c3b/libsass-0.22.0.tar.gz",
"sha256": "3ab5ad18e47db560f4f0c09e3d28cf3bb1a44711257488ac2adad69f4f7f8425"
}
]
}
Expand Down
3 changes: 3 additions & 0 deletions data/com.github.GradienceTeam.Gradience.gschema.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
<key name="enabled-plugins" type="as">
<default>[]</default>
</key>
<key name="enabled-theme-engines" type="as">
<default>['shell', 'monet']</default>
</key>
<key name="user-flatpak-theming-gtk4" type="b">
<default>false</default>
</key>
Expand Down
5 changes: 5 additions & 0 deletions data/gradience.gresource.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<file preprocess="xml-stripblanks">ui/error_list_row.ui</file>
<file preprocess="xml-stripblanks">ui/explore_preset_row.ui</file>
<file preprocess="xml-stripblanks">ui/log_out_dialog.ui</file>
<file preprocess="xml-stripblanks">ui/monet_theming_group.ui</file>
<file preprocess="xml-stripblanks">ui/no_plugin_window.ui</file>
<file preprocess="xml-stripblanks">ui/option_row.ui</file>
<file preprocess="xml-stripblanks">ui/palette_shades.ui</file>
Expand All @@ -18,8 +19,12 @@
<file preprocess="xml-stripblanks">ui/preset_row.ui</file>
<file preprocess="xml-stripblanks">ui/presets_manager_window.ui</file>
<file preprocess="xml-stripblanks">ui/repo_row.ui</file>
<file preprocess="xml-stripblanks">ui/reset_preset_group.ui</file>
<file preprocess="xml-stripblanks">ui/save_dialog.ui</file>
<file preprocess="xml-stripblanks">ui/share_window.ui</file>
<file preprocess="xml-stripblanks">ui/shell_prefs_window.ui</file>
<file preprocess="xml-stripblanks">ui/shell_theming_group.ui</file>
<file preprocess="xml-stripblanks">ui/theming_empty_group.ui</file>
<file preprocess="xml-stripblanks">ui/welcome_window.ui</file>
<file preprocess="xml-stripblanks">ui/window.ui</file>
<file>images/welcome-dark.svg</file>
Expand Down
3 changes: 3 additions & 0 deletions data/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,6 @@ endif

subdir('icons')
subdir('plugins')

subdir('shell')
subdir('submodules/gnome-shell')
6 changes: 4 additions & 2 deletions data/presets/adwaita-dark.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
"popover_bg_color": "#383838",
"popover_fg_color": "#ffffff",
"shade_color": "rgba(0, 0, 0, 0.36)",
"scrollbar_outline_color": "rgba(0, 0, 0, 0.5)"
"scrollbar_outline_color": "rgba(0, 0, 0, 0.5)",
"thumbnail_bg_color": "#383838",
"thumbnail_fg_color": "#ffffff"
},
"palette": {
"blue_": {
Expand Down Expand Up @@ -100,4 +102,4 @@
"5": "#000000"
}
}
}
}
6 changes: 4 additions & 2 deletions data/presets/adwaita.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
"popover_bg_color": "#ffffff",
"popover_fg_color": "rgba(0, 0, 0, 0.8)",
"shade_color": "rgba(0, 0, 0, 0.07)",
"scrollbar_outline_color": "#ffffff"
"scrollbar_outline_color": "#ffffff",
"thumbnail_bg_color": "#ffffff",
"thumbnail_fg_color": "rgba(0, 0, 0, 0.8)"
},
"palette": {
"blue_": {
Expand Down Expand Up @@ -100,4 +102,4 @@
"5": "#000000"
}
}
}
}
6 changes: 4 additions & 2 deletions data/presets/pretty-purple.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
"popover_bg_color": "#241f31",
"popover_fg_color": "#ffffff",
"shade_color": "rgba(0, 0, 0, 0.36)",
"scrollbar_outline_color": "rgba(0, 0, 0, 0.5)"
"scrollbar_outline_color": "rgba(0, 0, 0, 0.5)",
"thumbnail_bg_color": "#241f31",
"thumbnail_fg_color": "#ffffff"
},
"palette": {
"blue_": {
Expand Down Expand Up @@ -100,4 +102,4 @@
"5": "#000000"
}
}
}
}
5 changes: 5 additions & 0 deletions data/shell/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
install_subdir('templates',
install_dir: join_paths(get_option('datadir'), 'gradience', 'shell'),
exclude_files: 'meson.build',
strip_directory : false
)
18 changes: 18 additions & 0 deletions data/shell/templates/42/check-box.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* Check Boxes */

// these are equal to the size of the SVG assets
$check_height: 24px;
$check_width: 24px;


.check-box {
StBoxLayout { spacing: .8em; }
StBin {
width: $check_width;
height: $check_height;
background-image: if($variant == 'light', url("resource:///org/gnome/shell/theme/checkbox-off-light.svg"), url("resource:///org/gnome/shell/theme/checkbox-off.svg"));
}
&:focus StBin { background-image: if($variant == 'light', url("resource:///org/gnome/shell/theme/checkbox-off-focused-light.svg"), url("resource:///org/gnome/shell/theme/checkbox-off-focused.svg"));; }
&:checked StBin { background-image: url("resource:///org/gnome/shell/theme/checkbox.svg"); }
&:focus:checked StBin { background-image: url("resource:///org/gnome/shell/theme/checkbox-focused.svg"); }
}
71 changes: 71 additions & 0 deletions data/shell/templates/42/colors.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// When color definition differs for dark and light variant,
// it gets @if-ed depending on $variant

@import '_palette.scss';

$_dark_base_color: darken(desaturate({{bg_color}}, 2%), 2%);

$base_color: $_dark_base_color;
$bg_color: if($variant == 'light', darken($base_color, 5%), lighten($base_color, 5%));
$fg_color: if($variant == 'light', transparentize(black, .2), {{fg_color}});

$accent_fg_color: {{accent_fg_color}};
$selected_fg_color: if($variant == 'light', $accent_fg_color, {{selected_fg_color}});
$selected_bg_color: {{selected_bg_color}};
$selected_borders_color: if($variant == 'light', darken($selected_bg_color, 15%), darken($selected_bg_color, 30%)); // NOTE: Unused in GNOME Shell 42

$borders_color: if($variant == 'light', transparentize($fg_color, .5), transparentize($fg_color, .9));
$borders_edge: if($variant == 'light', rgba(255,255,255,0.8), lighten($bg_color, 5%));

$link_color: if($variant == 'light', darken($selected_bg_color, 10%), lighten($selected_bg_color, 20%));
$link_visited_color: if($variant == 'light', darken($selected_bg_color, 20%), lighten($selected_bg_color, 10%)); // NOTE: Unused in GNOME Shell 42

$warning_color: {{warning_bg_color}};
$error_color: {{error_bg_color}};
$success_color: {{success_bg_color}}; // NOTE: Unused in GNOME Shell 42
$destructive_color: {{destructive_bg_color}};

// NOTE: Used also in overview for folder colors, in search results, partially in text and for indicators below app icons
$osd_fg_color: {{osd_fg_color}};
$osd_bg_color: $_dark_base_color; // hardcoded for both light & dark
$osd_insensitive_bg_color: transparentize(mix($osd_fg_color, opacify($osd_bg_color, 1), 10%), 0.5); // NOTE: Unused in GNOME Shell 42
$osd_insensitive_fg_color: if($variant == 'light', mix($osd_fg_color, $osd_bg_color, 80%), mix($osd_fg_color, $osd_bg_color, 70%));
$osd_borders_color: transparentize(black, 0.3);
$osd_outer_borders_color: transparentize($osd_fg_color, 0.98);

$shadow_color: if($variant == 'light', rgba(0,0,0,0.1), rgba(0,0,0,0.2));

// cards
$card_bg_color: if($variant == 'light', darken($bg_color, 5%), lighten($bg_color, 2%)); // TODO: Allow to modify this value

// notifications
$bubble_buttons_color: if($variant == 'light', darken($bg_color, 12%), lighten($bg_color, 10%));

// overview background color
$system_bg_color: darken(desaturate({{system_bg_color}}, 2%), 2%);

//insensitive state derived colors
$insensitive_fg_color: mix($fg_color, $bg_color, 50%);
$insensitive_bg_color: mix($bg_color, $base_color, 60%);
$insensitive_borders_color: mix($borders_color, $base_color, 60%); // NOTE: Unused in GNOME Shell 42

//colors for the backdrop state, derived from the main colors.
// NOTE: This entire section doesn't seem to be used anywhere in GNOME Shell 42
$backdrop_base_color: if($variant =='light', darken($base_color,1%), lighten($base_color,1%));
$backdrop_bg_color: $bg_color;
$backdrop_fg_color: mix($fg_color, $backdrop_bg_color, 80%);
$backdrop_insensitive_color: if($variant =='light', darken($backdrop_bg_color,15%), lighten($backdrop_bg_color,15%));
$backdrop_borders_color: mix($borders_color, $bg_color, 90%);
$backdrop_dark_fill: mix($backdrop_borders_color,$backdrop_bg_color, 35%);

// derived checked colors
$checked_bg_color: if($variant=='light', darken($bg_color, 7%), lighten($bg_color, 7%));
$checked_fg_color: if($variant=='light', darken($fg_color, 7%), lighten($fg_color, 7%)); // NOTE: Unused in GNOME Shell 42

// derived hover colors
$hover_bg_color: if($variant=='light', darken($bg_color, 3%), lighten($bg_color, 10%));
$hover_fg_color: if($variant=='light', darken($fg_color, 5%), lighten($fg_color, 10%));

// derived active colors
$active_bg_color: if($variant=='light', darken($bg_color, 5%), lighten($bg_color, 12%));
$active_fg_color: if($variant=='light', darken($fg_color, 5%), lighten($fg_color, 12%));
Loading

0 comments on commit e412a2c

Please sign in to comment.