update: huge style update

This commit is contained in:
2026-03-13 10:37:01 +03:00
parent 1dea8c1a69
commit c49c97d55c
55 changed files with 686 additions and 332 deletions

View File

@@ -1,29 +1,85 @@
[mgr]
prepend_keymap = [
{on = [ ";" ], run = 'shell "$SHELL" --block --confirm', desc = "Open shell here"},
[[mgr.prepend_keymap]]
on = [ ";" ]
run = 'shell "$SHELL" --block --confirm'
desc = "Open shell here"
{on = [ ":","q","a","<Enter>" ], run = 'quit', desc = "Close the current tab"},
{on = [ ":","q","<Enter>" ], run = 'close', desc = "Close the current tab"},
[[mgr.prepend_keymap]]
on = [ ":","q","a","<Enter>" ]
run = 'quit'
desc = "Close the current tab"
[[mgr.prepend_keymap]]
on = [ ":","q","<Enter>" ]
run = 'close'
desc = "Close the current tab"
# Makes "Enter" key necessary to press
{on = [ ":","q","a","<Esc>" ], run = 'echo meow', desc = ""},
# Makes "Enter" key necessary to press
[[mgr.prepend_keymap]]
on = [ ":","q","a","<Esc>" ]
run = 'echo meow'
desc = ""
{on = [ "q" ], run = 'noop'},
[[mgr.prepend_keymap]]
on = [ "q" ]
run = 'noop'
{on = [ "g","e" ], run = 'cd /etc', desc = "Go to /etc"},
{on = [ "g","r" ], run = 'cd /', desc = "Go to /"},
{on = [ "g","s" ], run = 'cd /srv', desc = "Go to /srv"},
{on = [ "g","u" ], run = 'cd /usr', desc = "Go to /usr"},
{on = [ "g","v" ], run = 'cd /var', desc = "Go to /var"},
{on = [ "g","c" ], run = 'cd ~/.config', desc = "Go to .config"},
{on = [ "v" ], run = 'select_all --state=true', desc = "Select all files"},
{on = [ "V" ], run = 'visual_mode', desc = "Enter visual mode"},
[[mgr.prepend_keymap]]
on = [ "g","r" ]
run = 'cd /'
desc = "Go to /"
[[mgr.prepend_keymap]]
on = [ "g","u" ]
run = 'cd /usr'
desc = "Go to /usr"
[[mgr.prepend_keymap]]
on = [ "g","e" ]
run = 'cd /etc'
desc = "Go to /etc"
[[mgr.prepend_keymap]]
on = [ "g","v" ]
run = 'cd /var'
desc = "Go to /var"
{on = [ "y" ], run = [
'shell -- for path in "$@"; do echo "file://$path"; done | wl-copy -t text/uri-list',
"yank"
]},
[[mgr.prepend_keymap]]
on = [ "g","a" ]
run = 'cd /run/media/eugenebee'
desc = "Go to attached devices"
{on = [ "D", "<Enter>" ], run = 'remove --force --permanently', desc = "Permanently delete"},
[[mgr.prepend_keymap]]
on = [ "g","c" ]
run = 'cd ~/.config'
desc = "Go to .config"
[[mgr.prepend_keymap]]
on = [ "g","d" ]
run = 'cd ~/Downloads'
desc = "Go to Downloads"
[[mgr.prepend_keymap]]
on = [ "g","p" ]
run = 'cd ~/Pictures'
desc = "Go to Pictures"
[[mgr.prepend_keymap]]
on = [ "v" ]
run = 'select_all --state=true'
desc = "Select all files"
[[mgr.prepend_keymap]]
on = [ "V" ]
run = 'visual_mode'
desc = "Enter visual mode"
[[mgr.prepend_keymap]]
on = [ "y" ]
run = [
'shell -- for path in "$@"; do echo "file://$path"; done | wl-copy -t text/uri-list',
"yank"
]
[[mgr.prepend_keymap]]
on = "<C-y>"
run = ["plugin wl-clipboard"]
[[mgr.prepend_keymap]]
on = [ "D", "<Enter>" ]
run = 'remove --force --permanently'
desc = "Permanently delete"

View File

@@ -0,0 +1,29 @@
[mgr]
prepend_keymap = [
{on = [ ";" ], run = 'shell "$SHELL" --block --confirm', desc = "Open shell here"},
{on = [ ":","q","a","<Enter>" ], run = 'quit', desc = "Close the current tab"},
{on = [ ":","q","<Enter>" ], run = 'close', desc = "Close the current tab"},
# Makes "Enter" key necessary to press
{on = [ ":","q","a","<Esc>" ], run = 'echo meow', desc = ""},
{on = [ "q" ], run = 'noop'},
{on = [ "g","e" ], run = 'cd /etc', desc = "Go to /etc"},
{on = [ "g","r" ], run = 'cd /', desc = "Go to /"},
{on = [ "g","s" ], run = 'cd /srv', desc = "Go to /srv"},
{on = [ "g","u" ], run = 'cd /usr', desc = "Go to /usr"},
{on = [ "g","v" ], run = 'cd /var', desc = "Go to /var"},
{on = [ "g","c" ], run = 'cd ~/.config', desc = "Go to .config"},
{on = [ "v" ], run = 'select_all --state=true', desc = "Select all files"},
{on = [ "V" ], run = 'visual_mode', desc = "Enter visual mode"},
{on = [ "y" ], run = [
'shell -- for path in "$@"; do echo "file://$path"; done | wl-copy -t text/uri-list',
"yank"
]},
{on = [ "D", "<Enter>" ], run = 'remove --force --permanently', desc = "Permanently delete"},
]

View File

@@ -0,0 +1,7 @@
[[plugin.deps]]
use = "grappas/wl-clipboard"
rev = "e9a38e4"
hash = "6b8e5d6b09626facec713923d3ddb54b"
[flavor]
deps = []

View File

@@ -0,0 +1,7 @@
Copyright 2024 grappas
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,34 @@
# wl-clipboard.yazi
Forked from: [orhnk/system-clipboard.yazi](https://github.com/orhnk/system-clipboard.yazi) to work with wayland compositors.
## Demo
<https://github.com/user-attachments/assets/74d59f49-266a-497e-b67e-d77e64209026>
## Config
> [!NOTE]
> You need yazi 3.x for this plugin to work.
> [!Important]
> This plugin utilizes ["wl-clipboard" project](https://github.com/bugaevc/wl-clipboard).
> You need to have it installed on your system. (Make sure that It's on your $PATH)
## Installation
```bash
ya pkg add grappas/wl-clipboard
```
## Configuration
Copy or install this plugin and add the following keymap to your `manager.prepend_keymap`:
```toml
on = "<C-y>"
run = ["plugin wl-clipboard"]
```
> [!Tip]
> If you want to use this plugin with yazi's default yanking behaviour you should use `cx.yanked` instead of `tab.selected` in `init.lua` (See [#1487](https://github.com/sxyazi/yazi/issues/1487))

View File

@@ -0,0 +1,60 @@
-- Meant to run at async context. (yazi system-clipboard)
local selected_or_hovered = ya.sync(function()
local tab, paths = cx.active, {}
for _, u in pairs(tab.selected) do
paths[#paths + 1] = tostring(u)
end
if #paths == 0 and tab.current.hovered then
paths[1] = tostring(tab.current.hovered.url)
end
return paths
end)
return {
entry = function()
ya.manager_emit("escape", { visual = true })
local urls = selected_or_hovered()
if #urls == 0 then
return ya.notify({ title = "System Clipboard", content = "No file selected", level = "warn", timeout = 5 })
end
-- ya.notify({ title = #urls, content = table.concat(urls, " "), level = "info", timeout = 5 })
-- Format the URLs for `text/uri-list` specification
local function encode_uri(uri)
return uri:gsub("([^%w%-%._~:/])", function(c)
return string.format("%%%02X", string.byte(c))
end)
end
local file_list_formatted = ""
for _, path in ipairs(urls) do
-- Each file path must be URI-encoded and prefixed with "file://"
file_list_formatted = file_list_formatted .. "file://" .. encode_uri(path) .. "\r\n"
end
local status, err =
Command("wl-copy"):arg("--type"):arg("text/uri-list"):arg(file_list_formatted):spawn():wait()
if status or status.succes then
ya.notify({
title = "System Clipboard",
content = "Succesfully copied the file(s) to system clipboard",
level = "info",
timeout = 5,
})
end
if not status or not status.success then
ya.notify({
title = "System Clipboard",
content = string.format("Could not copy selected file(s) %s", status and status.code or err),
level = "error",
timeout = 5,
})
end
end,
}