diff --git a/alacritty_config_gui.py b/alacritty_config_gui.py index b67cfb7..9c81b80 100644 --- a/alacritty_config_gui.py +++ b/alacritty_config_gui.py @@ -210,13 +210,20 @@ class KeyBindingDialog(QtWidgets.QDialog): self.mods.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection) self.layout.addRow(QtWidgets.QLabel('Mods'), self.mods) + self.tabs = QtWidgets.QTabWidget() + self.action = QtWidgets.QComboBox() for option in self.action_options: self.action.addItem(option) - self.layout.addRow(QtWidgets.QLabel('Action'), self.action) + self.tabs.addTab(self.action, 'Action') self.chars = QtWidgets.QLineEdit() - self.layout.addRow(QtWidgets.QLabel('Chars'), self.chars) + self.tabs.addTab(self.chars, 'Chars') + + self.command = QtWidgets.QLineEdit() + self.tabs.addTab(self.command, 'Command') + + self.layout.addWidget(self.tabs) buttons = QtWidgets.QDialogButtonBox() buttons.addButton(buttons.Ok) @@ -232,19 +239,23 @@ class KeyBindingDialog(QtWidgets.QDialog): # TODO: this is an ugly heuristic. should we parse yaml here? self.result['key'] = int(key) if key.isdigit() else key - action = self.action.currentText() - if action: - self.result['action'] = action - - chars = self.chars.text() - if chars: - self.result['chars'] = chars - mods = self.mods.selectedItems() - if len(mods): self.result['mods'] = '|'.join(mod.text() for mod in mods) + idx = self.tabs.currentIndex() + title = self.tabs.tabText(idx).lower() + + if title == 'action': + self.result['action'] = self.action.currentText() + elif title == 'chars': + self.result['chars'] = self.chars.text() + elif title == 'command': + command = self.command.text().split(' ') + self.result['command'] = { + 'program': command[0], 'args': command[1:] + } + self.accept()