p0deje / Maccy

Lightweight clipboard manager for macOS
https://maccy.app
MIT License
11.83k stars 508 forks source link

Limit the size of the popup but leave older items #229

Open thysm00 opened 3 years ago

thysm00 commented 3 years ago

I know i can limit the number of items in the list manually, but when i do that, i can no longer access them unless i search for them (which means i remember what they contained). I've seen that in other apps, but wouldn't it be possible to have a submenu under the list the show the rest of the items that Maccy remembers? This way, the menu stays small for most usage but when you need to find an older item, you can still do it even if you don't remember precisely what it was.

p0deje commented 3 years ago

How would you find the item if you don't remember what it was? If you remember at least a part of the text, this should be enough, shouldn't it?

thysm00 commented 3 years ago

Well, if it's for example a phone number, a name or email, a serial number (i sell softwares), it's usually impossible to remember any part of it. I've been using clipmenu for years, and it happened to me hundreds of times to have to copy something i did not remember.

thysm00 commented 3 years ago

That's why being able to go through the whole list is important even if and i agree, searching through them is good. The other reason why submenus could be useful is that you still get a small popup but it can contain many items.

allomorphy commented 3 years ago

My 2c: I find it useful to have an arbitrary tag for pinned entries. I have tons of pinned entries for things like URLs of public facing documentation, contracts, registration and bank account numbers. What I do now, is put save some text in UPPERCASE: Works super for searching, typically I just use the keyboard and do not even look an my MANUAL: url is pasted. (Problem is that I have to delete the tag preceding a URL when I paste into a browser, that could be solved by a tag that is not by default pasted)

-- one day all computers will be made this way 🤔 Thanks Alex for this master-work 😊

sveggiani commented 3 years ago

I second @thysm00's request. I think having the last X items displayed and the rest of them under a submenu would be nice to un-clutter the main menu. I love how ClipMenu handles this:

image

image

p0deje commented 3 years ago

I think I've found a way to show a smaller popup and then the rest could be scrolled. It will look like this:

Screen Shot 2021-07-02 at 12 50 33

Would that work for your case?

thysm00 commented 3 years ago

Yes, that would definitely work for me! And would indeed be even better than the sub menus!

sveggiani commented 3 years ago

@p0deje I think the scrollable would work and solve the inconvenience of having a very long list of items.

borekb commented 3 years ago

Another use case is having a weird Unicode character in the history, like a middle dot or something – that cannot be easily searched for.

Scrolling as shown above looks like a great solution! 👍

kerryj89 commented 2 years ago

I was going to suggest this but I am happy to see the author came to the same conclusion.

p0deje commented 2 years ago

There are a lot of edge cases when trying to force menu height using confinementRect(for:on:):

  1. It seems like it's completely ignored when showing a popup by clicking on the menu icon.
  2. It works on the main display, but doesn't on the secondary.
  3. The direction of the popup needs to be handled manually (e.g. it should draw below the cursor by default, but when the cursor is at the bottom of the screen - it should draw above the cursor).
  4. Similar to previous, the popup should offset to the left when part of the menu is wider than the screen (e.g. popup when the cursor is near the right edge of the screen).

The dummy reference implementation which limits height to 250px is done by add this to Menu.swift:


  func confinementRect(for menu: NSMenu, on screen: NSScreen?) -> NSRect {
    var x: CGFloat = 0
    var y: CGFloat = 0

    switch UserDefaults.standard.popupPosition {
    case "center":
      if let screen = screen {
        let topLeftX = (screen.visibleFrame.width - menu.size.width) / 2 + screen.visibleFrame.origin.x
        var topLeftY = (screen.visibleFrame.height + menu.size.height) / 2 + screen.visibleFrame.origin.y
        if screen.visibleFrame.height < menu.size.height {
          topLeftY = screen.visibleFrame.origin.y
        }

        x = topLeftX + 1
        y = topLeftY + 1
      }
    default:
      x = NSEvent.mouseLocation.x
      y = NSEvent.mouseLocation.y
    }

    return NSRect(x: x, y: y - CGFloat(250) - 1, width: menu.size.width, height: 250)
  }

Given the existing problems, I'm not sure if I find a way to make it work reliably.

juarezr commented 1 year ago

An alternative approach could be:

robert-d-94 commented 1 year ago

@p0deje Has there been any progress in implementing this feature? I would love to be able to limit the height of the popup to 20 items, but be able to scroll through my entire history.

p0deje commented 1 year ago

Nothing new since my last comment. On Aug 18, 2023, at 14:16, robert-d-94 @.***> wrote: @p0deje Has there been any progress in implementing this feature? I would love to be able to limit the height of the popup to 20 items, but be able to scroll through my entire history.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

itdhsc commented 6 months ago

This would be awesome!

chenxiccc commented 5 months ago

I think I've found a way to show a smaller popup and then the rest could be scrolled. It will look like this: Screen Shot 2021-07-02 at 12 50 33

Would that work for your case?

This is a very good solution! But i found only at the botton of the screen, this type of popup will function, is it possible to limit all popup height anywhere it appears?