Skip to content

Commit

Permalink
Merge pull request #84 from pdonadeo/master
Browse files Browse the repository at this point in the history
Make fzf preview window configurable
  • Loading branch information
Biont authored Aug 22, 2024
2 parents 109b356 + 41025f6 commit 452b3ec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ Some of your desktop entries will probably be TUI programs that expect to be lau
### 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.

### Configure fzf preview window
You can configure the fzf preview window using the environment variable `PREVIEW_WINDOW` (default: `up:2:noborder`). For example, if you prefer a taller window, you could use `PREVIEW_WINDOW=5:up`. The content of `PREVIEW_WINDOW` is passed to the `--preview-window` option, so check out the fzf manual for further details.

## Extending the launcher

In addition to desktop application entries and binaries, you can extend `sway-launcher-desktop` with custom item providers.
Expand Down
5 changes: 4 additions & 1 deletion sway-launcher-desktop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ if [[ "${PROVIDERS_FILE#/}" == "${PROVIDERS_FILE}" ]]; then
# $PROVIDERS_FILE is a relative path, prepend $CONFIG_DIR
PROVIDERS_FILE="${CONFIG_DIR}/${PROVIDERS_FILE}"
fi
if [[ ! -v PREVIEW_WINDOW ]]; then
PREVIEW_WINDOW=up:2:noborder
fi

# Provider config entries are separated by the field separator \034 and have the following structure:
# list_cmd,preview_cmd,launch_cmd,purge_cmd
Expand Down Expand Up @@ -316,7 +319,7 @@ readarray -t COMMAND_STR <<<$(
${FZF_COMMAND} --ansi +s -x -d '\034' --nth ..3 --with-nth 3 \
--print-query \
--preview "$0 describe {2} {1}" \
--preview-window=up:2:noborder \
--preview-window="${PREVIEW_WINDOW}" \
--no-multi --cycle \
--prompt="${GLYPH_PROMPT-# }" \
--header='' --no-info --margin='1,2' \
Expand Down

0 comments on commit 452b3ec

Please sign in to comment.