initial dotfiles

This commit is contained in:
srtk 2026-04-25 16:39:11 +05:30
commit 45e5fe53d2
370 changed files with 25449 additions and 0 deletions

View 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.

View file

@ -0,0 +1,41 @@
# krita-preview.yazi
A [Yazi](https://github.com/sxyazi/yazi) plugin to preview Krita's .kra and
.kra~ files.
> [!TIP]
> Krita's thumbnails are limited to 256x256 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
Either `unzip` or `7z` need to be installed and available in the PATH.
## Installation
```sh
ya pkg add walldmtd/krita-preview
```
## Usage
Add this to `yazi.toml`:
```toml
[plugin]
prepend_preloaders = [
{ name = "*.kra", run = "krita-preview" },
{ name = "*.kra~", run = "krita-preview" },
]
prepend_previewers = [
{ name = "*.kra", run = "krita-preview" },
{ name = "*.kra~", run = "krita-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)

View file

@ -0,0 +1,56 @@
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_unzip = Command("unzip"):arg({ "-jp", tostring(job.file.url), "preview.png" })
local cmd_7z = Command("7z"):arg({ "e", "-so", tostring(job.file.url), "preview.png" })
local output = cmd_unzip:output()
if not output then
-- Try with `7z` instead
output = cmd_7z:output()
if not output then
return nil, Err("Failed to start `unzip` or `7z`")
elseif not output.status.success then
return nil, Err("`7z` exited with error code: %s", output.status.code)
end
elseif not output.status.success then
return nil, Err("`unzip` exited with error code: %s", output.status.code)
end
local ok, err = fs.write(cache, output.stdout)
if not ok then
return false, Err("Failed to write preview image to cache, error: %s", err)
else
return true
end
end
function M:spot(job)
require("file"):spot(job)
end
return M