Skip to content

0xhalil/ThinkTok

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

macOS Hammerspoon Cursor MIT License

🧠 ThinkTok

Entertainment while AI thinks!
Watch YouTube Shorts while waiting for AI responses in Cursor IDE

Version Platform


What is ThinkTok?

ThinkTok is a productivity tool that automatically opens YouTube Shorts when you send a prompt to Cursor AI and closes it when the response is complete. No more staring at a loading screen - make the most of your waiting time!

ThinkTok Demo

How It Works

1. You send a prompt to Cursor AI (press Enter)
     ↓
2. ThinkTok detects the prompt submission
     ↓
3. YouTube Shorts widget appears automatically
     ↓
4. AI response completes
     ↓
5. Widget closes automatically - back to coding!

Features

Feature Description
Auto-Detection Detects when you send a prompt and opens Shorts
Smart Close Automatically closes when AI response is complete
Overlay Widget Floating window that stays on top
Chat Panel Detection Auto-positions over the Cursor chat panel
Keyboard Shortcuts Manual control with customizable hotkeys
Minimal Resource Usage Lightweight screenshot-based detection

Installation

Prerequisites

Quick Install

# 1. Install Hammerspoon
brew install --cask hammerspoon

# 2. Clone this repository
git clone https://github.com/0xhalil/ThinkTok.git

# 3. Copy files to Hammerspoon config
cp ThinkTok/cursor_tiktok.lua ~/.hammerspoon/
cp ThinkTok/init.lua ~/.hammerspoon/

# 4. Reload Hammerspoon config
# Press Cmd + Alt + Ctrl + R or click Hammerspoon menu β†’ Reload Config

Grant Permissions

  1. Open System Settings β†’ Privacy & Security β†’ Accessibility
  2. Enable Hammerspoon βœ“

Usage

Automatic Mode (Default)

Just use Cursor as normal! ThinkTok will:

  • Open Shorts when you press Enter to send a prompt
  • Close automatically when the AI finishes responding

Manual Control

Shortcut Action
Cmd + Alt + Ctrl + T Toggle Shorts widget
Cmd + Alt + Ctrl + S Show Shorts widget
Cmd + Alt + Ctrl + H Hide Shorts widget
Cmd + Alt + Ctrl + R Reload Hammerspoon config

Configuration

Edit ~/.hammerspoon/cursor_tiktok.lua to customize:

M.config = {
    -- Widget size (fallback if auto-detect fails)
    fallbackWidth = 380,   -- pixels
    fallbackHeight = 650,  -- pixels
    
    -- Video source
    videoUrl = "https://www.youtube.com/shorts",
    
    -- Detection sensitivity
    checkInterval = 1.5,        -- Check every 1.5 seconds
    stableChecksRequired = 3,   -- 3 stable checks = response complete
    
    -- Debug mode
    debug = false,  -- Set to true for console logging
}

Alternative Video Sources

-- TikTok
videoUrl = "https://www.tiktok.com/foryou"

-- Instagram Reels
videoUrl = "https://www.instagram.com/reels/"

-- Reddit Videos
videoUrl = "https://www.reddit.com/r/videos"

Troubleshooting

Widget doesn't appear
  1. Check Hammerspoon accessibility permissions
  2. Make sure Cursor is the focused app
  3. Enable debug mode and check Console.app for logs:
    cursorTikTok.config.debug = true
Widget doesn't close automatically
  1. Increase stableChecksRequired for longer responses
  2. The widget has a 5-minute max timeout as a fallback
  3. Use Cmd + Alt + Ctrl + H to manually hide
Widget position is wrong
  1. The widget tries to auto-detect the chat panel
  2. If detection fails, it uses fallbackWidth and fallbackHeight
  3. Adjust these values in the config file

How It Detects Response Completion

ThinkTok uses a clever screenshot-based approach:

  1. Takes small snapshots of the Cursor window (80x80 pixels)
  2. Generates a hash of each snapshot
  3. Compares consecutive hashes
  4. When the hash is stable for N consecutive checks, the response is complete

This method is:

  • Lightweight - No need to parse Cursor's UI
  • Reliable - Works regardless of response length
  • Non-intrusive - No modifications to Cursor needed

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.


Acknowledgments

  • Hammerspoon - Powerful macOS automation
  • Cursor - The AI-first code editor
  • Inspired by the countless seconds spent waiting for AI responses

Made with ❀️ for developers who value every second

Report Bug Β· Request Feature

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages