mirror of
https://github.com/ksyasuda/dotfiles.git
synced 2025-12-05 02:53:38 -08:00
Compare commits
3 Commits
d8a0e95bb5
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
a93761b042
|
|||
|
a1ec1a54ba
|
|||
|
|
7b7fae9b91 |
@@ -26,7 +26,6 @@ monitorv2 {
|
||||
scale = 1
|
||||
vrr = 2
|
||||
cm = srgb
|
||||
|
||||
# Optional HDR settings
|
||||
# cm = hdr
|
||||
# bitdepth = 10
|
||||
|
||||
@@ -436,6 +436,14 @@ local misc_utilities_mappings = {
|
||||
end,
|
||||
group = "mkdir under cursor",
|
||||
},
|
||||
{
|
||||
mode = "v",
|
||||
key = "<leader>m",
|
||||
cmd = function()
|
||||
mkdir_under_cursor()
|
||||
end,
|
||||
group = "mkdir selection",
|
||||
},
|
||||
}
|
||||
-- }}}
|
||||
|
||||
|
||||
@@ -2,8 +2,20 @@ local M = {}
|
||||
vim.notify = require("notify")
|
||||
|
||||
function M.mkdir_under_cursor()
|
||||
-- Get the word under the cursor
|
||||
local word = vim.fn.expand("<cWORD>")
|
||||
local word
|
||||
|
||||
-- Check if in visual mode
|
||||
if vim.fn.mode():match("[vV]") then
|
||||
-- Get visual selection
|
||||
local start_pos = vim.fn.getpos("'<")
|
||||
local end_pos = vim.fn.getpos("'>")
|
||||
local line = vim.fn.getline(start_pos[2])
|
||||
word = line:sub(start_pos[3], end_pos[3])
|
||||
else
|
||||
-- Get word under cursor
|
||||
word = vim.fn.expand("<cWORD>")
|
||||
end
|
||||
|
||||
-- Remove quotes if present
|
||||
word = word:gsub("^[\"']", ""):gsub("[\"']$", "")
|
||||
-- Check if directory exists
|
||||
|
||||
@@ -10,8 +10,10 @@
|
||||
"Cloudflare - https://dash.cloudflare.com/",
|
||||
"CoinMarketCap - https://coinmarketcap.com/",
|
||||
"Deemix - http://pve-main:3358",
|
||||
"Ephemera - https://ephemera.suda.codes",
|
||||
"F1TV - https://f1tv.suda.codes",
|
||||
"Fidelity - https://login.fidelity.com/",
|
||||
"Ghstats - http://oracle-vm:3340",
|
||||
"Gitea - https://gitea.suda.codes",
|
||||
"Github - https://github.com",
|
||||
"Ghostfolio - http://pve-main:3334",
|
||||
@@ -23,7 +25,7 @@
|
||||
"Jellyfin (Vue) - http://pve-main:8098",
|
||||
"Karakeep - https://karakeep.suda.codes",
|
||||
"Komodo - https://komodo.suda.codes",
|
||||
"Komga - http://oracle-vm:3332",
|
||||
"Komga - http://pve-main:3332",
|
||||
"Lidarr - http://pve-main:3357",
|
||||
"MeTube - https://metube.suda.codes",
|
||||
"Navidrome - https://navidrome.suda.codes",
|
||||
@@ -32,7 +34,8 @@
|
||||
"Pihole - https://pihole.suda.codes/admin",
|
||||
"Pihole2 - https://pihole2.suda.codes/admin",
|
||||
"Proxmox - https://thebox.unicorn-ilish.ts.net",
|
||||
"qBittorrent - https://qbit.suda.codes",
|
||||
"qBittorrent - https://qbittorrent.suda.codes",
|
||||
"qui - https://qui.suda.codes",
|
||||
"Plausible - https://plausible.sudacode.com",
|
||||
"Paperless - https://paperless.suda.codes",
|
||||
"Prometheus - http://prometheus:9090",
|
||||
@@ -42,6 +45,7 @@
|
||||
"Sabnzbd - https://sabnzbd.suda.codes",
|
||||
"Sonarr - https://sonarr.suda.codes",
|
||||
"Sonarr Anime - http://pve-main:6969",
|
||||
"Speedtest Tracker - http://pve-main:8765",
|
||||
"Sudacode - https://sudacode.com",
|
||||
"Suwayomi - https://suwayomi.suda.codes",
|
||||
"Tailscale - https://login.tailscale.com/admin/machines",
|
||||
|
||||
@@ -31,6 +31,9 @@ generate_thumbnail() {
|
||||
local temp_thumb="/tmp/rmpv-thumbnail-$$.jpg"
|
||||
local thumbnail_file="${video_file%.*}.jpg"
|
||||
|
||||
# Clean up previous thumbnail
|
||||
rm -f "$THUMBNAIL_PATH"
|
||||
|
||||
# Validate input
|
||||
if [[ -z "$video_file" ]]; then
|
||||
echo "Error: No video file specified" >&2
|
||||
@@ -51,28 +54,39 @@ generate_thumbnail() {
|
||||
# Generate thumbnail if it doesn't exist
|
||||
if [[ ! -f "$thumbnail_file" ]]; then
|
||||
echo "Generating thumbnail for $(basename "$video_file")..."
|
||||
if ! ffmpeg -i "$video_file" \
|
||||
-vf "select='gt(scene,0.4)',scale=320:240:force_original_aspect_ratio=decrease,pad=320:240:(ow-iw)/2:(oh-ih)/2" \
|
||||
# Try generating thumbnail side-by-side
|
||||
if ! ffmpeg -ss 00:00:01 -i "$video_file" \
|
||||
-vf "scale=320:240:force_original_aspect_ratio=decrease,pad=320:240:(ow-iw)/2:(oh-ih)/2" \
|
||||
-frames:v 1 \
|
||||
-q:v 4 \
|
||||
"$thumbnail_file" \
|
||||
-loglevel error -y 2>/dev/null; then
|
||||
echo "Error: Failed to generate thumbnail" >&2
|
||||
return 1
|
||||
|
||||
# Fallback to temp file if side-by-side fails (e.g. read-only fs)
|
||||
echo "Warning: Failed to write to $thumbnail_file, trying temp location" >&2
|
||||
thumbnail_file="$temp_thumb"
|
||||
|
||||
if ! ffmpeg -ss 00:00:01 -i "$video_file" \
|
||||
-vf "scale=320:240:force_original_aspect_ratio=decrease,pad=320:240:(ow-iw)/2:(oh-ih)/2" \
|
||||
-frames:v 1 \
|
||||
-q:v 4 \
|
||||
"$thumbnail_file" \
|
||||
-loglevel error -y 2>/dev/null; then
|
||||
echo "Error: Failed to generate thumbnail" >&2
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Copy to temporary location with error handling
|
||||
if ! cp "$thumbnail_file" "$temp_thumb" 2>/dev/null; then
|
||||
echo "Error: Failed to copy thumbnail to temporary location" >&2
|
||||
return 1
|
||||
# Copy to consistent location for notify-send
|
||||
# We use a fixed path so notify-send always finds it
|
||||
if cp "$thumbnail_file" "$THUMBNAIL_PATH" 2>/dev/null; then
|
||||
echo "Thumbnail ready at: $THUMBNAIL_PATH"
|
||||
ls -l "$THUMBNAIL_PATH"
|
||||
file "$THUMBNAIL_PATH"
|
||||
else
|
||||
echo "Error: Failed to copy thumbnail to $THUMBNAIL_PATH" >&2
|
||||
fi
|
||||
|
||||
# Create symlink for consistent access
|
||||
ln -sf "$temp_thumb" /tmp/rmpv-thumbnail.jpg 2>/dev/null
|
||||
sleep 0.1
|
||||
|
||||
echo "Thumbnail ready: $temp_thumb"
|
||||
}
|
||||
|
||||
choice="$(find . -iname "*[.mkv|.mp4]" | sort -h | rofi -dmenu -i -theme "$THEME" -theme-str 'listview {columns: 1; lines: 15;} window {width: 88%;}' -p "Choose Video")"
|
||||
@@ -89,3 +103,4 @@ notify-send -i "$THUMBNAIL_PATH" "Playing Video" "$(basename "$choice")"
|
||||
$COMMAND "$choice" &
|
||||
|
||||
# vim: ft=sh
|
||||
|
||||
|
||||
Reference in New Issue
Block a user