Skip to content

Commit

Permalink
Add check to ensure window class names are lowercase. #10
Browse files Browse the repository at this point in the history
  • Loading branch information
justbuchanan committed Aug 14, 2018
1 parent b619793 commit 14014e8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions autoname_workspaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@
DEFAULT_ICON = '*'


def ensure_window_icons_lowercase():
for cls in WINDOW_ICONS:
if cls != cls.lower():
raise ValueError(
"Keys in WINDOW_ICONS must be lowercase. Please fix '{}'.".
format(cls))


def icon_for_window(window):
# Try all window classes and use the first one we have an icon for
classes = xprop(window.window, 'WM_CLASS')
Expand Down Expand Up @@ -141,6 +149,8 @@ def on_exit(i3):
if __name__ == '__main__':
logging.basicConfig(level=logging.INFO)

ensure_window_icons_lowercase()

i3 = i3ipc.Connection()

# Exit gracefully when ctrl+c is pressed
Expand Down

0 comments on commit 14014e8

Please sign in to comment.