Skip to content

sonjek/mouse-stay-up

Repository files navigation

Mouse-Stay-Up

ci status Go Report Card Contributors Go GitHub release (latest by date including pre-releases) License

This lightweight application is designed to prevent your computer from entering sleep mode by periodically moving the cursor when it detects periods of inactivity. Additionally, the program allows you to disable the keyboard programmatically (MacOS only).

Installation from source

Prepare Build Environment (macOS)

For macOS systems, the installation of additional tools and development libraries is not needed.

Prepare Build Environment (Linux/BSD)

You may require a proxy app which can convert the new DBus calls to the old format. More info in systray library info. For Debian-based systems with GTK based trays, use this script to install snixembed.

Install

Verify that you have Go 1.26+ installed. If go is not installed, follow instructions on the Go website.

Install via go install

go install github.com/sonjek/mouse-stay-up/cmd/mouse-stay-up@latest

This should download the source code and compile the executable into $GOPATH/bin/mouse-stay-up.

Make sure $GOPATH/bin is in your $PATH so the shell can discover this application.

For example, my ~/.profile contains this:

export GOPATH="$HOME/go"
export PATH="$GOPATH/bin:$PATH"

Alternatively, you can run this application using the full path /Users/<USERNAME>/go/bin/mouse-stay-up.

Build yourself

  1. Clone this repository
git clone https://github.com/sonjek/mouse-stay-up && cd mouse-stay-up
  1. Build
make build

The binary file is built and ready to run:

./bin/mouse-stay-up
  1. You can install the binary file to your OS.

    Installs to /usr/local/bin/ by default:

make install

or

sudo make install

Install to a custom location:

make install INSTALL_PATH=/tmp

MacOS

Autostart at login

  1. Create a new file in ~/Library/LaunchAgents/ called com.github.sonjek.mouse-stay-up.plist with the following contents:
cat <<EOF > ~/Library/LaunchAgents/com.github.sonjek.mouse-stay-up.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.sonjek.mouse-stay-up</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/local/bin/mouse-stay-up</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>KeepAlive</key>
    <false/>
    <key>StandardOutPath</key>
    <string>/tmp/mouse-stay-up.stdout.log</string>
    <key>StandardErrorPath</key>
    <string>/tmp/mouse-stay-up.stderr.log</string>
</dict>
</plist>
EOF

or

cp deployments/com.github.sonjek.mouse-stay-up.plist ~/Library/LaunchAgents/com.github.sonjek.mouse-stay-up.plist

If you used go install, update the application path to /Users/<USERNAME>/go/bin/mouse-stay-up.

  1. Load the launch agent:
launchctl load ~/Library/LaunchAgents/com.github.sonjek.mouse-stay-up.plist

Access rights

  1. Accessibility permissions are required for the keyboard lock to function. Please grant these permissions in settings to enable this feature:
  • Go to System Settings > Privacy & Security > Accessibility.
  • Enable mouse-stay-up.
  1. To disable background activity:
  • Go to System Settings > General > Login Items & Extensions.
  • Disable mouse-stay-up in app background activity section.

About

Small app that moves your cursor to prevent sleep mode — efficient and virtually invisible.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

 
 
 

Contributors