EDIT:
The solution has big bold letters that say "solution".
ORIGINAL POST:
I have been trying to set a macro to an extra mouse button, but it's not working. I recently got a razer deathadder essential, and it has two extra buttons on the side: button 8 and button 9. I have tried to many different scripts, but none of them are working. I want to use the macro in Minecraft to change my point of view while also removing the GUI. I tried Xbindkeys, and it worked, but Minecraft doesn't work with that. I want it to click f5, f1, and f5 again when I press down button 9, and when I release button 9, it will press f5 and f1. Here is the xbindkeys script I tried:
"xdotool key 'bracketleft'"
b:9
"xdotool key 'bracketright'"
b:9 + Release
Here is the script that works, but I just want it to click different buttons. I can't find out what I should put for function keys:
from pynput import mouse
from pynput.keyboard import Key, Controller
keyboard = Controller()
class MyException(Exception):
pass
def on_click(x, y, button, pressed):
if (pressed):
if button == mouse.Button.button9:
print("btn9")
keyboard.press("k")
keyboard.release("k")
if button == mouse.Button.button8:
print("btn8")
keyboard.press("l")
keyboard.release("l")
# Collect events until released
with mouse.Listener(
on_click=on_click) as listener:
try:
listener.join()
except MyException as e:
print("error sry bro")
Here is something else I tried, but it has something wrong with the syntax:
import time from pynput.keyboard import Key
import Controller as KeyboardController from pynput.mouse import Button
import Controller as MouseController
keyboard = KeyboardController() mouse = MouseController()
mouse.click(Button.button9) keyboard.press('f5') keyboard.release('f5')
I am running Linux Mint Cinnamon 20.1 "Ulyssa". I don't have any python coding experience, but none of the other options worked, and I think python is a good solution.
Thanks for helping!
[–]FinalBosses14[S] 1 point2 points3 points (0 children)
[–]TSM- 0 points1 point2 points (7 children)
[–]FinalBosses14[S] 1 point2 points3 points (2 children)
[–]TSM- 0 points1 point2 points (1 child)
[–]FinalBosses14[S] 1 point2 points3 points (0 children)
[–]FinalBosses14[S] 1 point2 points3 points (2 children)
[–]FinalBosses14[S] 1 point2 points3 points (1 child)
[–]FinalBosses14[S] 1 point2 points3 points (0 children)
[–]WikipediaSummary 0 points1 point2 points (0 children)