idTip icon indicating copy to clipboard operation
idTip copied to clipboard

Feature Request: Add the ability to configure a Modifier key to show the idTip info.

Open Kilrahs opened this issue 6 months ago • 4 comments

Feature Request: Add the ability to configure a Modifier key to show the idTip info.

I have added to my copy of the addon the ability to chose a modifier key to only show the idTip info when that key is pressed.

After where you have --

-- Check if we already added to this tooltip
  local frame, text
  for i = tooltip:NumLines(), 1, -1 do
    frame = _G[name .. "TextLeft" .. i]
    if frame then text = frame:GetText() end
    if text and string.find(text, kinds[kind]) then return end
  end

I have added --

-- Check if any of the configured modifier keys are pressed
local modifierKeyPressed = false
if idTipConfig.altKey and IsAltKeyDown() then
    modifierKeyPressed = true
end
if idTipConfig.ctrlKey and IsControlKeyDown() then
    modifierKeyPressed = true
end
if idTipConfig.shiftKey and IsShiftKeyDown() then
    modifierKeyPressed = true
end
-- Return if no configured modifier key is pressed
if not modifierKeyPressed then return end

And in your "-- Options panel" section I have added --

 -- Add a separator before the modifier keys section
  local separator = panel:CreateTexture(nil, "ARTWORK")
  separator:SetColorTexture(1, 1, 1, 0.5)
  separator:SetSize(panel:GetWidth() - 32, 1)
  separator:SetPoint("TOPLEFT", kindsTitle, "BOTTOMLEFT", 0, -(rowHeight * rowNum) -40)

  -- Add checkboxes for modifier keys
  local modifierTitle = panel:CreateFontString("ARTWORK", nil, "GameFontNormal")
  modifierTitle:SetPoint("TOPLEFT", separator, "BOTTOMLEFT", 0, -16)
  modifierTitle:SetText("Modifier Keys")

  local altCheckBox = createCheckbox("Alt Key", "altKey")
  altCheckBox:SetPoint("TOPLEFT", modifierTitle, "BOTTOMLEFT", 0, -16)

  local ctrlCheckBox = createCheckbox("Control Key", "ctrlKey")
  ctrlCheckBox:SetPoint("TOPLEFT", altCheckBox, "BOTTOMLEFT", 0, 0)

  local shiftCheckBox = createCheckbox("Shift Key", "shiftKey")
  shiftCheckBox:SetPoint("TOPLEFT", ctrlCheckBox, "BOTTOMLEFT", 0, 0)

Before your --

  panel:SetScript("OnShow", nil)
end)

Image

Kilrahs avatar Jul 01 '25 21:07 Kilrahs

/bump

Kilrahs avatar Aug 09 '25 22:08 Kilrahs

This is a good idea but that method only works to some degree because some tooltips like the NPC one don't refresh constantly, so pressing a modifier while the tooltip is shown does not add/remove the info.

I think idTip would need to trigger a refresh of the tooltip when a modifier key is enabled and when its state changes.

silverwind avatar Aug 10 '25 16:08 silverwind

I tried making it add/remove lines on MODIFIER_STATE_CHANGED, but have given up making it work. It's too complex to remove text from a tooltip. I think I will make something based on your example, even if it's not a completely perfect solution.

silverwind avatar Aug 10 '25 19:08 silverwind

Thank you for considering this.

I have not seen the issue of the ID being added. I may have another addon that updates. I do use the same modifier for idTip and ATT and MobInfo.

EDIT: Now that I am looking for it, I have noticed this in the Bank.

Kilrahs avatar Aug 11 '25 13:08 Kilrahs