Skip to content
detect-buttons logo

Detect Buttons Skill

detect-buttons

Guide user through button detection for an unknown mouse using Slicer Python console

SKILL.md

Full skill instructions

Detect Buttons Skill

Guide user through button detection for an unknown mouse.

When to Use

Use this skill when:

  • User has a mouse not in the built-in profiles
  • User needs to determine Qt button codes
  • User wants to verify button codes on their system

Steps

  1. Explain the Process Tell the user:

    • They'll need to run code in Slicer's Python console
    • Each button press will print its Qt code
    • They should note which physical button maps to which code
  2. Provide Detection Code Give the user this code to paste in Slicer Python console:

    import qt
    
    class ButtonDetector(qt.QObject):
        def __init__(self):
            super().__init__()
            self.detected = []
            slicer.app.installEventFilter(self)
            print("Button detection active. Press mouse buttons...")
            print("Press Ctrl+C in console when done.")
    
        def eventFilter(self, obj, event):
            if event.type() == qt.QEvent.MouseButtonPress:
                btn = int(event.button())
                mods = int(event.modifiers())
                if btn not in [b[0] for b in self.detected]:
                    self.detected.append((btn, mods))
                    print(f"Detected button: {btn} (modifiers: {hex(mods)})")
            return False
    
        def stop(self):
            slicer.app.removeEventFilter(self)
            print("\nDetection stopped. Results:")
            for btn, mods in self.detected:
                print(f"  Button {btn}")
            return self.detected
    
    detector = ButtonDetector()
    # When done: detector.stop()
    
  3. Collect Results After user runs detection, ask them to share:

    • Which button code corresponds to which physical button
    • Any buttons that weren't detected
  4. Map to Profile Help user create mapping:

    Code 1  -> Left Click (not remappable)
    Code 2  -> Right Click (not remappable)
    Code 4  -> Middle Click
    Code 8  -> Back / Thumb Back
    Code 16 -> Forward / Thumb Forward
    Code 32 -> Extra button (side, thumb, etc.)
    
  5. Create Profile Use the add-mouse-profile skill to create the profile JSON.

Platform Notes

  • Windows: Standard Qt codes usually work
  • macOS: Some buttons may not generate Qt events if intercepted by system
  • Linux: Standard codes work; evdev can detect more buttons

Troubleshooting

Button not detected:

  • Check if system/​driver software is intercepting
  • On Linux, check if user is in input group
  • Try running Slicer as administrator (Windows)

Wrong button detected:

  • Driver software may be remapping buttons
  • Disable vendor software (Logitech Options, etc.)
  • Reset mouse to default configuration

Example Output

Button detection active. Press mouse buttons...
Detected button: 1 (modifiers: 0x0)      # Left click
Detected button: 2 (modifiers: 0x0)      # Right click
Detected button: 4 (modifiers: 0x0)      # Middle click
Detected button: 8 (modifiers: 0x0)      # Back
Detected button: 16 (modifiers: 0x0)     # Forward
Detected button: 32 (modifiers: 0x0)     # Thumb button

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View