add script for ytfzf
This commit is contained in:
parent
20ca30ba46
commit
b1566efd63
2 changed files with 22 additions and 2 deletions
|
@ -7,11 +7,11 @@
|
|||
tmux,
|
||||
kitty,
|
||||
imagemagick,
|
||||
sway,
|
||||
hyprland,
|
||||
swww,
|
||||
jq,
|
||||
curl,
|
||||
ytfzf,
|
||||
}:
|
||||
stdenvNoCC.mkDerivation {
|
||||
pname = "scripts";
|
||||
|
@ -25,7 +25,7 @@ stdenvNoCC.mkDerivation {
|
|||
mkdir -p $out/bin
|
||||
cp power-menu.sh $out/bin/power-menu
|
||||
chmod +x $out/bin/power-menu
|
||||
wrapProgram $out/bin/power-menu --prefix PATH : ${lib.makeBinPath [libnotify rofi-wayland sway hyprland]}
|
||||
wrapProgram $out/bin/power-menu --prefix PATH : ${lib.makeBinPath [libnotify rofi-wayland hyprland]}
|
||||
|
||||
cp tmux-sessions.sh $out/bin/tmux-sessions
|
||||
chmod +x $out/bin/tmux-sessions
|
||||
|
@ -38,5 +38,9 @@ stdenvNoCC.mkDerivation {
|
|||
cp wallhaven.sh $out/bin/wallhaven
|
||||
chmod +x $out/bin/wallhaven
|
||||
wrapProgram $out/bin/wallhaven --prefix PATH : ${lib.makeBinPath [imagemagick libnotify jq curl]}
|
||||
|
||||
cp youtube.sh $out/bin/youtube
|
||||
chmod +x $out/bin/youtube
|
||||
wrapProgram $out/bin/youtube --prefix PATH : ${lib.makeBinPath [kitty ytfzf rofi-wayland]}
|
||||
'';
|
||||
}
|
||||
|
|
16
packages/scripts/youtube.sh
Executable file
16
packages/scripts/youtube.sh
Executable file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -eu
|
||||
XDG_CACHE_HOME=${XDG_CACHE_HOME:-}
|
||||
if [ -n "$XDG_CACHE_HOME" ] ; then
|
||||
HISTORY_FILE="$XDG_CACHE_HOME/youtube_history"
|
||||
else
|
||||
HISTORY_FILE="$HOME/.cache/youtube_history"
|
||||
fi
|
||||
if [ ! -e "$HISTORY_FILE" ] ; then
|
||||
touch "$HISTORY_FILE"
|
||||
fi
|
||||
SEARCH_TERM="$(rofi -dmenu -p "Search Youtube:" < "$HISTORY_FILE")"
|
||||
echo "$SEARCH_TERM" >> $HISTORY_FILE
|
||||
kitty --class=ytfzf --title "YouTube Search: ${SEARCH_TERM}" -- ytfzf -f -tT kitty --async-thumbnails "${SEARCH_TERM}"
|
||||
|
Loading…
Reference in a new issue