Code Monkey home page Code Monkey logo

ibus-theme-tools's Introduction

IBus Theme Tools

last-commit pipy

GPL Licence Repo-Size

Total alerts Language grade: Python

Welcome to contribute your translation on Weblate!

Translation Status

中文 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:

yay -S ibus-theme-tools

(For Manjaro user, since unlike Arch Linux, the dependency python-tinycss2 is not included in the official package repository. You can install that dependency using the pkg file by manually downloading it from the Arch Linux community repository just like the following example)

wget https://ftp5.gwdg.de/pub/linux/archlinux/community/os/x86_64/python-tinycss2-1.1.1-1-any.pkg.tar.zst
sudo pacman -U python-tinycss2-1.1.1-1-any.pkg.tar.zst
rm python-tinycss2-1.1.1-1-any.pkg.tar.zst

AUR

For openSUSE, you can install directly through the ymp file.

You can download the majority of your Linux distributions related packages through OpenSUSE OBS and then install.

For Ubuntu, you can use PPA to install:

sudo add-apt-repository ppa:hollowman86/ibus-theme-tools
sudo apt-get update

For Gentoo:

git clone https://github.com/openSUSE/IBus-Theme-Tools.git
cd IBus-Theme-Tools && make emerge

For NixOS:

sudo nix-env -i ibus-theme-tools

For Guix:

guix install ibus-theme-tools

Functionality

Non-GNOME desktop

Generate the IBus GTK theme in a non-GNOME Shell desktop environment and supporting to select a background picture or configure border radius.

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

After generating the new theme, just select the theme in the system theme configuration.

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 your IBus style sheet has changed after application, please close and reopen the corresponding custom IME theme to make it effective. Starting from v69, now this extension support stylesheets hot reload, CSS changes will reflect in real-time.

Sample extracted stylesheet: exportedIBusTheme.css

Note

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

ibus-theme-tools's People

Contributors

hollowman6 avatar weblate avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ibus-theme-tools's Issues

[Help Wanted]: GTK candidate highlight color can't be overwritten

It looks like the GTK candidate highlight color can't be set in current version (v4.1.0), and I can't find a way to solve this issue.

It seems to be related to ibus/ibus@bdc83bc , and the color can't be overwritten once the imported stylesheet has that color definitions. Maybe it's because that commit gets the color directly from the global GTK style properties, having no idea how to make a workaround except for changing the upstream.

I've tried adding the following seperately in the hope to change the GTK candidate highlight color in the tools' generated GTK stylesheets so far, and none of them successfully changed the candidate highlight color, but just follow the imported (base) GTK definitions.

#IBusCandidate * {
  background-color: #000000;
  -gtk-secondary-caret-color: #000000;
}
* {
  background-color: #000000;
  -gtk-secondary-caret-color: #000000;
}

If you know what's going on here, please tell me or simply submit a PR, thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.