Skip to content

Instantly share code, notes, and snippets.

@egel
Last active June 5, 2026 15:13
Show Gist options
  • Select an option

  • Save egel/b7beba6f962110596660 to your computer and use it in GitHub Desktop.

Select an option

Save egel/b7beba6f962110596660 to your computer and use it in GitHub Desktop.
Auto-remove Sublime's license popup
#!/usr/bin/python
# -*- coding: utf-8 -*-
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)
sublimeMainWindowTitle = " - Sublime Text (UNREGISTERED)"
class LicenseWindowKiller(sublime_plugin.EventListener):
def seek_n_close(self):
sublimePid = int(cl("""wmctrl -lp | grep "%s" | awk '{print $3}'""" % sublimeMainWindowTitle).decode())
if sublimePid:
sublimeMainWindowId = cl("""wmctrl -lp | grep "%s" | awk '{print $1}'""" % sublimeMainWindowTitle).decode()
sublimeSecondWindowId = cl("""wmctrl -lp | grep %s | awk '{ids[$1]++}{for (id in ids){if (id != "%s"){printf id}}}'""" % (sublimePid, sublimeMainWindowId)).decode()
if sublimeSecondWindowId:
sublimeSecondWindowTitle = cl("""wmctrl -lp | grep %s | awk '{print $5}'""" % sublimeSecondWindowId).decode()
if not sublimeSecondWindowTitle:
cl("wmctrl -i -c %s" % sublimeSecondWindowId)
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()
@SudhanshuBlaze

Copy link
Copy Markdown

@aliazhar-id not working I'm on macOS, if you get any solution please help

@xaliazhar

Copy link
Copy Markdown

@SudhanshuBlaze sorry I don't know, now I've moved to visual studio code.

@flora-le

flora-le commented Jul 7, 2022

Copy link
Copy Markdown

As others said, there is a code that prevents the pop up to show, but also prevents any pop up to show (tried to delete a folder, i couldn't because it was always closing). It was the code here that closes everything and i can't do anything

@kassbohm

Copy link
Copy Markdown

Thanks egel, but at the moment it's working in Linux - maybe because of this error:

killer.py", line 17, in seek_n_close sublimePid = int(cl("""wmctrl -lp | grep "%s" | awk '{print $3}'""" % sublimeMainWindowTitle).decode()) ValueError: invalid literal for int() with base 10: '741430\n741430'

@vhbui02

vhbui02 commented Apr 19, 2023

Copy link
Copy Markdown

I'm having the same error like @kassbohm had, have anybody figured out yet?

 line 17, in seek_n_close
    sublimePid = int(cl("""wmctrl -lp | grep "%s" | awk '{print $3}'""" % sublimeMainWindowTitle).decode())
ValueError: invalid literal for int() with base 10: ''

@DinleyH

DinleyH commented Aug 18, 2023

Copy link
Copy Markdown

Here is a working windows version: it works by closing the dialog box the moment it appears. its instant more or less, I never see the box anymore.

Windowkill.py

`import sublime_plugin
import ctypes
import time

TARGET_CLASS_NAME = "#32770"

class DialogBoxKiller(sublime_plugin.EventListener):

def close_dialog_boxes(self):
    EnumWindowsProc = ctypes.WINFUNCTYPE(ctypes.c_bool, ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int))
    
    def get_window_class_name(hwnd):
        buff = ctypes.create_unicode_buffer(256)  # Assuming class name won't be longer than 256 characters
        ctypes.windll.user32.GetClassNameW(hwnd, buff, len(buff))
        return buff.value
    
    def enum_windows_callback(hwnd, lparam):
        class_name = get_window_class_name(hwnd)
        if class_name == TARGET_CLASS_NAME:
            ctypes.windll.user32.SendMessageW(hwnd, 0x0010, 0, 0)  # 0x0010 is WM_CLOSE
        return True

    ctypes.windll.user32.EnumWindows(EnumWindowsProc(enum_windows_callback), 0)
    
def on_pre_save_async(self, *args):
    time.sleep(0.1)  # Brief delay to ensure dialog has time to appear if it does
    self.close_dialog_boxes()

`

FYI this also works with SFTP.

@DinleyH

DinleyH commented Aug 18, 2023

Copy link
Copy Markdown

For a working windows version and instructions on how to install sublime plugins:

https://gist.github.com/DinleyH/e222834ddb3533d59fd7cafccf612f07

@megvadulthangya

megvadulthangya commented Aug 14, 2024

Copy link
Copy Markdown

Hi guyz! This thing removes that UNREGISTERED Annoying bullcrapp? I dont know how to use this script, no stubid proof readme or howto do this i find for it...? Is it possibru to someone guide me where to find, and what to search to work this out?

Or suggest me pls alternatives?

Code, or VSCodium? Or what should be annoyance free? And know functions what Sublime text knows?

I think this shaming thing with UNREGISTERED is distgusting... need to puke

@Argus-Khan

Copy link
Copy Markdown

You guys can look into this thread for a simpler one line solution, it works with the latest build:

https://gist.github.com/skoqaq/3f3e8f28e23c881143cef9cf49d821ff

@christophersalem

Copy link
Copy Markdown

Argus-Khan, thank you this worked for me!

@yashwant938

Copy link
Copy Markdown

@Argus-Khan it works for me thnx

@luisvalenzuelar

Copy link
Copy Markdown

@Argus-Khan it works for me thnx

Link is dead but can be found here.

One liner is below but does not work in Ubuntu 26.04 build 4200

sudo perl -pi -e 's/\x80\x79\x05\x00\x0F\x94\xC2/\xC6\x41\x05\x01\xB2\x00\x90/' /opt/sublime_text/sublime_text

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment