应用启动器yofi使用配置

应用程序启动器(application launcher), 通常是用来快速定位和启动计算机中的其它程序的。例如 Linux 中的 Albert Launcher、Synapse,macOS 中的 Alfred 等。Gnome 环境按 Super 快捷键后也是差不多的功能。

启动器一般有模糊搜索功能,本文介绍的是 yofi,一个用 rust 编写的适用于 wanyland 环境的轻量启动器,rust 编写好感度增加,作者还在积极维护,目前看起来使用的人不多,写这个文章的时候,Google 搜索不出中文相关资料,不小心填补了中文世界的空白,做了一点点微小工作,功德+1。

1. 下载编译安装

  • 下载源码
1 git clone https://github.com/l4l/yofi
  • 编译安装

rust 的应用,cargo 编译,省心省力,坐等生成可执行文件即可。生成的二进制在target/release/目录下,

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]=83e34f2d6952622f6767b088083ed045c53ca4df, for GNU/Linux 3.2.0, with debug_info, not stripped
  • 做个软链接

方便后续升级

1sudo ln -s /home/mephisto/github/yofi/target/release/yofi /usr/bin/yofi
  • 绑定个快捷键

如果你是 Gnome 环境: Settings/Keyboard/Coustom Shortcuts 根据喜好设置快捷键。

图示:

Gnome yofi settings

F8搜索启动对应的程序,使用频次高的会靠前展示。

Gnome yofi

如果你是 Sway 环境:

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

意思是绑定F8快捷键,执行 yofi apps 命令

图示:

sway yofi

我主要用 Gnome 和 sway 两个环境,其它不做介绍。

可能有读者会有疑问,既然 Gnome 的Super键有类似效果,为什么还要费劲。先生此言差矣,不是人人都用 Gnome,比如用 sway 环境的时候,Gnome 不好定制,这个想怎么改就怎么改,还有黑名单等功能,详情参考yofi wiki

2. 个性化配置

主要定制 yofi 呼出后的样式,例如窗口大小、字体、圆角、颜色相关。

记得找个好看的图标集,绝对值得,颜值也很关键,我选的Papirus,理由是好看,图标多且全。

个人配置仅供参考:

  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"
最后修改于: Friday, February 23, 2024
欢迎关注微信公众号,留言交流。

相关文章:

翻译: