Add extract.sh script
Also move preview script to ~/.local/bin and rename to preview.sh
This commit is contained in:
parent
e5c33e7d01
commit
ad08375db7
|
@ -1,3 +1,3 @@
|
||||||
function fish_greeting
|
function fish_greeting
|
||||||
not status is-login; and "$XDG_BIN_HOME/bunny"
|
not status is-login; and "$XDG_BIN_HOME/bunny.sh"
|
||||||
end
|
end
|
||||||
|
|
|
@ -75,6 +75,7 @@ https://www.youtube.com/feeds/videos.xml?channel_id=UCEBb1b_L6zDS3xTUrIALZOw "~M
|
||||||
https://www.youtube.com/feeds/videos.xml?channel_id=UCcabW7890RKJzL968QWEykA "~Havard CS50" youtube
|
https://www.youtube.com/feeds/videos.xml?channel_id=UCcabW7890RKJzL968QWEykA "~Havard CS50" youtube
|
||||||
https://www.youtube.com/feeds/videos.xml?channel_id=UC8butISFwT-Wl7EV0hUK0BQ "~freeCodeCamp.org" youtube
|
https://www.youtube.com/feeds/videos.xml?channel_id=UC8butISFwT-Wl7EV0hUK0BQ "~freeCodeCamp.org" youtube
|
||||||
https://www.youtube.com/feeds/videos.xml?channel_id=UCDiFRMQWpcp8_KD4vwIVicw "~Emergency Awesome" youtube
|
https://www.youtube.com/feeds/videos.xml?channel_id=UCDiFRMQWpcp8_KD4vwIVicw "~Emergency Awesome" youtube
|
||||||
|
https://www.youtube.com/feeds/videos.xml?channel_id=UCjQK8kV4ik7p_605z8nTEgw "~Residual Entropy" youtube
|
||||||
=======Podcasts========
|
=======Podcasts========
|
||||||
https://tuxdigital.com/feed/thisweekinlinux-mp3 "~This week in Linux" podcast
|
https://tuxdigital.com/feed/thisweekinlinux-mp3 "~This week in Linux" podcast
|
||||||
https://www.arresteddevops.com/episode/index.xml "~Arrested DevOps" podcast
|
https://www.arresteddevops.com/episode/index.xml "~Arrested DevOps" podcast
|
||||||
|
|
|
@ -16,7 +16,7 @@ alias cargo 'cargo auditable'
|
||||||
|
|
||||||
# neovim
|
# neovim
|
||||||
abbr v nvim
|
abbr v nvim
|
||||||
abbr vv 'fzf --prompt "Edit files: " --preview "{{ xdg_dir.libexec_dir }}/preview {} 2>/dev/null" --bind "enter:become(nvim {+})"'
|
abbr vv 'fzf --prompt "Edit files: " --preview "{{ xdg_dir.bin_home }}/preview.sh {} 2>/dev/null" --bind "enter:become(nvim {+})"'
|
||||||
|
|
||||||
# emacs
|
# emacs
|
||||||
abbr e 'emacs -nw'
|
abbr e 'emacs -nw'
|
||||||
|
|
|
@ -163,7 +163,7 @@ set -gx FZF_DEFAULT_OPTS "--multi --layout=reverse --inline-info --cycle --separ
|
||||||
--color separator:{{ colors.highlight }},label:{{ colors.white2 }},border:{{ colors.highlight }}"
|
--color separator:{{ colors.highlight }},label:{{ colors.white2 }},border:{{ colors.highlight }}"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
set -gx FZF_DEFAULT_COMMAND "fd --type f --follow --hidden --exclude .git --color never"
|
set -gx FZF_DEFAULT_COMMAND "fd --type f --follow --hidden --exclude .git --color never"
|
||||||
set -gx FZF_CTRL_T_OPTS "--no-height --preview '{{ xdg_dir.libexec_dir }}/preview {} \$FZF_PREVIEW_COLUMNS \$FZF_PREVIEW_LINES 2>/dev/null'"
|
set -gx FZF_CTRL_T_OPTS "--no-height --preview '{{ xdg_dir.bin_home }}/preview.sh {} \$FZF_PREVIEW_COLUMNS \$FZF_PREVIEW_LINES 2>/dev/null'"
|
||||||
set -gx FZF_CTRL_T_COMMAND "fd . \$dir --follow --hidden --exclude .git --color never"
|
set -gx FZF_CTRL_T_COMMAND "fd . \$dir --follow --hidden --exclude .git --color never"
|
||||||
set -gx FZF_ALT_C_OPTS "--preview 'lsd -1FAL --group-dirs first --icon always --color always {} 2>/dev/null'"
|
set -gx FZF_ALT_C_OPTS "--preview 'lsd -1FAL --group-dirs first --icon always --color always {} 2>/dev/null'"
|
||||||
set -gx FZF_ALT_C_COMMAND "fd --type d --follow --hidden --exclude .git --color never"
|
set -gx FZF_ALT_C_COMMAND "fd --type d --follow --hidden --exclude .git --color never"
|
||||||
|
|
|
@ -133,17 +133,18 @@ set findprg='fd --follow --hidden --exclude .git --color never %p %s'
|
||||||
command! df df -h %m 2> /dev/null
|
command! df df -h %m 2> /dev/null
|
||||||
command! diff nvim -d %f %F
|
command! diff nvim -d %f %F
|
||||||
command! gzip tar -cvzf %a %f
|
command! gzip tar -cvzf %a %f
|
||||||
|
command! zstd tar --zstd -cvf %a %f
|
||||||
command! xz bsdtar -cvJf %a %f
|
command! xz bsdtar -cvJf %a %f
|
||||||
command! extract bsdtar -xvf %c
|
command! extract !{{ xdg_dir.bin_home }}/extract.sh %f
|
||||||
command! shred shred -fu %f
|
command! shred shred -fu %f
|
||||||
command! run !! ./%f
|
command! run !!./%f
|
||||||
command! vgrep nvim "+grep %a"
|
command! vgrep nvim "+grep %a"
|
||||||
command! reload :write | restart
|
command! reload :write | restart
|
||||||
command! exif exiftool -all= -overwrite_original %f
|
command! exif exiftool -all= -overwrite_original %f
|
||||||
|
|
||||||
" fzf file
|
" fzf file
|
||||||
command! FZFfile : set noquickview
|
command! FZFfile : set noquickview
|
||||||
\| let $FZF_RES = term('fzf --prompt "File: " --no-multi --preview "{{ xdg_dir.libexec_dir }}/preview {} \$FZF_PREVIEW_COLUMNS \$FZF_PREVIEW_LINES 2>/dev/null" 2>&0')
|
\| let $FZF_RES = term('fzf --prompt "File: " --no-multi --preview "{{ xdg_dir.bin_home }}/preview.sh {} \$FZF_PREVIEW_COLUMNS \$FZF_PREVIEW_LINES 2>/dev/null" 2>&0')
|
||||||
\| if $FZF_RES != ''
|
\| if $FZF_RES != ''
|
||||||
\| execute 'goto' fnameescape($FZF_RES)
|
\| execute 'goto' fnameescape($FZF_RES)
|
||||||
\| endif
|
\| endif
|
||||||
|
@ -312,7 +313,7 @@ filetype *.mbox aerc %f
|
||||||
|
|
||||||
" ------------------------------------------------------------------------------
|
" ------------------------------------------------------------------------------
|
||||||
|
|
||||||
{% set preview_cmd = xdg_dir.libexec_dir ~ '/preview %c:p %pw %ph' -%}
|
{% set preview_cmd = xdg_dir.bin_home ~ '/preview.sh %c:p %pw %ph' -%}
|
||||||
" Overwrite the image previewer
|
" Overwrite the image previewer
|
||||||
fileviewer <image/vnd.djvu,image/x-djvu> {{ preview_cmd }} 2>/dev/null
|
fileviewer <image/vnd.djvu,image/x-djvu> {{ preview_cmd }} 2>/dev/null
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Require at least 1 argument
|
||||||
|
if [ $# -lt 1 ]; then
|
||||||
|
echo "Require at least 1 argument."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
extract() {
|
||||||
|
local file="$1"
|
||||||
|
local mimetype="$(file --dereference --brief --mime-type -- "$file")"
|
||||||
|
local filename="$(basename "$file")"
|
||||||
|
|
||||||
|
if [[ $filename == @(*.tar.@(zst|gz|lz|lzma|lzo|xz|Z)|*.tb2|*.tz2|*.tbz|*.tbz2|*.taz|*.tgz|*.tlz|*.txz|*.tZ|*.taZ|*.tzst) ]] || [[ $mimetype == @(application/x-?(g)tar*|application/*-compressed-tar) ]]; then
|
||||||
|
tar -xf "$file" || bsdtar -xf "$file"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $mimetype == application/zstd ]]; then
|
||||||
|
zstd -d "$file"; return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $mimetype == @(application/x-xz*|application/*-xz-compressed) ]]; then
|
||||||
|
xz -kd "$file" || bsdtar -xf "$file"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $mimetype == @(application/vnd.rar|application/vnd.comicbook-rar|application/x-rar*) ]]; then
|
||||||
|
unrar x -p- -- "$file" || bsdtar -xf "$file"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $mimetype == application/x-7z-compressed ]]; then
|
||||||
|
7z x -p -- "$file" || bsdtar -xf "$file"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $mimetype == @(application/vnd.efi.iso|application/x-*-rom|application/x-compressed-iso|application/x*-iso?(9660)-?(app)image) ]]; then
|
||||||
|
isoinfo -X -i "$file" || bsdtar -xf "$file"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $mimetype == application/x-cpio* ]]; then
|
||||||
|
cpio -iF "$file" || bsdtar -xf "$file"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $mimetype == application/?(x-)gzip ]]; then
|
||||||
|
bsdtar -xf "$file" || gzip -d "$file"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $mimetype == @(application/vnd.ms-cab-compressed|application/x-archive|application/?(x-)bzip*|application/x-lzma|application/x-lzip|application/x-lha|application/x-lzh-compressed|application/x-lhz|application/x-lzop|application/x-lz4|application/x-lrzip) ]]; then
|
||||||
|
bsdtar -xf "$file"; return
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "File $file with mimetype $mimetype is not supported."
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
for file in "$@"; do
|
||||||
|
extract "$file" || exit 1
|
||||||
|
done
|
|
@ -21,31 +21,36 @@
|
||||||
recursive: true
|
recursive: true
|
||||||
delete: false
|
delete: false
|
||||||
|
|
||||||
- name: Copy templates to ~/.local/libexec/wayland
|
- name: Copy script templates
|
||||||
template:
|
template:
|
||||||
src: '{{ item }}.j2'
|
src: '{{ item.name }}.j2'
|
||||||
dest: '~/.local/libexec/wayland/{{ item }}'
|
dest: '{{ item.dest }}'
|
||||||
mode: '755'
|
mode: '755'
|
||||||
loop:
|
loop:
|
||||||
- bukumenu
|
- name: preview
|
||||||
- calcmenu
|
dest: '{{ xdg_dir.bin_home }}/preview.sh'
|
||||||
- clipboard
|
- name: bukumenu
|
||||||
- dismiss_notify
|
dest: '{{ xdg_dir.libexec_dir }}/wayland/bukumenu'
|
||||||
- launch_wallpaper
|
- name: calcmenu
|
||||||
- mangamenu
|
dest: '{{ xdg_dir.libexec_dir }}/wayland/calcmenu'
|
||||||
- musicmenu
|
- name: clipboard
|
||||||
- notifymenu
|
dest: '{{ xdg_dir.libexec_dir }}/wayland/clipboard'
|
||||||
- screenshot
|
- name: dismiss_notify
|
||||||
- searchmenu
|
dest: '{{ xdg_dir.libexec_dir }}/wayland/dismiss_notify'
|
||||||
- sway_window
|
- name: launch_wallpaper
|
||||||
|
dest: '{{ xdg_dir.libexec_dir }}/wayland/launch_wallpaper'
|
||||||
- name: Copy templates to ~/.local/libexec
|
- name: mangamenu
|
||||||
template:
|
dest: '{{ xdg_dir.libexec_dir }}/wayland/mangamenu'
|
||||||
src: '{{ item }}.j2'
|
- name: musicmenu
|
||||||
dest: ~/.local/libexec/{{ item }}
|
dest: '{{ xdg_dir.libexec_dir }}/wayland/musicmenu'
|
||||||
mode: '755'
|
- name: notifymenu
|
||||||
loop:
|
dest: '{{ xdg_dir.libexec_dir }}/wayland/notifymenu'
|
||||||
- preview
|
- name: screenshot
|
||||||
|
dest: '{{ xdg_dir.libexec_dir }}/wayland/screenshot'
|
||||||
|
- name: searchmenu
|
||||||
|
dest: '{{ xdg_dir.libexec_dir }}/wayland/searchmenu'
|
||||||
|
- name: sway_window
|
||||||
|
dest: '{{ xdg_dir.libexec_dir }}/wayland/sway_window'
|
||||||
|
|
||||||
- name: Install external scripts with curl
|
- name: Install external scripts with curl
|
||||||
import_tasks: curl.yml
|
import_tasks: curl.yml
|
||||||
|
@ -54,6 +59,6 @@
|
||||||
- name: Symlink jq executable to {{ jq_binary }}
|
- name: Symlink jq executable to {{ jq_binary }}
|
||||||
file:
|
file:
|
||||||
src: '{{ jq_binary }}'
|
src: '{{ jq_binary }}'
|
||||||
dest: ~/.local/bin/jq
|
dest: '{{ xdg_dir.bin_home }}/jq'
|
||||||
state: link
|
state: link
|
||||||
force: true
|
force: true
|
||||||
|
|
|
@ -157,7 +157,7 @@ if [[ $mimetype == application/x-7z-compressed ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $mimetype == @(application/vnd.efi.iso|application/x-*-rom|application/x-compressed-iso|application/x*-iso?(9660)-?(app)image) ]]; then
|
if [[ $mimetype == @(application/vnd.efi.iso|application/x-*-rom|application/x-compressed-iso|application/x*-iso?(9660)-?(app)image) ]]; then
|
||||||
isoinfo -l -i "$FILE" || bsdtar -tf "$FILE"
|
isoinfo -f -i "$FILE" || bsdtar -tf "$FILE"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -166,7 +166,12 @@ if [[ $mimetype == application/x-cpio* ]]; then
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $mimetype == @(application/?(x-)gzip|application/vnd.ms-cab-compressed|application/x-archive|application/?(x-)bzip*|application/x-lzma|application/x-lzip|application/x-lha|application/x-lzh-compressed|application/x-lhz|application/x-lzop|application/x-lz4|application/x-lrzip) ]]; then
|
if [[ $mimetype == application/?(x-)gzip ]]; then
|
||||||
|
bsdtar -tf "$FILE" || gzip -l "$FILE"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $mimetype == @(application/vnd.ms-cab-compressed|application/x-archive|application/?(x-)bzip*|application/x-lzma|application/x-lzip|application/x-lha|application/x-lzh-compressed|application/x-lhz|application/x-lzop|application/x-lz4|application/x-lrzip) ]]; then
|
||||||
bsdtar -tf "$FILE"; exit
|
bsdtar -tf "$FILE"; exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue