mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 06:39:14 +00:00
nix: format with alejandra
This commit is contained in:
parent
d5cad148da
commit
95eb4b71e0
118 changed files with 1291 additions and 1703 deletions
|
|
@ -1,71 +1,66 @@
|
|||
{ pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
programs.cmus.extraConfig = let
|
||||
# dispatch to multiple callbacks
|
||||
callback-script = pkgs.writeShellApplication {
|
||||
name = "cmus-callback-script";
|
||||
runtimeInputs = [
|
||||
pkgs.cmusfm
|
||||
pkgs.libnotify
|
||||
];
|
||||
text = ''
|
||||
# All keys contain only chars a-z. Values are UTF-8 strings.
|
||||
#
|
||||
# Keys: status file url artist album discnumber tracknumber title date
|
||||
# - status (stopped, playing, paused) is always given
|
||||
# - file or url is given only if track is 'loaded' in cmus
|
||||
# - other keys/values are given only if they are available
|
||||
|
||||
programs.cmus.extraConfig =
|
||||
let
|
||||
# dispatch to multiple callbacks
|
||||
callback-script = pkgs.writeShellApplication {
|
||||
name = "cmus-callback-script";
|
||||
runtimeInputs = [
|
||||
pkgs.cmusfm
|
||||
pkgs.libnotify
|
||||
];
|
||||
text = ''
|
||||
# All keys contain only chars a-z. Values are UTF-8 strings.
|
||||
#
|
||||
# Keys: status file url artist album discnumber tracknumber title date
|
||||
# - status (stopped, playing, paused) is always given
|
||||
# - file or url is given only if track is 'loaded' in cmus
|
||||
# - other keys/values are given only if they are available
|
||||
# Use a map so that we can redirect all the args to cmusfm
|
||||
argv=("$@")
|
||||
declare -A map
|
||||
while [ $# -gt 0 ]; do
|
||||
map["$1"]="$2"
|
||||
shift
|
||||
shift
|
||||
done
|
||||
|
||||
# Use a map so that we can redirect all the args to cmusfm
|
||||
argv=("$@")
|
||||
declare -A map
|
||||
while [ $# -gt 0 ]; do
|
||||
map["$1"]="$2"
|
||||
shift
|
||||
shift
|
||||
done
|
||||
# Setup pretty symbols
|
||||
case ''${map[status]} in
|
||||
paused)
|
||||
SYMB="⏸"
|
||||
;;
|
||||
playing)
|
||||
SYMB="⏵"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Setup pretty symbols
|
||||
case ''${map[status]} in
|
||||
paused)
|
||||
SYMB="⏸"
|
||||
;;
|
||||
playing)
|
||||
SYMB="⏵"
|
||||
;;
|
||||
esac
|
||||
|
||||
notify-send \
|
||||
"$SYMB ''${map[title]}" \
|
||||
"''${map[artist]} / ''${map[album]}"
|
||||
cmusfm "''${argv[@]}"
|
||||
'';
|
||||
};
|
||||
in
|
||||
notify-send \
|
||||
"$SYMB ''${map[title]}" \
|
||||
"''${map[artist]} / ''${map[album]}"
|
||||
cmusfm "''${argv[@]}"
|
||||
'';
|
||||
};
|
||||
in
|
||||
(builtins.readFile ./rc)
|
||||
|
||||
+ (lib.optionalString pkgs.stdenv.isLinux ''
|
||||
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
|
||||
# Alsa backend has this behavior where system volume button will unsync two channels
|
||||
+ (lib.optionalString pkgs.stdenv.isLinux ''
|
||||
set output_plugin=pulse
|
||||
'')
|
||||
|
||||
# When switching over bluetooth, toggle the output device to coreaudio
|
||||
# and back to ao would fix the no sound issue.
|
||||
+ (lib.optionalString pkgs.stdenv.isDarwin ''
|
||||
# distortion fix https://github.com/cmus/cmus/issues/1130#issuecomment-1003324193
|
||||
set output_plugin=ao
|
||||
'');
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue