Giter VIP home page Giter VIP logo

ruby-wm's Introduction

ruby-wm

A very simple implementation of a tiling window manager for OS X, in MacRuby

This is something I hacked together fairly quickly, and it can be greatly improved. I primarily use this on a 27" screen, and usually only have 2-3 windows open at a time. It works reasonably well for this setup, but there are several problems that can occur due to the APIs used (Accessibility APIs).

  • Some windows have a lower bound on how small they can get. This messes up the current tiling procedures.

  • Occasionally windows will fail to resize completely. This can usually be fixed by telling it to tile again.

  • The windows will flash with focus as they are resized. This is a limitation in the API.

    rvm install macruby # if needed

    rvm use macruby

    macgem install bundler

    bundle install

You can run it from the command line with macruby start.rb. Note: You will need to have MacRuby and the "hotkeys" MacRuby gem installed.

  • Command + Option + V tiles with the "Tall" layout, which puts focused window on the left and the rest on the right.
  • Command + Option + B tiles with the "Full" layout, which minimizes all of the windows except the focused one, and maximizes the focused one.
  • Command + Option + Shift + X - saves the current layout
  • Command + Option + X - returns to the layout saved

Future work

Where to begin? I started investigating a way to reverse engineer the code that makes Mission Control work. It may be possible to use those hidden APIs to make something as functional as tiling WMs for X11. The code can be cleaned up substantially. It might also be possible to spark window resizes on their own threads to help speed up the tiling process, but I haven't tried this. There also need to be more layouts, and there is currently a bug with restoring windows that have been minimized.

ruby-wm's People

Contributors

dzoba avatar jgrimes avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

ruby-wm's Issues

Restoring Windows Without a Saved Position produces an error

2013-10-17 09:35:44.293 macruby[44195:707] An uncaught exception was raised
2013-10-17 09:35:44.294 macruby[44195:707] /Users/dzoba/other code/ruby-wm/layout.rb:28:in block': undefined methodtile' for nil:NilClass (NoMethodError)
from /Users/dzoba/.rvm/gems/ruby-1.9.2-p320/gems/hotkeys-0.1.2/lib/hotkeys.rb:56:in block' from /Users/dzoba/.rvm/gems/ruby-1.9.2-p320/gems/hotkeys-0.1.2/lib/hotkeys.rb:51:inhotkeyWasPressed'
from /Users/dzoba/other code/ruby-wm/start.rb:51:in start' from /Users/dzoba/other code/ruby-wm/start.rb:57:in

'
2013-10-17 09:35:44.301 macruby[44195:707](0 CoreFoundation 0x00007fff840cfb06 __exceptionPreprocess + 198
1 libobjc.A.dylib 0x00007fff85e263f0 objc_exception_throw + 43
2 libmacruby.dylib 0x000000010016d56e rb_vm_raise + 430
3 libmacruby.dylib 0x000000010004113c rb_exc_raise + 44
4 libmacruby.dylib 0x000000010016a5b2 rb_vm_method_missing + 562
5 libmacruby.dylib 0x00000001001561e4 rb_vm_dispatch + 7844
6 libmacruby.dylib 0x0000000100159450 rb_vm_respond_to2 + 736
7 libmacruby.dylib 0x0000000100154948 rb_vm_dispatch + 1544
8 ??? 0x0000000105a261d4 0x0 + 4389495252
9 ??? 0x0000000105a62794 0x0 + 4389742484
10 libmacruby.dylib 0x0000000100157859 rb_vm_block_eval + 1401
11 libmacruby.dylib 0x00000001001561e4 rb_vm_dispatch + 7844
12 ??? 0x0000000105a261d4 0x0 + 4389495252
13 ??? 0x0000000105a62b41 0x0 + 4389743425
14 libmacruby.dylib 0x0000000100158a77 rb_vm_yield_args + 1895
15 libmacruby.dylib 0x000000010010b5a8 rb_yield + 40
16 libmacruby.dylib 0x000000010001214d rary_reserve + 909
17 libmacruby.dylib 0x0000000100156744 rb_vm_dispatch + 9220
18 ??? 0x0000000105a261d4 0x0 + 4389495252
19 ??? 0x0000000105a58094 0x0 + 4389699732
20 shortcut.bundle 0x0000000100ef3bf2 myHotKeyHandler + 147
21 HIToolbox 0x00007fff8336bd1a _ZL23DispatchEventToHandlersP14EventTargetRecP14OpaqueEventRefP14HandlerCallRec + 1206
22 HIToolbox 0x00007fff8336b1e9 _ZL30SendEventToEventTargetInternalP14OpaqueEventRefP20OpaqueEventTargetRefP14HandlerCallRec + 410
23 HIToolbox 0x00007fff8336b046 SendEventToEventTargetWithOptions + 43
24 HIToolbox 0x00007fff833a0ebb _ZL29ToolboxEventDispatcherHandlerP25OpaqueEventHandlerCallRefP14OpaqueEventRefPv + 2678
25 HIToolbox 0x00007fff8336c0d1 _ZL23DispatchEventToHandlersP14EventTargetRecP14OpaqueEventRefP14HandlerCallRec + 2157
26 HIToolbox 0x00007fff8336b1e9 _ZL30SendEventToEventTargetInternalP14OpaqueEventRefP20OpaqueEventTargetRefP14HandlerCallRec + 410
27 HIToolbox 0x00007fff83380fc9 SendEventToEventTarget + 40
28 AppKit 0x00007fff882a199d -[NSApplication sendEvent:] + 6618
29 AppKit 0x00007fff881b721a -[NSApplication run] + 636
30 ??? 0x0000000105a5d3d4 0x0 + 4389721044
31 libmacruby.dylib 0x0000000100154e63 rb_vm_dispatch + 2851
32 ??? 0x0000000105a261d4 0x0 + 4389495252
33 ??? 0x0000000105a5bcac 0x0 + 4389715116
34 libmacruby.dylib 0x0000000100156744 rb_vm_dispatch + 9220
35 ??? 0x0000000105a261d4 0x0 + 4389495252
36 ??? 0x0000000105a252f8 0x0 + 4389491448
37 libmacruby.dylib 0x000000010016ed66 rb_vm_run + 470
38 libmacruby.dylib 0x0000000100041400 ruby_run_node + 80
39 macruby 0x0000000100000d28 main + 152
40 macruby 0x0000000100000c88 start + 52
41 ??? 0x0000000000000002 0x0 + 2)

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.