-
Notifications
You must be signed in to change notification settings - Fork 0
/
console.lua
62 lines (53 loc) · 1.71 KB
/
console.lua
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
-- local axuiWindowElement = require('hs._asm.axuielement').windowElement
-- local axuiWindowElement = require("hs.axuielement").windowElement
-- local reloadHS = require("ext.system").reloadHS
local module = {}
module.init = function()
-- some global functions for console
-- inspect = hs.inspect
-- reload = reloadHS
--[[
dumpWindows = function()
hs.fnutils.each(hs.window.allWindows(), function(win)
print(hs.inspect {
id = win:id(),
title = win:title(),
app = win:application():name(),
role = win:role(),
subrole = win:subrole(),
frame = win:frame(),
buttonZoom = axuiWindowElement(win):attributeValue "AXZoomButton",
buttonFullScreen = axuiWindowElement(win):attributeValue "AXFullScreenButton",
isResizable = axuiWindowElement(win):isAttributeSettable "AXSize",
})
end)
end
dumpScreens = function()
hs.fnutils.each(hs.screen.allScreens(), function(s)
print(s:id(), s:position(), s:frame(), s:name())
end)
end
timestamp = function(date)
date = date or hs.timer.secondsSinceEpoch()
return os.date("%F %T" .. ((tostring(date):match "(%.%d+)$") or ""), math.floor(date))
end ]]
-- console styling
local grayColor = {
red = 24 * 4 / 255,
green = 24 * 4 / 255,
blue = 24 * 4 / 255,
alpha = 1,
}
local blackColor = {
red = 24 / 255,
green = 24 / 255,
blue = 24 / 255,
alpha = 1,
}
hs.console.consoleCommandColor(blackColor)
hs.console.consoleResultColor(grayColor)
hs.console.consolePrintColor(grayColor)
-- no toolbar
hs.console.toolbar(nil)
end
return module