summaryrefslogtreecommitdiffstats
path: root/lass/2configs/mpv.nix
diff options
context:
space:
mode:
authorlassulus <lass@aidsballs.de>2016-04-28 22:55:18 +0200
committerlassulus <lass@aidsballs.de>2016-04-28 22:55:18 +0200
commitd73ad6b0547c23155e6168fba54ef01c1ff9f4fc (patch)
treeafc7eed97e3966b4868e80e98a67131b2c135921 /lass/2configs/mpv.nix
parentd22a4a59641e26895711ff1795e6c1a7495ed6ff (diff)
l 2: add mpv.nix (with delete.lua)
Diffstat (limited to 'lass/2configs/mpv.nix')
-rw-r--r--lass/2configs/mpv.nix30
1 files changed, 30 insertions, 0 deletions
diff --git a/lass/2configs/mpv.nix b/lass/2configs/mpv.nix
new file mode 100644
index 000000000..71f1409e0
--- /dev/null
+++ b/lass/2configs/mpv.nix
@@ -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
+ ];
+}