Change the look of Adwaita, with ease
Go to file
0xMRTT db124a200a
Refactor shell theming module (#806)
## Description

This PR refactors a few operations to make the code handle edge cases
efficiently with marginal performance improvements.

## Type of change

- [ ] Bugfix (Change which fixes an issue)
- [ ] New feature (Change which adds new functionality)
- [x] Enhancement (Change which slightly improves existing code)
- [ ] Breaking change (This change will introduce incompatibility with
existing functionality)

## Changelog <!-- This is optional, but highly appreciated. -->

- Stores the comma separated string representation of valid versions for
later use in raising exceptions.
- Uses tuple for `async_data` in `ShellTheme` since its members are
immutable.
- Uses tuple decomposition to assign theme variant and preset from
`async_data` later.
- Replaces `Gio.File.make_directory_with_parents` with Python's builtin
`os.makedirs` with `exist_ok` as True to implicitly create directories
when nonexistent.
- Instead of relying on `KeyError`s when accessing dictionary values,
the `get` method is used to supply a default value.
- When a key might exist in one dictionary, the `get` method (which may
return `None`) is coupled with the nullish `or` operator to use the
value that is not `None`.
- Uses predefined `main_source` attribute as argument to the
`_compile_sass` function.
- Uses the walrus operator to scope a template match to the condition
when it is not `None`.
- Removes unnecessary implicit `.close()`s on file handles when using
context managers.

## Testing

- [x] I have tested my changes and verified that they work as expected
<!-- Make sure you did this step before marking your PR as ready for
merge. -->

### How to test the changes

<!-- Optional, it can speed up review process if you provide the
information on how to test your changes. -->
Just run `./local.sh`
2023-08-16 23:34:51 +02:00
.github fix: add index file 2023-07-10 21:47:24 +02:00
build-aux/flatpak Merge branch 'main' into blueprint-update 2023-08-16 19:40:41 +00:00
data chore: update UI definitions to Blueprint 0.8.0 syntax 2023-08-15 23:58:35 +02:00
gradience Merge branch 'main' into refactor-shell 2023-08-16 17:21:54 +00:00
po translate: translated using Weblate (Dutch) 2023-08-16 09:53:25 +02:00
repo feat: Update text 2023-07-13 21:51:32 +03:00
.editorconfig misc add more rules to .editorconfig 2023-03-12 19:53:27 +00:00
.gitignore meta: add builddir;export to .gitignore 2023-04-30 20:09:26 +00:00
.gitmodules feat: move plugins to submodules 2023-08-15 21:10:36 +02:00
.pylintrc meta: update and rename pylintrc 2022-12-27 21:13:20 +01:00
CHANGELOG.md doc: Fix typo 2023-05-04 22:04:00 +03:00
CODE_OF_CONDUCT.md feat: add link to gnome coc 2022-11-21 19:25:29 +01:00
gradience.doap chore: Update roadmap, fix doap gradience website 2023-06-27 15:43:47 +03:00
HACKING.md Update HACKING.md 2023-05-18 23:34:09 +03:00
LICENSE Create LICENSE 2022-08-10 23:51:10 +02:00
local.sh scripts: fix if statement in local.sh 2023-03-06 00:39:37 +01:00
local_cli.sh meson: configure local build launchers if buildtype is set to debug 2023-02-11 22:06:05 +01:00
MAINTAINERS.md fix: nicknames and links 2022-09-16 15:34:28 +03:00
Makefile meson: remove depracation warnings in newer Meson versions 2022-11-11 01:42:00 +01:00
meson.build chore: update project version to 0.8.0-beta1 2023-06-20 20:15:56 +03:00
README.md Update README.md 2023-08-13 07:03:12 +03:00
requirements.txt GNOME Shell theming support (#679) 2023-05-04 13:24:18 +00:00
ROADMAP.md doc: update roadmap 2023-06-28 09:43:15 +02:00
SECURITY.md chore: Update sec. policy versions 2023-06-27 15:38:58 +03:00
typos.toml misc: CI improvements (#700) 2023-01-18 03:04:00 +03:00

Important

This software is currently in a beta state. It can break things, and it doesn't yet have a polished, foolproof UX.

Contributions are welcome!

Please, if you got into some trouble with it, just create a new issue, or contact us on Matrix and Discord.

Gradience
Gradience

Change the look of Adwaita, with ease

Download on Flathub


Translation status Build status Flathub downloads Packaging status

Chat on Matrix Chat on Discord

Please do not theme this app

Preview

Gradience is a tool for customizing Libadwaita applications and the adw-gtk3 theme.

Important

Gradience, stopthemingmy.app and Adwaita Developers

The main features of Gradience include the following:

  • 🎨 Changing any color of Adwaita theme
  • 🖼️ Applying Material 3 color scheme from wallpaper
  • 🎁 Usage of other users presets
  • ⚙️ Changing advanced options with CSS
  • 🧩 Extending functionality using plugins
📷 More screenshots

Monet Tab

Proof of Work

Note

You can download latest nightly build from GitHub actions

🎨 Theming setup

Note

You can go to Preferences and apply overrides for Flatpak

🪛 Manual setup

Libadwaita applications

No additional setup is required for native Libadwaita applications.

For Flatpak Libadwaita applications, you need to override their permissions:

  • Run sudo flatpak override --filesystem=xdg-config/gtk-4.0 or
  • Use Flatseal and adding xdg-config/gtk-4.0 to Other files in the Filesystem section of All Applications

Vanilla GTK 4 applications

Use this guide to theme vanilla GTK 4 applications.

GTK 3 applications

  • Install and apply the adw-gtk3 theme (don't forget to install the Flatpak package!)
  • For Flatpak applications, you need to override their permissions:
    • Run sudo flatpak override --filesystem=xdg-config/gtk-3.0 or
    • Use Flatseal and adding xdg-config/gtk-3.0 to Other files in the Filesystem section of All Applications

🔄 Revert Theming

  1. Open Preferences window

Main Gradience Menu

  1. Go to Theming tab

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

Reset & Restore Presets Group

🪛 Manual revert

Remove GTK 3 and GTK 4 configs

  • Run rm -rf .config/gtk-4.0 .config/gtk-3.0

Remove adw-gtk3 theme

  • Run flatpak uninstall adw-gtk3 to remove Flatpak adw-gtk3 theme
  • Run rm -rf .themes/adw-gtk3 .themes/adw-gtk3-dark .local/share/themes/adw-gtk3 .local/share/themes/adw-gtk3-dark to remove local adw-gtk3 theme

Reset Flatpak overrides

  • Run sudo flatpak override --reset

Warning

This will reset all Flatpak overrides, such as Firefox Wayland override

📦 Alternative installation methods

Important

The main installation method is Flatpak from Flathub

Note

There are number of Gradience packages that are not tested by Gradience Team and not listed here, available at Repology

Fedora (COPR)

Gradience is available for Fedora via COPR:

dnf copr enable lyessaadi/gradience
dnf install gradience

Debian (And derivatives)

Warning

Not available yet.

Arch Linux (AUR)

Gradience is available for Arch Linux via AUR:

Using Paru:

paru -S gradience

For latest changes:

paru -S gradience-git
🪛 Without AUR helpers
git clone https://aur.archlinux.org/gradience.git
cd gradience
makepkg -sic

For latest changes:

git clone https://aur.archlinux.org/gradience-git.git
cd gradience-git
makepkg -sic

NixOS

Gradience is available for NixOS 23.05 (Stoat) and later:

To run in a temporary shell:

nix-shell -p gradience

To install:

nix-env -iA nixos.gradience

🏗️ Building from source

Nightly Remote

First of all, you need to have GNOME Nightly Flatpak remote added if it's not already:

flatpak remote-add --if-not-exists gnome-nightly https://nightly.gnome.org/gnome-nightly.flatpakrepo

Then, add the Gradience Flatpak remote:

flatpak remote-add --if-not-exists gradience-nightly https://gradienceteam.github.io/Gradience/index.flatpakrepo

Finally, install Gradience by running:

flatpak install gradience-nightly com.github.GradienceTeam.Gradience.Devel

GNOME Builder

GNOME Builder is the environment used for developing this application. It can use Flatpak manifests to create a consistent building and running environment cross-distro. Thus, it is highly recommended you use it.

  1. Download GNOME Builder.
  2. In Builder, click the "Clone Repository" button at the bottom, using https://github.com/GradienceTeam/Gradience.git as the URL.
  3. Click the build button at the top once the project is loaded.

For more building and installation methods, see HACKING.md

🎛️ Miscellaneous

Show welcome window again

The following command will make Gradience show welcome screen on next launch, like you just installed it

Flatpak

flatpak run --command=gsettings com.github.GradienceTeam.Gradience reset com.github.GradienceTeam.Gradience first-run

Alternative installation methods

gsettings reset com.github.GradienceTeam.Gradience first-run

FAQ

How can I launch a CLI?

Refer to temporary CLI documentation in repo's wiki for instructions on how to launch a CLI.

🙌 Contribute to Gradience

See HACKING.md

Contributors

Contributors

🏷️ About the Name

Gradience was originally named Adwaita Manager.

You can see the meaning of Gradience on Wiktionary.

The icon represents: A Paint Roller repainting an Adwaita window, keeping its functionality.

🖌️ About the "Pretty Purple"

The Pretty Purple theme comes from the very beginning, directly from the original author of Gradience, Artyom Fomin.

It was called "Purple Guy", presumably as a reference to the FNaF, later it was renamed to Pretty Purple.

Pretty Purple preset was originally shared in the https://github.com/GradienceTeam/Gradience/discussions/23.

Pretty Purple is built-in in the Gradience and used in all Gradience artworks.

🌱 Gradience, stopthemingmy.app and Adwaita Developers

See gradienceteam.github.io/hack

Gradience Team is not against the ideas of stopthemingmy.app and the developers of Adwaita. Gradience is a tool for tinkerers who want to theme their desktop to their liking, and not a tool for distributions to ship in their releases. Gradience Team agrees with importance of unified look of Adwaita to make sure that all apps function correctly and that developers have a unified and stable tool for creating their apps.

💝 Acknowledgment

Special thanks to:

  • Original author of Gradience, Artyom Fomin for creating this project
  • Weblate for providing translation platform

This README is based on README from Kooha by Dave Patrick Caberto

🪞 Mirrors