Coder Social home page Coder Social logo

Comments (18)

kiichi avatar kiichi commented on May 28, 2024 1

I submitted, I kept the previous copy in Alt+Shift+Z, those shortcuts will be configurable via settings screen soon.

Here is the list of current settings


Copy Rich Text:
- Windows: Alt+Shift+C
- Mac: Ctrl+Shift+C

Copy Markdown:
- Windows: Alt+Shift+D
- Mac: Ctrl+Shift+D

Copy Title - URL:
- Windows: Alt+Shift+X
- Mac: Ctrl+Shift+X

Repeat previous copy format:
- Windows: Alt+Shift+Z
- Mac: Ctrl+Shift+Z

from quickcopytitleandurl.

tomnielsen avatar tomnielsen commented on May 28, 2024

Chrome supports "activating" extension using: chrome://extensions/shortcuts (found via the hamburger menu in the upper left of the Extensions page chrome://extensions)

Then I guess when the popup window is active, you can try to capture keyboard shortcuts using javascript in the extensions popup page.

This post is a bit of overkill but does hotkey handling:
https://medium.com/better-programming/full-featured-hotkeys-library-in-200-lines-of-javascript-code-81a74e3138cc

from quickcopytitleandurl.

kiichi avatar kiichi commented on May 28, 2024

Thank you for your feedback, I'll look into those hotkeys features!

from quickcopytitleandurl.

kiichi avatar kiichi commented on May 28, 2024

It seems they already have out-of-box API here, and those shortcut keys are available

chrome.commands - Google Chrome

from quickcopytitleandurl.

kiichi avatar kiichi commented on May 28, 2024

I got hot-key working, Command+Shift+C is bringing debug console so I'm thinking using Command+Shift+P. I also figured I needed reload chrome extension for testing, some voodoo reloading stuff. It's impossible to popup menu programmatically without user interaction. This make sense, all playing sound API, etc... requires the user to click on the screen first. Only the way is to popup modal window or new tab, which defeats the purpose of this plugin to copy Title.

One solution is using Notification as if it's like Toastr message, but it could be annoying if it's not transparent. Instead, I'm thinking "Remember the last selection" and Ctrl+Shift+P to repeat the previous action.

from quickcopytitleandurl.

kiichi avatar kiichi commented on May 28, 2024

A few updates on this PR #14

First of all, Chrome doesn't allow popup something without user interaction using mouse. This is common security feature and I saw similar behavior for auto-playing sound and so on. So I decided to implement HotKey / Shortcuts based on previous selection. This should serve most of use case. For example, you are editing Markdown, you might be keep adding links in Markdown format.

Current candidates for shortcuts:

Windows: Alt+Shift+C
Mac: Ctrl+Shift+C (Alt key is not translated in Mac? Option Key didn't load somehow)

notification

idea__keyboard_shortcuts_for_copycat_ยท_Issue__11_ยท_kiichi_QuickCopyTitleAndURL

Demo

from quickcopytitleandurl.

kiichi avatar kiichi commented on May 28, 2024

Ok here is the updated shortcut key features in v1.5.0

Quick Copy (Use previously selected format)
- Windows: Alt+Shift+C (Single Tab) / Alt+Shift+A (All Tabs)
- Mac: Ctrl+Shift+C (Single Tab) / Ctrl+Shift+A (All Tabs)

from quickcopytitleandurl.

jeske avatar jeske commented on May 28, 2024

awsome! I'm looking forward to trying it out!

from quickcopytitleandurl.

jeske avatar jeske commented on May 28, 2024

Ohh, I just read your notes about "using the last selection" for the hotkey... I can't speak for other users, but this mystery-context-sensitivty is not going to work for me.

I'm about 60% Rich Text, 39% Markdown, 1% others. And I most frequently only grab one link per compose session. (80% of sessions are only 1 link) I'm not going to remember "which format I used last", so because of this "use last model" I'm still always going to have to use the menu.

I would prefer other models, like:

  • hit the hotkey multiple times in a row to cycle through the types... but in a fixed order.. (i.e. hit hotkey 4 times to get rich text)
  • ...or let me re-order the menu so I can put Rich Text first, and Markdown Second.
  • let me choose one type to hotkey (I would do Rich Text)
  • let me click to open the menu and then use numbers to just speed up picking the type... so I would click on the addon to open the popup, then hit "4"... which would be much faster

from quickcopytitleandurl.

kiichi avatar kiichi commented on May 28, 2024

@jeske
I hear you, I'm going to implement settings soon. I can reserve max 4 shortcuts and I'll make them customizable.

For now, how about those 4 keys

  • Alt+Shift+C (Default: Repeat Previous Format)
  • Alt+Shift+A (Default: Repeat Previous Format for All Tabs) ... probably I'll drop this.. When we use "Copy All Tabs" probably we should do this from dropdown menu.
  • Alt+Shift+R (Default: Rich Text)
  • Alt+Shift+M (Default: Markdown)

Let me add Rich Text and Markdown today, I'm updating one more version for the context menu, and this should help you for quick solution before working on the setting screen. I think it's better than cycle since you can hit in one-stroke (Alt+Shift+R or Alt+Shift+M). I also agree that I often use those 2 items.

Yeah, I was thinking re-order menu items too, I added it in my todo list. Feature Requests
I'll research about capturing key while popup is open. I'm expecting Chrome Extension can do same key event handling like regular browser window.

from quickcopytitleandurl.

kiichi avatar kiichi commented on May 28, 2024

Btw, I just put those shortcuts and in this early stage, I don't mind changing those default shortcut keys (I don't think other users will complain either). Does Alt+Shift+M is bad choice for you since I am forcing you to use both hands?

  • Alt+Shift - left hand
  • M - right hand

It's easy to remember, and my workflow is usually copy into chat tools after Alt+Tab then past it.

from quickcopytitleandurl.

jeske avatar jeske commented on May 28, 2024

ALT-SHIFT-R shortcut seems good.

No, I don't think I'd use two handed shortcuts like alt-shift-M. My most common use of this is with gmail (or github). Typically I go into another browser window, either to find an existing tab, or search the web for a page I already knew about, mouse-copycat to grab link, mouse-click directly back into the composer insertion point (I'm usually on a desktop dual monitor setup with lots of space for windows), then control-V to paste.

Here are some more thoughts on this topic...

I would remove the "repeat last" concept entirely. The problem is, the last time a user used copycat could be hours or even days ago. How would they remember and know what repeat-last is even going to do? Repeat-last is more something used to repeat something complex a bunch of times quickly, like in emacs, where I record a weird complex sequence of editing actions, and then spam repeat-last 15 times to do the same thing on a bunch of successive lines. In this case i's more like "repeat the thing I did in the last ~30 seconds, otherwise do nothing".

I would drop the all-tabs shortcuts, and certainly not make them default, because this doesn't seem like a common use case. I've never used the feature at all, even from the menu. Is this something you use?

If it was me, I would setup 2-3 shortcuts for the most commonly used options, and defer anything else for when there is a settings page. Something like:

  • alt-shift-C (rich text)
  • alt-shift-D (markdown)
  • alt-shift-X (Title - URL) (maybe?)

from quickcopytitleandurl.

kiichi avatar kiichi commented on May 28, 2024

ok make sense, let me put those 4 keys and I'll set default actions.

from quickcopytitleandurl.

jeske avatar jeske commented on May 28, 2024

sounds great!

from quickcopytitleandurl.

kiichi avatar kiichi commented on May 28, 2024

OK it's published. Please try now.

from quickcopytitleandurl.

jeske avatar jeske commented on May 28, 2024

unfortunately, the shortcuts are not working for me in the new version on windows 10. I'll load it unpacked and see if I can figure out what's going on.

from quickcopytitleandurl.

jeske avatar jeske commented on May 28, 2024

I guess the alt-shift-C shortcut isn't available by default on windows?

I went into chrome://extensions/shortcuts and it was empty... However, after assigning it, there, it works great!

image

from quickcopytitleandurl.

jeske avatar jeske commented on May 28, 2024

As another note.... it has a shortcut called "Activate the Extension" which activates the popup. I wonder if this can be used to do the original idea, of having a shortcut to activate the extension, and then a number key for the type of the copy.

from quickcopytitleandurl.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.