[rofi] rofi gud

This commit is contained in:
odrling 2021-12-22 00:13:10 +01:00
parent 1e1fc1ea5a
commit 74223201d9
No known key found for this signature in database
GPG key ID: A0145F975F9F8B75
3 changed files with 64 additions and 0 deletions

33
.config/rofi/config.rasi Normal file
View file

@ -0,0 +1,33 @@
configuration {
modi: "window,run,ssh,mugen:~/.config/rofi/modi/mugen,combi";
font: "sans 12";
terminal: "st";
matching: "fuzzy";
normalize-match: true;
sort: false;
/* sorting-method: "fzf"; */
fixed-num-lines: false;
timeout {
action: "kb-cancel";
delay: 0;
}
filebrowser {
directories-first: true;
sorting-method: "name";
}
}
@theme "purple"
#window {
anchor: north;
location: north;
border: 0;
width: 100%;
}
#listview {
/* layout: horizontal; */
spacing: 5px;
lines: 8;
border: 0;
}

28
.config/rofi/modi/mugen Executable file
View file

@ -0,0 +1,28 @@
#!/bin/sh
kara_api="${MUGEN_KARA_API:-https://kara.moe/api/karas}"
karamedia="${MUGEN_KARAOKEMEDIA:-https://kara.moe/downloads}"
# karaoke medias and lyrics directories
medias="$karamedia/medias"
lyrics="$karamedia/lyrics"
if [ -z "$@" ]; then
# cache results for 30 minutes
karas=/tmp/$USER-mugen-karas
find "$karas" -mmin 30 > /dev/null 2>&1 || (curl "$kara_api" | jq -r '.content | .[] | "\(.mediafile)\u0000info\u001f\(.kid)"' > "$karas")
cat "$karas"
exit 0
fi
# choose karaoke
kid=$ROFI_INFO
[ -z "$kid" ] && exit
# find karaoke files
kara="$(curl "$kara_api/$kid" | jq '{mediafile: .mediafile, subfile: .subfile, gain: .gain}')"
media="$(echo "$kara" | jq -r '.mediafile' | sed 's/#/%23/g')"
sub="$(echo "$kara" | jq -r '.subfile' | sed 's/#/%23/g')"
gain="$(echo "$kara" | jq -r '.gain')"
mpv --replaygain-fallback=$gain --sub-file="$lyrics/$sub" "$medias/$media" > /dev/null 2>&1 &
exec 1>&-

3
.gitignore vendored
View file

@ -152,3 +152,6 @@ Cache
!/.local/share/zinit
/.local/share/zinit/*
!/.local/share/zinit/zinit.git
# rofi
!/.config/rofi