This commit is contained in:
do butterflies cry? 2026-03-21 10:25:31 +10:00
parent 2d677a19ac
commit e3453b0a87
Signed by: cry
GPG key ID: F68745A836CA0412
20 changed files with 668 additions and 274 deletions

View file

@ -6,8 +6,15 @@
}: {
imports = [
./hardware.nix
./modules/gamergrl
];
# services.wa2k = {
# enable = true;
# port = 8080;
# openFirewall = true;
# };
networking = {
hostName = "myputer";

View file

@ -1,11 +1,10 @@
{...}: {
services.flatpak = {
packages = [
{
# Linux Runtime for Roblox
appId = "org.vinegarhq.Sober";
origin = "flathub";
}
];
};
{upkgs, ...}: {
imports = [
./flatpak.nix
./mcsr
];
environment.systemPackages = with upkgs; [
hydralauncher
];
}

View file

@ -0,0 +1,11 @@
{...}: {
services.flatpak = {
packages = [
{
# Linux Runtime for Roblox
appId = "org.vinegarhq.Sober";
origin = "flathub";
}
];
};
}

View file

@ -0,0 +1,52 @@
{
inputs,
pkgs,
lib,
config,
...
}: let
cfg = config.programs.waywall;
inherit (inputs) mcsr;
mcsrPkgs = mcsr.packages.${pkgs.stdenv.hostPlatform.system};
in {
imports = [mcsr.nixosModules.waywall];
options = {
programs.waywall = {
width = lib.mkOption {
type = lib.types.int;
default = 1920;
};
height = lib.mkOption {
type = lib.types.int;
default = 1080;
};
};
};
config = {
environment.systemPackages = [
mcsrPkgs.ninjabrain-bot
(pkgs.prismlauncher.override {
jdks = [mcsrPkgs.graalvm-21];
})
];
programs.waywall = {
enable = true;
config = {
enableWaywork = true;
programs = [mcsrPkgs.ninjabrain-bot];
files = {
thin_bg = ./vibing-on-my-puter.png;
wide_bg = ./vibing-on-my-puter.png;
};
source = ./waywall.lua;
};
};
};
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 MiB

View file

@ -0,0 +1,233 @@
-- vim: foldmethod=marker
local waywall = require("waywall")
local helpers = require("waywall.helpers")
local Scene = require("waywork.scene")
local Modes = require("waywork.modes")
local Keys = require("waywork.keys")
local Processes = require("waywork.processes")
local scene = Scene.SceneManager.new(waywall)
local ModeManager = Modes.ModeManager.new(waywall)
-- config --
local thin_res = { w = resolution.h * 0.28, h = resolution.h }
local wide_res = { w = resolution.w, h = resolution.h / 3.6 }
local tall_res = { w = 384, h = 16384 }
local pie_colors = {
{ input = "#e145c2", output = "#a000a0" },
{ input = "#e96d4d", output = "#aa3310" },
{ input = "#45cb65", output = "#00a000" },
{ input = "#4de1ca", output = "#1a7286" },
{ input = "#c46de1", output = "#ff55ff" },
}
-- https://arjuncgore.github.io/waywall-boat-eye-calc/
-- https://github.com/Esensats/mcsr-calcsens
local normal_sens = 13.117018998967824
local tall_sens = 0.88486625532087
-- utils {{{
function smart_enable_group(mode, status)
scene:enable_group(mode, status)
scene:enable_group("normal", not status)
end
function mode_guard()
return not waywall.get_key("F3") and waywall.state().screen == "inworld" and waywall.state().inworld == "unpaused"
end
function piechart_src(res)
return { x = res.w - 93, y = res.h - 221, w = 33, h = 42 }
end
function piechart_dst(res)
-- x = right_of_thin - 11 (gap between edge and pie) - 160 (pie width / 2) - 99 (mirror width / 2)
if res.w == resolution.w and res.h == resolution.h then
return { x = res.w - 270, y = res.h - 390, w = 33 * 6, h = 42 * 6 }
else
return { x = (resolution.w + res.w) / 2 - 270, y = (resolution.h + res.h) / 2 - 390, w = 33 * 6, h = 42 * 6 }
end
end
local ensure_ninjabrain = Processes.ensure_application(waywall, programs.ninjabrain_bot)("ninjabrain.*\\.jar")
-- }}}
-- background images {{{
for _, name in ipairs({ "wide", "thin", "tall" }) do
scene:register(name .. "_bg", {
kind = "image",
path = files[name],
options = {
dst = { x = 0, y = 0, w = resolution.w, h = resolution.h },
depth = -1,
},
groups = { name },
})
end
-- }}}
-- thin {{{
local e_scale = resolution.w > 2560 and 20 or 10
local left_middle = (resolution.w - thin_res.w) / 4
scene:register("e_counter", {
kind = "mirror",
options = {
src = { x = 1, y = 37, w = 49, h = 9 },
dst = { x = left_middle - (49 * e_scale / 2), y = resolution.h / 10.8, w = 49 * e_scale, h = 9 * e_scale },
depth = 0,
},
groups = { "thin" },
})
for _, ck in ipairs(pie_colors) do
scene:register("prct_mirror_" .. ck.input, {
kind = "mirror",
options = {
src = piechart_src(thin_res),
dst = piechart_dst(thin_res),
depth = 1,
color_key = ck,
},
groups = { "thin" },
})
end
ModeManager:define("thin", {
width = thin_res.w,
height = thin_res.h,
on_enter = function()
smart_enable_group("thin", true)
end,
on_exit = function()
smart_enable_group("thin", false)
end,
toggle_guard = mode_guard,
})
-- }}}
-- wide {{{
ModeManager:define("wide", {
width = wide_res.w,
height = wide_res.h,
on_enter = function()
smart_enable_group("wide", true)
end,
on_exit = function()
smart_enable_group("wide", false)
end,
toggle_guard = mode_guard,
})
-- }}}
-- tall {{{
local measure_w = (resolution.w - tall_res.w) / 2
local measure_h = (resolution.h * measure_w) / resolution.w
local measure_dst = { x = 0, y = (resolution.h - measure_h) / 2, w = measure_w, h = measure_h }
scene:register("eye_measure", {
kind = "mirror",
options = {
src = { x = (tall_res.w - 60) / 2, y = (tall_res.h - 580) / 2, w = 60, h = 580 },
dst = measure_dst,
depth = 0,
},
groups = { "tall" },
})
scene:register("eye_overlay", {
kind = "image",
path = files.eye_overlay,
options = { dst = measure_dst, depth = 1 },
groups = { "tall" },
})
ModeManager:define("tall", {
width = tall_res.w,
height = tall_res.h,
on_enter = function()
smart_enable_group("tall", true)
waywall.set_sensitivity(tall_sens)
end,
on_exit = function()
smart_enable_group("tall", false)
waywall.set_sensitivity(0)
end,
toggle_guard = function()
return not waywall.get_key("F3") and waywall.state().screen == "inworld"
end,
})
-- }}}
-- normal res mirrors {{{
for _, ck in ipairs(pie_colors) do
scene:register("prct_mirror_normal_" .. ck.input, {
kind = "mirror",
options = {
src = piechart_src(resolution),
dst = piechart_dst(resolution),
depth = 1,
color_key = ck,
},
groups = { "normal" },
})
end
-- }}}
-- startup actions
waywall.listen("load", function()
-- wait for title screen
repeat
local error, state = pcall(waywall.state)
waywall.sleep(1000)
until error == true and state.screen == "title"
-- actual actions
ensure_ninjabrain()
scene:enable_group("normal", true)
end)
local config = {
input = {
layout = "us",
repeat_rate = 40,
repeat_delay = 300,
sensitivity = normal_sens,
confine_pointer = false,
remaps = {
["MB5"] = "F3",
},
},
theme = {
background = "#303030ff",
-- https://github.com/Smithay/smithay/issues/1894
ninb_anchor = "right",
},
window = {
fullscreen_width = resolution.w,
fullscreen_height = resolution.h,
},
actions = Keys.actions({
["Ctrl-Super-F"] = waywall.toggle_fullscreen,
["*-N"] = function()
return ModeManager:toggle("thin")
end,
["*-P"] = function()
return ModeManager:toggle("tall")
end,
["*-G"] = function()
return ModeManager:toggle("wide")
end,
["Ctrl-Shift-M"] = function()
ensure_ninjabrain()
helpers.toggle_floating()
end,
}),
}
return config