Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hammerspoon 添加自定义菜单,执行 shell 脚本 #331

Open
xxleyi opened this issue Aug 27, 2022 · 0 comments
Open

hammerspoon 添加自定义菜单,执行 shell 脚本 #331

xxleyi opened this issue Aug 27, 2022 · 0 comments

Comments

@xxleyi
Copy link
Owner

xxleyi commented Aug 27, 2022

local kit={}
kit.__index = kit
kit.menubar = hs.menubar.new(false)


function kit:start()
    kit.menubar:returnToMenuBar()
    kit:newMenu()
end

function kit:stop()
    kit.menubar:removeFromMenuBar()
    kit.timer:stop()
end

function kit:toggle()
    if kit.timer:running() then
        kit:stop()
    else
        kit:start()
    end
end


function kit:newMenu()
    local menuitems_table = {}
    local submenu = {}
    table.insert(submenu, {
      title = "test"
    })
    table.insert(menuitems_table, {
        title = "new-learning-issue",
        fn = function() hs.execute("~/.kit/kar new-learning-issue") end
    })
    table.insert(menuitems_table, {
      title = "tt",
      menu = submenu,
  })

    kit.menubar:setTitle("k")
    kit.menubar:setMenu(menuitems_table)
end

return kit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant