summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xar/.local/bin/rgafiles32
-rwxr-xr-xar/.local/bin/statusbar/sb-mpdup2
-rwxr-xr-xar/.local/bin/statusbar/sb-playerctlup12
3 files changed, 35 insertions, 11 deletions
diff --git a/ar/.local/bin/rgafiles b/ar/.local/bin/rgafiles
index 150ca1d..57b19d4 100755
--- a/ar/.local/bin/rgafiles
+++ b/ar/.local/bin/rgafiles
@@ -75,17 +75,27 @@ search_term() {
openfiles "$files"
fi
else
- # Multiple files: build quickfix entries for line-accurate navigation
+ # Multiple files: open at matching lines via quickfix
tmpfile=$(mktemp)
echo "$files" | while IFS= read -r file; do
match=$(rga --max-count=1 --line-number --no-filename ${case_flag:+$case_flag} --no-messages "$query" "$file" 2>/dev/null | head -1)
if [ -n "$match" ]; then
- printf '%s:%s\n' "$file" "$match" >> "$tmpfile"
+ printf '%s:%s\n' "$(realpath "$file")" "$match" >> "$tmpfile"
else
- printf '%s:1:\n' "$file" >> "$tmpfile"
+ printf '%s:1:\n' "$(realpath "$file")" >> "$tmpfile"
fi
done
- ${EDITOR:-nvim} -q "$tmpfile"
+ if [ "$count" -lt 5 ]; then
+ ${EDITOR:-nvim} -q "$tmpfile" \
+ -c 'for i in range(2,len(getqflist())) | vsplit | execute "cc ".i | endfor | wincmd t'
+ else
+ first_line=$(head -1 "$tmpfile" | cut -d: -f2)
+ file_args=""
+ while IFS=: read -r fpath _; do
+ file_args="$file_args \"$fpath\""
+ done < "$tmpfile"
+ eval "${EDITOR:-nvim}" "+${first_line}" "$file_args"
+ fi
rm -f "$tmpfile"
fi
@@ -146,17 +156,23 @@ list_or_open_project_files() {
openfiles "$rga_output"
fi
else
- # Multiple files: build quickfix entries for line-accurate navigation
+ # Multiple files: open at matching lines via quickfix
tmpfile=$(mktemp)
for file in $rga_output; do
match=$(rga --max-count=1 --line-number --no-filename --no-messages "$project_tag" "$file" 2>/dev/null | head -1)
if [ -n "$match" ]; then
- printf '%s:%s\n' "$file" "$match" >> "$tmpfile"
+ printf '%s:%s\n' "$(realpath "$file")" "$match" >> "$tmpfile"
else
- printf '%s:1:\n' "$file" >> "$tmpfile"
+ printf '%s:1:\n' "$(realpath "$file")" >> "$tmpfile"
fi
done
- ${EDITOR:-nvim} -q "$tmpfile"
+ if [ "$file_count" -lt 5 ]; then
+ ${EDITOR:-nvim} -q "$tmpfile" \
+ -c 'for i in range(2,len(getqflist())) | vsplit | execute "cc ".i | endfor | wincmd t'
+ else
+ ${EDITOR:-nvim} -q "$tmpfile" \
+ -c 'silent! for i in range(2,len(getqflist())+1) | execute "silent! cc ".i | endfor | silent! cfirst'
+ fi
rm -f "$tmpfile"
fi
fi
diff --git a/ar/.local/bin/statusbar/sb-mpdup b/ar/.local/bin/statusbar/sb-mpdup
index 9931d76..ecc48a4 100755
--- a/ar/.local/bin/statusbar/sb-mpdup
+++ b/ar/.local/bin/statusbar/sb-mpdup
@@ -8,5 +8,5 @@ export MPD_HOST
while :; do
mpc idle >/dev/null || continue
- kill -52 "$(pidof "${STATUSBAR:-dwmblocks}")" 2>/dev/null
+ kill -52 $(pidof "${STATUSBAR:-dwmblocks}") 2>/dev/null
done
diff --git a/ar/.local/bin/statusbar/sb-playerctlup b/ar/.local/bin/statusbar/sb-playerctlup
index 744abbd..a5c0763 100755
--- a/ar/.local/bin/statusbar/sb-playerctlup
+++ b/ar/.local/bin/statusbar/sb-playerctlup
@@ -2,8 +2,16 @@
# Updates the music statusbar module when a playerctl-compatible player changes
-signal() { kill -52 "$(pidof "${STATUSBAR:-dwmblocks}")" 2>/dev/null; }
+signal() { kill -52 $(pidof "${STATUSBAR:-dwmblocks}") 2>/dev/null; }
playerctl -aF status 2>/dev/null | while read -r _; do signal; done &
-playerctl -aF metadata -f '{{playerName}}' 2>/dev/null | while read -r _; do signal; done &
+playerctl -aF metadata -f '{{playerName}}{{title}}' 2>/dev/null | while read -r _; do signal; done &
+
+dbus-monitor --session "interface='org.freedesktop.DBus.Properties',member='PropertiesChanged',arg0='org.mpris.MediaPlayer2.Player'" 2>/dev/null |
+ while read -r line; do
+ case "$line" in
+ *PropertiesChanged*) signal ;;
+ esac
+ done &
+
wait