mirror of
https://github.com/nmasur/dotfiles
synced 2024-11-09 22:12:56 +00:00
setup ultrawide curved monitor
This commit is contained in:
parent
4fefe54435
commit
61f26315d5
@ -29,6 +29,7 @@ function obj:init()
|
||||
win:moveToScreen(screen:previous(), true, true, 0)
|
||||
end)
|
||||
|
||||
-- Maximize
|
||||
hs.hotkey.bind({ "alt", "ctrl", "cmd" }, "m", function()
|
||||
-- get the focused window
|
||||
local win = hs.window.focusedWindow()
|
||||
@ -47,6 +48,34 @@ function obj:init()
|
||||
-- win:maximize()
|
||||
-- end
|
||||
end)
|
||||
|
||||
-- Half-maximize (right)
|
||||
hs.hotkey.bind({ "alt", "ctrl", "cmd" }, "o", function()
|
||||
-- get the focused window
|
||||
local win = hs.window.focusedWindow()
|
||||
local frame = win:frame()
|
||||
-- maximize if possible
|
||||
local max = win:screen():fullFrame()
|
||||
frame.x = max.w / 2
|
||||
frame.y = max.y
|
||||
frame.w = max.w / 2
|
||||
frame.h = max.h
|
||||
win:setFrame(frame)
|
||||
end)
|
||||
|
||||
-- Half-maximize (left)
|
||||
hs.hotkey.bind({ "alt", "ctrl", "cmd" }, "u", function()
|
||||
-- get the focused window
|
||||
local win = hs.window.focusedWindow()
|
||||
local frame = win:frame()
|
||||
-- maximize if possible
|
||||
local max = win:screen():fullFrame()
|
||||
frame.x = max.x
|
||||
frame.y = max.y
|
||||
frame.w = max.w / 2
|
||||
frame.h = max.h
|
||||
win:setFrame(frame)
|
||||
end)
|
||||
end
|
||||
|
||||
return obj
|
||||
|
@ -4,28 +4,27 @@
|
||||
-- License is also available:
|
||||
-- https://github.com/anishathalye/dotfiles-local/blob/ffdadd313e58514eb622736b09b91a7d7eb7c6c9/LICENSE.md
|
||||
|
||||
WORK_LEFT_MONITOR = "DELL U2415 (2)"
|
||||
WORK_RIGHT_MONITOR = "DELL U2415 (1)"
|
||||
WORK_ONLY_MONITOR = "DELL U4021QW"
|
||||
LAPTOP_MONITOR = "Built-in Retina Display"
|
||||
|
||||
-- Used to find out the name of the monitor in Hammerspoon
|
||||
-- local function dump(o)
|
||||
-- if type(o) == "table" then
|
||||
-- local s = "{ "
|
||||
-- for k, v in pairs(o) do
|
||||
-- if type(k) ~= "number" then
|
||||
-- k = '"' .. k .. '"'
|
||||
-- end
|
||||
-- s = s .. "[" .. k .. "] = " .. dump(v) .. ","
|
||||
-- end
|
||||
-- return s .. "} "
|
||||
-- else
|
||||
-- return tostring(o)
|
||||
-- end
|
||||
-- end
|
||||
local function dump(o)
|
||||
if type(o) == "table" then
|
||||
local s = "{ "
|
||||
for k, v in pairs(o) do
|
||||
if type(k) ~= "number" then
|
||||
k = '"' .. k .. '"'
|
||||
end
|
||||
s = s .. "[" .. k .. "] = " .. dump(v) .. ","
|
||||
end
|
||||
return s .. "} "
|
||||
else
|
||||
return tostring(o)
|
||||
end
|
||||
end
|
||||
|
||||
-- Turn on when looking for the monitor name
|
||||
-- print(dump(hs.screen.allScreens()))
|
||||
print(dump(hs.screen.allScreens()))
|
||||
|
||||
local function concat(...)
|
||||
local res = {}
|
||||
@ -42,15 +41,16 @@ local function worklayout()
|
||||
local u = hs.geometry.unitrect
|
||||
-- set the layout
|
||||
local left = {
|
||||
{ "kitty", nil, WORK_LEFT_MONITOR, u(0, 0, 1, 1), nil, nil, visible = true },
|
||||
{ "kitty", nil, WORK_ONLY_MONITOR, u(0, 0, 1 / 2, 1), nil, nil, visible = true },
|
||||
}
|
||||
local right = {
|
||||
{ "Slack", nil, WORK_RIGHT_MONITOR, u(0, 0, 1, 1), nil, nil, visible = true },
|
||||
{ "Mail", nil, WORK_RIGHT_MONITOR, u(0, 0, 1, 1), nil, nil, visible = true },
|
||||
{ "zoom.us", nil, WORK_RIGHT_MONITOR, u(1 / 4, 1 / 4, 1 / 2, 1 / 2), nil, nil, visible = true },
|
||||
{ "Slack", nil, WORK_ONLY_MONITOR, u(1 / 2, 0, 1 / 2, 1), nil, nil, visible = true },
|
||||
{ "Mail", nil, WORK_ONLY_MONITOR, u(1 / 2, 0, 1 / 2, 1), nil, nil, visible = true },
|
||||
{ "zoom.us", nil, WORK_ONLY_MONITOR, u(5 / 8, 1 / 4, 1 / 4, 1 / 2), nil, nil, visible = true },
|
||||
}
|
||||
local laptop = {
|
||||
{ "Firefox", nil, LAPTOP_MONITOR, u(0, 0, 1, 1), nil, nil, visible = true },
|
||||
{ "Firefox", nil, LAPTOP_MONITOR, u(0, 0, 1, 1), nil, nil, visible = true },
|
||||
{ "Obsidian", nil, LAPTOP_MONITOR, u(0, 0, 1, 1), nil, nil, visible = true },
|
||||
}
|
||||
local layout = concat(left, right, laptop)
|
||||
hs.layout.apply(layout)
|
||||
|
Loading…
Reference in New Issue
Block a user