vdmAPI/VDMAPI/Display/i3.py

20 lines
501 B
Python

from ..VDM import VDM
import subprocess
import i3
class i3(object):
"""display all vdm into i3 menu"""
def __init__(self):
super(i3, self).__init__()
self.v = VDM()
def render(self):
lstAllVDM = self.v.get()
dmenu = subprocess.Popen(['/usr/bin/dmenu', '-i','-l', str(len(lstAllVDM))],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE)
menu_str = '\n'.join(lstAllVDM)
win_str = dmenu.communicate(menu_str.encode('utf-8'))[0].decode('utf-8').rstrip()
print(win_str)