cutter icon indicating copy to clipboard operation
cutter copied to clipboard

Tab management using keyboard and mouse shortcuts

Open ITAYC0HEN opened this issue 5 years ago • 16 comments

Is your feature request related to a problem? Please describe.

Currently, there is no easy way to control the tabs in Cutter from the keyboard

Describe the solution you'd like

I want to apply a set of keyboard shortcuts to manage tabs in Cutter:

  • Ctrl+Tab - Jump to the next open tab
  • Ctrl+Shift+Tab -J ump to the previous open tab
  • Ctrl+W - Close the current tab
  • Ctrl+T - Duplicate current tab
  • Ctrl+Shift+T - Reopen previously closed tabs in the order they were closed

Mouse shortcut - Mouse middle click on a tab will close it

ITAYC0HEN avatar Sep 01 '19 11:09 ITAYC0HEN

Hello, I would like to pick up this issue if possible. Thanks.

0x24D avatar Sep 29 '19 10:09 0x24D

Sure thing! Go ahead :) Let us know how you progress and if you have any questions. You can discuss it with us here or on our Telegram or IRC channels.

ITAYC0HEN avatar Sep 29 '19 11:09 ITAYC0HEN

Hi, as a part of this issue I have made some changes to make it easier to develop using Docker. Shall I create a new issue for these changes or just create a separate pull request?

0x24D avatar Sep 30 '19 20:09 0x24D

Just create a separate pull request.

karliss avatar Sep 30 '19 22:09 karliss

@0x24D Your commits for docker look very good. Please open a separated Pull Request for it.

p.s don't forget to sign up for Hacktoberfest and get a neat T-shirt for your PRs :)

ITAYC0HEN avatar Oct 01 '19 13:10 ITAYC0HEN

Hey @0x24d :) do you have any progress yet? want us to have a look?

ITAYC0HEN avatar Oct 19 '19 11:10 ITAYC0HEN

I haven't really had much time to work on this after making the Docker changes. Am I correct in thinking it is the CutterDockWidget class where I should be catching the keyPress and mousePress events?

0x24D avatar Oct 26 '19 13:10 0x24D

Am I correct in thinking it is the CutterDockWidget class where I should be catching the keyPress and mousePress events?

For most of them probably yes. Reopening closed tab would better be done at global level.

karliss avatar Oct 26 '19 13:10 karliss

Okay, great. I was going to do the reopening closed tabs one last as I wasn't sure how it should be done.

0x24D avatar Oct 26 '19 13:10 0x24D

I have updated CutterDockWidget to catch the QKeyEvent on keyPress and keyRelease but in the respective methods event seems to be uninitialised, see: https://github.com/0x24D/cutter/commit/2072fb335b6f0810b162cb8b7847695f0b1688f8#diff-16c4d34007c0d4874105b8a5329706abR96-R97

After building Cutter, whenever I press a key with the dock widget in focus and line 97 uncommented, the program segfaults. I ran the program with Valgrind and it states that event is uninitialised. Any thoughts?

0x24D avatar Oct 30 '19 18:10 0x24D

Did you checked the callstack? Qt shouldn't be doing that. Maybe one of CutterDockWidget subclasses is calling parent method with incorrect argument.

Even if it didn't crash I don't think you should be handling keypress events in this situation manually but use QAction or QShortcut instead which already implement the logic for handling multikey shortcuts. Even more - when possible you should use methods that accept StandardKey like void QAction::setShortcuts(QKeySequence::StandardKey key) instead of specifying keys explicitly.

karliss avatar Oct 30 '19 20:10 karliss

Hi,

Apologies that this has taken as long as it has done. I have just finished implementing the first three keyboard shortcuts and would like some feedback on what I have done, what could be improved, etc.

Please find my changes here: https://github.com/radareorg/cutter/compare/master...0x24D:issue-1730-tab-management. Some of the changes are due to running AStyle.

I have currently got an issue with the 'jump to previous tab' shortcut, as the QAction shortcut is not being caught when pressed - although the other two shortcuts are fine.

0x24D avatar Apr 24 '20 16:04 0x24D

HEy 0x24d, thanks for the follow-up! I appreciate it highly.

Would you mind sending this as a work-in-progress PR? Also, it would be easier for us to reveiew before applying astyle

ITAYC0HEN avatar Apr 24 '20 17:04 ITAYC0HEN

Yes I can do. Do you want me to revert the AStyle commit first?

0x24D avatar Apr 24 '20 17:04 0x24D

yeah, please, this should be the final commit :)

ITAYC0HEN avatar Apr 24 '20 17:04 ITAYC0HEN

Bumping this issue, special thanks @0x24D for making working solution, I had to compile against it to make work with cutter easier. Can we revive this issue?

upd. unfortunately it stops working, when you get rid of all unnecessary windows from info section.

egoarka avatar Dec 27 '23 00:12 egoarka