mpv stuff and mcsr stuff (sens might change in future)

This commit is contained in:
Dea 2026-01-11 18:02:53 -05:00
parent 0d0bafe04e
commit f2dfde840f
9 changed files with 110 additions and 28 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 593 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 846 KiB

View file

@ -165,6 +165,7 @@
yt-dlp
bottles # windows emulation
];
# There have been amdgpu issues in 6.10 so you maybe need to revert on the default lts kernel.
@ -180,6 +181,11 @@
defaultEditor = true;
};
services.mullvad-vpn = {
enable = true;
package = pkgs.mullvad-vpn; # mullvad only has the cli
};
programs.nix-ld = {
enable = true;
libraries = with pkgs; [

View file

@ -24,6 +24,7 @@
libsForQt5.qt5.qtbase
btop-cuda
croc
syncplay
];

View file

@ -1,7 +1,87 @@
{ pkgs, ... }:
let
auto-sub =
let
file = builtins.toFile "auto-sub.lua" ''
mp.add_hook('on_load', 10, function ()
mp.set_property('sub-file-paths', 'Subs/' .. mp.get_property('filename/no-ext'))
end)
'';
in
pkgs.mpvScripts.buildLua {
pname = "auto-sub";
version = "1.0.0";
src = file;
unpackPhase = ":";
scriptPath = file;
};
seek-end =
let
file = builtins.toFile "seek_end.lua" ''
function seek_end()
mp.commandv("seek", math.floor(mp.get_property_number("duration") - 4), "absolute")
end
mp.add_key_binding(nil, "seek_end", seek_end)
'';
in
pkgs.mpvScripts.buildLua {
pname = "seek-end";
version = "1.0.0";
src = file;
unpackPhase = ":";
scriptPath = file;
};
in
{
programs.mpv = {
enable = true;
config = {
input-default-bindings = false;
input-builtin-bindings = false;
sub-outline-color = "0.0/0.3";
sub-border-style = "opaque-box";
sub-outline-size = -2;
sub-filter-regex-append = "opensubtitles\\.org";
sub-auto = "all";
ytdl-format = "bestvideo+bestaudio/best";
slang = "en";
ytdl-raw-options = "ignore-config=,sub-lang=en,write-sub=,write-auto-sub=";
hidpi-window-scale = false;
hwdec = "auto";
profile = "high-quality";
vulkan-swap-mode = "auto";
gpu-context = "wayland";
};
bindings = {
"]" = "add speed 0.5";
"[" = "add speed -0.5";
SPACE = "cycle pause";
RIGHT = "seek 5 exact";
LEFT = "seek -5 exact";
v = "cycle sub";
V = "cycle sub down";
b = "cycle audio";
B = "cycle audio down";
f = "cycle fullscreen";
WHEEL_UP = "add volume 2";
WHEEL_DOWN = "add volume -2";
j = "add chapter -1";
l = "add chapter 1";
y = "script-binding seek_end";
"`" = "script-binding console/enable";
};
scripts =
with pkgs.mpvScripts;
[
mpv-osc-tethys
thumbfast
]
++ [
seek-end
auto-sub
];
};
}

View file

@ -12,7 +12,8 @@
prismlauncher # minecraft
r2modman
# osu-lazer-bin
waywall
waywall
glfw3-minecraft
];
programs = {

View file

@ -17,9 +17,6 @@ in
local resolution = { w = ${toString 1920}, h = ${toString 1080} }
local images = {
eye_overlay = "${./eye-overlay.png}",
thin = "${./yukata.jpg}",
wide = "${./yukata.jpg}",
tall = "${./yukata.jpg}",
}
-- end globals
''

View file

@ -10,7 +10,9 @@ local scene = Scene.SceneManager.new(waywall)
local ModeManager = Modes.ModeManager.new(waywall)
-- resolution is a magic global
local thin_w = resolution.h * 0.28
-- local thin_w = resolution.h * 0.28
local thin_w = 350
local thin_h = 1000
local tall_w = 384
local tall_h = 16384
@ -29,20 +31,9 @@ local mc_eye_y = (tall_h - mc_eye_h) / 2
-- https://arjuncgore.github.io/waywall-boat-eye-calc/
-- https://github.com/Esensats/mcsr-calcsens
local normal_sens = 13.117018998967824
local tall_sens = 0.88486625532087
local normal_sens = 3.974841839338015
local tall_sens = 0.26814045280749516
for _, name in ipairs({ "wide", "thin", "tall" }) do
scene:register(name .. "_bg", {
kind = "image",
path = images[name],
options = {
dst = { x = 0, y = 0, w = resolution.w, h = resolution.h },
depth = -1,
},
groups = { name },
})
end
local left_middle = (resolution.w - thin_w) / 4
scene:register("e_counter", {
@ -50,7 +41,7 @@ scene:register("e_counter", {
options = {
src = { x = 1 * e_src_scale, y = 37 * e_src_scale, w = e_w, h = e_h },
dst = { x = left_middle - (e_w * e_scale / 2), y = resolution.h / 10.8, w = e_w * e_scale, h = e_h * e_scale },
depth = 0,
depth = 1,
},
groups = { "thin" },
})
@ -68,7 +59,7 @@ scene:register("eye_measure", {
scene:register("eye_overlay", {
kind = "image",
path = images.eye_overlay,
options = { dst = eye_dst, depth = 1 },
options = { dst = eye_dst, depth = 5 },
groups = { "tall" },
})
@ -78,7 +69,7 @@ end
ModeManager:define("thin", {
width = thin_w,
height = resolution.h,
height = thin_h,
on_enter = function()
scene:enable_group("thin", true)
end,
@ -100,6 +91,7 @@ ModeManager:define("wide", {
toggle_guard = mode_guard,
})
-- eye measuring
ModeManager:define("tall", {
width = tall_w,
height = tall_h,
@ -119,30 +111,35 @@ local ensure_ninjabrain = Processes.ensure_application(waywall, ninb_path)("ninj
local config = {
input = {
layout = "fr",
layout = "us",
repeat_rate = 40,
repeat_delay = 300,
sensitivity = normal_sens,
confine_pointer = false,
remaps = {
["MB5"] = "F3"
},
},
theme = {
background = "#303030ff",
-- background = "#303030ff",
background_png = os.getenv("HOME") .. "/dea-files/assets/wallpapers/yukata.png",
-- https://github.com/Smithay/smithay/issues/1894
ninb_anchor = "top",
},
actions = Keys.actions({
["Ctrl-Super-F"] = waywall.toggle_fullscreen,
["*-N"] = function()
["F11"] = waywall.toggle_fullscreen,
["*-B"] = function()
return ModeManager:toggle("thin")
end,
["*-P"] = function()
["*-V"] = function()
return ModeManager:toggle("tall")
end,
["*-G"] = function()
return ModeManager:toggle("wide")
end,
["Ctrl-Shift-M"] = function()
["*-L"] = function()
ensure_ninjabrain()
helpers.toggle_floating()
end,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 593 KiB