Clamshell
🐚 A daemon that implements clamshell mode on Linux for any init system
Install / Use
/learn @Hato1125/ClamshellREADME
What is clamshell mode?
Clamshell mode allows you to work with your laptop lid closed, using an external monitor, keyboard, and mouse.
How to enable clamshell mode
Required
- At least one external monitor is connected
- The laptop lid is closed
Optional
- ~~The laptop is connected to AC power~~ TODO
Comparison
macOS and systemd-based implementations require AC power as an absolute condition for clamshell mode, but clamshell does not. It also does not depend on any init system, so it works in any environment.
Installation
To install, you need xmake, cmake, ninja, and gcc.
For systemd users
chmod +x service/systemd/install.sh
service/systemd/install.sh
After installation, enable clamshell with the following commands:
sudo systemctl restart systemd-logind
sudo systemctl enable --now clamshell
A configuration file that disables systemd's control of the lid will be created at /etc/systemd/logind.conf.d/clamshell.conf.
To uninstall clamshell, delete /etc/systemd/logind.conf.d/clamshell.conf to restore systemd's lid control.
For OpenRC users
chmod +x service/openrc/install.sh
service/openrc/install.sh
After installation, enable clamshell with the following commands:
sudo rc-update add clamshell default
sudo rc-service clamshell start
Other init systems
Contributions are welcome ;)
Configuration
The configuration file is in TOML format and is loaded in the following order:
~/.config/clamshell/config.conf → /etc/clamshell/config.conf
fallback
Whether to automatically fall back to another mode if the mode specified by suspend_mode_type is unavailable.
Default: false
suspend_mode_type
The suspend method to use.
Default: freeze
| Value | Description |
|:-|:-|
| freeze | Freezes the CPU. The lightest option and works in most environments. |
| suspend_to_ram | Uses RAM suspend (S3). |
| suspend_to_disk | Uses disk suspend (hibernation). |
nvidia_method_type
The suspend method to use when an NVIDIA GPU is present.
Default: official_script
| Value | Description |
|:-|:-|
| official_script | Uses /usr/bin/nvidia-sleep.sh This is the recommended option. |
| direct_proc | Directly uses /proc/driver/nvidia/suspend Not recommended due to instability. |
Roadmap
- [ ] Turn off the laptop display using DPMS
- [ ] Allow user configuration via D-Bus
- [ ] Add AC power connection as an optional condition
Related Skills
node-connect
346.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
107.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
346.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
346.4kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
