Add bookmark finder scripts, fix a few incorrect uses of IFS and read
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
- config for mpd, and client(s), (mpd clients to consider: mpc, ncmpcpp, ncmpc, inori)
|
||||
- get find, xargs, and awk (use nawk) as unified as i can across system types
|
||||
- seems mpv install (maybe others?) bring in wayland, see if i can remove it
|
||||
- switched to macports (replace homebrew) before september 2026
|
||||
- adjusted tmux so that n goes next/down and N goes prev/up in search results
|
||||
- figured out nvim debug options for linux and macos, then update nvim's dap.lua
|
||||
- picked and configured rss reader
|
||||
|
||||
@@ -33,10 +33,10 @@ echo "---- installing programs ---------------"
|
||||
|
||||
echo "$system_types_list" |
|
||||
sed -E "s/,/\n/g" |
|
||||
while IFS="\n" read -r system_type; do
|
||||
while IFS= read -r system_type; do
|
||||
echo "-------- install for system type: $system_type"
|
||||
cat "installs_and_builds/programs_$system_type.txt" |
|
||||
while IFS="\n" read -r program_name; do
|
||||
while IFS= read -r program_name; do
|
||||
build_install "$program_name"
|
||||
done
|
||||
done
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
# this file is just here to easily allow committing this directory to git
|
||||
# the imported themes are copied here when ./copy_dotfiles.sh is run
|
||||
|
||||
@@ -6,8 +6,9 @@ cmd - l : $(which skhd) -k "ctrl - tab"
|
||||
|
||||
# shortcuts to open programs
|
||||
cmd - return : open -a kitty.app -n
|
||||
cmd - b : open -a Brave\ Browser.app -n
|
||||
cmd + shift - b : open -a Brave\ Browser.app -n
|
||||
cmd - s : open -a kitty.app -n --args htop
|
||||
cmd - b : open -a kitty.app -n --args bookmark-find
|
||||
|
||||
# shortcuts to scripts/procs
|
||||
# cmd - zxcv : path/to/script.sh
|
||||
|
||||
35
src_files/.local/scripts/bookmark-find
Executable file
35
src_files/.local/scripts/bookmark-find
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
|
||||
bm_selected_bookmark_url=$(
|
||||
find "$DIR_HOME_BOX" \
|
||||
\( -type d -name "*archive" -prune \) \
|
||||
-o \( -type d -name "*z-sort" -prune \) \
|
||||
-o -name "*.bkmrk" -print |
|
||||
while IFS= read -r bookmark_file; do tail -n +2 "$bookmark_file"; done |
|
||||
fzf \
|
||||
--preview-border=line \
|
||||
--preview='bookmark-preview-info {}' |
|
||||
sed -E "s/^[^^]+\^([^^]+)\^.*$/\1/g" ||
|
||||
printf "%s" "BM_SELECT_ERROR"
|
||||
)
|
||||
|
||||
[ "$bm_selected_bookmark_url" = "BM_SELECT_ERROR" ] &&
|
||||
printf "%s\n" "error while selecting bookmark" &&
|
||||
read && # read command to force a pause for input (hit return) before shell is closed
|
||||
exit 1
|
||||
|
||||
[ "$XDG_SESSION_TYPE" = "wayland" ] && command -v wl-copy > /dev/null 2>&1 && {
|
||||
printf "%s" "$bm_selected_bookmark_url" | wl-copy
|
||||
} || {
|
||||
command -v xclip > /dev/null 2>&1 && {
|
||||
printf "%s" "$bm_selected_bookmark_url" | xclip -selection clipboard
|
||||
}
|
||||
} || {
|
||||
command -v pbcopy > /dev/null 2>&1 && {
|
||||
printf "%s" "$bm_selected_bookmark_url" | pbcopy
|
||||
}
|
||||
} || {
|
||||
printf "error finding clipboard tool; bookmark url: %s" "$bm_selected_bookmark_url"
|
||||
read # read command to force a pause for input (hit return) before shell is closed
|
||||
}
|
||||
|
||||
29
src_files/.local/scripts/bookmark-preview-info
Executable file
29
src_files/.local/scripts/bookmark-preview-info
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/bin/sh
|
||||
|
||||
IFS="^" read -r bm_name bm_url bm_tags bm_date_added bm_type bm_parent <<BM_LINE_BLOCK
|
||||
$(printf "%s" "$@")
|
||||
BM_LINE_BLOCK
|
||||
|
||||
bm_preview_format_block=$(cat <<'BM_PREVIEW_FORMAT_BLOCK'
|
||||
name:
|
||||
%s
|
||||
|
||||
url:
|
||||
%s
|
||||
|
||||
tags:
|
||||
%s
|
||||
|
||||
date_added:
|
||||
%s
|
||||
|
||||
type:
|
||||
%s
|
||||
|
||||
parent:
|
||||
%s
|
||||
|
||||
BM_PREVIEW_FORMAT_BLOCK)
|
||||
|
||||
printf "$bm_preview_format_block" \
|
||||
"$bm_name" "$bm_url" "$bm_tags" "$bm_date_added" "$bm_type" "$bm_parent"
|
||||
@@ -9,7 +9,7 @@ non_primary_monitors_off() {
|
||||
grep -v "^Screen" |
|
||||
grep -v "^\s" |
|
||||
grep -v "primary" |
|
||||
while IFS="\n " read -r target_mon_id remaining_text; do
|
||||
while read -r target_mon_id remaining_text; do
|
||||
xrandr --output "$target_mon_id" --off
|
||||
done
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user