summaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
authorSam Nystrom <sam@samnystrom.dev>2026-10-27 22:19:44 -0400
committerSam Nystrom <sam@samnystrom.dev>2026-10-27 22:19:44 -0400
commit6f63127994e4721195c2aa589198c19b12dc39d0 (patch)
treeaaeef4a2884253f3aafe977d08695a53a38f96ff /init.lua
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua249
1 files changed, 249 insertions, 0 deletions
diff --git a/init.lua b/init.lua
new file mode 100644
index 0000000..bd5c663
--- /dev/null
+++ b/init.lua
@@ -0,0 +1,249 @@
+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)
+
+local waywall_config_path = os.getenv("HOME") .. "/.config/waywall"
+
+--[[
+celeste menu colors:
+
+light pink: ff92b1
+lavender: 9768e4
+med green: 419462
+pale yellow: ffff99
+gray blue: 759cb2
+dark gray blue: 36527c
+dark gray: 3b566b
+cyan: 53cfde
+brick red: ba5358
+med yellow: fff672
+royal purple: 8d24ed
+pale pink: eb82ff
+sky blue: 54b0ff
+cornflower blue: 606de7
+gold: ffea42
+med blue: 448ede
+deep red: 8a2939
+brightish red: f53c4c
+
+--]]
+
+local bg_color = "#ffffff"
+
+local pie_colors = {
+ entities = { pie = "#e446c4", text = "#e145c2", out = "#f225fc" },
+ unspecified = { pie = "#46ce66", text = "#45cc65", out = "#56f440" },
+ blockEntities = { pie = "#ec6e4e", text = "#e96d4d", out = "#f48769" },
+ destroyProgress = { pie = "#cc6c46", text = "#ca6b45", out = "#c78b56" },
+ mob_spawner = { pie = "#4ee4cc", text = "#4de1ca", out = "#63f9fb" },
+ chest = { pie = "#c66ee4", text = "#c46de1", out = "#e75dfc" },
+}
+
+local normal_sens = 12.800000599064097
+local tall_sens = 0.8634803836976988
+
+local pie_dst = { x = 1200, y = 400, w = 340, h = 340 }
+local percent_dst = { x = 1280, y = 800, w = 34 * 6, h = 25 * 6 }
+local eye_dst = { x = 30, y = 340, w = 700, h = 400 }
+
+local f3_root = { x = 1200, y = 150 }
+local f3_scale = 5
+local f3_text_color = "#48106e"
+
+function add_f3_scene(name, row, col, len, groups)
+ scene:register(name, {
+ kind = "mirror",
+ options = {
+ src = { x = col * 6 + 1, y = row * 9 + 1, w = len * 6, h = 9 },
+ dst = { x = f3_root.x, y = f3_root.y, w = len * 6 * f3_scale, h = 9 * f3_scale },
+ color_key = {
+ input = "#dddddd",
+ output = f3_text_color,
+ },
+ depth = 1,
+ },
+ groups = groups,
+ })
+ f3_root.y = f3_root.y + 9 * f3_scale
+end
+
+add_f3_scene("c_counter", 3, 0, 11, { "thin", "tall" })
+add_f3_scene("e_counter", 4, 0, 8, { "thin", "tall" })
+
+for _, name in ipairs({ "wide", "thin", "tall" }) do
+ scene:register(name .. "_bg", {
+ kind = "image",
+ path = waywall_config_path .. "/resources/" .. name .. "_bg.png",
+ options = {
+ dst = { x = 0, y = 0, w = 1920, h = 1080 },
+ },
+ groups = { name },
+ })
+end
+
+scene:register("bubble", {
+ kind = "image",
+ path = waywall_config_path .. "/resources/bubble_pie.png",
+ options = {
+ dst = pie_dst,
+ depth = -1
+ },
+ groups = { "thin", "tall" },
+})
+
+for name, colors in pairs(pie_colors) do
+ scene:register("thin_pie_" .. name, {
+ kind = "mirror",
+ options = {
+ src = { x = 9, y = 680, w = 321, h = 160 },
+ dst = pie_dst,
+ color_key = { input = colors.pie, output = colors.out },
+ },
+ groups = { "thin" },
+ })
+
+ scene:register("tall_pie_" .. name, {
+ kind = "mirror",
+ options = {
+ src = { x = 9, y = 15984, w = 321, h = 160 },
+ dst = pie_dst,
+ color_key = { input = colors.pie, output = colors.out },
+ },
+ groups = { "tall" },
+ })
+ scene:register("thin_percent_" .. name, {
+ kind = "mirror",
+ options = {
+ src = { x = 247, y = 859, w = 34, h = 25 },
+ dst = percent_dst,
+ color_key = { input = colors.text, output = colors.out },
+ depth = 1,
+ },
+ groups = { "thin" },
+ })
+ scene:register("tall_percent_" .. name, {
+ kind = "mirror",
+ options = {
+ src = { x = 247, y = 16163, w = 34, h = 25 },
+ dst = percent_dst,
+ color_key = { input = colors.text, output = colors.out },
+ depth = 1,
+ },
+ groups = { "tall" },
+ })
+end
+
+scene:register("eye_measure", {
+ kind = "mirror",
+ options = {
+ src = { x = 140, y = 7902, w = 60, h = 580 },
+ dst = eye_dst,
+ },
+ groups = { "tall" },
+})
+
+scene:register("eye_overlay", {
+ kind = "image",
+ path = waywall_config_path .. "/resources/measuring_overlay.png",
+ options = { dst = eye_dst },
+ groups = { "tall" },
+})
+
+scene:register("oneshot_overlay", {
+ kind = "image",
+ path = waywall_config_path .. "/resources/oneshot_overlay.png",
+ options = {
+ dst = { x = 958, y = 538, w = 4, h = 4 },
+ },
+ groups = { "oneshot" },
+})
+
+ModeManager:define("thin", {
+ width = 340,
+ height = 1080,
+ on_enter = function() scene:enable_group("thin", true) end,
+ on_exit = function() scene:enable_group("thin", false) end,
+})
+
+ModeManager:define("tall", {
+ width = 340,
+ height = 16384,
+ on_enter = function()
+ scene:enable_group("tall", true)
+ waywall.set_sensitivity(tall_sens)
+ end,
+ on_exit = function()
+ scene:enable_group("tall", false)
+ waywall.set_sensitivity(normal_sens)
+ end,
+})
+
+ModeManager:define("wide", {
+ width = 1920,
+ height = 300,
+ on_enter = function() scene:enable_group("wide", true) end,
+ on_exit = function() scene:enable_group("wide", false) end,
+})
+
+ModeManager:define("oneshot", {
+ width = 1920,
+ height = 1080,
+ on_enter = function() scene:enable_group("oneshot", true) end,
+ on_exit = function() scene:enable_group("oneshot", false) end,
+})
+
+local ninbot_path = waywall_config_path .. "/result/bin/ninjabrain-bot"
+local ensure_ninbot = Processes.ensure_application(waywall, ninbot_path)("[Nn]injabrain.*\\.jar")
+
+function prevent_double_maps(remaps)
+ for k, v in pairs(remaps) do
+ remaps[v] = k
+ end
+ return remaps
+end
+
+return {
+ input = {
+ layout = "us",
+ variant = "colemak_dh",
+ repeat_rate = 40,
+ repeat_delay = 300,
+ sensitivity = normal_sens,
+ confine_pointer = false,
+ remaps = prevent_double_maps({
+ ["MB5"] = "F3",
+ ["Enter"] = "Esc",
+ ["dot"] = "leftctrl",
+ ["slash"] = "rightshift",
+ ["MB4"] = "leftshift",
+ }),
+ },
+ theme = {
+ background = bg_color,
+ ninb_anchor = "bottomright",
+ ninb_opacity = 1.0,
+ },
+ experimental = {
+ debug = false,
+ jit = false,
+ tearing = false,
+ scene_add_text = true,
+ },
+ actions = Keys.actions({
+ ["*-bracketleft"] = function() return ModeManager:toggle("thin") end,
+ ["*-bracketright"] = function() return ModeManager:toggle("tall") end,
+ ["*-apostrophe"] = function() return ModeManager:toggle("wide") end,
+ ["*-grave"] = function() return ModeManager:toggle("oneshot") end,
+ ["*-Alt_L"] = function()
+ ensure_ninbot()
+ helpers.toggle_floating()
+ end,
+ }),
+}