feat(home-manager): add cmus module
This commit is contained in:
parent
11309754fa
commit
dbea61d652
5 changed files with 120 additions and 0 deletions
17
modules/home-manager/audio/cmus/default.nix
Normal file
17
modules/home-manager/audio/cmus/default.nix
Normal file
|
@ -0,0 +1,17 @@
|
|||
{ lib, config, pkgs, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.modules.audio.cmus;
|
||||
in
|
||||
{
|
||||
options.modules.audio.cmus= {
|
||||
enable = mkEnableOption "enable cmus audio player";
|
||||
};
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = with pkgs; [
|
||||
cmus
|
||||
];
|
||||
home.file.".config/cmus/rc".source = ./files/rc;
|
||||
home.file.".config/cmus/notify.sh".source = ./files/notify.sh;
|
||||
};
|
||||
}
|
45
modules/home-manager/audio/cmus/files/notify.sh
Executable file
45
modules/home-manager/audio/cmus/files/notify.sh
Executable file
|
@ -0,0 +1,45 @@
|
|||
#!/usr/bin/env bash
|
||||
# shellcheck disable=SC2154
|
||||
process_args() {
|
||||
while [ "$#" -ge 2 ]
|
||||
do
|
||||
printf -v "$1" "%s" "$2"
|
||||
shift
|
||||
shift
|
||||
done
|
||||
}
|
||||
|
||||
main() {
|
||||
filename=${file#*/}
|
||||
image=${file%/*}/cover.jpg
|
||||
[ -f "$image" ] && options="$options -i \"${image}\""
|
||||
|
||||
title=${title:-$filename}
|
||||
if [[ ${#title} -gt 25 ]]; then
|
||||
title="${title:0:24}…"
|
||||
fi
|
||||
|
||||
if [ -n "$artist" ]
|
||||
then
|
||||
if [[ ${#artist} -gt 22 ]]; then
|
||||
artist="<i>by</i> ${artist:0:21}…"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$album" ]
|
||||
then
|
||||
if [[ ${#album} -gt 19 ]]; then
|
||||
album="${album:0:18}…"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$date" ]
|
||||
then
|
||||
date="${date%%-*}"
|
||||
fi
|
||||
printf -v body "%s\n%-19s <i>%s</i>" "${artist:-}" "${album:-}" "${date:-}"
|
||||
notify-send --app-name=cmus -i "$image" "$title" "$body"
|
||||
}
|
||||
|
||||
process_args "$@"
|
||||
main
|
56
modules/home-manager/audio/cmus/files/rc
Normal file
56
modules/home-manager/audio/cmus/files/rc
Normal file
|
@ -0,0 +1,56 @@
|
|||
## Base16 Default Dark
|
||||
|
||||
# overall background and foreground color
|
||||
set color_win_fg=7
|
||||
set color_win_bg=0
|
||||
|
||||
# bottom status line
|
||||
set color_statusline_fg=20
|
||||
set color_statusline_bg=19
|
||||
|
||||
# bottom title line
|
||||
set color_titleline_fg=7
|
||||
set color_titleline_bg=18
|
||||
|
||||
# top title area
|
||||
set color_win_title_fg=20
|
||||
set color_win_title_bg=19
|
||||
set color_win_title_attr=bold
|
||||
|
||||
# command-line colors
|
||||
set color_cmdline_bg=default
|
||||
set color_cmdline_fg=default
|
||||
set color_error=1
|
||||
set color_info=6
|
||||
|
||||
# separator of windows
|
||||
# should be black
|
||||
set color_separator=16
|
||||
|
||||
# unselected currently playing track's text
|
||||
set color_win_cur=13
|
||||
|
||||
# active selection for currently playing track
|
||||
set color_win_cur_sel_bg=20
|
||||
set color_win_cur_sel_fg=0
|
||||
set color_win_cur_sel_attr=none
|
||||
|
||||
# inactive selection for currently playing track
|
||||
set color_win_inactive_cur_sel_bg=8
|
||||
set color_win_inactive_cur_sel_fg=21
|
||||
|
||||
# active selection
|
||||
set color_win_sel_bg=6
|
||||
set color_win_sel_fg=0
|
||||
set color_win_sel_attr=none
|
||||
|
||||
# inactive selection
|
||||
set color_win_inactive_sel_bg=19
|
||||
set color_win_inactive_sel_fg=20
|
||||
|
||||
# directory listing color
|
||||
set color_win_dir=default
|
||||
|
||||
set status_display_program=~/.config/cmus/notify.sh
|
||||
|
||||
add -l ~/medias/music
|
|
@ -5,6 +5,7 @@
|
|||
./application/gnupg
|
||||
./application/imv
|
||||
./application/zathura
|
||||
./audio/cmus
|
||||
./cli/direnv
|
||||
./cli/ghq/default.nix
|
||||
./cli/git
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue