Update: 2024-11-28

This commit is contained in:
Kristofers Solo 2024-11-28 11:25:04 +02:00
parent 74e444a83f
commit d231e9de9c
12 changed files with 181 additions and 18 deletions

View File

@ -16,6 +16,8 @@ monitor=DP-1,disable
# See https://wiki.hyprland.org/Configuring/Keywords/ for more
env = HYPRLAND_INSTANCE_SIGNATURE,/tmp/hypr
# Execute your favorite apps at launch
# exec-once = waybar & hyprpaper & firefox
exec-once = pipewire & pipewire-pulse & wireplumber & eww daemon & eww open bar & nextcloud & /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 & xrdb "$XDG_CONFIG_HOME/x11/xresources" & spotifyd --no-daemon & syncthing & transmission-daemon & dunst & dbus-update-activation-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP DISPLAY XAUTHORITY & hyprpaper

View File

@ -41,6 +41,7 @@ alias \
j="joshutoub" \
lf="lfub" \
lg="lazygit" \
lzd="lazydocker" \
lock="swaylock" \
night="redshift -PO 4500" \
py="python" \

View File

@ -38,6 +38,10 @@ export XDG_RUNTIME_DIR="$HOME/.cache/xdgr"
export XDG_STATE_HOME="$HOME/.local/share"
export HYPRSHOT_DIR="$HOME/Pictures/screenshots"
# export XDG_CURRENT_DESKTOP=Hyprland
# export XDG_SESSION_TYPE=wayland
# export XDG_SESSION_DESKTOP=Hyprland
# export HYPRLAND_INSTANCE_SIGNATURE=/tmp/hypr
export ANDROID_HOME="$XDG_CONFIG_HOME/android"

View File

@ -1,6 +1,6 @@
#!/bin/sh
autostart="picom nextcloud discord transmission-daemon floorp discord syncthing mullvad-vpn spotify-launcher set-animated-bg"
autostart="picom nextcloud discord transmission-daemon floorp discord syncthing mullvad-vpn spotify-launcher"
for program in $autostart; do
pidof -sx "$program" || "$program" &

View File

@ -1,21 +1,21 @@
[plugin]
deps = [
{use = "AnirudhG07/nbpreview", rev = "2d24602" },
{use = "Reledia/glow", rev = "388e847" },
{use = "Reledia/hexyl", rev = "ccc0a4a" },
{use = "Reledia/miller", rev = "40e0265" },
{use = "Sonico98/exifaudio", rev = "855ff05" },
{use = "dedukun/relative-motions", rev = "1d6d686" },
{use = "hankertrix/augment-command", rev = "fe145ac" },
{use = "imsi32/yatline", rev = "e255f5c" },
{use = "kirasok/torrent-preview", rev = "76970b6" },
{use = "ndtoan96/ouch", rev = "db14883" },
{use = "pirafrank/what-size", rev = "f08f7f2" },
{use = "yazi-rs/plugins:chmod", rev = "776b160" },
{use = "yazi-rs/plugins:full-border", rev = "776b160" },
{use = "yazi-rs/plugins:git", rev = "776b160" },
{use = "yazi-rs/plugins:hide-preview", rev = "776b160" },
{use = "yazi-rs/plugins:max-preview", rev = "776b160" },
{use = "AnirudhG07/nbpreview", rev = "2d24602"},
{use = "Reledia/glow", rev = "388e847"},
{use = "Reledia/hexyl", rev = "ccc0a4a"},
{use = "Reledia/miller", rev = "40e0265"},
{use = "Sonico98/exifaudio", rev = "855ff05"},
{use = "dedukun/relative-motions", rev = "44c4c1c"},
{use = "hankertrix/augment-command", rev = "fe145ac"},
{use = "imsi32/yatline", rev = "e255f5c"},
{use = "kirasok/torrent-preview", rev = "76970b6"},
{use = "ndtoan96/ouch", rev = "db14883"},
{use = "pirafrank/what-size", rev = "f08f7f2"},
{use = "yazi-rs/plugins:chmod", rev = "d85bfd6"},
{use = "yazi-rs/plugins:full-border", rev = "d85bfd6"},
{use = "yazi-rs/plugins:git", rev = "d85bfd6"},
{use = "yazi-rs/plugins:hide-preview", rev = "d85bfd6"},
{use = "yazi-rs/plugins:max-preview", rev = "d85bfd6"},
]
[flavor]

View File

@ -18,6 +18,8 @@ Add this to your `~/.config/yazi/keymap.toml`:
[[manager.prepend_keymap]]
on = "T"
run = "plugin --sync hide-preview"
# For upcoming Yazi 0.4 (nightly version):
# run = "plugin hide-preview"
desc = "Hide or show preview"
```

View File

@ -18,6 +18,8 @@ Add this to your `~/.config/yazi/keymap.toml`:
[[manager.prepend_keymap]]
on = "T"
run = "plugin --sync max-preview"
# For upcoming Yazi 0.4 (nightly version):
# run = "plugin max-preview"
desc = "Maximize or restore preview"
```

View File

@ -0,0 +1,19 @@
Copyright (c) 2024 Lauri Niskanen
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,22 @@
# mediainfo.yazi
This is a Yazi plugin for previewing media files. The preview shows thumbnail
using `ffmpegthumbnailer` if available and media metadata using `mediainfo`.
## Installation
Install the plugin:
```
ya pack -a Ape/mediainfo
```
Create `~/.config/yazi/yazi.toml` and add:
```
[plugin]
prepend_previewers = [
{ mime = "{image,audio,video}/*", run = "mediainfo"},
{ mime = "application/x-subrip", run = "mediainfo"},
]
```

View File

@ -0,0 +1,111 @@
local skip_labels = {
["Complete name"] = true,
["CompleteName_Last"] = true,
["Unique ID"] = true,
["File size"] = true,
["Format/Info"] = true,
["Codec ID/Info"] = true,
["MD5 of the unencoded content"] = true,
}
local M = {}
function M:peek()
local image_height = 0
if self:preload() == 1 then
local cache = ya.file_cache(self)
if cache and fs.cha(cache).length > 0 then
image_height = ya.image_show(cache, self.area).h
end
end
local cmd = "mediainfo"
local output, code = Command(cmd)
:args({ tostring(self.file.url) })
:stdout(Command.PIPED)
:output()
local lines = {}
if output then
local i = 0
for str in output.stdout:gmatch("[^\n]*") do
local label, value = str:match("(.*[^ ]) +: (.*)")
local line
if label then
if not skip_labels[label] then
line = ui.Line({
ui.Span(label .. ": "):bold(),
ui.Span(value),
})
end
elseif str ~= "General" then
line = ui.Line({ ui.Span(str):underline() })
end
if line then
if i >= self.skip then
table.insert(lines, line)
end
local max_width = math.max(1, self.area.w - 3)
i = i + math.max(1, math.ceil(line:width() / max_width))
end
end
else
local error = string.format("Spawn `%s` command returns %s", cmd, code)
table.insert(lines, ui.Line(error))
end
ya.preview_widgets(self, {
ui.Paragraph(
ui.Rect({
x = self.area.x,
y = self.area.y + image_height,
w = self.area.w,
h = self.area.h - image_height,
}),
lines
):wrap(ui.Paragraph.WRAP),
})
end
function M:seek(units)
local h = cx.active.current.hovered
if h and h.url == self.file.url then
local step = math.floor(units * self.area.h / 10)
ya.manager_emit("peek", {
math.max(0, cx.active.preview.skip + step),
only_if = self.file.url,
})
end
end
function M:preload()
local cache = ya.file_cache(self)
if not cache or fs.cha(cache) then
return 1
end
local cmd = "ffmpegthumbnailer"
local child, code = Command(cmd):args({
"-q", "6",
"-c", "jpeg",
"-i", tostring(self.file.url),
"-o", tostring(cache),
"-t", "5",
"-s", tostring(PREVIEW.max_width),
}):spawn()
if not child then
ya.err(string.format("spawn `%s` command returns %s", cmd, code))
return 0
end
local status = child:wait()
return status and status.success and 1 or 2
end
return M

View File

@ -214,7 +214,7 @@ return {
local initial_value
-- this is checking if the argument is a valid number
if args then
if #args > 0 then
initial_value = tostring(tonumber(args[1]))
if initial_value == "nil" then
return