Compare commits
No commits in common. "51433e6aca6139ef0f35556876833c5efae64e87" and "71a1a67f164e88ec61a500d8164a156a2734b93a" have entirely different histories.
51433e6aca
...
71a1a67f16
@ -27,7 +27,7 @@
|
||||
description = "Print this menu";
|
||||
exec = ''
|
||||
echo "Commands:"
|
||||
echo -n '${
|
||||
echo -n ${
|
||||
builtins.toJSON (
|
||||
builtins.mapAttrs (s: value: value.description) self.devShells.${pkgs.system}.default.config.scripts
|
||||
)
|
||||
|
||||
@ -1,11 +1,4 @@
|
||||
return (function()
|
||||
local application = hs.application
|
||||
local grid = hs.grid
|
||||
local screen = hs.screen
|
||||
local spaces = hs.spaces
|
||||
local timer = hs.timer
|
||||
local wf = hs.window.filter
|
||||
|
||||
spoon = {
|
||||
name = "C3C Workspace";
|
||||
version = "0.0.1";
|
||||
@ -22,90 +15,45 @@ return (function()
|
||||
screen = "0F6BDB5B-840D-40BE-AAC9-B467A78E057A",
|
||||
fullscreen = true,
|
||||
},
|
||||
Cursor = {
|
||||
desktop = 1,
|
||||
screen = "B5A65BB6-E73E-4C3D-977C-33C86798AA5A",
|
||||
fullscreen = true,
|
||||
},
|
||||
Spotify = {
|
||||
desktop = 3,
|
||||
screen = "B5A65BB6-E73E-4C3D-977C-33C86798AA5A",
|
||||
fullscreen = true,
|
||||
},
|
||||
["zoom.us"] = {
|
||||
desktop = 2,
|
||||
screen = "D3142823-261D-46EF-B9C2-5181C7FE2CA5",
|
||||
fullscreen = true,
|
||||
},
|
||||
["Microsoft Outlook"] = {
|
||||
desktop = 3,
|
||||
screen = "D3142823-261D-46EF-B9C2-5181C7FE2CA5",
|
||||
fullscreen = true,
|
||||
},
|
||||
}
|
||||
|
||||
local fullscreen = function(win)
|
||||
local screen = win:screen()
|
||||
|
||||
local cell = grid.get(win, screen)
|
||||
local cell = hs.grid.get(win, screen)
|
||||
|
||||
cell.x = 0
|
||||
cell.y = 0
|
||||
cell.w = 24
|
||||
cell.h = 24
|
||||
|
||||
grid.set(win, cell, screen)
|
||||
hs.grid.set(win, cell, screen)
|
||||
end
|
||||
|
||||
function spoon:restoreAppsToScreens()
|
||||
local screens = {}
|
||||
for _, scr in ipairs(screen.allScreens()) do
|
||||
screens[scr:getUUID()] = scr
|
||||
for _, screen in ipairs(hs.screen.allScreens()) do
|
||||
screens[screen:getUUID()] = screen
|
||||
end
|
||||
|
||||
local currentSpaces = spaces.allSpaces()
|
||||
|
||||
local foundWindows = {}
|
||||
|
||||
for appName, def in pairs(appScreenMap) do
|
||||
local scr = screens[def.screen]
|
||||
if scr ~= nil then
|
||||
local app = application.get(appName)
|
||||
local app = hs.application.get(appName)
|
||||
if app then
|
||||
local appFilter = wf.new(appName)
|
||||
if appFilter then
|
||||
local wf = hs.window.filter.new(appName)
|
||||
if wf then
|
||||
-- TODO: Really bad performance
|
||||
foundWindows[appName] = appFilter:getWindows()
|
||||
for _, win in pairs(wf:getWindows()) do
|
||||
win:moveToScreen(scr)
|
||||
if def.fullscreen then
|
||||
fullscreen(win)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for appName, windows in pairs(foundWindows) do
|
||||
local def = appScreenMap[appName]
|
||||
local scr = screens[def.screen]
|
||||
|
||||
for _, win in pairs(windows) do
|
||||
if currentSpaces[def.screen] ~= nil then
|
||||
print(appName .. " moving window into an index " .. def.desktop .. " which is space " .. currentSpaces[def.screen][def.desktop])
|
||||
spaces.moveWindowToSpace(win, currentSpaces[def.screen][def.desktop])
|
||||
end
|
||||
|
||||
print(appName .. " scheduling timer to move window into a screen")
|
||||
timer.doAfter(1, function()
|
||||
print(appName .. " moving window into a screen " .. def.screen)
|
||||
|
||||
win:moveToScreen(scr)
|
||||
if def.fullscreen then
|
||||
timer.doAfter(1, function()
|
||||
print(appName .. " fullscreening window")
|
||||
|
||||
fullscreen(win)
|
||||
end)
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- https://github.com/Hammerspoon/hammerspoon/blob/master/SPOONS.md#hotkeys
|
||||
|
||||
@ -1,32 +1,27 @@
|
||||
windowMove = function()
|
||||
local grid = hs.grid
|
||||
local screen = hs.screen
|
||||
local timer = hs.timer
|
||||
local window = hs.window
|
||||
|
||||
-- move window to next screen
|
||||
hs.hotkey.bind({ "ctrl", "alt", "cmd" }, "N", function()
|
||||
local win = window.focusedWindow()
|
||||
local win = hs.window.focusedWindow()
|
||||
win:moveToScreen(win:screen():next())
|
||||
end)
|
||||
|
||||
local fullscreen = function(win)
|
||||
local scr = win:screen()
|
||||
local screen = win:screen()
|
||||
|
||||
local cell = grid.get(win, scr)
|
||||
local cell = hs.grid.get(win, screen)
|
||||
|
||||
cell.x = 0
|
||||
cell.y = 0
|
||||
cell.w = 24
|
||||
cell.h = 24
|
||||
|
||||
grid.set(win, cell, scr)
|
||||
hs.grid.set(win, cell, screen)
|
||||
end
|
||||
|
||||
local getScreenById = function(id)
|
||||
for _, scr in ipairs(screen.allScreens()) do
|
||||
if scr:getUUID() == id then
|
||||
return scr
|
||||
for _, screen in ipairs(hs.screen.allScreens()) do
|
||||
if screen:getUUID() == id then
|
||||
return screen
|
||||
end
|
||||
end
|
||||
|
||||
@ -35,44 +30,38 @@ windowMove = function()
|
||||
|
||||
hs.hotkey.bind({ "ctrl", "alt", "cmd" }, "pad1", function()
|
||||
-- DELL S2722DGM
|
||||
local scr = getScreenById("0F6BDB5B-840D-40BE-AAC9-B467A78E057A")
|
||||
if scr == nil then
|
||||
local screen = getScreenById("0F6BDB5B-840D-40BE-AAC9-B467A78E057A")
|
||||
if screen == nil then
|
||||
return
|
||||
end
|
||||
|
||||
local win = window.focusedWindow()
|
||||
win:moveToScreen(scr)
|
||||
timer.doAfter(1, function()
|
||||
fullscreen(win)
|
||||
end)
|
||||
local win = hs.window.focusedWindow()
|
||||
win:moveToScreen(screen)
|
||||
fullscreen(win)
|
||||
end)
|
||||
|
||||
hs.hotkey.bind({ "ctrl", "alt", "cmd" }, "pad2", function()
|
||||
-- DELL S2721DGF
|
||||
local scr = getScreenById("D3142823-261D-46EF-B9C2-5181C7FE2CA5")
|
||||
if scr == nil then
|
||||
local screen = getScreenById("D3142823-261D-46EF-B9C2-5181C7FE2CA5")
|
||||
if screen == nil then
|
||||
return
|
||||
end
|
||||
|
||||
local win = window.focusedWindow()
|
||||
win:moveToScreen(scr)
|
||||
timer.doAfter(1, function()
|
||||
fullscreen(win)
|
||||
end)
|
||||
local win = hs.window.focusedWindow()
|
||||
win:moveToScreen(screen)
|
||||
fullscreen(win)
|
||||
end)
|
||||
|
||||
hs.hotkey.bind({ "ctrl", "alt", "cmd" }, "pad3", function()
|
||||
-- AV Receiver
|
||||
local scr = getScreenById("B5A65BB6-E73E-4C3D-977C-33C86798AA5A")
|
||||
if scr == nil then
|
||||
local screen = getScreenById("B5A65BB6-E73E-4C3D-977C-33C86798AA5A")
|
||||
if screen == nil then
|
||||
return
|
||||
end
|
||||
|
||||
local win = window.focusedWindow()
|
||||
win:moveToScreen(scr)
|
||||
timer.doAfter(1, function()
|
||||
fullscreen(win)
|
||||
end)
|
||||
local win = hs.window.focusedWindow()
|
||||
win:moveToScreen(screen)
|
||||
fullscreen(win)
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
@ -1,8 +1,4 @@
|
||||
windowTiling =function()
|
||||
local window = hs.window
|
||||
local grid = hs.grid
|
||||
local screen = hs.screen
|
||||
|
||||
hs.window.animationDuration = 0
|
||||
hs.window.setShadows(false)
|
||||
local hyper = { "ctrl", "alt", "cmd" }
|
||||
@ -12,14 +8,14 @@ windowTiling =function()
|
||||
}
|
||||
|
||||
function wm:_nextStep(dim, offs, cb)
|
||||
if window.focusedWindow() then
|
||||
if hs.window.focusedWindow() then
|
||||
local axis = dim == "w" and "x" or "y"
|
||||
local oppDim = dim == "w" and "h" or "w"
|
||||
local oppAxis = dim == "w" and "y" or "x"
|
||||
local win = window.frontmostWindow()
|
||||
local scr = win:screen()
|
||||
local win = hs.window.frontmostWindow()
|
||||
local screen = win:screen()
|
||||
|
||||
local cell = grid.get(win, scr)
|
||||
local cell = hs.grid.get(win, screen)
|
||||
|
||||
local nextSize = self.sizes[1]
|
||||
for i = 1, #self.sizes do
|
||||
@ -38,31 +34,32 @@ windowTiling =function()
|
||||
cell[oppAxis] = 0
|
||||
end
|
||||
|
||||
grid.set(win, cell, scr)
|
||||
hs.grid.set(win, cell, screen)
|
||||
end
|
||||
end
|
||||
|
||||
function wm:_fullscreen()
|
||||
if hs.window.focusedWindow() then
|
||||
local win = window.frontmostWindow()
|
||||
local scr = win:screen()
|
||||
local win = hs.window.frontmostWindow()
|
||||
local screen = win:screen()
|
||||
|
||||
local cell = grid.get(win, scr)
|
||||
local cell = hs.grid.get(win, screen)
|
||||
|
||||
cell.x = 0
|
||||
cell.y = 0
|
||||
cell.w = self.GRID.w
|
||||
cell.h = self.GRID.h
|
||||
|
||||
grid.set(win, cell, scr)
|
||||
hs.grid.set(win, cell, screen)
|
||||
end
|
||||
end
|
||||
|
||||
function wm:_fullDimension(dim)
|
||||
if window.focusedWindow() then
|
||||
local win = window.frontmostWindow()
|
||||
local scr = win:screen()
|
||||
local cell = grid.get(win, scr)
|
||||
if hs.window.focusedWindow() then
|
||||
local win = hs.window.frontmostWindow()
|
||||
local id = win:id()
|
||||
local screen = win:screen()
|
||||
local cell = hs.grid.get(win, screen)
|
||||
|
||||
if dim == "x" then
|
||||
cell = "0,0 " .. self.GRID.w .. "x" .. self.GRID.h
|
||||
@ -71,7 +68,7 @@ windowTiling =function()
|
||||
cell[dim == "w" and "x" or "y"] = 0
|
||||
end
|
||||
|
||||
grid.set(win, cell, scr)
|
||||
hs.grid.set(win, cell, screen)
|
||||
end
|
||||
end
|
||||
|
||||
@ -84,9 +81,9 @@ windowTiling =function()
|
||||
}
|
||||
self.GRID = { w = 24, h = 24 }
|
||||
|
||||
grid.setGrid(self.GRID.w .. "x" .. self.GRID.h)
|
||||
grid.MARGINX = 0
|
||||
grid.MARGINY = 0
|
||||
hs.grid.setGrid(self.GRID.w .. "x" .. self.GRID.h)
|
||||
hs.grid.MARGINX = 0
|
||||
hs.grid.MARGINY = 0
|
||||
|
||||
hs.hotkey.bind(hyper, "down", function()
|
||||
self._pressed.down = true
|
||||
|
||||
@ -17,13 +17,13 @@ keybind = super+alt+down=unbind
|
||||
keybind = super+alt+left=unbind
|
||||
keybind = super+alt+up=unbind
|
||||
|
||||
keybind = super+alt+k=new_split:down
|
||||
keybind = super+alt+l=new_split:right
|
||||
keybind = super+k=new_split:down
|
||||
keybind = super+l=new_split:right
|
||||
|
||||
keybind = super+j=goto_split:up
|
||||
keybind = super+k=goto_split:down
|
||||
keybind = super+h=goto_split:left
|
||||
keybind = super+l=goto_split:right
|
||||
keybind = super+alt+j=goto_split:up
|
||||
keybind = super+alt+k=goto_split:down
|
||||
keybind = super+alt+h=goto_split:left
|
||||
keybind = super+alt+l=goto_split:right
|
||||
|
||||
keybind = super+shift+j=resize_split:up,10
|
||||
keybind = super+shift+k=resize_split:down,10
|
||||
|
||||
@ -285,11 +285,5 @@ in
|
||||
aws --profile $profile "$@";
|
||||
done
|
||||
''}'';
|
||||
|
||||
veracode-login = ''${pkgs.writeShellScript "veracode-login" ''
|
||||
for region in us eu; do
|
||||
aws sso login --profile $region-shared-services
|
||||
done
|
||||
''}'';
|
||||
};
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user