Skip to content

Commit

Permalink
Cleanup debugging logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Pandoks committed Oct 20, 2023
1 parent 93025eb commit a1ce275
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
8 changes: 3 additions & 5 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ local time = require("hammer-control/time")
-- system event tracker
SYSTEM_WATCHER = hs.caffeinate.watcher.new(function(event_type)
if event_type == hs.caffeinate.watcher.screensDidUnlock then
print("unlocking") --remove
time.getTime() -- reset time after wake
selfcontrol.start() -- run Self Control after unlock
time.getTime()
selfcontrol.start()
SELFCONTROL_TIMER:start()
end

if event_type == hs.caffeinate.watcher.screensDidLock then
print("locking") --remove
SELFCONTROL_TIMER:stop() -- stop Self Control running on login screen
SELFCONTROL_TIMER:stop()
end
end)
SYSTEM_WATCHER:start()
Expand Down
5 changes: 1 addition & 4 deletions selfcontrol.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ local function insertPassword()
prompt_timer = hs.timer.new(0.1, function()
local security_prompt = hs.application.get("SecurityAgent")
if security_prompt then
print("inserting") --remove
local password =
hs.execute("security find-generic-password -a $(whoami) -s hammer-control -w")

Expand All @@ -32,13 +31,11 @@ local function insertPassword()
return
end
end
print("after") --remove
end)
prompt_timer:start()
end

local function selfControlCallback(exit_code, std_output, std_error)
print(std_output)
local function selfControlCallback(exit_code, _, std_error)
if exit_code == 0 then
print("SelfControl started")
hs.alert.show("SelfControl started", 2)
Expand Down
3 changes: 0 additions & 3 deletions time.lua
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ function M.getSchedule()
for _, timeblock in pairs(SCHEDULE[M.DAY]) do
local start_time = timeblock["start"]
local end_time = timeblock["end"]
print(M.TIME)

if compareTime(M.TIME, end_time) >= 0 then
goto continue
Expand All @@ -98,13 +97,11 @@ function M.getSchedule()
::continue::
end
if block == nil then
print("block") --remove
return
end

local block_time = convertToMinute(block["end"]) - convertToMinute(M.TIME)
if block_time < 0 then
print("time < 0") --remove
return
end
local end_time = os.date("!%Y-%m-%dT%H:%M:%SZ", os.time(os.date("*t")) + block_time * 60)
Expand Down

0 comments on commit a1ce275

Please sign in to comment.