This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Get current day of the week | |
set currentDay to weekday of (current date) as string | |
-- Get the current time in seconds since midnight | |
set currentTime to time of (current date) | |
-- Convert the current time to hours | |
set currentHour to currentTime div 3600 | |
-- Check if today is between Monday and Friday |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Define the events that should trigger the startWorkDay function | |
local startWorkDayEvents = { | |
hs.caffeinate.watcher.systemDidWake, | |
hs.caffeinate.watcher.screensDidUnlock, | |
hs.caffeinate.watcher.screensaverDidStop | |
} | |
-- Function to check if the event should trigger the startWorkDay function | |
local function shouldTriggerStartWorkDay(eventType) | |
for _, startWorkDayEvent in ipairs(startWorkDayEvents) do |