summaryrefslogtreecommitdiff
path: root/monitor-menu.py
diff options
context:
space:
mode:
Diffstat (limited to 'monitor-menu.py')
-rwxr-xr-xmonitor-menu.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/monitor-menu.py b/monitor-menu.py
index f810f9c..413b12d 100755
--- a/monitor-menu.py
+++ b/monitor-menu.py
@@ -19,6 +19,10 @@ import dialog
import docopt
+class NoMatchingProfile(ValueError):
+ pass
+
+
class MonitorMenu():
def __init__(self, config_file='~/.config/monitor-profiles.json'):
with open(expanduser(config_file)) as fh:
@@ -41,7 +45,10 @@ class MonitorMenu():
if code in (self.d.ESC, self.d.CANCEL):
return
- profile = self.profiles[int(profile_idx)]
+ try:
+ profile = self.profiles[int(profile_idx)]
+ except IndexError:
+ raise NoMatchingProfile from None
# We build the command line starting from just "xrandr" and adding
# arguments.