Last active
September 26, 2021 23:19
-
-
Save tonkoandrew/6da28ad58ee2a0371f8019142fb898c1 to your computer and use it in GitHub Desktop.
remove nag screen in sublimetext 3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Place this file in ~/.config/sublime-text-3/Packages/User/ | |
import sublime | |
import sublime_plugin | |
import subprocess | |
from time import sleep | |
import sys | |
cl = lambda line: subprocess.Popen(line, shell=True, stdout=subprocess.PIPE).communicate()[0].strip() | |
log = lambda message: sys.stderr.write("Log: %s\n" % message) | |
class LicenseWindowKiller(sublime_plugin.EventListener): | |
def run(self, edit): | |
pass | |
def seek_n_close(self): | |
# Get main winids and pid | |
out = cl("""wmctrl -Gpl | grep "Sublime Text (UNREGISTERED)" | awk '{print $1, $3}'""").splitlines() | |
out = [c.strip() for c in out] | |
for c in out: | |
win_id, pid = c.split() | |
pid = int(pid) | |
out_2 = cl("""wmctrl -Gpl | grep '{}' | grep -v '{}' | awk '{{print $1, $6, $7}}'""".format(pid, win_id)).decode().splitlines() | |
for c_2 in out_2: | |
w2_id, w, h = c_2.split() | |
w, h = int(w), int(h) | |
if (w, h) == (541, 179): | |
title = cl("""wmctrl -lp | grep {}| awk '{{print $5}}'""".format(w2_id)).decode() | |
if not title: | |
cl("wmctrl -i -c {}".format(w2_id)) | |
return True | |
return False | |
def on_pre_save_async(self, *args): | |
seek = True | |
counter = 10 | |
while seek: | |
sleep(.5) | |
counter -= 1 | |
if counter < 0: | |
seek = False | |
seek = not self.seek_n_close() |
it works only in linux with wmctrl
command available and 1920x1080 screen resolution. you can adjust it for your resolution (try to play with values in line 28)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is there anything else you need to do other than add this to the proper directory?