Skip to content

Commit

Permalink
examples/winmenu: utf-8 encoding for Python 2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
ziberna committed Apr 19, 2012
1 parent 235e851 commit e7fd324
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/winmenu.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def i3clients():
workspace = workspace[0]
windows = i3.filter(workspace, nodes=[])
instances = {}
# Adds windows and their ids to a dictionary
# Adds windows and their ids to the clients dictionary
for window in windows:
win_str = '[%s] %s' % (workspace['name'], window['name'])
# Appends an instance number if other instances are present
Expand All @@ -45,7 +45,7 @@ def win_menu(clients, l=10):
stdout=subprocess.PIPE)
menu_str = '\n'.join(sorted(clients.keys()))
# Popen.communicate returns a tuple stdout, stderr
win_str = dmenu.communicate(menu_str.encode())[0].decode().strip()
win_str = dmenu.communicate(menu_str.encode('utf-8'))[0].decode().strip()
return clients.get(win_str, None)

if __name__ == '__main__':
Expand Down

0 comments on commit e7fd324

Please sign in to comment.