Skip to content

Turn hiding of Dock on or off by hammerspoon #3560

Answered by asmagill
MirageTurtle asked this question in Q&A
Discussion options

You must be logged in to vote

For items with popup menus, the menu items don't "exist", and thus don't have AXUIElement's we can access, unless the menu is showing (unlike the application menus, whose AXUIElement's always exist all the time). So, we have to take a few extra steps:

toggleDockHiding = function()
    local axuielement = require("hs.axuielement")
    local timer       = require("hs.timer")
    local minFloat    = require("hs.math").minFloat
    
    local dockElement = axuielement.applicationElement("com.apple.dock")
    local separator = nil
    -- the first child of the dock item is a list of the icons on display
    for _, child in ipairs(dockElement[1]) do
        if child.AXSubrole == "AXSeparatorDoc…

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@MirageTurtle
Comment options

Answer selected by MirageTurtle
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants