diff --git a/tasks/mpv.yml b/tasks/mpv.yml index 3afcc60..a7ba1bb 100644 --- a/tasks/mpv.yml +++ b/tasks/mpv.yml @@ -1,12 +1,9 @@ --- -- name: Create configuration directories +- name: Create configuration directory ansible.builtin.file: - path: "{{ item }}" + path: "{{ ansible_env.HOME }}/.config/mpv" state: directory mode: "0700" - loop: - - "{{ ansible_env.HOME }}/.config/mpv" - - "{{ ansible_env.HOME }}/.config/mpv/scripts" - name: Copy configuration files ansible.builtin.template: @@ -18,5 +15,3 @@ dest: "{{ ansible_env.HOME }}/.config/mpv/input.conf" - src: "templates/mpv/config.j2" dest: "{{ ansible_env.HOME }}/.config/mpv/mpv.conf" - - src: "templates/mpv/clipboard.lua.j2" - dest: "{{ ansible_env.HOME }}/.config/mpv/scripts/clipboard.lua" diff --git a/templates/mpv/clipboard.lua.j2 b/templates/mpv/clipboard.lua.j2 deleted file mode 100644 index 0283a78..0000000 --- a/templates/mpv/clipboard.lua.j2 +++ /dev/null @@ -1,28 +0,0 @@ --- {{ ansible_managed }} --- Note that the mp global is injected by mpv when the script is ran. - -local utils = require 'mp.utils' - -local function paste_from_clipboard(command) - local res = utils.subprocess({ args = { 'wl-paste', '--no-newline' } }) - if res.status == 0 and res.stdout then - local url = res.stdout:gsub("^%s*(.-)%s*$", "%1") -- trim whitespace - if url ~= "" then - mp.commandv("loadfile", url, command) - mp.osd_message("Processed: " .. url) - end - end -end - - -local function append_from_clipboard() - paste_from_clipboard("append") -end - -local function replace_from_clipboard() - paste_from_clipboard("replace") -end - --- TODO: add keybinding that works with idle screen -mp.add_key_binding("Shift+MBTN_RIGHT", "append_clipboard", append_from_clipboard) -mp.add_key_binding("Shift+MBTN_LEFT", "replace_clipboard", replace_from_clipboard) diff --git a/templates/mpv/config.j2 b/templates/mpv/config.j2 index 0c14a71..d9bc854 100644 --- a/templates/mpv/config.j2 +++ b/templates/mpv/config.j2 @@ -8,6 +8,3 @@ keep-open=yes # do not close the window on exit keepaspect-window=no # add black bars if window aspect and video aspect mismatch sub-auto=fuzzy # load all subs containing the media filename - -alang=en,nl -slang=en,nl