summaryrefslogtreecommitdiff
path: root/ar
diff options
context:
space:
mode:
Diffstat (limited to 'ar')
-rw-r--r--ar/.config/fontconfig/fonts.conf2
-rw-r--r--ar/.config/lf/lfrc79
-rw-r--r--ar/.config/shell/aliasrc2
-rw-r--r--ar/.config/vim/plugins.vim5
-rw-r--r--ar/.config/zsh/keymaps.zsh4
-rwxr-xr-xar/.local/bin/statusbar/sb-ylog23
6 files changed, 81 insertions, 34 deletions
diff --git a/ar/.config/fontconfig/fonts.conf b/ar/.config/fontconfig/fonts.conf
index 1bfcf6c..4979ed3 100644
--- a/ar/.config/fontconfig/fonts.conf
+++ b/ar/.config/fontconfig/fonts.conf
@@ -40,8 +40,6 @@
<family>Noto Sans Mono</family>
<family>Noto Sans Mono CJK KR</family>
<family>Hack Nerd Font Mono</family>
- <family>Joy Pixels</family>
- <family>Noto Color Emoji</family>
<family>Font Awesome 6 Free</family>
<family>Font Awesome 6 Brands</family>
<family>Braille</family>
diff --git a/ar/.config/lf/lfrc b/ar/.config/lf/lfrc
index 87b1858..a69d578 100644
--- a/ar/.config/lf/lfrc
+++ b/ar/.config/lf/lfrc
@@ -235,23 +235,70 @@ cmd extract ${{
printf "%s\n\t" "$fx"
printf "extract?[y/N]"
read ans
- [ $ans = "y" ] && {
- case $fx in
- *.tar.bz|*.tar.bz2|*.tbz|*.tbz2) tar xjf $fx;;
- *.tar.gz|*.tgz) tar xzf $fx ;;
- *.tar.xz|*.txz) tar xf $fx ;;
- *.bz2) bunzip2 $fx ;;
- *.lzma) unlzma $fx ;;
- *.rar) unrar e $fx ;;
- *.gz) gunzip $fx ;;
- *.tar) tar xf $fx ;;
- *.xz) unxz $fx ;;
- *.zip|*.jar|*.war|*.7z) 7z x $fx ;;
- *.Z) uncompress $fx ;;
- *.exe) cabextract $fx ;;
- *.ace) unace x $fx ;;
+ [ "$ans" != "y" ] && exit
+
+ for archive in $fx; do
+ [ -e "$archive" ] || continue
+ case "$archive" in
+ /*) archive_abs="$archive";;
+ *) archive_abs="$PWD/$archive";;
esac
- }
+ base="${archive##*/}"
+ tar_flag=""
+ type=""
+ name=""
+ case "$base" in
+ *.tar.bz2) name="${base%.tar.bz2}"; type=tar; tar_flag=j;;
+ *.tar.bz) name="${base%.tar.bz}"; type=tar; tar_flag=j;;
+ *.tbz2) name="${base%.tbz2}"; type=tar; tar_flag=j;;
+ *.tbz) name="${base%.tbz}"; type=tar; tar_flag=j;;
+ *.tar.gz) name="${base%.tar.gz}"; type=tar; tar_flag=z;;
+ *.tgz) name="${base%.tgz}"; type=tar; tar_flag=z;;
+ *.tar.xz) name="${base%.tar.xz}"; type=tar; tar_flag=J;;
+ *.txz) name="${base%.txz}"; type=tar; tar_flag=J;;
+ *.tar) name="${base%.tar}"; type=tar;;
+ *.zip|*.jar|*.war|*.7z) name="${base%.*}"; type=7z;;
+ *.rar) name="${base%.rar}"; type=rar;;
+ *.exe) name="${base%.exe}"; type=cab;;
+ *.ace) name="${base%.ace}"; type=ace;;
+ *.bz2) bunzip2 "$archive"; continue;;
+ *.gz) gunzip "$archive"; continue;;
+ *.xz) unxz "$archive"; continue;;
+ *.lzma) unlzma "$archive"; continue;;
+ *.Z) uncompress "$archive"; continue;;
+ *) printf "Unknown archive type: %s\n" "$archive"; continue;;
+ esac
+
+ case "$type" in
+ tar) toplevel=$(tar tf "$archive" 2>/dev/null | awk -F/ 'NF{print $1}' | sort -u);;
+ 7z) toplevel=$(7z l -slt -ba "$archive" 2>/dev/null | awk -F'= ' '/^Path = /{print $2}' | awk -F/ 'NF{print $1}' | sort -u);;
+ rar) toplevel=$(unrar lb "$archive" 2>/dev/null | awk -F/ 'NF{print $1}' | sort -u);;
+ *) toplevel="";;
+ esac
+ if [ -z "$toplevel" ]; then
+ count=0
+ else
+ count=$(printf '%s\n' "$toplevel" | wc -l)
+ fi
+
+ target="."
+ if [ "$count" != "1" ]; then
+ printf "\n'%s' has %s top-level entries.\nExtract into folder '%s'? [Y/n] " "$base" "$count" "$name"
+ read folder_ans
+ if [ "$folder_ans" != "n" ] && [ "$folder_ans" != "N" ]; then
+ mkdir -p -- "$name"
+ target="$name"
+ fi
+ fi
+
+ case "$type" in
+ tar) tar x${tar_flag}f "$archive" -C "$target";;
+ 7z) 7z x "$archive" -o"$target";;
+ rar) (cd "$target" && unrar x "$archive_abs");;
+ cab) (cd "$target" && cabextract "$archive_abs");;
+ ace) (cd "$target" && unace x "$archive_abs");;
+ esac
+ done
}}
# Git
diff --git a/ar/.config/shell/aliasrc b/ar/.config/shell/aliasrc
index fe1a363..bd648d7 100644
--- a/ar/.config/shell/aliasrc
+++ b/ar/.config/shell/aliasrc
@@ -311,7 +311,7 @@ alias open='xdg-open'
# pacman
command -v pacman > /dev/null 2>&1 && {
alias -g pcy='pacman -Syu'
- alias -g pcyr='pacman -Syu && remaps'
+ alias -g pcyr='pacman -Syu; remaps'
alias -g pcs='pacman -S'
alias -g pcss='pacman -Ss'
alias -g pcqs='pacman -Qs'
diff --git a/ar/.config/vim/plugins.vim b/ar/.config/vim/plugins.vim
index 072c4c2..1f2b23b 100644
--- a/ar/.config/vim/plugins.vim
+++ b/ar/.config/vim/plugins.vim
@@ -1,8 +1,7 @@
-if ! filereadable(system('echo -n "${XDG_CONFIG_HOME:-$HOME/.config}/vim/autoload/plug.vim"'))
+if getfsize(expand("${XDG_CONFIG_HOME:-$HOME/.config}/vim/autoload/plug.vim")) <= 0
echo "Downloading junegunn/vim-plug to manage plugins..."
- silent !mkdir -p ${XDG_CONFIG_HOME:-$HOME/.config}/vim/autoload/
silent !mkdir -p ${XDG_CONFIG_HOME:-$HOME/.config}/vim/plugged/
- silent !curl "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" > ${XDG_CONFIG_HOME:-$HOME/.config}/vim/autoload/plug.vim
+ silent !curl -fLo ${XDG_CONFIG_HOME:-$HOME/.config}/vim/autoload/plug.vim --create-dirs "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim"
autocmd VimEnter * PlugInstall
endif
diff --git a/ar/.config/zsh/keymaps.zsh b/ar/.config/zsh/keymaps.zsh
index 7f0f9b0..33a16d6 100644
--- a/ar/.config/zsh/keymaps.zsh
+++ b/ar/.config/zsh/keymaps.zsh
@@ -194,7 +194,7 @@ if [[ -f "${ZPLUGINDIR:-${HOME}/.local/share/zsh}/zsh-vi-mode/zsh-vi-mode.plugin
zvm_bind_script viins '^X^X^P' 'pcyr'
zvm_bind_script viins '^X^X^R' 'rbackup -r'
zvm_bind_script viins '^X^X^S' 'sshadd'
- zvm_bind_script viins '^X^X^Y' 'pacman -Syyu && yay -Syu && remaps'
+ zvm_bind_script viins '^X^X^Y' 'pacman -Syyu && yay -Syu; remaps'
# widgets
zvm_define_widget sudo-command-line
@@ -339,6 +339,6 @@ else
bindkey -s '^X^X^P' '^upcyr\n'
bindkey -s '^X^X^R' '^urbackup -r\n'
bindkey -s '^X^X^S' '^usshadd\n'
- bindkey -s '^X^X^Y' '^upacman -Syyu && yay -Syu && remaps\n'
+ bindkey -s '^X^X^Y' '^upacman -Syyu && yay -Syu; remaps\n'
bindkey -s '^X^X^]' '^uylogd\n'
fi
diff --git a/ar/.local/bin/statusbar/sb-ylog b/ar/.local/bin/statusbar/sb-ylog
index b763c34..4326765 100755
--- a/ar/.local/bin/statusbar/sb-ylog
+++ b/ar/.local/bin/statusbar/sb-ylog
@@ -2,8 +2,8 @@
# Displays new nginx log entries from ylog.
# Updates every 30 minutes via dwmblocks.
-# Left click: show new entries and mark as seen
-# Middle click: force refresh
+# Left click: show all current entries
+# Middle click: show new entries and mark as seen
# Right click: help
CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/ylog_sb"
@@ -54,6 +54,14 @@ mark_seen() {
case $BLOCK_BUTTON in
1)
+ if [ -s "$CURR" ]; then
+ count=$(wc -l <"$CURR")
+ notify-send "🌐 Current log entries ($count)" "$(sed 's/^[^ ]* //' "$CURR" | cut -c1-120 | tail -20)"
+ else
+ notify-send "🌐 Ylog" "No entries in cache."
+ fi
+ ;;
+2)
if [ -s "$NEW" ]; then
notify-send "🌐 New log entries" "$(cat "$NEW" | sed 's/^[^ ]* //' | cut -c1-120 | tail -20)"
mark_seen
@@ -62,16 +70,11 @@ case $BLOCK_BUTTON in
notify-send "🌐 Ylog" "No new entries."
fi
;;
-2)
- notify-send "🌐 Ylog" "Refreshing..."
- update
- pkill -RTMIN+21 "${STATUSBAR:-dwmblocks}"
- ;;
3)
- notify-send "🌐 Ylog module" "- Shows new nginx log entries (diary/recordings/peertube/videos US)
+ notify-send "🌐 Ylog module" "\- Shows new nginx log entries (diary/recordings/peertube/videos US)
- Updates every 30 minutes
-- Left click: show new entries & mark seen
-- Middle click: force refresh"
+- Left click: show all current entries
+- Middle click: show new entries & mark seen"
;;
6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
*)