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

Shortcut discoverability should be improved in GT #4273

Open
botwhytho opened this issue Jan 18, 2025 · 0 comments
Open

Shortcut discoverability should be improved in GT #4273

botwhytho opened this issue Jan 18, 2025 · 0 comments

Comments

@botwhytho
Copy link

A proposed solution below. Anything like this functionality would help people with learning shortcuts. Using this in my image I learned about many shortcuts I didn't even know about like adding a Breakpoint (that one can be added through a context menu as well but doesn't apply to most keyboard shortcuts).

addShortcutsHelperShortcut
	| rootElement shortcut |
	rootElement := (GtWorld spaceWithId: GtWorld defaultId do: #yourself) root.
	shortcut := BlShortcutWithAction new
			name: 'Show List of Keyboard Shortcuts';
			description: 'Show list of keyboard shortcuts in the currently focused element';
			combination: (BlKeyCombinationBuilder new primary key: BlKeyboardKey slash) build;
			action: [ :aBlShortcutEvent :aBlShortcutWithAction | 
				| focused pager shortcuts |
				focused := rootElement deepestFocusedChild ifNil: [ rootElement ].
				pager := focused
						withAllParentsDetect: [ :each | each isKindOf: GtPager ]
						ifFound: #yourself
						ifNone: [ nil ].
				shortcuts := focused gtShortcutsFor: GtPhlowEmptyView new.
				pager
					ifNil: [ GtInspector openOn: shortcuts from: rootElement ]
					ifNotNil: [ focused phlow spawnObject: shortcuts ] ].
	rootElement addShortcut: shortcut

Above is an MVP, this could show up as a context menu or in some other way.

The primary + slash in an american QWERTY keyboard is the same key as the question mark. I've seen other software show keyboard shortcut help when typing Shift + ?, so trying to resemble that but using primary so as to not type / or ? if in an editor. Open to other keyboard shortcuts but this is close to one I have already seen in other places so maybe others already have the notion/muscle memory that such a shortcut would have a similar action in GT.

I've tested this and works as expected in coders, pharo snippets, text snippets, from the spotter, etc.

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

No branches or pull requests

1 participant