forked from SublimeText/LaTeXTools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtoggle_focus.py
More file actions
28 lines (22 loc) · 725 Bytes
/
toggle_focus.py
File metadata and controls
28 lines (22 loc) · 725 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# ST2/ST3 compat
from __future__ import print_function
import sublime
if sublime.version() < '3000':
# we are on ST2 and Python 2.X
_ST3 = False
else:
_ST3 = True
import sublime_plugin
# Toggle focus after jumping to PDF
class toggle_focusCommand(sublime_plugin.TextCommand):
def run(self, edit, **args):
s = sublime.load_settings("LaTeXTools.sublime-settings")
prefs_keep_focus = s.get("keep_focus", True)
if self.view.settings().get("keep focus",prefs_keep_focus):
self.view.settings().set("keep focus", False)
sublime.status_message("Focus PDF")
print ("Focus PDF")
else:
self.view.settings().set("keep focus", True)
sublime.status_message("Focus editor")
print ("Focus ST2")