Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8876937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:20:25+00:00 2026-06-14T19:20:25+00:00

I wrote a C program/LaunchDaemon that checks if my MacBook is at home (connected

  • 0

I wrote a C program/LaunchDaemon that checks if my MacBook is at home (connected to my WLAN). If so, it disables my password protection; if not, it enables it.

Easy. But the problem is that when I take my MacBook anywhere else and password protection is disabled, it will wake up without a password protection.

My fix for this would be: enable the password protection every time just before it goes to sleep.

QUESTION: is there any way find out when my Mac is preparing for sleep? Some interupt I can let my program listen to?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T19:20:27+00:00Added an answer on June 14, 2026 at 7:20 pm

    You can do it using I/O Kit, check Apple’s QA1340: Registering and
    unregistering for sleep and wake notifications
    . You may also want to
    analyze the SleepWatcher utility sources or use/integrate for your needs.
    From the homepage:

    SleepWatcher 2.2 (running with Mac OS X 10.5 to 10.8, source code included)
    is a command line tool (daemon) for Mac OS X that monitors sleep, wakeup and
    idleness of a Mac. It can be used to execute a Unix command when the Mac or
    the display of the Mac goes to sleep mode or wakes up, after a given time
    without user interaction or when the user resumes activity after a break or
    when the power supply of a Mac notebook is attached or detached. It also can
    send the Mac to sleep mode or retrieve the time since last user activity. A
    little bit knowledge of the Unix command line is required to benefit from
    this software.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wrote a program using Tweepy that I can run on my home computer
I wrote a program called Hello.py that looks like this: import pygame, sys from
I wrote this program: #include <stdio.h> /*Part B Write a program that: defines an
I wrote a program that forks some processes with fork(). I want to kill
I wrote a program that accepts and outputs Hebrew (i.e. right-to-left) text. In lieu
I wrote a program that simulates soft bodies using springs. It looks nice but
I wrote a program that uses OLE and it was working fine until I
I wrote a program in C which has a function that processes files which
I wrote a program that is based completely on a single text file: I
I wrote a Program that backup SQL Databases using SMO Library on .net ,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.