Skip to content

Instantly share code, notes, and snippets.

@hooke007
Created August 4, 2022 11:58
Show Gist options
  • Save hooke007/c0ddde8a4acc0a6ead78439c883a7bd6 to your computer and use it in GitHub Desktop.
Save hooke007/c0ddde8a4acc0a6ead78439c883a7bd6 to your computer and use it in GitHub Desktop.
[mpv-script] 快捷键循环命令
// 使用单个快捷键依次执行指令
// input.conf
// KEY script-message cycle-cmd "CMD1" "CMD2"
// Created by https://github.com/avih
var registry = {};
mp.register_script_message("cycle-cmd", function() {
var key = JSON.stringify(arguments);
if (!(registry[key] >= 0))
registry[key] = -1;
registry[key] = (registry[key] + 1) % arguments.length;
mp.command(arguments[registry[key]]);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment