Requesting Help to Ctrl+Tab and Ctrl+Shift+Tab on Twist

Questions and answers about 3Dconnexion devices on Windows.

Moderator: Moderators

Post Reply
Yogi
Posts: 12
Joined: Wed Jun 29, 2022 4:39 am

Requesting Help to Ctrl+Tab and Ctrl+Shift+Tab on Twist

Post by Yogi »

Hello I just got the spacemouse wireless and I was wondering if anyone could help me edit an xml for firefox (or any application really as I use this all the time).

I want to instruct it to:
Press Ctrl+Tab once when I twist it clockwise
Press Ctrl+Shift+Tab once when I twist it anti-clockwise

I would use this to switch between tabs.

Is this possible? I would greatly appreciate any guidance.

Thank you.
Yogi
Posts: 12
Joined: Wed Jun 29, 2022 4:39 am

Re: Requesting Help to Ctrl+Tab and Ctrl+Shift+Tab on Twist

Post by Yogi »

I've currently got this:

Code: Select all

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<AppCfg xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Default="false" CfgFormatVersion="1.3" ThisFileVersion="1.10">
  <AppInfo>
    <Signature>
      <Name>STR_FIREFOX</Name>
    </Signature>
    <Options />
  </AppInfo>
  <CfgProperties>
    <ID>ID_STR_FIREFOX</ID>
    <Name>STR_FIREFOX</Name>
    <InheritsFromID>ID_STR_FIREFOX</InheritsFromID>
  </CfgProperties>
  <Devices>
    <Device>
      <ID>ID_Standard_3D_Mouse</ID>
      <AxisBank>
        <Name>Default</Name>
        <ID>Default</ID>
        <Axis>
          <Enabled>true</Enabled>
          <Input>
            <ActionID>HIDMultiAxis_Ry</ActionID>
            <Min>-512</Min>
            <Max>511</Max>
          </Input>
          <Output> 
	       <KeyStroke>
		    <Modifiers>
	           <Modifier>Control</Modifier>
		      <Modifier>Shift</Modifier>
		    </Modifiers>
		    <Key>2B</Key>
	       </KeyStroke>    
          </Output>
        </Axis>
      </AxisBank>
    </Device>
  </Devices>
  <AuthorInfo>
    <DriverVersion>17.8.7.19322</DriverVersion>
    <LastChange>
      <Tool>3DxSmartUI.exe</Tool>
      <Version>1.2.22097.19277</Version>
      <Date>6/30/2022 1:19:13 PM UTC</Date>
      <User>yasir</User>
    </LastChange>
  </AuthorInfo>
</AppCfg>
But it doesn't seem to be doing anything. (Also I changed the axis mentioned in the OP, to be when you press right or left - sorry I can't figure out how to edit the post).
Yogi
Posts: 12
Joined: Wed Jun 29, 2022 4:39 am

Re: Requesting Help to Ctrl+Tab and Ctrl+Shift+Tab on Twist

Post by Yogi »

I got it working!

Sharing the code that goes into the XML file for anyone else:

Code: Select all

  <Axis>
          <Enabled>true</Enabled>
          <Input>
            <ActionID>HIDMultiAxis_Rz</ActionID>
            <Min>0</Min>
            <Max>511</Max>
            <Deadband>25</Deadband>
          </Input>
          <Output>
            <ActionID>KB_Keystroke</ActionID>
            <MaxEventRate>2.50</MaxEventRate>
            <Modifiers>
              <Modifier>Control</Modifier>
            </Modifiers>
            <KeyStroke>
              <Key>2B</Key>
            </KeyStroke>
          </Output>
        </Axis>
        <Axis>
          <Enabled>true</Enabled>
          <Input>
            <ActionID>HIDMultiAxis_Rz</ActionID>
            <Min>-512</Min>
            <Max>0</Max>
            <Deadband>25</Deadband>
          </Input>
          <Output>
            <ActionID>KB_Keystroke</ActionID>
            <MaxEventRate>2.50</MaxEventRate>
            <Modifiers>
              <Modifier>Control</Modifier>
              <Modifier>Shift</Modifier>
            </Modifiers>
            <KeyStroke>
              <Key>2B</Key>
            </KeyStroke>
          </Output>
        </Axis>
Location of the file:
C:\Users\User\AppData\Roaming\3Dconnexion\3DxWare\Cfg

Open up the program you want to do the custom keys for and change a setting in 3Dconnexion so it creates the basic XML file for you and paste the above code in (under the part that says <ID>). Assuming there's no conflicts with whatever else you've set up.

If you don't know what the keys are called for the XML file, create a macro on a button and see the config file. Just note that if you use modifiers, make sure the order is like the code above, the order with the buttons is slightly different and it won't work when remapping the tilt controls (something like <Modifiers is under <KeyStroke> when doing it with the button).

Tips for the axis names:
jwick wrote: Mon Oct 05, 2020 7:01 am We use the HID conventions.
Rotations are about the translation axes.
In HID convention, X&Y are like a 2D mouse (along the top of the desk). Z is the additional direction (up/down perpendicular to the table).
Rx is rotatation like a motorcycle throttle (pitch).
Ry is rotatation like opening a door (roll).
Rz is rotatation like opening a jar of peanut butter (yaw).
You can also do the same trick as the keys but changing reversing the direction of the axis in the 3dconnexion software for a random application and then seeing the xml file.

I'm am curious what <Scale> does though.
jwick
Moderator
Moderator
Posts: 3331
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: Requesting Help to Ctrl+Tab and Ctrl+Shift+Tab on Twist

Post by jwick »

Good job figuring out a completely undocumented feature.
I'm happy you confirmed it still works. It doesn't get much exercise, so the joints tend to stiffen up.

<Scale> depends on where it is. It can be in a few places. E.g., it could be at a Global, Application, Device(?) or Axis/Output level.
It would generally multiple the default input to produce the output.
E.g., if an Axis Input generates 0, 350 a Scale of 2.0 would cause it to Output 0, 700.

I forget if it is used if you are Outputting KeyStrokes. I could imagine it being used to control the key repeat rate.
Yogi
Posts: 12
Joined: Wed Jun 29, 2022 4:39 am

Re: Requesting Help to Ctrl+Tab and Ctrl+Shift+Tab on Twist

Post by Yogi »

Thank you very much I'm quite proud because I was running into a few issues for a while, especially where a light tap and letting go would send it repeating super fast. Turns out I was using the min and max as sort of the minimum input required but it's much cleaner to use the deadband value for that - at least that's the only way I could get it without hitches. I was also using negative values for deadband on the negative axis at first but you don't need to.

It's not too hard when you get the basics down! You'll be customising every app - as long as there's keyboard shortcuts for the task.
This is also a link to a file which contains all the key codes so you don't have to keep making macros:
https://www.usb.org/sites/default/files ... 1_12v2.pdf

Here's my full code with some comments saying what it does in case it helps beginners. For the Modifier only on an axis without a key, just leave the <key> part blank but include it and add the <RepeatStyle> as shown below:

Code: Select all

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<AppCfg xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Default="false" CfgFormatVersion="1.3" ThisFileVersion="1.10">
  <AppInfo>
    <Signature>
      <Name>STR_FIREFOX</Name>
    </Signature>
    <Options />
  </AppInfo>
  <CfgProperties>
    <ID>ID_STR_FIREFOX</ID>
    <Name>STR_FIREFOX</Name>
    <InheritsFromID>ID_STR_FIREFOX</InheritsFromID>
  </CfgProperties>
  <Devices>
    <Device>
      <ID>ID_Standard_3D_Mouse</ID>
      <AxisBank>
        <Name>Default</Name>
        <ID>Default</ID>
        <Axis>
          <Enabled>true</Enabled>
          <Input>
            <ActionID>HIDMultiAxis_Rz</ActionID>  <!-- Ctrl + Tab <Next Tab> when Rotating CW -->
            <Min>0</Min>
            <Max>511</Max>
            <Deadband>64</Deadband>
          </Input>
          <Output>
            <ActionID>KB_Keystroke</ActionID>
            <MaxEventRate>2.50</MaxEventRate>
            <Modifiers>
              <Modifier>Control</Modifier>
            </Modifiers>
            <KeyStroke>
              <Key>2B</Key>
            </KeyStroke>
          </Output>
        </Axis>
        <Axis>
          <Enabled>true</Enabled>
          <Input>
            <ActionID>HIDMultiAxis_Rz</ActionID> <!-- Ctrl + Shift + Tab <Previous Tab> when Rotating ACW -->
            <Min>-512</Min>
            <Max>0</Max>
            <Deadband>64</Deadband>
          </Input>
          <Output>
            <ActionID>KB_Keystroke</ActionID>
            <MaxEventRate>2.50</MaxEventRate>
            <Modifiers>
              <Modifier>Control</Modifier>
              <Modifier>Shift</Modifier>
            </Modifiers>
            <KeyStroke>
              <Key>2B</Key>
            </KeyStroke>
          </Output>
        </Axis>
        <Axis>
          <Enabled>true</Enabled>
          <Input>
            <ActionID>HIDMultiAxis_Rx</ActionID> <!-- Reverse Scrolling -->
            <Min>-512</Min>
            <Max>511</Max>
          </Input>
          <Output>
            <ActionID>HIDMouse_Wheel</ActionID>
            <Reversed>true</Reversed>
          </Output>
        </Axis>
        <Axis>
          <Enabled>true</Enabled>
          <Input>
            <ActionID>HIDMultiAxis_Z</ActionID> <!-- Ctrl + 1 <Go to 1st Tab> when pushing Down -->
            <Min>0</Min>
            <Max>511</Max>
            <Deadband>200</Deadband>
          </Input>
          <Output>
            <ActionID>KB_Keystroke</ActionID>
            <MaxEventRate>0.50</MaxEventRate>
            <Modifiers>
              <Modifier>Control</Modifier>
            </Modifiers>
            <KeyStroke>
              <Key>1E</Key>
            </KeyStroke>
          </Output>
        </Axis>
        <Axis> 
          <Enabled>true</Enabled>
          <Input>
            <ActionID>HIDMultiAxis_Y</ActionID> <!-- ALT + R <Reset Zoom Charts> when pushing Forward -->
            <Min>-512</Min>
            <Max>0</Max>
            <Deadband>120</Deadband>
          </Input>
          <Output>
            <ActionID>KB_Keystroke</ActionID>
            <MaxEventRate>0.50</MaxEventRate>
            <Modifiers>
              <Modifier>Alt</Modifier>
            </Modifiers>
            <KeyStroke>
              <Key>15</Key>
            </KeyStroke>
          </Output>
        </Axis>
        <Axis>
          <Enabled>true</Enabled>
          <Input>
            <ActionID>HIDMultiAxis_Y</ActionID>  <!-- ALT when pulling Backward -->
            <Min>0</Min>
            <Max>511</Max>
            <Deadband>120</Deadband>
          </Input>
          <Output>
            <ActionID>KB_Keystroke</ActionID>
            <RepeatStyle>PressAndHold</RepeatStyle>
            <Modifiers>
              <Modifier>Alt</Modifier>
            </Modifiers>
            <KeyStroke>
		<Key></Key>
            </KeyStroke>
          </Output>
        </Axis>
        <Axis>
          <Enabled>true</Enabled>
          <Input>
            <ActionID>HIDMultiAxis_X</ActionID>  <!-- Ctrl + Shift + T <Undo Close Tab> when dragging Left -->
            <Min>-512</Min>
            <Max>0</Max>
            <Deadband>100</Deadband>
          </Input>
          <Output>
            <ActionID>KB_Keystroke</ActionID>
            <MaxEventRate>1.00</MaxEventRate>
            <Modifiers>
              <Modifier>Control</Modifier>
              <Modifier>Shift</Modifier>
            </Modifiers>
            <KeyStroke>
              <Key>17</Key>
            </KeyStroke>
          </Output>
        </Axis>
        <Axis>
          <Enabled>true</Enabled>
          <Input>
            <ActionID>HIDMultiAxis_X</ActionID> <!-- Ctrl + T <New Tab> when dragging Right -->
            <Min>0</Min>
            <Max>511</Max>
            <Deadband>100</Deadband>
          </Input>
          <Output>
            <ActionID>KB_Keystroke</ActionID>
            <MaxEventRate>1.00</MaxEventRate>
            <Modifiers>
              <Modifier>Control</Modifier>
            </Modifiers>
            <KeyStroke>
              <Key>17</Key>
            </KeyStroke>
          </Output>
        </Axis>
      </AxisBank>
      <AxisFilter>Dominant</AxisFilter>
    </Device>
    <Device>
      <ID>ID_ProductID_C62E</ID>
      <ButtonBank Default="true">
        <Name>STR_DEFAULT_BUTTONBANK</Name>
        <ID>Default</ID>
        <Button>
          <Input>
            <ActionID>HIDButton_1</ActionID>
          </Input>
          <Output>
            <ActionID>Macro_Firefox_Fullscreen</ActionID>
          </Output>
        </Button>
        <Button>
          <Input>
            <ActionID>HIDButton_2</ActionID>
          </Input>
          <Output>
            <ActionID>Macro_Firefox_CloseTab</ActionID>
          </Output>
        </Button>
      </ButtonBank>
    </Device>
  </Devices>
  <AuthorInfo>
    <DriverVersion>17.8.7.19322</DriverVersion>
    <LastChange>
      <Tool>3DxSmartUI.exe</Tool>
      <Version>1.2.22097.19277</Version>
      <Date>7/1/2022 12:19:41 AM UTC</Date>
      <User>yasir</User>
    </LastChange>
  </AuthorInfo>
</AppCfg>
Really glad I got it working as it's so ergonomic when working long hours on the computer - you can have it do what you want in each application with just little movements.

Also, I read about the rubber pealing so I wrapped a whole bunch of small rubber bands around the rubber part just to try and keep it in good shape, love this thing!

Thanks again for all your posts throughout the forum, jwick!
jwick
Moderator
Moderator
Posts: 3331
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: Requesting Help to Ctrl+Tab and Ctrl+Shift+Tab on Twist

Post by jwick »

It holds down the Modifier(s) even if there are no Keys? That's sort of clever.

I could see some uses for that.
E.g., multiple selections with the 2D mouse and not having to move your hand over to the kb.
Or an unintentional ctrl+alt+delete.

Good tip!
hotspur
Posts: 1
Joined: Fri Aug 05, 2022 10:17 am

Re: Requesting Help to Ctrl+Tab and Ctrl+Shift+Tab on Twist

Post by hotspur »

this is brilliant--got me almost all the way to where I'm trying to get.

I've used space mice for years in AEC industry, but I also enjoy video gaming and have been trying to get it working for things like RTS games, and Arma Editor, etc. This is mostly pretty simple--after searching around and digging through .cfg templates for examples and syntax, I've got most of what I need working. For reference, RTS is typically you controlling an army, from a high vantage point camera, so typically they have camera controls. Usually something that can be mapped to WASD for xy translation, a zoom and a rotate. Sometimes, like in Arma Editor, it's more like in a 3d modeller, so you have xyz, pitch and Rz.

I've got all the basics sorted and have moved onto my last hurdle--setting up axis with a modifier. Between this, and the other thread where jwick posted the .cfg info for mapping 2d mouse axes onto the 3d axes, I've got most of the components. What I can't figure out directly is the proper syntax. I want to set up Ry and Rz as 2d mouse movements, but with a modifier. This modifier would be holding down middle mouse button (I'd change this if I could, but the games I'm thinking of both use this convention and its not part of the keybinding). So scheme would be you tilt forwards or backwards (Ry) the device sends output of MMB(down) + HIDMouse_Y. I'm not sure how to write the middle mouse button part as a modifier, as I've only seen it in .cfg files as an <ActionID>. Is this possible, or does this fall under the "axes can't include macros" umbrella?

I know I can probably get this going with sx2joy and joystick gremlin, but I've got everything else working just with the 3dconnexion driver, so if I can, I'd love to keep it to a .cfg file.
Post Reply