update rofi scripts

This commit is contained in:
2025-11-30 22:57:56 -08:00
parent 099d5e8ba6
commit 3b87c06731
2 changed files with 62 additions and 12 deletions

View File

@@ -1,20 +1,68 @@
#!/usr/bin/env bash #!/usr/bin/env bash
BROWSER=/usr/bin/zen-browser BROWSER=/usr/bin/zen-browser
URLS=( OPTIONS=(
"Arch Linux (btw)"
"Hyprland"
)
ARCH=(
"Archlinux Wiki|https://wiki.archlinux.org/title/Main_page" "Archlinux Wiki|https://wiki.archlinux.org/title/Main_page"
)
HYPRLAND=(
"Hyprland Docs|https://wiki.hypr.land/" "Hyprland Docs|https://wiki.hypr.land/"
"Hyprland Window Rules|https://wiki.hypr.land/Configuring/Window-Rules/" "Hyprland Window Rules|https://wiki.hypr.land/Configuring/Window-Rules/"
) )
DISPLAY_URLS=() get_url() {
declare -A URL_MAP urls=("$@")
for url in "${URLS[@]}"; do display_urls=()
DISPLAY_URLS+=("${url%%|*}") declare -A url_map
label="${url%%|*}" for url in "${urls[@]}"; do
URL_MAP["$label"]="${url##*|}" display_urls+=("${url%%|*}")
done label="${url%%|*}"
url_map["$label"]="${url##*|}"
done
display_urls+=("Back")
url_map["Back"]="Back"
SELECTION="$(printf "%s\n" "${DISPLAY_URLS[@]}" | rofi -theme-str 'window {width: 25%;} listview {columns: 1; lines: 10;}' -theme ~/.config/rofi/launchers/type-2/style-2.rasi -dmenu -l 5 -i -p "Select Documentation")" selection="$(printf "%s\n" "${display_urls[@]}" | rofi -theme-str 'window {width: 25%;} listview {columns: 1; lines: 10;}' -theme ~/.config/rofi/launchers/type-2/style-2.rasi -dmenu -l 5 -i -p "Select Documentation")"
URL="${URL_MAP[$SELECTION]}" url="${url_map[$selection]}"
$BROWSER "$URL" &>/dev/null &
if [ -z "$url" ]; then
exit 0
fi
printf "%s\n" "$url"
}
get_docs_list() {
selection="$(printf "%s\n" "${OPTIONS[@]}" | rofi -theme-str 'window {width: 25%;} listview {columns: 1; lines: 10;}' -theme ~/.config/rofi/launchers/type-2/style-2.rasi -dmenu -l 5 -i -p "Select Documentation Group")"
case "$selection" in
"Arch Linux (btw)")
urls=("${ARCH[@]}")
;;
"Hyprland")
urls=("${HYPRLAND[@]}")
;;
*)
exit 0
;;
esac
printf "%s\n" "${urls[@]}"
}
main() {
urls=("$(get_docs_list)")
url="$(get_url "${urls[@]}")"
if [ -z "$url" ]; then
printf "No URL selected.\n"
exit 0
elif [ "$url" == "Back" ]; then
main
exit 0
fi
$BROWSER "$url" &>/dev/null &
}
main

View File

@@ -7,5 +7,7 @@ DIR="$HOME/Pictures/wallpapers/favorites"
SELECTED_WALL=$(cd "$DIR" && for a in *.jpg *.png; do echo -en "$a\0icon\x1f$a\n"; done | rofi -dmenu -i -no-custom -theme "$THEME" -p "Select a wallpaper" -theme-str 'configuration {icon-size: 128; dpi: 96;} window {width: 45%; height: 45%;}') SELECTED_WALL=$(cd "$DIR" && for a in *.jpg *.png; do echo -en "$a\0icon\x1f$a\n"; done | rofi -dmenu -i -no-custom -theme "$THEME" -p "Select a wallpaper" -theme-str 'configuration {icon-size: 128; dpi: 96;} window {width: 45%; height: 45%;}')
PTH="$(printf "%s" "$DIR/$SELECTED_WALL" | tr -s '/')" PTH="$(printf "%s" "$DIR/$SELECTED_WALL" | tr -s '/')"
notify-send -a "rofi-wallpaper" "Wallpaper set to" -i "$PTH" "$PTH" notify-send -a "rofi-wallpaper" "Wallpaper set to" -i "$PTH" "$PTH"
hyprctl hyprpaper preload "$PTH"
hyprctl hyprpaper wallpaper "DP-1,$PTH"
hyprctl hyprpaper unload "$(cat "$HOME/.wallpaper")"
echo "$PTH" >"$HOME/.wallpaper" echo "$PTH" >"$HOME/.wallpaper"
hyprctl hyprpaper reload , "$PTH"