initial dotfiles
This commit is contained in:
commit
45e5fe53d2
370 changed files with 25449 additions and 0 deletions
21
.config/yazi/plugins/blender-preview.yazi/LICENSE
Normal file
21
.config/yazi/plugins/blender-preview.yazi/LICENSE
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2025 walldmtd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
42
.config/yazi/plugins/blender-preview.yazi/README.md
Normal file
42
.config/yazi/plugins/blender-preview.yazi/README.md
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
# blender-preview.yazi
|
||||
|
||||
A [Yazi](https://github.com/sxyazi/yazi) plugin to preview Blender's .blend and
|
||||
.blend1 files.
|
||||
|
||||
> [!TIP]
|
||||
> Blender's thumbnails are limited to 128x128 pixels.
|
||||
> [zoom.yazi](https://github.com/yazi-rs/plugins/tree/main/zoom.yazi) can help
|
||||
increase the size, but won't change the resolution.
|
||||
|
||||
## Requirements
|
||||
|
||||
`blender-thumbnailer` needs to be available on the path
|
||||
(usually done automatically when Blender is installed).
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
ya pkg add walldmtd/blender-preview
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Add this to `yazi.toml`:
|
||||
|
||||
```toml
|
||||
[plugin]
|
||||
prepend_preloaders = [
|
||||
{ name = "*.blend", run = "blender-preview" },
|
||||
{ name = "*.blend1", run = "blender-preview" },
|
||||
]
|
||||
prepend_previewers = [
|
||||
{ name = "*.blend", run = "blender-preview" },
|
||||
{ name = "*.blend1", run = "blender-preview" },
|
||||
]
|
||||
```
|
||||
|
||||
## Acknowledgements
|
||||
|
||||
- [Yazi](https://github.com/sxyazi/yazi), for
|
||||
[magick.lua](https://github.com/sxyazi/yazi/blob/main/yazi-plugin/preset/plugins/magick.lua)
|
||||
(used as a base for this plugin)
|
||||
44
.config/yazi/plugins/blender-preview.yazi/main.lua
Normal file
44
.config/yazi/plugins/blender-preview.yazi/main.lua
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
local M = {}
|
||||
|
||||
function M:peek(job)
|
||||
local start, cache = os.clock(), ya.file_cache(job)
|
||||
if not cache then
|
||||
return
|
||||
end
|
||||
|
||||
local ok, err = self:preload(job)
|
||||
if not ok or err then
|
||||
return ya.preview_widget(job, err)
|
||||
end
|
||||
|
||||
ya.sleep(math.max(0, rt.preview.image_delay / 1000 + start - os.clock()))
|
||||
|
||||
local _, err = ya.image_show(cache, job.area)
|
||||
ya.preview_widget(job, err)
|
||||
end
|
||||
|
||||
function M:seek() end
|
||||
|
||||
function M:preload(job)
|
||||
local cache = ya.file_cache(job)
|
||||
if not cache or fs.cha(cache) then
|
||||
return true
|
||||
end
|
||||
|
||||
local cmd = Command("blender-thumbnailer"):arg({ tostring(job.file.url), tostring(cache) })
|
||||
|
||||
local status, err = cmd:status()
|
||||
if not status then
|
||||
return true, Err("Failed to start `blender-thumbnailer`, error: %s", err)
|
||||
elseif not status.success then
|
||||
return false, Err("`blender-thumbnailer` exited with error code: %s", status.code)
|
||||
else
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
function M:spot(job)
|
||||
require("file"):spot(job)
|
||||
end
|
||||
|
||||
return M
|
||||
Loading…
Add table
Add a link
Reference in a new issue