Assorted shell and Python scripts

Update hn, rofi- maim,power,prompt,search

+5 -5
hn
···
exit 1
fi
-
python3 <(cat <<EOF
+
selection=$(python3 <(cat <<EOF
import feedparser
HNFeed = feedparser.parse("https://hnrss.org/newest")
···
ENDC = "\033[0m"
for item in HNFeed.entries:
-
print(f"{bcolors.HEADER}%s{bcolors.ENDC}" % item.title)
-
print(item.links[0].href)
-
print()
+
print(f"[{item.title}]({item.links[0].href})")
EOF
-
) | gum pager
+
) | gum format -t "markdown" | gum choose --limit=1)
+
+
xdg-open "$(echo "$selection" | grep -o 'http[s]\?://[^ ]\+')" >/dev/null || echo "$selection"
+1 -3
rofimaim
···
area=' Select area'
window=' Window'
-
chosen=$(printf '%s;%s;%s\n' "$screen" "$area" "$window" \
+
chosen=$(printf '%s;%s;%s' "$screen" "$area" "$window" \
| rofi -theme-str 'window { width: 10em; height: 10em; }' \
-P 'Screenshot' \
-dmenu \
···
# shellcheck disable=2086
maim --hidecursor --quiet --quality=3 --format='png' $extra_args "$screenshot_path" && {
notify-send --icon=org.xfce.screenshooter "Screenshot saved as $screenshot_path"
-
-
xclip -selection clipboard -target 'image/png' -in "$screenshot_path"
}
+1 -1
rofipower
···
suspend='鈴 Suspend'
log_out=' Log out'
-
chosen=$(printf '%s;%s;%s;%s;%s\n' "$power_off" "$reboot" "$lock" "$suspend" \
+
chosen=$(printf '%s;%s;%s;%s;%s' "$power_off" "$reboot" "$lock" "$suspend" \
"$log_out" \
| rofi -theme-str 'window { width: 10em; height: 11em; }' \
-dmenu -p "Session"\
+1 -1
rofiprompt
···
shift
done
-
chosen=$(printf '%s;%s\n' "$yes" "$no" \
+
chosen=$(printf '%s;%s' "$yes" "$no" \
| rofi -theme-str 'window { width: 10em; height: 11em; }' \
-p "$query" \
-dmenu \
+1 -1
rofisearch
···
set -euo pipefail
-
rofi -dmenu -p "Search" -theme-str 'window { width: 40em; height: 4em; }' | xargs -I{} xdg-open "https://librey.hyperreal.coffee/search.php?q={}"
+
rofi -dmenu -p "Search" -theme-str 'window { width: 40em; height: 4em; }' | xargs -I{} xdg-open "https://librey.nirn.quest/search.php?q={}"