[PYTHON] Implement features like window replacement on Ubuntu

Windows window change is too convenient

I started window change with ctrl + tab and switched to the specified window by inputting one character. http://www.vector.co.jp/soft/winnt/util/se431478.html

I want to make it available on ubuntu.

Using m-yamashita's Quick.py

--You can say goodbye to Alt + Tab on Linux! I made Quickey.py.

Scribble implementation

Create an appropriate script in Autokey and write as follows. Assign an appropriate shortcut key with autokey. I like ctrl + tab.

Please change the necessary parts as appropriate. The usage is the same as Quitck.py, but Tkinter is used to create a super-easy switcher window.

It accepts a single character input on the Tkinter window, and the window associated with it is activated or started, and if there is no corresponding key, it will end automatically.

Due to time constraints, I have no intention of making it at the moment.

# Enter script code
import Tkinter as tk
import threading
import subprocess

def onKeyPress(event):
    is_found = True
    # Regexp of window title or WM_CLASS.
    if event.char == "f":
        regexp = " - Firefox$"
        command = "firefox"
        options = "-a"
    elif event.char == "a":
        regexp = " Atom$"
        command = "atom"
        options = "-a"
    elif event.char == "e":
        regexp = " Eclipse$"
        command = "eclipse"
        options = "-a"
        is_found = False

    # Call the main routine(Don't change me!!).
    if is_found:
        subprocess.Popen('python ~/.config/autokey/quickey.py/quickey.py %s "%s" "%s"' % (options, regexp, command), shell=True)
        #subprocess.Popen(['python', '~/.config/autokey/quickey.py/quickey.py', options, regexp, command])

root = tk.Tk()
text = tk.Text(root, background='black', foreground='white', font=('Comic Sans MS', 12))
text.insert('end', 'a:Atom\n')
text.insert('end', 'e:Eclipse\n')
text.insert('end', 'f:Firefox\n')
root.bind('<KeyPress>', onKeyPress)


Recommended Posts

Implement features like window replacement on Ubuntu
Shebang on Ubuntu 20.04
Install TensorFlow on Ubuntu
Install PySide2 on Ubuntu
Install JModelica on Ubuntu
build Python on Ubuntu
Install Python 3.3 on Ubuntu 12.04
Installing pyenv on ubuntu 16.04
Install Theano on Ubuntu 12.04
Install angr on Ubuntu 18.04
Install pip / pip3 on Ubuntu