-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbindings.lua
More file actions
47 lines (38 loc) · 1.29 KB
/
bindings.lua
File metadata and controls
47 lines (38 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
require 'functions';
-- Setup timer to stash every minute
hs.timer.doEvery(60, stashWindowPositions);
local lastScreenCount = screenCount();
-- Setup screen watcher to restore window positions
screenWatcher = hs.screen.watcher.new(function()
-- Don't restore if screen count hasn't changed. This happens when laptop lid is closed as this
local screenCount = screenCount();
if (screenCount == lastScreenCount) then
return;
end;
lastScreenCount = screenCount;
hs.timer.doAfter(5, function()
if restoreWindowPositions(true) == false then
arrangeApps(apps, true);
stashWindowPositions();
end;
end);
end);
screenWatcher:start()
-- Setup hotkey bindings
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "l", listApps);
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "a", function()
arrangeApps(apps, true);
stashWindowPositions();
end);
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "r", function()
restoreWindowPositions(true);
end);
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "s", function()
stashWindowPositions(true);
end);
hs.hotkey.bind({"cmd", "alt", "ctrl"}, ".", function()
scaleWindow(hs.window.frontmostWindow(), 50);
end);
hs.hotkey.bind({"cmd", "alt", "ctrl"}, ",", function()
scaleWindow(hs.window.frontmostWindow(), -50);
end);