Not sure if something like this is even worth releasing as an official package, but I was playing around with this idea and thought I’d share.
The idea:
- Hide sidebar when mouse is in text view (hover event).
- Show sidebar when mouse hovers over gutter.
"""AutoSideBar."""
import sublime
import sublime_plugin
class AutoSideBarListener(sublime_plugin.EventListener):
"""Listener that auto hides/shows the sidebar."""
def on_hover(self, view, point, hover_zone):
"""
Hide/Show sidebar on hover event.
If hovering over the main view, keep the sidebar hidden.
If hovering over the gutter, show the sidebar.
Events like "reveal file" in sidebar will usually show the sidebar on their own.
"""
win = view.window()
if win is not None:
sidebar_visible = win.is_sidebar_visible()
if sidebar_visible is False and hover_zone == sublime.HOVER_GUTTER:
win.run_command('toggle_side_bar')
elif sidebar_visible is True and hover_zone != sublime.HOVER_GUTTER:
win.run_command('toggle_side_bar')
I just threw this together. Feel free to use it if you like it .
EDIT: I should note this is for Sublime Text 3116+.