Repository navigation
System Tray and Auto Updater
RubyLock RPC provides a persistent, zero-dependency native system tray icon on both Windows and Linux (lib/rubylock_rpc/tray.rb) alongside a verified GitHub Releases auto-updater (lib/rubylock_rpc/updater.rb).
Unless --no-tray is passed (which instantiates Tray::NullTray), RubyLock RPC creates a platform-native tray icon that stays live in the notification area and reflects your current Deadlock phase in real time.
Both Windows and Linux expose the exact same menu layout and actions:
| Menu Item | Behavior |
|---|---|
| RubyLock RPC v1.3.0 (disabled header) | Displays the running version. |
Status: <live status> (disabled header)
|
Live Rich Presence summary (<details> — <state>, "Waiting for Deadlock", or "Connecting to Discord..."). |
| Launch Deadlock | Invokes Launcher.launch_deadlock (starts Deadlock via Steam with -condebug if not already running). |
| Exit When Game Closes (checkmark toggle) | Flips shared.exit_when_game_closes in memory and immediately persists general.exit_when_game_closes to config.toml. |
| Auto-Update (checkmark toggle) | Flips shared.auto_update in memory and immediately persists general.auto_update to config.toml. |
| Check for Updates | Runs an immediate interactive Updater.check_and_apply(auto_update: false) check and notifies you if you are already on the latest version. |
| Open Config Folder | Opens RpcLogger.resolve_data_dir in explorer.exe (Windows) or xdg-open (Linux). |
| Quit RubyLock RPC | Clears Discord Rich Presence (SET_ACTIVITY with nil), closes IPC, removes the tray icon, releases the single-instance lock, and exits cleanly. |
On 64-bit Windows (Gem.win_platform? && Fiddle::SIZEOF_VOIDP == 8), WindowsTray drives the Win32 notification area directly through Ruby's standard-library Fiddle bindings — no .NET, no PowerShell, and no compiled tray DLLs:
-
Bound Win32 Libraries:
-
kernel32.dll:GetModuleHandleW -
user32.dll:RegisterClassExW,CreateWindowExW,DestroyWindow,DefWindowProcW,PeekMessageW,TranslateMessage,DispatchMessageW,PostMessageW,LoadImageW,DestroyIcon,CreatePopupMenu,AppendMenuW,TrackPopupMenu,DestroyMenu,GetCursorPos,SetForegroundWindow,RegisterWindowMessageW -
shell32.dll:Shell_NotifyIconW
-
-
Hidden Message Window: Registers a per-PID window class (
RubyLockRpcTrayWindow_<pid>) with aFiddle::Closure::BlockCallerwindow procedure. -
Icon & Tooltip: Loads
assets/icon.icoviaLoadImageW(LR_LOADFROMFILE | LR_DEFAULTSIZE), constructs a 976-byteNOTIFYICONDATAWbuffer (NIM_ADD/NIM_MODIFY/NIM_DELETE), and updates tooltips (truncated to 127 UTF-16LE characters) from the 50msPeekMessageWloop. -
Explorer Restart Recovery: Registers
"TaskbarCreated"viaRegisterWindowMessageWand automatically re-adds the icon withNIM_ADDifexplorer.exerestarts. -
Click Handling: Both left-click (
WM_LBUTTONUP) and right-click (WM_RBUTTONUP) open the popup menu at the cursor position (GetCursorPos+SetForegroundWindow+TrackPopupMenu), dispatching the selected action on a background thread.
On Linux, RubyLock RPC speaks the D-Bus binary wire protocol (little-endian v1) directly in pure Ruby over a UNIXSocket — requiring neither libdbus, libayatana-appindicator, nor dbus-send:
- Reads
$DBUS_SESSION_BUS_ADDRESS(or falls back to$XDG_RUNTIME_DIR/busif a socket exists). - Supports both filesystem (
unix:path=...) and abstract (unix:abstract=...) UNIX sockets with percent-decoding. - Authenticates using
AUTH EXTERNAL <hex-encoded-uid>(falling back toAUTH ANONYMOUS), followed byBEGIN. - Calls
org.freedesktop.DBus.Hello, requests the bus nameorg.kde.StatusNotifierItem-<pid>-1, and registers/StatusNotifierItemwithorg.kde.StatusNotifierWatcher(RegisterStatusNotifierItem). - Subscribes to
NameOwnerChangedsignals fororg.kde.StatusNotifierWatcherso the tray icon automatically re-registers if the desktop shell or panel restarts.
| Object Path | Interfaces | Key Methods / Properties |
|---|---|---|
/StatusNotifierItem |
org.kde.StatusNotifierItemorg.freedesktop.DBus.Propertiesorg.freedesktop.DBus.Introspectableorg.freedesktop.DBus.Peer
|
Category ("ApplicationStatus"), Id ("rubylock-rpc"), Title ("RubyLock RPC"), Status ("Active"), IconName, IconThemePath, ToolTip, ItemIsMenu (true), Menu ("/MenuBar"), plus NewToolTip signal on status changes. |
/MenuBar |
com.canonical.dbusmenuorg.freedesktop.DBus.Propertiesorg.freedesktop.DBus.Introspectable
|
Version (3), GetLayout, GetGroupProperties, GetProperty, Event, EventGroup, AboutToShow, AboutToShowGroup, plus LayoutUpdated signal when status or checkboxes change. |
- Prefers the installed XDG hicolor icon (
$HOME/.local/share/icons/hicolor/256x256/apps/rubylock-rpc.png) usingIconName = "rubylock-rpc"andIconThemePath = "". - For portable / Git checkouts where the hicolor icon is not installed, falls back to
IconName = "icon"withIconThemePath = "<repo>/assets"(assets/icon.png).
Tip
Works out of the box on KDE Plasma, COSMIC, and XFCE. On GNOME, install the AppIndicator and KStatusNotifierItem Support extension to display StatusNotifierItem icons in the top bar.
Updater checks https://api.github.com/repos/buntatoes/rubylock-rpc/releases/latest on startup (unless --no-update-check is passed), when triggered from the tray (Check for Updates), or via CLI (--check-update / --update).
- Ignores
draftandprereleaseGitHub releases. - Parses semantic tags matching
vMAJOR.MINOR[.PATCH](rejecting pre-release suffixes containing-, such asv1.3.0-rc1). - Compares
[major, minor, patch]tuples againstRubylockRpc::VERSION(1.3.0) and only offers updates when remote > current. - Selects the platform asset automatically:
-
Windows:
RubyLock-RPC-Setup-*.exe(fallback:*.exe) -
Linux:
rubylock-rpc-linux-x86_64.tar.gz(fallback:*linux*.tar.gz)
-
Windows:
Every download and extraction step enforces strict validation:
| Guard | Implementation |
|---|---|
HTTPS-Only Host Allowlist (TRUSTED_HOSTS) |
Refuses any URL or redirect target that is not HTTPS on one of: github.com, api.github.com, objects.githubusercontent.com, release-assets.githubusercontent.com, github-releases.githubusercontent.com, codeload.github.com. |
| Redirect Limit | Caps HTTP redirects at MAX_REDIRECTS = 5, re-validating trusted_download_url? on every hop. |
| Magic-Byte Verification | Verifies downloaded bytes before executing or unpacking: "MZ" for Windows PE .exe installers and 0x1F 0x8B (gzip header) for Linux .tar.gz archives. |
Safe Tar Extraction (extract_tar_gz) |
Uses Zlib::GzipReader + Gem::Package::TarReader directly in Ruby and rejects any archive member starting with /, containing .., or resolving outside the destination directory (Path traversal detected). |
flowchart LR
Check["GET /releases/latest"] --> Newer{"Remote > Current?"}
Newer -->|No| Done["Up to date"]
Newer -->|Yes| Mode{"auto_update = true?"}
Mode -->|No| Prompt["Native Prompt (MessageBoxW / zenity / kdialog / notify-send)"]
Prompt -->|Declined| Stop["Skip update"]
Prompt -->|Accepted| Download["Download + Verify Host & Magic Bytes"]
Mode -->|Yes| Download
Download --> Win["Windows: Spawn Setup.exe --silent & Exit cleanly"]
Download --> Lin["Linux: Safe extract tar.gz & Run install.sh --silent with detected PREFIX"]
-
Windows: Downloads the setup
.exetoDir.tmpdir, validates"MZ", spawns<setup>.exe --silent, detaches it, and calls the shutdown callback so the running RubyLock RPC instance exits cleanly before files in%LOCALAPPDATA%\RubyLock-RPCare replaced (the installer itself retries locked files up to 25 times at 200ms intervals). -
Linux: Extracts the
.tar.gzinto a temporary directory, detects the current install prefix (detect_linux_install_prefix: strips/share/rubylock-rpcwhen installed there, otherwise uses$PREFIXor$HOME/.local), runssh install.sh --silentviaOpen3.capture3, and notifies the user to restart RubyLock RPC.
Copyright (c) 2026 Buntato (buntatoes). RubyLock RPC is free software licensed under the GNU General Public License v3.0 (GPL-3.0), based on the upstream GPL-3.0 project HeyTariq/deadlock-rpc. Not affiliated with or endorsed by Valve Corporation.
Getting Started
Core Architecture
- Architecture and Internals
- Deadlock Detection and State Machine
- Discord IPC and Rich Presence
- System Tray and Auto-Updater
Safety, Dev & Support
Links