Integrade IBus 1.5 and gnome-shell 3.6 on Gentoo

IBus becomes to a choice of universal input method platform on GNOME 3. In this post, I’ll introduce how to set up IBus with ibus-chewing properly on Gentoo with gnome-shell 3.6. This is also a note for the trail-and-error procedures for these days.

1.Unmask the restriction of IBus and related resources

# vim /etc/portage/package.accept_keywords

Then add the following sequences to unmask required packages:

=app-i18n/ibus-chewing-1.4.3 ~x86
=app-i18n/ibus-1.5.2 ~x86

NOTE: The version of packages and its related resources may vary with time. You should check the ebuilds in your portages and unmask them manually. Also, with their build-dependent packages and the input methods you want to install.

2. Install IBus and related input methods

# emerge ibus ibus-chewing

NOTE: The post-installation messages of IBus will encourage you to add some environment setting in your X-related settings. However, in my opinion, you can ignore them if you are using gnome-shell.

3. Integrate IBus with gnome-shell

$ gnome-control-center

In the opened “System Settings” window. Select the icon named “Region & Language“. In the “Input Sources” tab:
a. Add the input sources you want to use. E.g., Chinese(Chewing)
b. Set up the shortcut for switch input methods. E.g., Ctrl+Space

Finally, re-login into your session and everything should works. Enjoy it. 🙂

Change default theme font settings of gnome-shell

Although I’ve post how to make the DROID font as the default font family in Ubuntu, the works have no 100% work in default gnome-shell theme. In summary the steps to set DROID font globally are:

  1. Make sure the font priority is the highest one. Ref: Use droid font as default on Ubuntu 12.04
  2. Install the gnome-tweak-tool and use it to make all the FONT family settings are Sans and Monospace.
  3. Re-login and it works.

However, the top panel and some UI still use the cantarell as default font (since version 3.6, I guess). We should substitute them to make an uniform UI. I’ll introduce two ways as follows:

1. Alter the gnome-shell CSS directly. It is simplest and perfect. However, the settings will be OVERWRITE after upgrading gnome-shell. The steps are:

$ sudo vim /usr/share/gnome-shell/theme/gnome-shell.css

You will see the stage block (in my system, it is at Line 24) as:

/* default text style */
stage {
font-family: cantarell, sans-serif;
...

Then delete the cantarell font family setting as:

/* default text style */
stage {
font-family: sans-serif;
...

Then it works when you re-login.

2. Use a local .fonts.conf to override font settings. It is a per-user work but still a feasible solution.

$ vim ~/.config/fontconfig/fonts.conf

Then copy the following settings, paste and save.

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>

        <match target="pattern" name="family">
                <test name="family" qual="any">
                        <string>Cantarell</string>
                </test>
                <edit name="family" mode="assign" binding="same">
                        <string>Sans</string>
                </edit>
        </match>

</fontconfig>

After re-login or restart gnome-shell, it works.

The above two are for top-panel/UI font family that the gnome-tweak-tool cannot alter to. Moreover, the font-size of top panel is also controlled by the theme CSS. If you want to alter the default top panel font size, please alter the css file manually. Enjoy it. 🙂

Use RTL8192SE wireless card in Gentoo with kernel 3

Although I had solve this problem earlier, I forgot the solution when I built a new system today. The configuration in kernel’s menuconfig is:

1
2
3
4
5
6
7
8
9
10
Symbol: RTL8192SE [=m]
Type  : tristate
Prompt: Realtek RTL8192SE/RTL8191SE PCIe Wireless Network Adapter
Defined at drivers/net/wireless/rtlwifi/Kconfig:13
Depends on: NETDEVICES [=y] && WLAN [=y] && MAC80211 [=m] && EXPERIMENTAL [=y]
Location:
-> Device Drivers
-> Network device support (NETDEVICES [=y])
-> Wireless LAN (WLAN [=y])
Selects: FW_LOADER [=y] && RTLWIFI [=m]

But after reboot, it still not loaded. Via dmesg, it caused by firmware missing. There’s a package named rtl8192se-firmware in portage tree but it is NOT the one we need. What we need to do is to:
# emerge linux-firmware.
After this step, it works. 🙂

Use GCIN and gnome-shell on Gentoo

Despite the common usage of input method is iBus, GCIN is still my favorite one for Chinese. But with the upgrading of GNOME 3 (gtk3) and in Gentoo, there are notes should be wrote down.

1. The GCIN package is not provided officially by Gentoo’s portage tree. But with hard works of gentoo communities in gentoo-zh (from gentoo-taiwan and gentoo-china), we can use GCIN via layman:

1
2
# layman -L
# layman -a gentoo-zh

2. Add gtk3 use flag for GCIN in /etc/portage/package.use:
# echo 'app-i18n/gcin gtk3' > /etc/portage/package.use
3. Some note to make GCIN works is listing in Linux/X window gcin 無法使用的檢查事項.For example:
a) My own configuration for environment variable declare is in ~/.xprofile:

1
2
3
export GTK_IM_MODULE=gcin
export QT_IM_MODULE=gcin
export XMODIFIERS=@im=gcin

b) To install GCIN’s module in gtk2/3 on x86 (i686) Gentoo OS:

1
2
# gtk-query-immodules-2.0 > /etc/gtk-2.0/i686-pc-linux-gnu/gtk.immodules
# gtk-query-immodules-3.0 --update-cache

[20120209 edit]
The latest version since 2.7.1 disable the En input method (IM) for switching by default. And for my newly installed gentoo box, I cannot switch IM if the default method is set as En.

It is not convenient when I set other IMs as default, because I need to change to En by pressing an additional shift key or ctrl-space hotkey.

Help from GCIN forum by coolcd, the solution is to close the default attribute after IM launch. The setting is to un-check the box in gcin-tools for:

Default input method and toggle key > Toggle on input mode by default (non-XIM only)

After restart GCIN, the IM mode by default is En that like most IME done.

Enjoy it. 🙂

Make cpufreqd work as module in Gentoo

I’m using the default setting via genkernel to build my box. But the cpufreqd always shown it cannot be start-up without the kernel config CONFIG_CPU_FREQ.

But the weird thing is: I’ve selected the CPU_FREQ* settings in my kernel and there are corresponding modules in /lib/modules/<kernel version>:/

1
2
3
4
5
6
7
8
9
10
11
12
13
14
CONFIG_CPU_FREQ=y
CONFIG_CPU_FREQ_TABLE=m
CONFIG_CPU_FREQ_STAT=m
CONFIG_CPU_FREQ_STAT_DETAILS=y
# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
CONFIG_CPU_FREQ_GOV_POWERSAVE=m
CONFIG_CPU_FREQ_GOV_USERSPACE=y
CONFIG_CPU_FREQ_GOV_ONDEMAND=m
CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m
...

Finally, I found the reason: the modules (also the government settings) not be auto-loaded when booting. So I append the configuration for module auto-load for gentoo and everything works fine.

1. The final kernel configuration, I’ve change the default government setting from performance to userspace which make me can choose the speed I want:

1
2
3
4
5
6
7
8
9
10
11
12
13
CONFIG_CPU_FREQ=y
CONFIG_CPU_FREQ_TABLE=m
CONFIG_CPU_FREQ_STAT=m
CONFIG_CPU_FREQ_STAT_DETAILS=y
# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y
# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
CONFIG_CPU_FREQ_GOV_POWERSAVE=m
CONFIG_CPU_FREQ_GOV_USERSPACE=y
CONFIG_CPU_FREQ_GOV_ONDEMAND=m
CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m

2. The auto-load module settings in gentoo (/etc/conf.d/module):

1
modules_3_0="acpi-cpufreq cpufreq_ondemand cpufreq_powersave cpufreq_conservative"

Which will load the INTEL’s CPUFREQ driver (acpi-cpufreq) and the governments.
Note: The governments which is loaded can be used in the programs (eg: Gnome’s CPU Frequency Scaling Monitor).
Note: the modules should be set AT LEAST major AND minor number of kernel (eg: 3.0 as 3_0) or it cannot be parsed.

Finally, everything works fine. Enjoy it. 🙂

GRUB settings of booting from usb disk with genkernel on Gentoo

I’ve tried to use genkernel to build my gentoo box recent days. But I cannot boot correctly via an installation with external USB disk (My gentoo box is on an external USB 2.5″ disk).

The default GRUB settings for genkernel user is:

1
2
3
4
title Gentoo Linux 2.6.34-r1
root (hd0,0)
kernel /boot/kernel-genkernel-x86-2.6.34-gentoo-r1 real_root=/dev/sda3
initrd /boot/initramfs-genkernel-x86-2.6.34-gentoo-r1

But with this configuration, the boot procedure will stop at there is not correct root sector can be loaded. That’s because the usb is slower o be configured than my laptop’s disks. And on the other hand, the waitroot, doslowusb, and so on additional configurations cannot be passed to a genkernal-ed source.

For some tries and referenced configurations on other linux distribution, the works setting is to use UUID (UUID=….) rather than aliased device name (dev/$ROOT). The correct settings:

1
2
3
4
title Gentoo Linux 2.6.34-r1
root (hd0,0)
kernel /boot/kernel-genkernel-x86-2.6.34-gentoo-r1 real_root=UUID=....
initrd /boot/initramfs-genkernel-x86-2.6.34-gentoo-r1

The UUID for devices can be found in your /etc/fstab if you also use genkernel. Finally, my USB gentoo works fine. Enjoy it. 🙂