l 2: add mpv.nix (with delete.lua)
This commit is contained in:
parent
d22a4a5964
commit
d73ad6b054
30
lass/2configs/mpv.nix
Normal file
30
lass/2configs/mpv.nix
Normal file
|
@ -0,0 +1,30 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
let
|
||||
|
||||
mpv-config = pkgs.writeText "mpv-config" ''
|
||||
script=${deleteCurrentFile}
|
||||
'';
|
||||
mpv = pkgs.writeDashBin "mpv" ''
|
||||
exec ${pkgs.mpv}/bin/mpv --no-config --include=${mpv-config} $@
|
||||
'';
|
||||
|
||||
deleteCurrentFile = pkgs.writeText "delete.lua" ''
|
||||
deleted_tmp = "./.graveyard"
|
||||
|
||||
-- Delete the current track by moving it to the `deleted_tmp` location.
|
||||
function delete_current_track()
|
||||
track = mp.get_property("path")
|
||||
os.execute("mkdir -p '" .. deleted_tmp .. "'")
|
||||
os.execute("mv '" .. track .. "' '" .. deleted_tmp .. "'")
|
||||
print("'" .. track .. "' deleted.")
|
||||
end
|
||||
|
||||
mp.add_key_binding("D", "delete_current_track", delete_current_track)
|
||||
'';
|
||||
|
||||
in {
|
||||
krebs.per-user.lass.packages = [
|
||||
mpv
|
||||
];
|
||||
}
|
Loading…
Reference in a new issue