-- Generated by Home Manager.
-- See https://wiki.hypr.land/Configuring/Start/

-- settings.locals
local mod = "SUPER"
local terminal = "kitty"

-- settings.curve
hl.curve("smoothIn", {
  ["points"] = {
    {
      0.25,
      1
    },
    {
      0.5,
      1
    }
  },
  ["type"] = "bezier"
})

-- settings.animation
hl.animation({
  ["bezier"] = "smoothIn",
  ["enabled"] = true,
  ["leaf"] = "border",
  ["speed"] = 2
})
hl.animation({
  ["bezier"] = "smoothIn",
  ["enabled"] = true,
  ["leaf"] = "windows",
  ["speed"] = 3,
  ["style"] = "popin 80%"
})

-- settings.bind
hl.bind((mod .. " + Q"), (hl.dsp.window.close()), {
  ["locked"] = true
})
hl.bind((mod .. " + RETURN"), (hl.dsp.exec_cmd(terminal)))
hl.bind("SUPER + SHIFT + 1", (hl.dsp.window.move({ workspace = "1", follow = false })))
hl.bind((mod .. " + mouse:272"), (hl.dsp.window.drag()), {
  ["mouse"] = true
})

-- settings.config
hl.config({
  ["ecosystem"] = {
    ["enforce_permissions"] = true
  },
  ["input"] = {
    ["kb_layout"] = "ro",
    ["touchpad"] = {
      ["scroll_factor"] = 0.3
    }
  }
})

-- settings.device
hl.device({
  ["enabled"] = true,
  ["name"] = "some:device"
})

-- settings.env
hl.env("QT_QPA_PLATFORMTHEME", "qt5ct")
hl.env("XCURSOR_SIZE", "24")

-- settings.exec_cmd
hl.exec_cmd("hyprctl setcursor Bibata 24")

-- settings.gesture
hl.gesture({
  ["action"] = "workspace",
  ["direction"] = "left",
  ["fingers"] = 3
})

-- settings.layer_rule
hl.layer_rule({
  ["blur"] = false,
  ["match"] = {
    ["namespace"] = "waybar"
  }
})

-- settings.monitor
hl.monitor({
  ["mode"] = "highres",
  ["output"] = "desc:Monitor",
  ["position"] = "auto-right",
  ["scale"] = 1,
  ["vrr"] = 1
})

-- settings.on
hl.on("hyprland.start", (function()
  hl.exec_cmd("waybar")
end
))

-- settings.permission
hl.permission({
  ["binary"] = "^org\\.example\\..*",
  ["mode"] = "deny",
  ["type"] = "screencopy"
})

-- settings.window_rule
hl.window_rule({
  ["border_size"] = 2,
  ["match"] = {
    ["class"] = "kitty"
  }
})

-- settings.workspace_rule
hl.workspace_rule({
  ["monitor"] = "DP-1",
  ["workspace"] = "1"
})

-- submaps.resize
hl.define_submap("resize", "reset", function()
  hl.bind("right", (hl.dsp.window.resize({ x = 10, y = 0, relative = true })), {
    ["repeating"] = true
  })
  hl.bind("left", (hl.dsp.window.resize({ x = -10, y = 0, relative = true })), {
    ["repeating"] = true
  })
  hl.bind("escape", (hl.dsp.submap("reset")))
end)

-- startup
hl.on("hyprland.start", function()
  hl.exec_cmd("@dbus@/bin/dbus-update-activation-environment --systemd DISPLAY HYPRLAND_INSTANCE_SIGNATURE WAYLAND_DISPLAY XDG_CURRENT_DESKTOP XDG_SESSION_TYPE && systemctl --user stop hyprland-session.target && systemctl --user start hyprland-session.target")
  hl.exec_cmd("hyprctl plugin load /path/to/plugin1")
  hl.exec_cmd("hyprctl plugin load /nix/store/00000000000000000000000000000000-foo/lib/libfoo.so")
end)

-- extraConfig
local mainMod = "SUPER"
local terminal = "kitty"
hl.define_submap("resize", function()
  hl.bind("right", hl.dsp.window.move({ direction = "right" }))
end)
hl.on("hyprland.start", function()
  hl.exec_cmd("waybar")
end)
hl.config({
  decoration = {
    rounding = 4,
  },
})

