Skip to content

Instantly share code, notes, and snippets.

@LvWind
Last active September 25, 2018 08:41
Show Gist options
  • Save LvWind/c15bbcb1ea88c10bb9b1100750262c9e to your computer and use it in GitHub Desktop.
Save LvWind/c15bbcb1ea88c10bb9b1100750262c9e to your computer and use it in GitHub Desktop.
Mojave dark mode border fix. [Hammerspoon]
global_border = nil
local function blackLine()
local topLine = hs.drawing.rectangle(
hs.geometry.rect(0, 20, 1280, 1)
)
topLine:setFillColor({hex='#40403e',["alpha"]=1})
topLine:setFill(true)
topLine:setLevel('floating')
topLine:show()
end
local function blackBorder()
window = hs.window.focusedWindow()
if window ~= nil then
top_left = window:topLeft()
size = window:size()
if global_border ~= nil then
global_border:delete()
end
global_border = hs.drawing.rectangle(hs.geometry.rect(top_left['x'], top_left['y'], size['w'], size['h']))
global_border:setStrokeColor({hex='#404040',["alpha"]=1})
global_border:setFill(false)
global_border:setRoundedRectRadii(3, 3)
global_border:setStrokeWidth(2)
global_border:setLevel('tornOffMenu')
global_border:show()
end
end
local function removeBorder()
global_border:delete()
end
blackLine()
blackBorder()
allwindows = hs.window.filter.new(nil)
allwindows:subscribe(hs.window.filter.windowCreated, function () blackBorder() end)
allwindows:subscribe(hs.window.filter.windowFocused, function () blackBorder() end)
allwindows:subscribe(hs.window.filter.windowMoved, function () blackBorder() end)
allwindows:subscribe(hs.window.filter.windowUnfocused, function () removeBorder() end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment