Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds button shortcut for up to 4 tabs #1

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

javl
Copy link

@javl javl commented May 1, 2019

Great project! I think this could be quite useful to navigate all of my open tabs.

I've added some functionality that I thought would be useful. It adds the option to attach four buttons which can be used to jump to specific tabs. Long-pressing a button assigns the currently open tab to the button, after which a short press jumps back to that tab.
For example: when working on a website you can assign one button to the work in process site and one to the reference of the framework you're using.

Also, long pressing the encoder button will reopen the most recently closed tab.

note: originally I used a 'program' button (press program button, then press one of the tab buttons to assign), which I then replaced with the short/long press system in the last commit.

Changes:

  1. I've moved the .ino file into a subfolder with the same name, so you can open the file directly in the Arduino IDE (which seems so need that structure)
  2. I added four buttons to the firmware, attached between GND and pins 8, 9, 10 and 11 (using the build in pullup resistor). Depending on how long you press them for they'll send 'btn-1-short', 'btn-1-long', etc. The encoder also sends 'click-short' and 'click-long'. The JS part can now store and retrieve tab IDs using those buttons
  3. Added the sessions permission so we're able to reopen a closed tab / window

Things to improve:

  1. Would be nice to combine the long/short system with the debouncer.
  2. Currently the functions are triggered when you release the button: release > check how long the button was pressed for > respond. It might be nicer to add some way of responding to long presses while still pressing down.
  3. I might add some LEDs to the buttons to show which ones are in use.

btns

javl added 5 commits May 1, 2019 10:25
This way you can open the file straight into the Arduino IDE (which
wants you to place the .ino file in a folder with the same name
Pressing the store button, followed by one of the tab buttons, will
store the tab under that button. Pressing the tab button again will jump
directly to that tab.
Long press a tab button to assign a tab, long press encoder button to
reopen the most recently closed tab
@tachiniererin
Copy link
Owner

Just a minor nitpick: the checking for the command, now that there are so many, would probably be better done with a switch statement for cleanliness. Otherwise this looks awesome!

@javl
Copy link
Author

javl commented May 2, 2019

Yeah, I think there is a lot of room for improvement there. Also in the way the short and long press is detected (as mentioned in the pull request).
Later I also realized you can also easily map some random keyboard keys to control jumping straight to tabs (like using F10, F11, F12), but a small dedicated device is way more fun of course ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants