Quick script for editing Eos Qtile files

Requires PySimpleGUI from aur, then just set your favourite editor at the top.

#!/usr/bin/env python

import PySimpleGUI as sg
import os

sg.theme('DarkBlue')

Editor="emacsclient -c -s GUI "

layout = [[sg.Button("config", button_color=("white", "blue"), size=(13, 1), font=("Noto Sans Bold", 11))],
          [sg.Button("groups", button_color=("white", "green"), size=(13, 1), font=("Noto Sans Bold", 11))],
          [sg.Button("hooks", button_color=("white", "brown"), size=(13, 1), font=("Noto Sans Bold", 11))],
          [sg.Button("keys", button_color=("white", "orange"), size=(13, 1), font=("Noto Sans Bold", 11))],
          [sg.Button("layouts", button_color=("white", "purple"), size=(13, 1), font=("Noto Sans Bold", 11))],
          [sg.Button("mouse", button_color=("white", "grey"), size=(13, 1), font=("Noto Sans Bold", 11))],
          [sg.Button("screens", button_color=("white", "navy"), size=(13, 1), font=("Noto Sans Bold", 11))],
          [sg.Button("widgets", button_color=("black", "yellow"), size=(13, 1), font=("Noto Sans Bold", 11))],
          [sg.Button("autostart", button_color=("white", "darkgrey"), size=(13, 1), font=("Noto Sans Bold", 11))],
          [sg.Button("restart", button_color=("white", "black"), size=(13, 1), font=("Noto Sans Bold", 11))],
          [sg.Exit(button_color=("white", "DarkRed"), size=(13, 1),font=("Noto Sans Bold", 11))]]

# window = sg.Window("Button Bar", no_titlebar=True).Layout(layout)

# window = sg.Window("Button Bar", keep_on_top=True, location=(40,580), \
# no_titlebar=True).Layout(layout).Finalize()

window = sg.Window("Button Bar", location=(40, 400), alpha_channel=1,
                   keep_on_top=True, no_titlebar=True).Layout(layout).Finalize()

while True:
    event, values = window.Read()
    if event in (None, 'Exit'):
        break

    if event == 'config':
        os.system(Editor+"~/.config/qtile/"+event+".py&")

    if event == 'groups':
        os.system(Editor+"~/.config/qtile/modules/"+event+".py&")

    if event == 'hooks':
        os.system(Editor+"~/.config/qtile/modules/"+event+".py&")

    if event == 'keys':
        os.system(Editor+"~/.config/qtile/modules/"+event+".py&")

    if event == 'layouts':
        os.system(Editor+"~/.config/qtile/modules/"+event+".py&")

    if event == 'mouse':
        os.system(Editor+"~/.config/qtile/modules/"+event+".py&")

    if event == 'screens':
        os.system(Editor+"~/.config/qtile/modules/"+event+".py&")

    if event == 'widgets':
        os.system(Editor+"~/.config/qtile/modules/"+event+".py&")

    if event == 'autostart':
        os.system(Editor+"~/.config/qtile/"+event+".sh&")

    if event == 'restart':
        os.system("qtile cmd-obj -o cmd -f restart")

2 Likes