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

Add hs.tabs module #300

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
4 participants
@trishume
Contributor

trishume commented May 27, 2015

This module allows a certain kind of tabbing of the windows of any OSX app. I originally wrote it to tab Emacs frames but it might also be useful for other apps like Finder that don't have tabs but should.

Basically it organizes windows so that they are always all in the same position by listening to events. It then uses the drawing module to draw somewhat-nice looking tabs in the title bar with the window names when any window in the stack is focused.

It also exposes functions that allow for binding keys to switch between tabs and enumerate the tabbed windows and suchlike. It currently does not support clicking on the tab names since hs.drawing has no click event support.

screen shot 2015-04-19 at 5 51 11 pm

I've been using this module as a core part of my daily workflow for multiple weeks now so I'm fairly sure it holds up well. I think I've worked out all the bugs concerning apps crashing and restarting and so on.

@jhgg

This comment has been minimized.

Show comment
Hide comment
@jhgg

jhgg May 27, 2015

Contributor

Super cool.

On May 26, 2015, at 8:55 PM, Tristan Hume notifications@github.com wrote:

This module allows a certain kind of tabbing of the windows of any OSX app. I originally wrote it to tab Emacs frames but it might also be useful for other apps like Finder that don't have tabs but should.

Basically it organizes windows so that they are always all in the same position by listening to events. It then uses the drawing module to draw somewhat-nice looking tabs in the title bar with the window names when any window in the stack is focused.

It also exposes functions that allow for binding keys to switch between tabs and enumerate the tabbed windows and suchlike. It currently does not support clicking on the tab names since hs.drawing has no click event support.

I've been using this module as a core part of my daily workflow for multiple weeks now so I'm fairly sure it holds up well. I think I've worked out all the bugs concerning apps crashing and restarting and so on.

You can view, comment on, or merge this pull request online at:

#300

Commit Summary

Add tabs module
File Changes

A extensions/tabs/LICENSE (21)
A extensions/tabs/init.lua (196)
Patch Links:

https://github.com/Hammerspoon/hammerspoon/pull/300.patch
https://github.com/Hammerspoon/hammerspoon/pull/300.diff

Reply to this email directly or view it on GitHub.

Contributor

jhgg commented May 27, 2015

Super cool.

On May 26, 2015, at 8:55 PM, Tristan Hume notifications@github.com wrote:

This module allows a certain kind of tabbing of the windows of any OSX app. I originally wrote it to tab Emacs frames but it might also be useful for other apps like Finder that don't have tabs but should.

Basically it organizes windows so that they are always all in the same position by listening to events. It then uses the drawing module to draw somewhat-nice looking tabs in the title bar with the window names when any window in the stack is focused.

It also exposes functions that allow for binding keys to switch between tabs and enumerate the tabbed windows and suchlike. It currently does not support clicking on the tab names since hs.drawing has no click event support.

I've been using this module as a core part of my daily workflow for multiple weeks now so I'm fairly sure it holds up well. I think I've worked out all the bugs concerning apps crashing and restarting and so on.

You can view, comment on, or merge this pull request online at:

#300

Commit Summary

Add tabs module
File Changes

A extensions/tabs/LICENSE (21)
A extensions/tabs/init.lua (196)
Patch Links:

https://github.com/Hammerspoon/hammerspoon/pull/300.patch
https://github.com/Hammerspoon/hammerspoon/pull/300.diff

Reply to this email directly or view it on GitHub.

@oskarols

This comment has been minimized.

Show comment
Hide comment
@oskarols

oskarols May 27, 2015

Contributor

Nice!

(..) might also be useful for other apps like Finder that don't have tabs but should.

Finder actually has tabs in Yosemite; Command + T

It currently does not support clicking on the tab names since hs.drawing has no click event support.

If you really wanted to do this you could probably capture the mouse events via eventtap — return false from the event handler and let them pass through to other applications — and compare the clicked positions to the tabs and react accordingly.

Hmm.. I guess it's quite doable to actually create a generic onclick-handler for the drawings using that mechanism.

Contributor

oskarols commented May 27, 2015

Nice!

(..) might also be useful for other apps like Finder that don't have tabs but should.

Finder actually has tabs in Yosemite; Command + T

It currently does not support clicking on the tab names since hs.drawing has no click event support.

If you really wanted to do this you could probably capture the mouse events via eventtap — return false from the event handler and let them pass through to other applications — and compare the clicked positions to the tabs and react accordingly.

Hmm.. I guess it's quite doable to actually create a generic onclick-handler for the drawings using that mechanism.

@cmsj

This comment has been minimized.

Show comment
Hide comment
@cmsj

cmsj May 29, 2015

Member

@oskarols fwiw we have #269 to add proper click handlers to hs.drawing objects, which I suspect is probably a better way to go, than throwing eventtap into the mix.

Member

cmsj commented May 29, 2015

@oskarols fwiw we have #269 to add proper click handlers to hs.drawing objects, which I suspect is probably a better way to go, than throwing eventtap into the mix.

@trishume

This comment has been minimized.

Show comment
Hide comment
@trishume

trishume May 29, 2015

Contributor

Yah my Finder example was bad (I don't actually use finder at all). Clicking tabs would be nice when the functionality becomes built in but for now I don't think it is necessary. They are still useful as a visual indicator of which windows are in a stack so you can directly press a numbered key without for example having to wait for a hints GUI.

Also cc @JosephFerano since he was also looking into tabbing.

Contributor

trishume commented May 29, 2015

Yah my Finder example was bad (I don't actually use finder at all). Clicking tabs would be nice when the functionality becomes built in but for now I don't think it is necessary. They are still useful as a visual indicator of which windows are in a stack so you can directly press a numbered key without for example having to wait for a hints GUI.

Also cc @JosephFerano since he was also looking into tabbing.

@trishume

This comment has been minimized.

Show comment
Hide comment
@trishume

trishume Jun 12, 2015

Contributor

Is this good to be merged @cmsj? As I said I've tested it a bunch and it is super useful and works great.

Contributor

trishume commented Jun 12, 2015

Is this good to be merged @cmsj? As I said I've tested it a bunch and it is super useful and works great.

@cmsj

This comment has been minimized.

Show comment
Hide comment
@cmsj

cmsj Jun 12, 2015

Member

@trishume Sorry, I know it's taken me a while to get to the review, I think it should be good, I just need to do a deeper check over of the docs.

Member

cmsj commented Jun 12, 2015

@trishume Sorry, I know it's taken me a while to get to the review, I think it should be good, I just need to do a deeper check over of the docs.

@cmsj

This comment has been minimized.

Show comment
Hide comment
@cmsj

cmsj Jun 12, 2015

Member

I've made some slight tweaks to the docstrings and merged it into master. Thanks!

Member

cmsj commented Jun 12, 2015

I've made some slight tweaks to the docstrings and merged it into master. Thanks!

@cmsj cmsj closed this Jun 12, 2015

@cmsj

This comment has been minimized.

Show comment
Hide comment
@cmsj

cmsj Jun 13, 2015

Member

@trishume btw you might be interested in the recently added ability to add a click handler to hs.drawing objects. Will be in the next release :)

Member

cmsj commented Jun 13, 2015

@trishume btw you might be interested in the recently added ability to add a click handler to hs.drawing objects. Will be in the next release :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment