Skip to content

Instantly share code, notes, and snippets.

@salkin-mada
Last active January 1, 2024 07:27
Show Gist options
  • Save salkin-mada/1fea83ced3f2e8dd1b16513b446499dd to your computer and use it in GitHub Desktop.
Save salkin-mada/1fea83ced3f2e8dd1b16513b446499dd to your computer and use it in GitHub Desktop.
fzf/skim app launcher + window switcher using kitty/alacritty

.

Here follows a simple example using sway. Scripts and locations can/should be modified for your needs and layout can be changed to whatever likings. export FZF / SKIM default envir vars can also change behavior in addition to local fzf/skim --flags during command or scripting will override defaults. Go nuts.

  • in sway/config
# Preferred application launcher
# fzf launcher
set $fzf_launcher kitty --config \"$HOME/.config/kitty/fzf-launcher.config\" --class fzf-launcher --detach
set $menu $fzf_launcher sh -c \"dmenu_path | fzf | xargs -r swaymsg exec\"
for_window [app_id="fzf-launcher"] focus, floating enabled, border pixel 1

# search launcher
set $fzf_searcher kitty --config \"$HOME/.config/kitty/fzf-searcher.config\" --class fzf-searcher --detach
set $searcher $fzf_searcher sh -c \"cd ~ && fzf | xargs -r swaymsg exec\"
for_window [app_id="fzf-searcher"] focus, floating enabled, border pixel 0

# fzf show open sway windows and switch to one if you like :)
set $fzf_windows kitty --config \"$HOME/.config/kitty/fzf-windows.config\" --class fzf-windows --detach
set $windows $fzf_windows sh -c \"$HOME/.config/sway/scripts/switch_window\"
for_window [app_id="fzf-windows"] focus, floating enabled, border pixel 0
  • $HOME/.config/sway/scripts/switch_window
#!/bin/bash

swaymsg -t get_tree | jq -r 'recurse(.nodes[]?)|recurse(.floating_nodes[]?)|select(.type=="con"),select(.type=="floating_con")|(.id|tostring)+" "+.app_id+" -> "+.name' | fzf | awk '{print $1}' | xargs -I % sh -c 'swaymsg [con_id=%] focus'
  • "$HOME/.config/kitty/fzf-launcher.config
font_family DejaVu Sans Mono
font_size 20
enable_audio_bell no
remember_window_size no
initial_window_width 35c
initial_window_height 10c
background_opacity 0.75
  • $HOME/.config/kitty/fzf-searcher.config\
font_family DejaVu Sans Mono
font_size 20
enable_audio_bell no
remember_window_size no
initial_window_width 85c
initial_window_height 25c
background_opacity 0.75
  • "$HOME/.config/kitty/fzf-windows.config
font_family FiraCode
font_size 18
enable_audio_bell no
remember_window_size no
initial_window_width 60c
initial_window_height 15c
background_opacity 1.0
cursor_stop_blinking_after 1.0
window_padding_width 50.0
placement_strategy center
include $HOME/.config/kitty/themes/colors/base16-unikitty-dark.conf
cursor #ff00ff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment