Compare commits
6 commits
41f48aa208
...
99ef28fe19
Author | SHA1 | Date | |
---|---|---|---|
99ef28fe19 | |||
cbb33f7fe0 | |||
beefe545ed | |||
e2ce724bed | |||
7e37c1b579 | |||
62ca2d43bc |
6 changed files with 16 additions and 44 deletions
|
@ -34,7 +34,6 @@ in {
|
||||||
pkgs.go-task
|
pkgs.go-task
|
||||||
pkgs.convco
|
pkgs.convco
|
||||||
pkgs.typos
|
pkgs.typos
|
||||||
pkgs.home-manager
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
@ -103,8 +102,8 @@ in {
|
||||||
};
|
};
|
||||||
extraSpecialArgs = {
|
extraSpecialArgs = {
|
||||||
inherit stateVersion inputs;
|
inherit stateVersion inputs;
|
||||||
hostname = "work";
|
hostname = "yorick-Latitude-7320";
|
||||||
username = "yorick-barbanneau";
|
username = "yorick";
|
||||||
};
|
};
|
||||||
modules = [
|
modules = [
|
||||||
./home-manager/default.nix
|
./home-manager/default.nix
|
||||||
|
|
|
@ -17,6 +17,4 @@
|
||||||
slurp
|
slurp
|
||||||
wl-clipboard
|
wl-clipboard
|
||||||
];
|
];
|
||||||
targets.genericLinux.enable = true;
|
|
||||||
xdg.mime.enable = true;
|
|
||||||
}
|
}
|
|
@ -9,59 +9,36 @@ process_args() {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
|
||||||
escape(){
|
|
||||||
local string
|
|
||||||
string=$1
|
|
||||||
string=${string//"<"/"<"}
|
|
||||||
string=${string//">"/">"}
|
|
||||||
string=${string//"&"/"&"}
|
|
||||||
printf "%s" "$string"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
options=( --app-name=cmus --transient -u low)
|
filename=${file#*/}
|
||||||
|
|
||||||
filename=${file##*/}
|
|
||||||
image=${file%/*}/cover.jpg
|
image=${file%/*}/cover.jpg
|
||||||
|
[ -f "$image" ] && options="$options -i \"${image}\""
|
||||||
|
|
||||||
if [[ -f "$image" ]]; then
|
|
||||||
options+=( -i "${image}" )
|
|
||||||
fi
|
|
||||||
|
|
||||||
## Get title or filename
|
|
||||||
title=${title:-$filename}
|
title=${title:-$filename}
|
||||||
if [[ ${#title} -gt 25 ]]; then
|
if [[ ${#title} -gt 25 ]]; then
|
||||||
title="${title:0:24}…"
|
title="${title:0:24}…"
|
||||||
fi
|
fi
|
||||||
title="<b>$title</b>"
|
|
||||||
|
|
||||||
if [ -n "$artist" ]
|
if [ -n "$artist" ]
|
||||||
then
|
then
|
||||||
if [[ ${#artist} -gt 22 ]]; then
|
if [[ ${#artist} -gt 22 ]]; then
|
||||||
artist="${artist:0:21}…"
|
artist="<i>by</i> ${artist:0:21}…"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$album" ]
|
||||||
|
then
|
||||||
|
if [[ ${#album} -gt 19 ]]; then
|
||||||
|
album="${album:0:18}…"
|
||||||
fi
|
fi
|
||||||
printf -v l_artist "<span size='x-large'>by </span>%s" "$(escape "$artist")"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$date" ]
|
if [ -n "$date" ]
|
||||||
then
|
then
|
||||||
date="${date%%-*}"
|
date="${date%%-*}"
|
||||||
fi
|
fi
|
||||||
|
printf -v body "%s\n%-19s <i>%s</i>" "${artist:-}" "${album:-}" "${date:-}"
|
||||||
# Get Album
|
notify-send --app-name=cmus -i "$image" "$title" "$body"
|
||||||
if [ -n "$album" ]
|
|
||||||
then
|
|
||||||
if [[ ${#album} -gt 19 ]]; then
|
|
||||||
album="${album:0:19}…"
|
|
||||||
fi
|
|
||||||
printf -v l_album "<span size='x-large'>on </span>%-20s <span size='x-large'>%s</span>" "$(escape "$album")" "${date:-}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
printf -v l_intro "<span variant='small-caps'>cmus:<b>%s</b></span>" "$(escape "$status")"
|
|
||||||
printf -v body "%s\n" "${l_intro:-}" "${title:-}" "${l_artist:-}" "${l_album:-}"
|
|
||||||
notify-send "${options[@]}" "unseless" "$body"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
process_args "$@"
|
process_args "$@"
|
||||||
|
|
|
@ -52,5 +52,5 @@ set color_win_inactive_sel_fg=20
|
||||||
set color_win_dir=default
|
set color_win_dir=default
|
||||||
|
|
||||||
set status_display_program=~/.config/cmus/notify.sh
|
set status_display_program=~/.config/cmus/notify.sh
|
||||||
set format_current= %{?stream??} %t %{?a?by %a} %{?l?on %l}%= %y
|
|
||||||
add -l ~/medias/music
|
add -l ~/medias/music
|
||||||
|
|
|
@ -26,7 +26,6 @@ with lib;
|
||||||
maxIconSize = 64;
|
maxIconSize = 64;
|
||||||
layer = "overlay";
|
layer = "overlay";
|
||||||
anchor = "top-right";
|
anchor = "top-right";
|
||||||
format = ''<span font_scale="small-caps">%a</span>\n<b>%s</b>\n%b'';
|
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
[urgency="high"]
|
[urgency="high"]
|
||||||
border-color=#F268b3
|
border-color=#F268b3
|
||||||
|
@ -35,10 +34,9 @@ with lib;
|
||||||
border-size=1
|
border-size=1
|
||||||
default-timeout=7000
|
default-timeout=7000
|
||||||
group-by=app-name
|
group-by=app-name
|
||||||
format=%b
|
|
||||||
|
|
||||||
[app-name="cmus" grouped]
|
[app-name="cmus" grouped]
|
||||||
format=%b
|
format=<b>%s</b>\n%b
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue