mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 06:39:14 +00:00
parent
9e778eaad2
commit
48b4ae78d3
1 changed files with 17 additions and 12 deletions
|
|
@ -4,11 +4,13 @@
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
programs.cmus.extraConfig = let
|
programs.cmus.extraConfig = let
|
||||||
# Dispatch to multiple callbacks (if needed)
|
# dispatch to multiple callbacks
|
||||||
# Right now only notify-send is called
|
|
||||||
callback-script = pkgs.writeShellApplication {
|
callback-script = pkgs.writeShellApplication {
|
||||||
name = "cmus-callback-script";
|
name = "cmus-callback-script";
|
||||||
runtimeInputs = [pkgs.libnotify];
|
runtimeInputs = [
|
||||||
|
pkgs.cmusfm
|
||||||
|
pkgs.libnotify
|
||||||
|
];
|
||||||
text = ''
|
text = ''
|
||||||
# All keys contain only chars a-z. Values are UTF-8 strings.
|
# All keys contain only chars a-z. Values are UTF-8 strings.
|
||||||
#
|
#
|
||||||
|
|
@ -17,9 +19,8 @@
|
||||||
# - file or url is given only if track is 'loaded' in cmus
|
# - file or url is given only if track is 'loaded' in cmus
|
||||||
# - other keys/values are given only if they are available
|
# - other keys/values are given only if they are available
|
||||||
|
|
||||||
# Keep a copy of arguments
|
# Use a map so that we can redirect all the args to cmusfm
|
||||||
# argv=("$@")
|
argv=("$@")
|
||||||
|
|
||||||
declare -A map
|
declare -A map
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
map["$1"]="$2"
|
map["$1"]="$2"
|
||||||
|
|
@ -40,22 +41,26 @@
|
||||||
notify-send \
|
notify-send \
|
||||||
"$SYMB ''${map[title]}" \
|
"$SYMB ''${map[title]}" \
|
||||||
"''${map[artist]} / ''${map[album]}"
|
"''${map[artist]} / ''${map[album]}"
|
||||||
|
cmusfm "''${argv[@]}"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
(builtins.readFile ./rc)
|
(builtins.readFile ./rc)
|
||||||
+ lib.optionalString pkgs.stdenv.isLinux ''
|
+ (lib.optionalString pkgs.stdenv.isLinux ''
|
||||||
set status_display_program=${lib.getExe callback-script}
|
set status_display_program=${lib.getExe callback-script}
|
||||||
''
|
'')
|
||||||
|
+ (lib.optionalString pkgs.stdenv.isDarwin ''
|
||||||
|
set status_display_program=${lib.getExe pkgs.cmusfm}
|
||||||
|
'')
|
||||||
# This handles volume better
|
# This handles volume better
|
||||||
# Alsa backend has this behavior where system volume button will unsync two channels
|
# Alsa backend has this behavior where system volume button will unsync two channels
|
||||||
+ lib.optionalString pkgs.stdenv.isLinux ''
|
+ (lib.optionalString pkgs.stdenv.isLinux ''
|
||||||
set output_plugin=pulse
|
set output_plugin=pulse
|
||||||
''
|
'')
|
||||||
# When switching over bluetooth, toggle the output device to coreaudio
|
# When switching over bluetooth, toggle the output device to coreaudio
|
||||||
# and back to ao would fix the no sound issue.
|
# and back to ao would fix the no sound issue.
|
||||||
+ lib.optionalString pkgs.stdenv.isDarwin ''
|
+ (lib.optionalString pkgs.stdenv.isDarwin ''
|
||||||
# distortion fix https://github.com/cmus/cmus/issues/1130#issuecomment-1003324193
|
# distortion fix https://github.com/cmus/cmus/issues/1130#issuecomment-1003324193
|
||||||
set output_plugin=ao
|
set output_plugin=ao
|
||||||
'';
|
'');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue