Skip to content

mskv/sublime-sidebar-on-hover

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Sublime Sidebar On Hover

Sublime Text plugin that reveals the sidebar when mouse hovers over the left side of the window and hides it when mouse wanders away from it

Platform support

Currently it only works for Sublime Text 3 on OS X. Tested on Sublime Text 3 build 3103, OS X El Capitan 10.11.2.

How it works

The Python script starts a process that tracks the mouse position. The information is returned through standard output and handled by the script. I have only implemented the mouse tracker for OS X using Core Graphics framework and Accessibility API. Porting the plugin to Windows and Linux would require implementing separate mouse trackers for those platforms.

Installation & Settings

  1. Clone the git repository to Sublime Text package directory

    git clone https://github.com/mskv/sublime-sidebar-on-hover.git ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/SidebarOnHover
    
  2. Cd into it

    cd ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/SidebarOnHover
    
  3. Compile the mouse tracker

    clang mouse_tracker.m -framework Cocoa -o MouseTracker
    
  4. Run Sublime Text 3. You will probably be asked to enable Accessibility for Sublime Text. Do it.

  5. Add two entries to your settings (Sublime Text -> Preferences -> Settings - User):

    • "sidebar_on_hover_left_margin": 30 - determines the distance from the left edge of the window; when mouse moves to the left of it, the sidebar is opened; feel free to change this value

    • "sidebar_on_hover_right_margin": 275 - determines the distance from the left edge of the window; when mouse moves to the right of it, the sidebar is closed; feel free to change this value

    You can also disable the plugin using:

    • "sidebar_on_hover_disabled": true
  6. Restart the editor (you have to quit the whole application, not only close all the windows). It should be working now...

TODO, bugs and issues

  • TODO: Refactor - it's bad

  • Bug: The plugin freaks out when you open a single file with Sublime Text instead of a whole directory. The sidebar is unavailable by desing in that situation. But the plugin doesn't know it. It can't discern whether a project or a single file is opened and still tries to toggle the sidebar when moving the mouse. It seems harmless, but it does mess with the logic and can lead to a situation, when new window's behaviour is reversed - when you hover on the left it closes the sidebar and on the right it opens the sidebar. A quick fix is to manually toggle the sidebar at this point.

  • Bug: Usually when you quit Sublime Text the mouse tracking process is terminated properly. But not always, especially if you quit Sublime Text shortly after opening it, so sometimes you can end up with an orphaned process.

  • Feature: How to handle opening the sidebar manually? Suspend the plugin? I don't know.

About

NOT MAINTAINED - Sublime Text plugin that reveals the sidebar when mouse hovers over the left side of the window and hides it when mouse wanders away from it

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published