Rofi Trial
Before I used WoFi, I had already noticed RoFi. At that time, I was troubled by RoFi not supporting Wayland and needed a powerful program launcher, so I finally chose WoFi.
Recently, when I was watching videos, I saw someone configure a more exquisite rofi skin, which mentioned that rofi can also be used to switch windows (window switcher). Generally speaking, window switching is implemented by DE and WM by default.
Independent software dedicated to switching programs seems redundant, but it is not.
For example, under labwc, switching windows can only switch windows contained in the current workspace, which has certain limitations.
Second, suppose you are a madman and need to open many windows to carry out a certain work, and there are more than 8 programs opened at the same time. At this time, in the system default window switcher, to accurately find the target program window, it is almost entirely based on naked eye positioning, which is still a little difficult. At this time, rofi's fuzzy search matching comes in handy.
In addition, rofi can also be used with some emoji components to select emojis, such as if you want to copy this magnet emoji🧲, or some strange Tokyo Tower🗼. If your input method does not have this function, you can use rofi + emoji components to deal with it.
Of course, the official rofi also has additional fancy ways to play: ssh login, file browsing, secret selection, etc. I personally feel that it is a bit too much, maybe someone needs it.
I mainly use it to switch windows.
1. Installation
Under Arch, there are two rofi packages rofi
and rofi-wayland
. If you are in the wayland environment, it is recommended to use rofi-wayland. I tested it and the rofi package cannot switch windows. The corresponding source code is different and has not been merged yet. I don’t know why.
1sudo pamcna -S rofi-wayland
2. Configuration
My configuration is very simple. I searched for various themes, but I didn’t like any of them, and I was too lazy to bother.
1➜ ~ grep -Ev '^(/\*|$)' .config/rofi/config.rasi
2configuration {
3font: "mono 16";
4show-icons: true;
5icon-theme: "Papirus";
6timeout {
7action: "kb-cancel";
8delay: 0;
9}
10filebrowser {
11directories-first: true;
12sorting-method: "name";
13}
14}
Only change these font: "mono 16"; show-icons: true; icon-theme: "Papirus"
, that is, font, display icon, icon library.
If you like to tinker and like to customize themes, you can check out the official documentation of rofi. There is a command line tool rofi-theme-selector
that can help you test the effect.
3. Bind shortcut keys
1➜ ~ grep -A1 -B1 'rofi -theme-str' .config/labwc/rc.xml
2<keybind key="F9">
3<action name="Execute" command="rofi -theme-str 'element-icon { size: 1.0em;}' -show window" />
4</keybind>
The default icon is very small, and the icon size is changed here. It looks like a simple configuration -theme-str 'element-icon { size: 1.0em;}
. I found it after searching through boxes and cabinets. It can also be put into the theme configuration. I use the default one, so I put it here. Changing the theme will not be affected.
4. Effect screenshots
Rofi's program switching interface, you can search and filter at the top, and when there are many candidates, you can quickly hit.
The program switching interface that comes with labwc will show whether it is running under Wayland. If it is xdg-shell, it means it is running natively under Wayland. For example, if you start Dota2, that line will show Xwayland. By default, Dota2 runs under Xwayland. If you force Wayland to be turned on, you cannot input Chinese characters and the frame rate will drop significantly.
Each has its own advantages and disadvantages. I use rofi as a backup. When rofi is in window mode, some software cannot obtain icons. For details, please refer to this issue
According to my experiment, changing the icon library will alleviate the situation. For example, the default icon set cannot display the icons of sublime text, but it can be displayed by changing to Papirus.
In this case, I choose to be patient. Linux users with many years of experience will naturally understand that it is not critical, just pretend not to see it and habitually ignore it😅. Unless it really has a big impact or you care about it, you will fall into the vortex🌀, wasting time and effort infinitely.
Copyright statement:
- All content that is not sourced is original., please do not reprint without authorization (because the typesetting is often disordered after reprinting, the content is uncontrollable, and cannot be continuously updated, etc.);
- For non-profit purposes, to deduce any content of this blog, please give the relevant webpage address of this site in the form of 'source of original text' or 'reference link' (for the convenience of readers).
See Also:
- My Toolbox
- Labwc replaces customized skin
- Website navigation bar prevents insertion of Adsense automatic ads
- Solve the problem that VSCode cannot input Chinese under Arch
- Labwc Convenient Configuration
- Window manager labwc usage notes
- Mini console assembly notes
- Practical automatic proxy configuration example
- Openvpn Example
- labwc environment enables wlogout