#!/usr/bin/python3 -u
from subprocess import run
import time
from i3ipc import Connection


def desktop_run(program) -> None:
    """ Run .desktop file by name """
    run(['dbus-launch', program], check=False, capture_output=False)


class Sway(Connection):
    def __init__(self):
        super().__init__()

    def run(self, command):
        self.command(' '.join(['exec'] + command))

    def focus(self, workspace):
        self.command(f'workspace number {workspace}')


def main():
    """ Main function """
    sway = Sway()
    sway.run([
        '/usr/bin/steam-runtime', '-nochatui', '-nofriendsui', '-silent'])
    sway.focus(3)
    sway.run(['telegram-desktop'])
    time.sleep(3)
    sway.run(['vesktop'])


if __name__ == "__main__":
    main()
