Application launcher yofi configuration

Application launcher (application launcher), usually used to quickly locate and launch other programs in the computer. For example, Albert Launcher and Synapse in Linux, Alfred in macOS, etc. After pressing the Super shortcut key in the Gnome environment, the function is similar.

The launcher generally has a fuzzy search function. This article introduces yofi, a lightweight launcher written in rust and suitable for the wanyland environment. The popularity of rust writing has increased, and the author is still actively maintaining it. At present, it seems that not many people use it. When I wrote this article, Google couldn’t find relevant information in Chinese, so I accidentally filled the gap in the Chinese world. I did a little bit of work, and my merit +1.

1. Download, compile and install

  • Download the source code
1 git clone https://github.com/l4l/yofi
  • Compile and install

The application of rust, cargo compilation, save worry and effort, just wait for the executable file to be generated. The generated binary is in the target/release/ directory,

1➜ cargo run --release
2➜ yofi git:(master) ls
3  Cargo.lock Cargo.toml CHANGELOG.md flake.lock flake.nix LICENSE README.md rust-toolchain src target
4➜ yofi git:(master) ls -al target/release/yofi
5  -rwxrwxr-x 2 mephisto mephisto 11454816 Mar 17 14:54 target/release/yofi
6➜ yofi git:(master) file target/release/yofi
7  target/release/yofi: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=83e34f2d6952622f6767b088083ed045c5 3ca4df, for GNU/Linux 3.2.0, with debug_info, not stripped
  • make a soft link

Convenience for subsequent upgrades

1sudo ln -s /home/mephisto/github/yofi/target/release/yofi /usr/bin/yofi
  • Bind a shortcut key

If you are in the Gnome environment: Settings/Keyboard/Coustom Shortcuts Set shortcut keys according to your preferences.

Graphic:

Gnome yofi settings

Press F8 to search and start the corresponding program, and the ones with the highest frequency of use will be displayed first.

Gnome yofi

If you are a Sway environment:

1➜ ~ grep yofi ~/.config/sway/config
2     #yofi lancher
3     bindsym F8 exec yofi apps

It means to bind the F8 shortcut key to execute the yofi apps command

Graphic:

sway yofi

I mainly use Gnome and sway two environments, others will not be introduced.

Some readers may have doubts, since Gnome's Super key has a similar effect, why bother. Sir, this is wrong. Not everyone uses Gnome. For example, when using the sway environment, Gnome is not easy to customize. You can change it as you want, and there are functions such as blacklist. For details, refer to [yofi wiki](https:/ /github.com/l4l/yofi/wiki)

2. Personalized configuration

Mainly customize the style after yofi calls out, such as window size, font, rounded corners, and color.

Remember to find a good-looking icon set, it is definitely worth it, and the appearance is also very important. I chose Papirus because it looks good, and there are many and complete icons.

Personal Configuration is for reference only:

  1➜  ~ cat ~/.config/yofi/yofi.config
  2# Width/height of the app in pixels
  3width = 800
  4height = 512
  5
  6# If set forces usage of basic window instead of Layer Shell wayland protocol
  7force_window = false
  8
  9# if unset, renders window centered
 10# window_offsets = [500, -50] # in format [top_offset_pixels, left_offset_pixels]
 11
 12# Similar to CSS border-radius for main window, for more details see corner_radius
 13# for [input_text]
 14corner_radius = "0"
 15
 16# font = "DejaVu Sans"
 17font = "Source Sans Pro"
 18# or you may use an absolute path, e.g:
 19# font = "/usr/share/fonts/TTF/DejaVuSans.ttf"
 20font_size = 24
 21
 22# Color of the app background
 23# Colors are specified in 0xRRGGBBAA format
 24bg_color = 0x272822ee
 25# Border around background
 26#bg_border_color = 0x131411ff
 27bg_border_color = 0xa6e22eff
 28# bg_border_width = 2.0
 29
 30# Color for the fonts
 31# font_color = 0xf8f8f2ff
 32
 33# HiDPI scaling factor; default is requested from compositor but
 34# fractional values are truncated, so one may want to set it explicitly.
 35# scale = 3
 36
 37# Terminal emulator to use for apps that require terminal.
 38# Certain apps like vim might not launch unless specified.
 39#term = "alacritty -e"
 40
 41# TOML sections are scope config values for a related blocks.
 42# This one for instance is for input field area.
 43[input_text]
 44# font = ...
 45font_color = 0xf8f8f2ff
 46bg_color = 0x75715eff
 47
 48# Margin/padding values are specified as in CSS but only in pixels.
 49# So it's either a single value for all directions
 50# or two values: the first for top/bottom and the second for left/right
 51# or finally four values: for top, right, bottom and left directions respectively.
 52margin = "5" # equivalent to "5 5 5 5"
 53padding = "1.7 -4" # equivalent to "1.7 -4 1.7 -4"
 54
 55# Corner radius is the arc radius for the surrounding input box.
 56# Similar to border-radius in CSS but only in pixels.
 57# So it's either a single value for all corners
 58# or two values: the first for top-left/bottom-right and the second for top-right/bottom-left
 59# or finally four values: for top-left, top-right, bottom-right and bottom-left respectively.
 60# By default the radius is a maximal possible value.
 61# corner_radius = "1 2 3 4"
 62
 63# Section for items in the search results area.
 64[list_items]
 65# font = ...
 66font_color = 0xf8f8f2ff
 67
 68# Font color for an item that currently selected
 69selected_font_color = 0xa6e22eff
 70
 71# if specified, search matches are emphasized with this color
 72match_color = 0xe69f66ff
 73
 74margin = "5 10"
 75
 76# If set to true hides the desktop actions
 77hide_actions = false
 78# Specify left margin for action line
 79action_left_margin = 60
 80
 81# Additional spacing between list items.
 82# By default there's a space around 10 pixels
 83# the value can be reduced by specifying a negative value
 84item_spacing = 2
 85
 86# Spacing between an icon and a text.
 87icon_spacing = 5
 88
 89# Sections for the icons. When this section presents, icons are displayed
 90[icon]
 91# For now app only supports fixed sized icons and there's no icon up/down-scaling yet.
 92# More info: https://github.com/l4l/yofi/issues/76#issuecomment-1023631399
 93size = 32
 94
 95# For the icon search path, by default "hicolor" is used which usually not what you want.
 96theme = "Papirus"
 97
 98# If no icon found for an entry, this one will be used instead
 99#fallback_icon_path = "/usr/share/icons/Adwaita/16x16/categories/applications-engineering-symbolic.symbolic.png"
100fallback_icon_path = "/usr/share/icons/Papirus/32x32/apps/rust.svg"
Lastmod: Monday, August 28, 2023

See Also:

Translations: