mirror of
https://github.com/nmasur/dotfiles
synced 2024-11-22 20:25:38 +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)
|
win:moveToScreen(screen:previous(), true, true, 0)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
-- Maximize
|
||||||
hs.hotkey.bind({ "alt", "ctrl", "cmd" }, "m", function()
|
hs.hotkey.bind({ "alt", "ctrl", "cmd" }, "m", function()
|
||||||
-- get the focused window
|
-- get the focused window
|
||||||
local win = hs.window.focusedWindow()
|
local win = hs.window.focusedWindow()
|
||||||
@ -47,6 +48,34 @@ function obj:init()
|
|||||||
-- win:maximize()
|
-- win:maximize()
|
||||||
-- end
|
-- end
|
||||||
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
|
end
|
||||||
|
|
||||||
return obj
|
return obj
|
||||||
|
@ -4,28 +4,27 @@
|
|||||||
-- License is also available:
|
-- License is also available:
|
||||||
-- https://github.com/anishathalye/dotfiles-local/blob/ffdadd313e58514eb622736b09b91a7d7eb7c6c9/LICENSE.md
|
-- https://github.com/anishathalye/dotfiles-local/blob/ffdadd313e58514eb622736b09b91a7d7eb7c6c9/LICENSE.md
|
||||||
|
|
||||||
WORK_LEFT_MONITOR = "DELL U2415 (2)"
|
WORK_ONLY_MONITOR = "DELL U4021QW"
|
||||||
WORK_RIGHT_MONITOR = "DELL U2415 (1)"
|
|
||||||
LAPTOP_MONITOR = "Built-in Retina Display"
|
LAPTOP_MONITOR = "Built-in Retina Display"
|
||||||
|
|
||||||
-- Used to find out the name of the monitor in Hammerspoon
|
-- Used to find out the name of the monitor in Hammerspoon
|
||||||
-- local function dump(o)
|
local function dump(o)
|
||||||
-- if type(o) == "table" then
|
if type(o) == "table" then
|
||||||
-- local s = "{ "
|
local s = "{ "
|
||||||
-- for k, v in pairs(o) do
|
for k, v in pairs(o) do
|
||||||
-- if type(k) ~= "number" then
|
if type(k) ~= "number" then
|
||||||
-- k = '"' .. k .. '"'
|
k = '"' .. k .. '"'
|
||||||
-- end
|
end
|
||||||
-- s = s .. "[" .. k .. "] = " .. dump(v) .. ","
|
s = s .. "[" .. k .. "] = " .. dump(v) .. ","
|
||||||
-- end
|
end
|
||||||
-- return s .. "} "
|
return s .. "} "
|
||||||
-- else
|
else
|
||||||
-- return tostring(o)
|
return tostring(o)
|
||||||
-- end
|
end
|
||||||
-- end
|
end
|
||||||
|
|
||||||
-- Turn on when looking for the monitor name
|
-- Turn on when looking for the monitor name
|
||||||
-- print(dump(hs.screen.allScreens()))
|
print(dump(hs.screen.allScreens()))
|
||||||
|
|
||||||
local function concat(...)
|
local function concat(...)
|
||||||
local res = {}
|
local res = {}
|
||||||
@ -42,15 +41,16 @@ local function worklayout()
|
|||||||
local u = hs.geometry.unitrect
|
local u = hs.geometry.unitrect
|
||||||
-- set the layout
|
-- set the layout
|
||||||
local left = {
|
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 = {
|
local right = {
|
||||||
{ "Slack", nil, WORK_RIGHT_MONITOR, u(0, 0, 1, 1), nil, nil, visible = true },
|
{ "Slack", nil, WORK_ONLY_MONITOR, u(1 / 2, 0, 1 / 2, 1), nil, nil, visible = true },
|
||||||
{ "Mail", nil, WORK_RIGHT_MONITOR, u(0, 0, 1, 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_RIGHT_MONITOR, u(1 / 4, 1 / 4, 1 / 2, 1 / 2), 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 = {
|
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)
|
local layout = concat(left, right, laptop)
|
||||||
hs.layout.apply(layout)
|
hs.layout.apply(layout)
|
||||||
|
Loading…
Reference in New Issue
Block a user