diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2026-03-24 16:03:18 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2026-03-24 16:03:18 +0900 |
| commit | bc056b042e6508b91705f6d164dc29b18fa0e347 (patch) | |
| tree | 79e55b03d8c2430c4875e43351fba3cf0f79a840 /ar | |
| parent | d79e2e239245ffda8c4f892c113fe37ce0d0d43a (diff) | |
modified bin/rgafiles, modified statusbar/sb-mpdup, modified statusbar/sb-playerctlup
Diffstat (limited to 'ar')
| -rwxr-xr-x | ar/.local/bin/rgafiles | 32 | ||||
| -rwxr-xr-x | ar/.local/bin/statusbar/sb-mpdup | 2 | ||||
| -rwxr-xr-x | ar/.local/bin/statusbar/sb-playerctlup | 12 |
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 |
