diff options
Diffstat (limited to 'ar')
| -rw-r--r-- | ar/.config/mpv/input.conf | 1 | ||||
| -rw-r--r-- | ar/.config/mpv/scripts/slicing.lua | 15 | ||||
| -rwxr-xr-x | ar/.local/bin/remapd | 18 |
3 files changed, 30 insertions, 4 deletions
diff --git a/ar/.config/mpv/input.conf b/ar/.config/mpv/input.conf index ef86749..4d63c44 100644 --- a/ar/.config/mpv/input.conf +++ b/ar/.config/mpv/input.conf @@ -43,6 +43,7 @@ s cycle pause ctrl+PRINT script-binding crop-screenshot # Crop screenshot o script-binding slicing/set-start # Set lossless cut start point O script-binding slicing/set-end # Set lossless cut end point and export +ctrl+o script-binding slicing/set-end-eof # Cut from start point to the end of the video and export ctrl+l script-message-to misc cycle-known-tracks audio # Loop auidio shift+l no-osd seek 30 exact; script-message-to misc show-position # Seek exactly 1 second forward shift+h no-osd seek -30 exact; script-message-to misc show-position # Seek exactly 1 second backward diff --git a/ar/.config/mpv/scripts/slicing.lua b/ar/.config/mpv/scripts/slicing.lua index 2653ce8..59bd980 100644 --- a/ar/.config/mpv/scripts/slicing.lua +++ b/ar/.config/mpv/scripts/slicing.lua @@ -39,8 +39,7 @@ local function set_start() osd(("Cut start: %s"):format(fmt(start_time))) end -local function set_end() - local end_time = mp.get_property_number("time-pos") +local function do_cut(end_time) if not end_time then return end if not start_time then @@ -107,5 +106,17 @@ local function set_end() end) end +-- mark end at the current playback position +local function set_end() + do_cut(mp.get_property_number("time-pos")) +end + +-- mark end at the very end of the file, regardless of playback position, +-- so you don't have to catch the last frame before playback ends +local function set_end_eof() + do_cut(mp.get_property_number("duration")) +end + mp.add_key_binding(nil, "set-start", set_start) mp.add_key_binding(nil, "set-end", set_end) +mp.add_key_binding(nil, "set-end-eof", set_end_eof) diff --git a/ar/.local/bin/remapd b/ar/.local/bin/remapd index f669b0c..10c07b2 100755 --- a/ar/.local/bin/remapd +++ b/ar/.local/bin/remapd @@ -1,8 +1,22 @@ #!/bin/bash -# Rerun the remaps script whenever a new input device is added. +device_ids() { xinput list --id-only 2>/dev/null | sort; } -while :; do +run_remaps_settled() { + before=$1 + i=0 + while [ "$i" -lt 15 ]; do + [ "$(device_ids)" != "$before" ] && break + sleep 0.1 + i=$((i + 1)) + done + sleep 0.3 remaps +} + +remaps +while :; do + before=$(device_ids) grep -qP -m1 '[^un]bind.+\/[^:]+\(usb\)' <(udevadm monitor -u -t seat -s input -s usb) + run_remaps_settled "$before" done |
