Krolyxon
Commit 6418b5f

Branches

Refs →

aurora.configlflfrc

154 lines · 5.2 KB

1# Basic vars
2set shellopts '-eu'
3set ifs "\n"
4set scrolloff 10
5set icons
6set hidden true
7set drawbox true
8set roundbox true
9set watch true # files other programs add or remove (remage, downloads, waldl) show up without polling
10set previewer '~/.config/lf/scope'
11set preload true
12set autoquit true
13
14# cmds/functions
15cmd open ${{
16 set -f
17 case $(file --mime-type "$(readlink -f "$f")" -b) in
18 image/vnd.djvu|application/pdf|application/postscript) setsid -f zathura $fx >/dev/null 2>&1 ;;
19 text/*|application/json|inode/x-empty|application/x-subrip) $EDITOR $fx;;
20 image/x-xcf) setsid -f gimp "$f" >/dev/null 2>&1 ;;
21 # one image = remage on its whole directory, starting there; a selection = just those.
22 # Images marked in remage (m) become the selection here.
23 image/*) setsid -f ~/.config/lf/remage-pick $fx >/dev/null 2>&1 ;;
24 audio/*|video/x-ms-asf) mpv --audio-display=no $fx ;;
25 video/*) setsid -f mpv $fx -quiet >/dev/null 2>&1 ;;
26 application/vnd.djvu|application/epub*) setsid -f zathura $fx >/dev/null 2>&1 ;;
27 application/pgp-encrypted) $EDITOR $fx ;;
28 application/vnd.openxmlformats-officedocument.wordprocessingml.document|application/vnd.oasis.opendocument.text|application/vnd.openxmlformats-officedocument.spreadsheetml.sheet|application/vnd.oasis.opendocument.spreadsheet|application/vnd.oasis.opendocument.spreadsheet-template|application/vnd.openxmlformats-officedocument.presentationml.presentation|application/vnd.oasis.opendocument.presentation-template|application/vnd.oasis.opendocument.presentation|application/vnd.ms-powerpoint|application/vnd.oasis.opendocument.graphics|application/vnd.oasis.opendocument.graphics-template|application/vnd.oasis.opendocument.formula|application/vnd.oasis.opendocument.database) setsid -f libreoffice $fx >/dev/null 2>&1 ;;
29 application/octet-stream) case ${f##*.} in
30 doc|docx|xls|xlsx|odt|ppt|pptx) setsid -f libreoffice $fx >/dev/null 2>&1 ;;
31 ghw) setsid -f gtkwave "$f" >/dev/null 2>&1 ;;
32 ts) setsid -f mpv $fx -quiet >/dev/null 2>&1 ;;
33 *) setsid -f zathura $fx >/dev/null 2>&1 ;;
34 esac ;;
35 *) for f in $fx; do setsid -f xdg-open "$f" >/dev/null 2>&1; done;;
36 esac
37}}
38
39# pick any app registered for the file's type (gio mime) in aurora's runner
40cmd open-with ${{
41 set -f
42 app=$(gio mime "$(file -Lb --mime-type -- "$f")" | sed -n 's/^\t\(.*\)\.desktop$/\1/p' | sort -u |
43 aurora-run -d -p "open with:") || exit 0
44 setsid -f gtk-launch "$app" $fx >/dev/null 2>&1
45}}
46
47cmd mkdir %mkdir -p -- "$*"
48cmd touch %touch -- "$*"
49
50cmd extract ${{
51 clear; tput cup $(($(tput lines)/3)); tput bold
52 set -f
53 printf "%s\n\t" "$fx"
54 printf "extract?[y/N]"
55 read -r ans
56 [ "$ans" = "y" ] && ext $fx
57}}
58
59# D / <delete>: gone for good, after a y/N prompt (no trash: /tmp etc. have none)
60cmd delete ${{
61 clear; tput cup $(($(tput lines)/3)); tput bold
62 set -f
63 printf "%s\n\t" "$fx"
64 printf "delete permanently?[y/N]"
65 read -r ans
66 [ "$ans" = "y" ] && rm -rf -- $fx
67}}
68
69# M / C: move / copy the selection to a directory from ~/.config/lf/mvdirs
70cmd transfer ${{
71 set -f
72 dest=$(sed "s|^\\\$HOME|$HOME|; s|^~|$HOME|" ~/.config/lf/mvdirs | fzf --prompt "$1 to: ") || exit 0
73 if [ "$1" = move ]; then mv -iv -- $fx "$dest"; else cp -ivr -- $fx "$dest"; fi
74 notify-send "lf" "$1: $(printf '%s\n' "$fx" | wc -l) item(s) to $dest"
75}}
76
77cmd fzf-jump ${{
78 res=$(fd --hidden --exclude .git | fzf --prompt "jump: ") || exit 0
79 lf -remote "send $id select \"$(printf '%s' "$res" | sed 's/[\\"]/\\&/g')\""
80}}
81
82# copy paths / names / the image itself
83cmd yank-path %printf '%s' "$fx" | wl-copy && lf -remote "send $id echo copied path"
84cmd yank-name %basename -a -- $fx | head -c -1 | wl-copy && lf -remote "send $id echo copied name"
85cmd yank-dir %printf '%s' "$PWD" | wl-copy && lf -remote "send $id echo copied $PWD"
86cmd yank-file %wl-copy --type "$(file -Lb --mime-type -- "$f")" < "$f" && lf -remote "send $id echo copied file contents"
87
88cmd setwall %setwall -p "$f"
89
90# window title = the directory (Hyprland, aurora's overview)
91cmd on-cd &{{
92 lf -remote "send $id tty-write \"\033]2;lf $(pwd | sed "s|^$HOME|~|")\007\""
93}}
94on-cd
95
96# Bindings
97map <c-f> fzf-jump
98map D delete
99map <delete> delete
100map p paste
101map dd cut
102map M transfer move
103map C transfer copy
104map yy copy
105map H top
106map E extract
107map <c-n> push :mkdir<space>
108map <c-t> push :touch<space>
109map <c-r> reload
110map <c-s> set hidden!
111map <enter> shell
112map x $$f
113map X !$f
114map o &xdg-open "$f"
115map O open-with
116
117map A :rename; cmd-end # at the very end
118map c push A<c-u> # new rename
119map I :rename; cmd-home # at the very beginning
120map i :rename # before extension
121map a :rename; cmd-right # after extension
122map br $vimv
123map bg setwall
124
125map <c-e> down
126map <c-y> up
127map V push :!nvim<space>
128
129map W $setsid -f $TERMINAL >/dev/null 2>&1
130
131map Y yank-path
132map yp yank-path
133map yn yank-name
134map yd yank-dir
135map yi yank-file
136map T &~/.config/lf/remage-pick -t . # thumbnail grid of this directory, marks -> selection
137map <c-l> unselect
138
139# movement
140map gd cd ~/dox/
141map gD cd ~/dl/
142map gp cd ~/pix
143map gw cd ~/pix/wallpapers
144map gc cd ~/.config
145map gC cd ~/.cache
146map gr cd ~/code/repos
147map gv cd ~/vids/
148map gm cd ~/media/movies
149map gM cd ~/media
150map gn cd ~/music
151map gb cd ~/.local/bin
152map gt cd /tmp
153map gT cd ~/.local/share/Trash/files
154map gs cd ~/.local/share