13
submitted 3 days ago* (last edited 2 days ago) by PlzGivHugs@sh.itjust.works to c/linux4noobs@programming.dev

For years, I've used a Razor Naga with DPI switching on one of the side buttons, and for years before that, it was a Logitech G600. I've just installed Linux for the first time in a while only to realize Razor doesn't offer support, and Polychromatic doesn't offer button remapping.

Is there any way to rebind my mouse, or will I have to go back to Windows to keep using my mouse?

1Edit: plz send help fast. I am typing "1" into every window I open. I need rebind this before I break something.1

Edit21: Is there a way to bind a sensitivity toggle to the mouse button event more directly?

Edit 3: I've run out of time to work on this, so I'll need to install Windows for the time being. I might come back to it if I ever get a weekend free.

top 13 comments
sorted by: hot top controversial new old
[-] tal@lemmy.today 2 points 2 days ago* (last edited 2 days ago)

I haven't used it, but it looks like you can change DPI with the razor-cli command.

https://github.com/lolei/razer-cli

Says it can also print the current DPI, so I imagine that it'd be pretty straightforward to do a shell script of maybe three lines or so that cycles resolution through your favored resolutions when invoked. Doesn't show an example of the exact output of the command, though, so I can't tell you exactly what to run.

Looks like you can also set the LED color, if you want to have it indicate the DPI or something.

If you can't figure out the script but can paste the exact output from the command printing the current DPI, I can probably help you with the script.

I use Sway, and Sway can be configured to invoke commands when a button or key or whatever is pressed, so you'd just have it run said script.

https://man.archlinux.org/man/sway.5.en

You don't say what desktop environment you're using. If you're using Gnome or KDE, I expect that there's some similar utility, probably built into the desktop environment, to bind mouse buttons to invoke commands.

[-] PlzGivHugs@sh.itjust.works 1 points 2 days ago

1>Says it can also print the current DPI, so I imagine that it’d be pretty straightforward to do a shell script of maybe three lines or so that cycles resolution through your favored resolutions when invoked. Doesn’t show an example of the exact output of the command, though, so I can’t tell you exactly what to run.

I installed it. The output from razer-cli --dpi print is just my dpi (1400).

11>I use Sway, and Sway can be configured to invoke commands when a button or key or whatever is pressed, so you’d just have it run said script.1

1I'm using Cinnamon, on Linux Mint

[-] tal@lemmy.today 1 points 2 days ago* (last edited 2 days ago)

The output from razer-cli --dpi print is just my dpi (1400).

Okay. Something like this should work:

#!/bin/bash
dpi=$(razer-cli --dpi print)
case $dpi in
  1400)
    razer-cli --dpi 20000
    ;;
  20000)
    razer-cli --dpi 1400
    ;;
esac

If the resolutions you want are 1400 and 20000 dpi.

save it as cycle.sh or something like that in a directory in your PATH, and chmod +x it to make it executable. Every time it runs, it'll cycle though resolutions. Can add more resolutions or fiddle with the colors or whatever there too.

Cinnamon

Okay. I haven't used any GNOME stuff in ages, but it sounds like Cinnamon's applet only does keyboard bindings, so can't bind a mouse button to a command.

https://github.com/linuxmint/cinnamon/issues/12840

I don't know what the best route to run a command on mouse click is under Cinnamon is.

[-] Zorsith@lemmy.blahaj.zone 3 points 3 days ago* (last edited 3 days ago)

I use Piper for my g600 if thats any help? Not sure if/how it handles dpi tho

Edit; Piper relies on Libratbag

[-] Eeyore_Syndrome@sh.itjust.works 2 points 3 days ago
[-] PlzGivHugs@sh.itjust.works 1 points 3 days ago

As best as I can tell, it doesn't support anything related to DPI.

[-] foggy@lemmy.world 1 points 3 days ago

Find device ID with xinput list

Check button mapping with xinput get-button-map

Swap button assignment (eg 8<->9) with xinput set-button-map 1 2 3 4 5 6 7 9 8

[-] tal@lemmy.today 2 points 2 days ago* (last edited 2 days ago)

xinput will work under Xorg, but not Wayland.

I actually don't think I've needed to remap mouse buttons on Wayland. Most stuff like that got pushed to the compositor in Wayland. I assume that, given that I'm using sway, sway has some mechanism. Probably Gnome and KDE do too. OP didn't indicate what environment he was in, though.

https://wiki.archlinux.org/title/Input_remap_utilities

Has some packages.

[-] foggy@lemmy.world 1 points 2 days ago* (last edited 2 days ago)

God damn that's so good to know.

I've been neglecting this issue on a subset of vms. At work, no less.

No real issue just a headache.

Thank you. Deobfuscated a pain point I never bothered to look into. I can probably work around it now.

[-] PlzGivHugs@sh.itjust.works 1 points 3 days ago

I'm specifically trying to bind a button to dpi/sensitivity cycling.

[-] viral.vegabond@piefed.social 1 points 3 days ago

I solved a silimar issue by using a virtual machine to set/change the defaults. It isn't totally ideal, but it works. I can give more specifics later if you need 👍

[-] PlzGivHugs@sh.itjust.works 1 points 3 days ago

Was this using On-board memory, because my mouse doesn't have any?

[-] viral.vegabond@piefed.social 1 points 3 days ago

Yes, mine does use an on-board memory profile. Hope you are able to find a solution.

this post was submitted on 16 Oct 2025
13 points (100.0% liked)

linux4noobs

2990 readers
6 users here now

linux4noobs


Noob Friendly, Expert Enabling

Whether you're a seasoned pro or the noobiest of noobs, you've found the right place for Linux support and information. With a dedication to supporting free and open source software, this community aims to ensure Linux fits your needs and works for you. From troubleshooting to tutorials, practical tips, news and more, all aspects of Linux are warmly welcomed. Join a community of like-minded enthusiasts and professionals driving Linux's ongoing evolution.


Seeking Support?

Community Rules

founded 2 years ago
MODERATORS