Skip to content

About

Plays moaning sounds when you slap your laptop.

Resources

Stars

24 stars

Watchers

0 watching

Forks

Latest commit

 

History

29 Commits

Folders and files

Repository files navigation

The Moaning Guy

The Moaning Guy

Plays moaning sounds when you slap your laptop. Inspired by SlapMac - but for Windows, macOS, and Linux.

Tauri v2 Rust Cross-platform


How It Works

When available, The Moaning Guy can use a built-in accelerometer / motion sensor for more precise slap detection. On devices without sensor support, it automatically falls back to the microphone detector.

A slap on the laptop chassis produces a sharp, short impulse that is easy to distinguish from normal audio. The app listens in real time, detects either motion spikes or microphone amplitude spikes above a configurable threshold, and plays a random sound from your selected bundle.

Mic Input -> Amplitude Analysis -> Spike Detection -> Sound Playback
             (cpal)              (threshold + cooldown)    (rodio)
  • Volume scales with force - harder slap = louder moan
  • Shuffle bag - plays through all sounds before repeating any
  • No overlap - new trigger stops the previous sound
  • Accelerometer mode - use supported sensor hardware for tighter slap detection
  • Microphone fallback - works on devices without a motion sensor
  • Port rules - trigger bundles on charging, USB storage, external display, Ethernet, and dock events
  • Adjustable sensitivity - tune it for your environment
  • Cooldown timer - prevent rapid-fire triggers

Architecture

+-----------------------------------------+
|              System Tray                |
|   Pause/Resume · Test · Settings · Quit |
+--------------+--------------------------+
               |
       +-------v--------+    <- HTML/CSS/JS (Tauri webview)
       |  Settings UI   |
       | (settings.html)|
       +-------+--------+
               | IPC (invoke/emit)
       +-------v--------+
       |   Rust Backend |
       |                |
       |  + Detector +  |    <- Dedicated thread, cpal mic input
       |  | Threshold | |
       |  | Cooldown  | |
       |  | on_slap() | |
       |  +-----+-----+ |
       |        |       |
       |  +-----v-----+ |    <- Dedicated thread, rodio output
       |  |  Player   | |
       |  | Shuffle   | |
       |  | Single    | |
       |  +-----------+ |
       |                |
       |  + Settings +  |    <- Arc<Mutex<Settings>>
       |  | JSON disk | |
       |  +-----------+ |
       +--------+-------+
                |
       +--------v--------+    <- %APPDATA% / ~/Library / ~/.local/share
       |   App Data Dir  |
       |   sounds/       |
       |     bundle-a/   |
       |     bundle-b/   |
       |   settings.json |
       +-----------------+

Tech Stack

Layer Technology
Framework Tauri v2
Backend Rust
Frontend Vanilla HTML / CSS / JS
Audio Input cpal
Audio Output rodio
File Dialog tauri-plugin-dialog

Setup

Prerequisites

Linux only:

sudo apt install libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libasound2-dev

Development

git clone https://github.com/adityapatel-00/themoaningguy.git
cd themoaningguy
npm install
npm run dev

Build

npm run build

Produces platform-specific installers in src-tauri/target/release/bundle/.

Usage

  1. Launch the app - it sits in your system tray
  2. Right-click the tray icon -> Settings
  3. Create a sound bundle and import your audio files (wav, mp3, ogg, flac)
  4. Pick Accelerometer or Microphone mode when available
  5. Configure Port Detection rules for connect/remove events
  6. Adjust sensitivity, cooldown, and volume
  7. Save - then slap your laptop

The settings screen also includes a small support prompt and footer links for GitHub Sponsors, Ko-fi, UPI (x.pulseop@axl), and starring the repo.

Safety & Limitations

  • Detection is best-effort and may produce false positives or miss some events.
  • Port detection depends on what the operating system exposes on the current device.
  • Microphone mode uses the active input device while the app is running.
  • Accelerometer mode, when available, depends on supported sensor hardware and drivers.
  • Background monitoring uses some CPU and battery, especially in microphone mode.
  • Use the app responsibly on sensitive, shared, or production machines.

Disclaimer

This software is provided "as is", without warranty of any kind. The author is not responsible for any damage, data loss, hardware issues, or unintended behavior that may result from using the app.

Adding Sounds

The app ships with a built-in starter bundle. To add your own:

  1. Open Settings -> create a bundle (for example, anime or dramatic)
  2. Click + Add Sound Files inside the bundle
  3. Select audio files from your machine (wav, mp3, ogg, flac)
  4. Select the bundle as active and Save

Sounds are stored in your app data directory and persist across updates.

Project Site

The GitHub Pages landing page lives in docs/index.html. Enable GitHub Pages from the repo docs/ folder to publish it.

Platform Notes

Platform Tray Icon Notes
Windows Works out of the box Appears in system tray
macOS Works out of the box Appears in menu bar. You may need to grant Microphone permission in System Settings -> Privacy & Security
Linux Usually works If the tray icon does not appear on GNOME, install the AppIndicator extension

License

MIT

About

Plays moaning sounds when you slap your laptop.

Resources

Stars

24 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Contributors

Languages