stackline icon indicating copy to clipboard operation
stackline copied to clipboard

Show window title next to the indicator

Open Krever opened this issue 3 years ago • 6 comments

Hey, thanks a lot for the stackline, it's really useful.

In my setup I'm working with multiple windows of the same app (IntelliJ in my case) and navigating to the given one requires remembering the order of them (or browsing until you find what you look for).

It could be useful to show the titles next to the indicators. This would be quite intrusive so I was thinking of showing them only for a limited period of time since the last focus change.

I tried looking at the code myself but my lack of knowledge of both Lua and hammerspoon API made implementing it a real challenge.

Krever avatar Sep 09 '20 09:09 Krever

That's an awesome idea @Krever … something I've been thinking about too.

One of my use-cases for stackline is grouping browser tabs. The result is a stack of 4-5 chrome icons that all look the same. Personally, this hasn't been that disorienting (which is probably why I haven't done it yet) … but I can see how it could be a problem.

showing them only for a limited period of time since the last focus change.

Now THAT is brilliant! I had only thought of displaying them on hover … which isn't great because … mouse. This is a much better idea.

Would you expect the title to appear on the inside-side of the indicator, which would overlap parts of the active window?

A challenge I foresee with this is the need to filter window title text. Windows (especially browser windows) sometimes have ridiculous titles like:

Ridiculously long blog post title: 10 quick tricks on how to write awesome blog posts · Writing · Freelance · Other cool keyword · Search results for "how to write more gud"  – WriteBuddy is the BEST – writebuddy.com – YOU'RE THE 1,000th VISITOR! CLAIM YOUR PRIZE!

Sigh. :-) I guess the quick version can just truncate with ellipses after a reasonable number of characters, and get smarter about displaying only relevant parts of the window title in a future revision.

AdamWagner avatar Sep 10 '20 19:09 AdamWagner

Would you expect the title to appear on the inside-side of the indicator, which would overlap parts of the active window?

Yup, this sounds most intuitive.

Sigh. :-) I guess the quick version can just truncate with ellipses after a reasonable number of characters, and get smarter about displaying only relevant parts of the window title in a future revision.

That would be totally fine with me, especially if we could put the number of characters in the config.

Krever avatar Sep 11 '20 05:09 Krever

That would be totally fine with me, especially if we could put the number of characters in the config.

Cool! I hadn't thought of making truncateAt configurable. Very neat.

AdamWagner avatar Sep 18 '20 15:09 AdamWagner

Really thought I'd be able to work on this this weekend… but #32 was trickier than expected. I'd like to get that and #33 done first, but I'm looking forward to window titles!

AdamWagner avatar Sep 20 '20 12:09 AdamWagner

Note to self: Hammerspoon pro https://github.com/szymonkaliski implemented window title function like this:

--[[ make a descriptive title for a window
    params : window, length (int)
    returns : string
    combines the application title and, if it's different, the window title
    too. the whole thing will get truncated if it's too long ]]
function windowDescriptor(window, maxDescriptorLength)
    out = window:application():title()
    wt = window:title()

    if (wt ~= out) then out = out .. " / " .. wt end
    if (out:len() > maxDescriptorLength) then
        out = out:sub(0, maxDescriptorLength)
    end

    return out
end

from: https://github.com/szymonkaliski/dotfiles/blob/master/Dotfiles/hammerspoon/playground/cheaphints.lua

AdamWagner avatar Oct 15 '20 01:10 AdamWagner

@Krever Just wanted to give you an update on this. Here's a rough list of what I'm planning to work on:

  1. Add tests to improve reliability & enable faster iteration (see progress here)
  2. Address show-stopping bugs (#41, #44, #46, #47)
  3. Refactor to a component+event model (this may be required to truly complete number 2)
  4. Add enhancements (such as showing window title next to the indicator 😉️ )

AdamWagner avatar Nov 29 '20 04:11 AdamWagner