dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit 10274026739ef05a81093a99360209eed2e92bbd
parent f66713ce3edc35b36cb5dcc70ac1f683afdb1600
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Mon, 14 Jan 2019 21:33:28 +0100

Add fuzzy file launcher with Mod+o

Diffstat:
Mlinks/.commands.sh | 6++++--
Mlinks/.config/i3/config | 7++++++-
Mlinks/bin/ddspawn | 3++-
Alinks/bin/fuzzylaunch | 11+++++++++++
4 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/links/.commands.sh b/links/.commands.sh @@ -33,11 +33,13 @@ alias la='ls -A' ## Open files o() { - IFS=$'\n' out=($(fzf-tmux --query="$1" --exit-0 --expect=ctrl-o,ctrl-e)) + IFS=$'\n' out=($(fzf --query="$1" --exit-0 --expect=ctrl-o,ctrl-e --preview-window=hidden)) key=$(head -1 <<< "$out") file=$(head -2 <<< "$out" | tail -1) if [ -n "$file" ]; then - [ "$key" = ctrl-e ] && ${EDITOR:-vim} "$file" || xdg-open "$file" + [ "$key" = ctrl-e ] && \ + ${EDITOR:-vim} "$file" || \ + xdg-open "$file" & disown fi } diff --git a/links/.config/i3/config b/links/.config/i3/config @@ -45,6 +45,11 @@ for_window [instance="dropdowncalc"] resize set 625 450 for_window [instance="dropdowncalc"] move scratchpad for_window [instance="dropdowncalc"] border pixel 2 for_window [instance="dropdowncalc"] sticky enable +for_window [instance="fuzzylaunch"] floating enable +for_window [instance="fuzzylaunch"] resize set 625 450 +for_window [instance="fuzzylaunch"] move scratchpad +for_window [instance="fuzzylaunch"] border pixel 2 +for_window [instance="fuzzylaunch"] sticky enable # Set Xresources colors: set_from_resource $darkblack color0 #000000 @@ -103,7 +108,7 @@ bindsym $mod+l focus right bindsym $mod+$modalt+l exec --no-startup-id keyboard-layout-switch.sh && pkill -RTMIN+3 i3blocks bindsym $mod+m exec $term -e tmux-mutt.sh bindsym $mod+n exec $term -e ranger -bindsym $mod+o sticky toggle +bindsym $mod+o exec --no-startup-id ddspawn fuzzylaunch bindsym $mod+p exec --no-startup-id ddspawn dropdowncalc bindsym $mod+q kill bindsym $mod+r exec $term -e tmux-newsboat.sh diff --git a/links/bin/ddspawn b/links/bin/ddspawn @@ -19,7 +19,8 @@ then echo "Window detected." else echo "Window not detected... spawning." - i3 "exec --no-startup-id st -n $1 $(echo "$@" | cut -d ' ' -f2-) -e $1" && i3 "[instance=\"$1\"] scratchpad show; [instance=\"$1\"] move position center" + #i3 "exec --no-startup-id st -n $1 $(echo "$@" | cut -d ' ' -f2-) -e $1" && i3 "[instance=\"$1\"] scratchpad show; [instance=\"$1\"] move position center" + i3 "exec --no-startup-id st -n $1 -e $1" && i3 "[instance=\"$1\"] scratchpad show; [instance=\"$1\"] move position center" sleep .25 # This sleep is my laziness, will fix later (needed for immediate appearance after spawn). fi i3 "[instance=\"$1\"] scratchpad show; [instance=\"$1\"] move position center" diff --git a/links/bin/fuzzylaunch b/links/bin/fuzzylaunch @@ -0,0 +1,11 @@ +#!/usr/bin/env zsh + +IFS=$'\n' out=($(fzf --query="$1" --exit-0 --expect=ctrl-e --preview-window=hidden)) +key=$(head -1 <<< "$out") +file=$(head -2 <<< "$out" | tail -1) +if [ -n "$file" ]; then + [ "$key" = ctrl-e ] && \ + ${EDITOR:-vim} "$file" || \ + nohup xdg-open "$file" & + sleep 0.25 +fi