Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
robgha01 committed Sep 30, 2018
0 parents commit 4f08900
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
40 changes: 40 additions & 0 deletions Focuser/Focuser.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
local modifier = "shift" -- shift, alt or ctrl
local mouseButton = "1" -- 1 = left, 2 = right, 3 = middle, 4 and 5 = thumb buttons if there are any

local function SetFocusHotkey(frame)
frame:SetAttribute(modifier.."-type"..mouseButton,"focus")
end

local function CreateFrame_Hook(type, name, parent, template)
if template == "SecureUnitButtonTemplate" then
SetFocusHotkey(_G[name])
end
end

hooksecurefunc("CreateFrame", CreateFrame_Hook)

-- Keybinding override so that models can be shift/alt/ctrl+clicked
local f = CreateFrame("CheckButton", "FocuserButton", UIParent, "SecureActionButtonTemplate")
f:SetAttribute("type1","macro")
f:SetAttribute("macrotext","/focus mouseover")
SetOverrideBindingClick(FocuserButton,true,modifier.."-BUTTON"..mouseButton,"FocuserButton")

-- Set the keybindings on the default unit frames since we won't get any CreateFrame notification about them
local duf = {
PlayerFrame,
PetFrame,
PartyMemberFrame1,
PartyMemberFrame2,
PartyMemberFrame3,
PartyMemberFrame4,
PartyMemberFrame1PetFrame,
PartyMemberFrame2PetFrame,
PartyMemberFrame3PetFrame,
PartyMemberFrame4PetFrame,
TargetFrame,
TargetofTargetFrame,
}

for i,frame in pairs(duf) do
SetFocusHotkey(frame)
end
7 changes: 7 additions & 0 deletions Focuser/Focuser.toc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Interface: 30300
## Title: Focuser
## Notes: Sets your focus by shift clicking
## Author: Slizen, Areasis(Backporter)
## Version 0.51

Focuser.lua

0 comments on commit 4f08900

Please sign in to comment.