Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save abdulwahidgul24085/74471fa01fa1ea78f0b35110cde1db00 to your computer and use it in GitHub Desktop.

Select an option

Save abdulwahidgul24085/74471fa01fa1ea78f0b35110cde1db00 to your computer and use it in GitHub Desktop.
This guide shows how to use Solaar on Ubuntu 24.04 to remap the Logitech MX Master 3S Smart Shift / scroll-wheel mode button to open the GNOME screenshot interface.

Map Logitech MX Master 3S Smart Shift Button to GNOME Screenshot on Ubuntu 24.04 using Solaar

Goal

Use the Logitech MX Master 3S Smart Shift button, also known as the scroll-wheel mode shift button, to open the GNOME screenshot interface on Ubuntu 24.04.

This setup uses:

  • Solaar
  • A custom Solaar rule
  • A small wrapper script that calls the GNOME screenshot portal

Tested environment

Ubuntu 24.04 LTS
Logitech MX Master 3S
Solaar
GNOME / Wayland

1. Create the screenshot wrapper script

Ubuntu 24.04 may not reliably use the older gnome-screenshot -i flow. The GNOME portal screenshot command works better.

Run:

mkdir -p ~/.local/bin

cat > ~/.local/bin/screenshot-portal <<'EOF'
#!/usr/bin/env bash

gdbus call --session \
  --dest org.freedesktop.portal.Desktop \
  --object-path /org/freedesktop/portal/desktop \
  --method org.freedesktop.portal.Screenshot.Screenshot \
  "" \
  "{'interactive': <true>}"
EOF

chmod +x ~/.local/bin/screenshot-portal

Test the script:

~/.local/bin/screenshot-portal

If the GNOME screenshot interface opens, the script is working.

2. Open Solaar

Start Solaar:

solaar

Select your MX Master 3S device.

3. Divert the Smart Shift button

In the main Solaar window:

  1. Find Key/Button Diversion.
  2. Unlock the setting if needed.
  3. In the left dropdown, select:
Smart Shift
  1. In the right dropdown, select:
Diverted

The required setting is:

Key/Button Diversion → Smart Shift → Diverted

Do not select Mouse Gesture Button unless your rule also listens for Mouse Gesture Button.

4. Create a new Solaar rule

Open:

Rule Editor

Create a new user-defined rule.

The final rule should look like this:

User-defined rules
└─ Rule
   ├─ Key       Smart Shift (00C4) (pressed)
   └─ Execute   /home/YOUR_USERNAME/.local/bin/screenshot-portal

Replace YOUR_USERNAME with your Linux username.

Example:

/home/awg/.local/bin/screenshot-portal

5. Add the Smart Shift condition

In the Rule Editor:

  1. Right-click inside the new rule.
  2. Choose:
Insert here → Condition → Key
  1. Press the physical Smart Shift button on the mouse.

This is the small button behind the scroll wheel.

It should appear as something like:

Smart Shift (00C4) (pressed)

6. Add the screenshot action

Right-click inside the same rule and choose:

Insert here → Action → Execute

Set the command to the wrapper script path:

/home/YOUR_USERNAME/.local/bin/screenshot-portal

Do not add extra arguments.

7. Save and test

Click:

Save changes

Press the MX Master 3S Smart Shift button.

The GNOME screenshot UI should open.

Troubleshooting

Nothing happens

Make sure the diverted button and the rule condition match.

Correct:

Rule condition:        Smart Shift (00C4) (pressed)
Key/Button Diversion:  Smart Shift → Diverted

Incorrect:

Rule condition:        Smart Shift (00C4) (pressed)
Key/Button Diversion:  Mouse Gesture Button → Diverted

If these do not match, Solaar will not trigger the rule.

Check whether the script works

Run:

~/.local/bin/screenshot-portal

If the screenshot UI does not open, fix the script first.

Run Solaar with debug logs

Close Solaar, then run:

solaar -dd

Press the mouse button and watch the terminal output.

If you see messages like:

WHEEL: ratchet: 0

then the Smart Shift button is still acting as a wheel-mode toggle and is probably not diverted correctly.

Wayland note

On Wayland, Solaar may show messages like:

rules cannot access modifier keys in Wayland
cannot create uinput device: "/dev/uinput" cannot be opened for writing

Using the Execute action with the GNOME portal command avoids relying on simulated key presses such as Print or Super + Print.

Final working setup

Key/Button Diversion:
Smart Shift → Diverted
Solaar Rule:
Rule
├─ Key       Smart Shift (00C4) (pressed)
└─ Execute   /home/YOUR_USERNAME/.local/bin/screenshot-portal
Add this section to your Gist.


## 8. Start Solaar automatically from Ubuntu Startup Applications

<img width="611" height="503" alt="image" src="https://gist.github.com/user-attachments/assets/b963687b-4832-47cd-a92f-8af64361a113" />

Solaar must keep running for the custom Smart Shift button mapping to work. If Solaar is closed completely, the mapping stops working.

Ubuntu provides a **Startup Applications** tool for running apps or commands automatically when you log in. You can open it from the Activities overview, or by running `gnome-session-properties`. In the tool, click **Add** and enter the command to run at login. :contentReference[oaicite:0]{index=0}

### Open Startup Applications

Run:

```bash
gnome-session-properties

Or open it from the Ubuntu UI:

  1. Press the Super key.
  2. Search for Startup Applications.
  3. Open Startup Applications Preferences.

Add Solaar

Click Add.

Enter:

Name: Solaar
Command: solaar --window=hide
Comment: Start Solaar in background for Logitech mouse mappings

Click Add.

Make sure the new Solaar entry is checked/enabled in the Startup Applications list.

Test the command

Run:

solaar --window=hide &

If Solaar is already running, you may see:

Another Solaar process is already running so just expose its window

That is fine. It means a Solaar process is already active.

Verify with:

pgrep -a solaar

If this prints a Solaar process, Solaar is running and the Smart Shift mapping should work.

Log out and test

  1. Log out.
  2. Log back in.
  3. Press the MX Master 3S Smart Shift button.

The GNOME screenshot UI should open.

If solaar --window=hide does not work

Check Solaar’s available options:

solaar --help

If your Solaar version does not support --window=hide, edit the Startup Applications entry and use:

Command: solaar

This may show the Solaar window at login, but the mapping will still work as long as Solaar is running.

Wayland warnings

On Wayland, Solaar may print warnings such as:

rules cannot access modifier keys in Wayland
cannot create uinput device: "/dev/uinput" cannot be opened for writing

For this setup, those warnings are usually not a blocker because the Solaar rule uses an Execute action:

Execute /home/YOUR_USERNAME/.local/bin/screenshot-portal

It does not rely on simulated key presses such as Print or Super + Print.


The key UI values are:

```text
Name: Solaar
Command: solaar --window=hide
Comment: Start Solaar in background for Logitech mouse mappings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment