Wofi Tutorial

When I introduced labwc last time, the wofi launcher part was not explained. Similar ones include rofi, yofi, etc., which are similar. I wrote a yofi-related article before, and interested readers can take a look.

The warehouse address of wofi is not in github, but in https://hg.sr.ht/~scoopta/wofi, the official description:

Wofi is a launcher/menu program for wlroots based wayland compositors such as sway

From this description, it can be seen that it can be used as a launcher and also as a display menu. This article introduces these two usage modes, and I am very satisfied with the overall experience.

Look at the sample screenshot first:

Launcher:

wofi launcher

Clipman's clipboard history display (menu)

wofi menu

It has to be said that a software is used polymorphically, with fast response, beautiful interface, and no problems. It is recommended to use.

1. Installation

  • Direct apt install (recommended)

    1sudo apt install wofi
    
  • Source code compilation and installation

    The advantage of source code installation is that you can install the latest version

    1hg clone https://hg.sr.ht/~scoopta/wofi
    2cd wofi
    3meson setup build
    4ninja -C build
    5sudo ninja -C build install
    

2. Launcher configuration

You can use my configuration directly: https://github.com/kmephistoh/dotfiles/tree/main/.config/wofi

It is used every day during the working day, and it is easy to deceive.

 1➜ cat config
 2show=drun
 3width=750
 4height=400
 5always_parse_args=true
 6show_all=false
 7insensitive=true
 8allow_images=true
 9normal_window=true
10allow_markup=true
11prompt= 👍Start fast, start fast! I'm afraid you won't use it! 🤔
12pwd
13/home/mephisto/.config/wofi

It is worth mentioning that allow_images=true means to enable icon display, and there is an underscore between allow and images. I used a hyphen in the document at first, but it didn’t take effect. Look at the source code to confirm that it is an underscore. It seems that the parameters of double words must use underscores. The other parameters are simple and need no introduction.

style.css is the css file, which controls the display of the interface. CSS experts can give full play to it, and change what they don’t like.

Look at the desktop environment you have used, and configure a trigger key. You used to use Gnome and now use labwc. It is very convenient to configure.

Labwc configuration example, press F8 to pop up the wofi launcher

1<keybind key="F8">
2     <action name="Execute" command="wofi" />
3</keybind>

3. Clipboard menu configuration

This part is more complicated and requires the cooperation of three softwares to complete the work. I tested that it cannot work under Gnome (Mutter's pot).

The three software are:

  • wl-clipboard The clipboard tool under wayland, you can directly install it with apt, or click the link to read the document, so I won’t go into details here.

  • clipman The clipboard manager under wayland can also be installed directly with apt, and the clipboard history function needs to be used.

  • wofi is now used for clipboard history query and selection

Core configuration points:

    1. Set boot to start
1#clipman
2wl-paste -t text --watch clipman store > /dev/null 2>&1 &

It means that every time the content of wl-paste changes, it will be saved in clipman

    1. Set wofi as the selector of clipman
1clipman pick --tool wofi -T'--prompt=clipboard-history -i'

The parameters in single quotes are the parameters of wofi, which are prompt phrases and ignore case. After the configuration is complete, you can run the test directly to see if the menu can pop up.

    1. Configure shortcut keys Example in labwc:
1<keybind key="C-semicolon">
2     <action name="Execute" command="clipman pick --tool wofi -T'--prompt=clipboard-history -i'" />
3</keybind>

It means to press Ctrl+; to pop up the clipboard history menu, which is the same as the default shortcut key setting of Fcitx5 (if you decide to use wofi+clipman to take over the clipboard, you need to close the clipboard function in Fcitx5).

Under Gnome, I remember that I didn’t set it successfully before (the reason of mutter), because I have switched to labwc, and interested readers can try it by themselves.

key="C-semicolon" How did the key name come from? Please check this openbox documentation, it is running the xev command, and then press the ; number to see what the corresponding name is, openbox is really unique, labwc The set of configurations used by openbox.

openbox-key

Other common correspondences:

-S Shift key

  • C Control key -A Alt key
  • W Super key (Usually bound to the Windows key on keyboards which have one)
  • M Meta key
  • H Hyper key (If it is bound to something)

Finally, when you select the target strip, you need to press Ctrl+v to copy it to the target, which is a bit inconvenient, but software such as Fcitx5 and copyq cannot paste it correctly every time. Considering the appearance of wofi, there is no situation where the paste cannot be pasted so far, so it is barely acceptable. After all, reading the cutting history is not a particularly high-frequency operation. Of course, if it can be set to automatically paste in the future, and you can use the shortcut keys of vi to move and delete, it will be perfect.

Lastmod: Friday, February 23, 2024

See Also:

Translations: