문서 보기역링크PDF로 내보내기맨 위로 이 문서는 읽기 전용입니다. 원본을 볼 수는 있지만 바꿀 수는 없습니다. 문제가 있다고 생각하면 관리자에게 문의하세요. # hammperspoon chrome <code lua> local module = {} module.start = function(config_table) module.config = config_table end module.jump = function(searchUrl, gotoUrl) local url= string.gsub(searchUrl, "/", "\\/") if gotoUrl == nil then gotoUrl = searchUrl end hs.osascript.javascript([[ (function() { var chrome = Application('Google Chrome'); chrome.activate(); var find = false; for (win of chrome.windows()) { var tabIndex = win.tabs().findIndex(tab => tab.url().match(/]] .. url .. [[/)); if (tabIndex != -1) { win.activeTabIndex = (tabIndex + 1); win.index = 1; find = true; } } if (!find) { chrome.includeStandardAdditions = true; chrome.openLocation("]] .. gotoUrl .. [["); //chrome.windows[0].tabs[0].url = "]] .. gotoUrl .. [["; chrome.windows[0].activeTabIndex = -1; } })(); ]]) end module.killTabsByDomain = function(domain) hs.osascript.javascript([[ (function() { var chrome = Application('Google Chrome'); for (win of chrome.windows()) { for (tab of win.tabs()) { if (tab.url().match(/]] .. string.gsub(domain, '/', '\\/') .. [[/)) { tab.close() } } } })(); ]]) end return module </code> open/hammerspoon-chrome.txt 마지막으로 수정됨: 2022/05/24 06:44저자 127.0.0.1