Skip to content
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

Feature/43 not bringing sublime text 3 #54

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions rsub.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import tempfile
import socket

from threading import Thread
try:
import socketserver
Expand All @@ -20,6 +21,7 @@

SESSIONS = {}
server = None
WINDOW_HANDLE = 'sublime_text.sublime-text-2'


def say(msg):
Expand Down Expand Up @@ -85,6 +87,7 @@ def send_save(self):
self.socket.send(b"\n")

def on_done(self):
global WINDOW_HANDLE
# Create a secure temporary directory, both for privacy and to allow
# multiple files with the same basename to be edited at once without
# overwriting each other.
Expand Down Expand Up @@ -135,7 +138,7 @@ def on_done(self):
'tell app "Finder" to set frontmost of process "Sublime Text" to true')
elif(sublime.platform() == 'linux'):
import subprocess
subprocess.call("wmctrl -xa 'sublime_text.sublime-text-2'", shell=True)
subprocess.call("wmctrl -xa '%s'" % WINDOW_HANDLE, shell=True)


class ConnectionHandler(socketserver.BaseRequestHandler):
Expand Down Expand Up @@ -186,7 +189,9 @@ def on_close(self, view):


def plugin_loaded():
global SESSIONS, server
global SESSIONS, WINDOW_HANDLE, server

WINDOW_HANDLE = 'sublime_text.Sublime_text'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, plugin_loaded() is invoked for both Sublime 2 & 3. This will always overwrite WINDOW_HANDLE with "sublime_text.Sublime_text"?


# Load settings
settings = sublime.load_settings("rsub.sublime-settings")
Expand Down