Skip to main content

Change the IBus GTK theme or extracting IBus style from GNOME Shell theme.

Project description

IBus Theme Tools

last-commit pipy

GPL Licence Repo-Size

Total alerts Language grade: Python

中文 Chinese

Python Library Dependency

Pre-knowledge

IBus has its front-end based on GTK, and GNOME replace that front-end with its GJS version to make it more unified with GNOME.

As a result, in non-GNOME Shell desktop environment, the display effect of IBus is determined by the current GTK theme.

$HOME/.config/gtk-3.0/settings.ini defines the current GTK3 theme and font size.

Example of the content of the file is as follows:

[Settings]
gtk-theme-name=Materia-light
gtk-font-name=更纱黑体 SC 12

In the above content, gtk-theme-name specifies that the current GTK theme is material-light, gtk-font-name specifies that the current font is 更纱黑体 SC and the font size is `12 '.

The IBus font and font size can be changed by modifying the above documents.

As for the color scheme of IBus, you can specify that it uses specific GTK theme when IBus starts, and then customize the color matching of IBus.

Installation

You can directly use pip to install:

pip install ibus-theme-tools
ibus-theme-tools

Or just install manually:

git clone https://github.com/openSUSE/IBus-Theme-Tools.git
cd IBus-Theme-Tools && python3 setup.py install
ibus-theme-tools

If you use Arch Linux, you can also use AUR to install as a system extension:

yay -S ibus-theme-tools

AUR

Functionality

Non-GNOME desktop

Change the IBus GTK theme in a non-GNOME Shell desktop environment.

Run ibus_theme_tools.py script, select GTK theme according to prompted message.

After changing the GTK theme, the program will automatically add the startup item of changing IBus GTK theme to the current user's $HOME/.config/autostart/ directory.

Sample startup item file: org.hollowman.ibus-gtk-theme-customize.desktop

If you install themes that support GNOME shell style, you can also choose to extract IBus style, but you can only use it on GNOME desktop.

Customize IBus colors (Create a GTK theme)

Create a GTK3 theme called ibus-custom-theme by running:

mkdir -p $HOME/.themes/ibus-custom-theme/gtk-3.0
$EDITOR $HOME/.themes/ibus-custom-theme/gtk-3.0/gtk.css

then edit the file content. An example can be:

* {
  color: #0b141a; /* Font Color */
  background-color: #ffffff; /* Background Color */
  -gtk-secondary-caret-color: #d4d4d4; /* Highlight Background Color */
}

After that, run the program, then select the theme ibus-custom-theme which you just created.

GNOME desktop

Extracting IBus style from GNOME Shell theme, implement it using CSS parser library tinycss2 in Python. Additional IBus style sheets are generated for users to modify and test.

Run ibus_theme_tools.py script, operate according to prompted message.

When user chooses a theme from the list, this script will first read the theme CSS file, extract the IBus related style classes (.candidate-*), then write it to stylesheet.

Then use the Customize IBus GNOME Shell extension to import and apply themes.

Note: If you make any changes to the extracted stylesheet after applying the file in above extension, please disable and then enable custom IME theme again to make the changes take effect.

Sample extracted stylesheet: exportedIBusTheme.css

Note

This project is part of the achievement of @HollowMan6 partipating the Google Summer of Code 2021 at OpenSUSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ibus-theme-tools-3.1.1.tar.gz (23.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ibus_theme_tools-3.1.1-py3-none-any.whl (22.6 kB view details)

Uploaded Python 3

File details

Details for the file ibus-theme-tools-3.1.1.tar.gz.

File metadata

  • Download URL: ibus-theme-tools-3.1.1.tar.gz
  • Upload date:
  • Size: 23.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.2 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.10

File hashes

Hashes for ibus-theme-tools-3.1.1.tar.gz
Algorithm Hash digest
SHA256 5a40e55f03186e032f696dad58b6f95734e09a8d898511a6505cc588a78de5fe
MD5 1b3fa15641c72af98ddafee177fa9bb5
BLAKE2b-256 3eb124de601b87809463c6c546059f1c576e0fe848c70cbdd837a9a8ba45ffb7

See more details on using hashes here.

File details

Details for the file ibus_theme_tools-3.1.1-py3-none-any.whl.

File metadata

  • Download URL: ibus_theme_tools-3.1.1-py3-none-any.whl
  • Upload date:
  • Size: 22.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.2 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.10

File hashes

Hashes for ibus_theme_tools-3.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a3581e49a8593d9d526a3d0fa35701ea5631f6414e51ecceed8db79cbc933428
MD5 47272711ffac9c0745d0639276129c6f
BLAKE2b-256 348d6d81ccb828f8dd3b1742239433d9e7119a0332fc4b60da85dd9043938085

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page