sway-launcher-desktop

授权协议 GPL-3.0 License
开发语言 SHELL
所属分类 应用工具、 终端/远程登录
软件类型 开源软件
地区 不详
投 递 者 季稳
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

sway-launcher-desktop Build Status

screenshot_2019-10-25-213740

This is a TUI-based launcher menu made with bash and the amazing fzf.Despite its name, it does not (read: no longer) depend on the Sway window manager in any way and can be used with just about any WM.

Features

  • Lists and executes available binaries
  • Lists and executes .desktop files (entries as well as actions)
  • Does not depend on xdg-utils. Just pure bash and awk
  • Shows a preview window containing whatis info of binaries and the Comment= section of .desktop files
  • History support which will highlight recently used entries
  • Colored output and glyphs for the different entry types
  • Entries are lazily piped into fzf eliminating any lag during startup
  • Optional support for the XDG Autostart specification
  • Executes arbitrary custom commands (if there are no other matches)

Installation

Make sure you have fzf installed and download this repository.Arch Linux users can also grab it from the AUR (thanks @turtlewit)

Configure it in Sway like this:

for_window [app_id="^launcher$"] floating enable, sticky enable, resize set 30 ppt 60 ppt, border pixel 10
set $menu exec $term --class=launcher -e /path/to/repo/sway-launcher-desktop.sh
bindsym $mod+d exec $menu

You can override the default icons/glyphs by setting the appropriate GLYPH_ variable in your $menu command, e.g.:

set $menu exec $term --class=launcher -e env GLYPH_COMMAND="" GLYPH_DESKTOP="" GLYPH_PROMPT="? " sway-launcher

By default, the launcher will use a generic & WM-agnostic command to launch the selected program.However, it will detect if its output is being piped to another program and merely printthe selected command in that case - instead of launching it by itself. You can use this to integrate the launcher with other tools.For example, if you wish to launch your programs with swaymsg exec, you can do that like this¹:

swaymsg exec "$(./sway-launcher-desktop.sh)"

Setup a Terminal command

Some of your desktop entries will probably be TUI programs that expect to be launched in a new terminal window. Those entries have the Terminal=true flag set and you need to tell the launcher which terminal emulator to use. Pass the TERMINAL_COMMAND environment variable with your terminal startup command to the script to use your preferred terminal emulator. The script will default to $TERMINAL -e

Configure application autostart

If you want to be able to autostart applications , this script provides a function to handle them for you. Simply run sway-launcher-desktop.sh autostart in your .bashrc, at the end of your i3/sway config, or wherever else you deem fit.

Extending the launcher

In addition to desktop application entries and binaries, you can extend sway-launcher-desktop with custom item providers.It will read the configuration of custom item providers from $HOME/.config/sway-launcher-desktop/providers.conf.The structure looks like this:

[my-provider]
list_cmd=echo -e 'my-custom-entry\034my-provider\034  My custom provider'
preview_cmd=echo -e 'This is the preview of {1}'
launch_cmd=notify-send 'I am now launching {1}'

The list_cmd generated the list of entries. For each entry, it has to print the following columns, separated by the \034 field separator character:

  1. The item to launch. This will get passed to preview_cmd and launch_cmd as {1}
  2. The name of your provider (the same as what what you put inside the brackets, so my-provider in this example)
  3. The text that appears in the fzf window. You might want to prepend it with a glyph and add some color via ANSI escape codes
  4. (optional) Metadata that you can pass to preview_cmd and launch_cmd as {2}. For example, this is used to specify a specific Desktop Action inside a .desktop file

The preview_cmd renders the contents of the fzf preview panel. You can use the template variable {1} in your command, which will be substituted with the value of the selected item.

The launch_cmd is fired when the user has selected one of the provider's entries.

Note: Pass the environment variable PROVIDERS_FILE to read custom providers from another file than the default providers.conf.The path in PROVIDERS_FILE can either be absolute or relative to ${HOME}/.config/sway-launcher-desktop/.

Keeping builtin providers

When a custom provider config is used, the default behaviour is to replace the hardcoded builtins. This is not always desirable if you merely wish to add something new. Luckily, the built-in providers only call specific functions of the main script, which are also accessible externally.So you can simply mimick their behaviour by placing this in your config file:

[desktop]
list_cmd=/path/to/sway-launcher-desktop.sh list-entries
preview_cmd=/path/to/sway-launcher-desktop.sh describe-desktop "{1}"
launch_cmd=/path/to/sway-launcher-desktop.sh run-desktop '{1}' {2}

[command]
list_cmd=/path/to/sway-launcher-desktop.sh list-commands
preview_cmd=/path/to/sway-launcher-desktop.sh describe-command "{1}"
launch_cmd=$TERMINAL_COMMAND {1}

Launcher history file

By default, sway-launcher-desktop stores a history of commands to make frequently used entries available more quickly.This history is stored in a file in ~/.cache/ (or $XDG_CACHE_HOME, if that environment variable is set).You may change the file path and name by setting the environment variable HIST_FILE to the desired path.Setting the variable to an empty value disables the history feature entirely.

Troubleshooting

Debug information is directed to file descriptor 3 and can be dumped using ./sway-launcher-desktop.sh 3>> ~/sway-launcher-desktop.log


¹ If you want to use this as a keybinding though, this kind of shell substitution will not work inside the config file. Here's a way to make it work

  •  Launcher是安卓系统中的桌面启动器,安卓系统的桌面UI统称为Launcher。Launcher是安卓系统中的主要程序组件之一,安卓系统中如果没有Launcher就无法启动 安卓桌面 ,Launcher出错的时候,安卓系统会出现“进程 com.android.launcher 意外停止”的提示窗口。这时需要重新启动桌面Launcher。 安卓系统Launcher的开发    一、主要文件和类

  • 看一下LauncherModel是怎么加载应用的 在LoaderTask的run方法中调用了 /** Returns whether this is an upgrade path */ private boolean loadAndBindWorkspace() { mIsLoadingAndBindingWorkspace = true; boolean isUpgradePa

  • Launcher3拖拽分析(基于Android 11 ) ==== 先简单分析一下 Workspace#onDragOver()方法 ,后续还有完整的Launcher3源码原理方法解析===== === 分析在Workspace中拖拽item === DragView存在的意义:代替BubbleTextView,在DragLayer上滑动。为什么呢?因为这个BubbleTextView的父布局不是

  • ====workspace====功能 workspace中文翻译为桌面,也有人称为IDLE界面,主要作用是摆放用户常用的一些Appwidget及app的Icon,也可以创建 folder 功能操作 1.左右滑动切换页面 2.长按workspace空白处会进入overview mode,用于选择Walllpaper和appwidget、或者快速启动setting应用;也可以调正workspace上

  • 替换Android桌面的相关问题: 1、想将home screen换成自己写的activity,该如何实现? 在你要设置为home screen的那个activity的androidManifest.xml中的<intent-filter>标签中加上这几句 话<category android:name="android.intent.category.HOME" /> <category and

 相关资料
  • launcher 可以独立启动的java应用程序,我们可以去实现接口来开发我们自己的java独立应用程序。

  • User Guides Please start here! Send a payment with the Joule Chrome extension Requirements ~300 GB of download bandwidth ~10 GB of disk space (~300 GB if you want the Bitcoin transaction index, makes

  • NT-Launcher(梅糖桌面)是一个简陋的桌面系统,适用于类似于多看、有道等安卓系统的 Eink 电纸书的用户。 多看优化版本:https://gitee.com/rabbitTang_admin/NT_Launcher_DK English The main update locations are :https://gitee.com/rabbitTang_admin/NT-Eink-La

  • Browser-Launcher可以检测系统上的所有浏览器版本,并在一个独立的配置文件中启动它们,用于自动测试。 示例代码: var launcher = require('launcher');launcher(function (err, launch) {    if (err) return console.error(err);    console.log('# available b

  • Launchy是个类似于Mac上QuickSilver的小软件,用于快速启动程序,它可以在Windows下运行。 支持插件扩展

  • Remote Launcher 是一个 Android 上的简单易用的程序,可通过简单点击来启动和远程 PC 上的应用程序,设置可在关机状态下启动机器。它包含两部分,一个是运行在 PC 端的小服务程序,另外一个是手机上的应用。