Skip to content

Commit

Permalink
Merge branch 'feature-command'
Browse files Browse the repository at this point in the history
  • Loading branch information
zocker-160 committed Jun 25, 2022
2 parents d248804 + 6926b15 commit 110bcac
Show file tree
Hide file tree
Showing 19 changed files with 1,397 additions and 928 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
*.code-workspace

__pycache*
.qt_*

.vscode
venv
Expand Down
16 changes: 7 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ Keyboard Center is an application attempting to create an easy way for users to
## Features

- [x] Mapping of keys, combos and macros
- [x] Ability to map commands to keys
- [x] Ablity to add delays to macros
- [x] libhidraw backend and libusb as backup if needed
- [X] Support for switching LEDs of profile keys
- [ ] Import and export of the configuration
- [ ] Profiles for specific applications *(currently impossible on wayland)*
- [x] libhidraw backend ~and libusb as backup if needed~ (libusb only < 0.2.0)
- [x] Support for switching LEDs of profile keys
- [x] Import and export of the configuration (added ability to open configuration folder instead)
- [x] openRGB integration - linking of macro profiles with openRGB profiles
- [ ] Profiles for specific applications *(currently impossible on wayland)*

## Supported Keyboards

Expand Down Expand Up @@ -50,14 +51,11 @@ available in the AUR: [[AUR] keyboard-center](https://aur.archlinux.org/packages

![OpenRGBkeyboardcenter](images/OpenRGBkeyboardc.png)

**note:** if you install OpenRGB after Keyboard Center, you will need to restart the background service.
**note:** if you install OpenRGB after Keyboard Center, you will need to restart it.

## Manage Background Service

Keyboard Center does install a background service, which runs with user rights.

You can manage it using:\
`systemctl --user status|start|stop|restart|enable|disable keyboard-center.service`
Keyboard Center places itself into the system tray.

## Settings

Expand Down
4 changes: 2 additions & 2 deletions linux_packaging/DEB-keyboard-center/PKGBUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Maintainer: zocker_160 <zocker1600 at posteo dot net>

pkgname=keyboard-center
pkgver=0.1.32
pkgver=0.2.1
pkgrel=1
pkgdesc="Application to map G-keys on (some) Logitech Gaming Keyboards"
arch=('x86_64')
Expand Down Expand Up @@ -46,9 +46,9 @@ package() {
install -D -m755 linux_packaging/assets/keyboard-center.sh "$pkgdir"/usr/bin/"$pkgname"

install -D -m755 src/main.py -t "$pkgdir"/usr/lib/"$pkgname"
install -D -m755 src/mainUi.py -t "$pkgdir"/usr/lib/"$pkgname"
install -D -m755 src/service.py -t "$pkgdir"/usr/lib/"$pkgname"

install -D -m644 src/keyboard-center.service -t "$pkgdir"/usr/lib/systemd/user
install -D -m644 linux_packaging/60-keyboard-center.rules -t "$pkgdir"/usr/lib/udev/rules.d
install -D -m644 linux_packaging/uinput-keyboard-center.conf "$pkgdir"/usr/lib/modules-load.d/"$pkgname".conf

Expand Down
7 changes: 0 additions & 7 deletions linux_packaging/DEB-keyboard-center/postrm
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
#! /usr/bin/env bash

udevadm control --reload-rules

echo "IMPORTANT: in order to stop the background service ##########"
echo 'please run "systemctl --user stop keyboard-center.service"'
echo "and"
echo 'systemctl --user disable keyboard-center.service" as NON ROOT'
echo "##############################################################"
sleep 3
1 change: 0 additions & 1 deletion src/devices/keyboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class KeyboardInterface:

## optional
memoryKeysLEDs = dict() # dict[str, bytes]
useLibUsb: bool = field(default=False) # will use libhidraw if False

@dataclass(frozen=True)
class Logitech_G910_OrionSpectrum(KeyboardInterface):
Expand Down
2 changes: 1 addition & 1 deletion src/gui/Ui_aboutWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@ def setupUi(self, aboutWindow):
def retranslateUi(self, aboutWindow):
_translate = QtCore.QCoreApplication.translate
aboutWindow.setWindowTitle(_translate("aboutWindow", "About"))
self.about_maintext.setText(_translate("aboutWindow", "<html><head/><body><p>Keyboard Center - $$$</p><p>made by zocker_160</p><p>licensed under GPLv3 | 2021</p><p>source code: <a href=\"https://github.com/zocker-160/keyboard-center\"><span style=\" text-decoration: underline; color:#2980b9;\">https://github.com/zocker-160/keyboard-center</span></a></p></body></html>"))
self.about_maintext.setText(_translate("aboutWindow", "<html><head/><body><p>Keyboard Center - $$$</p><p>made by zocker_160</p><p>licensed under GPLv3 | 2021 - 2022</p><p>source code: <a href=\"https://github.com/zocker-160/keyboard-center\"><span style=\" text-decoration: underline; color:#2980b9;\">https://github.com/zocker-160/keyboard-center</span></a></p></body></html>"))
from . import ressources_rc
84 changes: 84 additions & 0 deletions src/gui/Ui_commandWidget.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file '/home/bene/Programmierkram/GitHub/G910-gui/src/gui/commandWidget.ui'
#
# Created by: PyQt5 UI code generator 5.14.1
#
# WARNING! All changes made in this file will be lost!


from PyQt5 import QtCore, QtGui, QtWidgets


class Ui_CommandWidget(object):
def setupUi(self, CommandWidget):
CommandWidget.setObjectName("CommandWidget")
CommandWidget.resize(726, 54)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(CommandWidget.sizePolicy().hasHeightForWidth())
CommandWidget.setSizePolicy(sizePolicy)
CommandWidget.setMinimumSize(QtCore.QSize(0, 40))
CommandWidget.setMaximumSize(QtCore.QSize(16777215, 60))
CommandWidget.setAutoFillBackground(True)
CommandWidget.setStyleSheet("QWidget {\n"
" #this does break dark mode stupid me\n"
" #background-color: white;\n"
"}\n"
"")
self.horizontalLayout = QtWidgets.QHBoxLayout(CommandWidget)
self.horizontalLayout.setObjectName("horizontalLayout")
self.label = QtWidgets.QLabel(CommandWidget)
self.label.setMinimumSize(QtCore.QSize(25, 0))
self.label.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
self.label.setObjectName("label")
self.horizontalLayout.addWidget(self.label)
self.label_2 = QtWidgets.QLabel(CommandWidget)
self.label_2.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
self.label_2.setObjectName("label_2")
self.horizontalLayout.addWidget(self.label_2)
self.commandEdit = QtWidgets.QLineEdit(CommandWidget)
self.commandEdit.setClearButtonEnabled(True)
self.commandEdit.setObjectName("commandEdit")
self.horizontalLayout.addWidget(self.commandEdit)
self.line_2 = QtWidgets.QFrame(CommandWidget)
self.line_2.setFrameShape(QtWidgets.QFrame.VLine)
self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken)
self.line_2.setObjectName("line_2")
self.horizontalLayout.addWidget(self.line_2)
self.moveUp = QtWidgets.QPushButton(CommandWidget)
self.moveUp.setFocusPolicy(QtCore.Qt.NoFocus)
icon = QtGui.QIcon.fromTheme("go-up")
self.moveUp.setIcon(icon)
self.moveUp.setObjectName("moveUp")
self.horizontalLayout.addWidget(self.moveUp)
self.moveDown = QtWidgets.QPushButton(CommandWidget)
self.moveDown.setFocusPolicy(QtCore.Qt.NoFocus)
icon = QtGui.QIcon.fromTheme("go-down")
self.moveDown.setIcon(icon)
self.moveDown.setObjectName("moveDown")
self.horizontalLayout.addWidget(self.moveDown)
self.line = QtWidgets.QFrame(CommandWidget)
self.line.setFrameShape(QtWidgets.QFrame.VLine)
self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
self.line.setObjectName("line")
self.horizontalLayout.addWidget(self.line)
self.delButton = QtWidgets.QPushButton(CommandWidget)
icon = QtGui.QIcon.fromTheme("list-remove")
self.delButton.setIcon(icon)
self.delButton.setObjectName("delButton")
self.horizontalLayout.addWidget(self.delButton)

self.retranslateUi(CommandWidget)
self.delButton.clicked.connect(CommandWidget._remove)
self.moveDown.clicked.connect(CommandWidget._moveDown)
self.moveUp.clicked.connect(CommandWidget._moveUp)
QtCore.QMetaObject.connectSlotsByName(CommandWidget)

def retranslateUi(self, CommandWidget):
_translate = QtCore.QCoreApplication.translate
CommandWidget.setWindowTitle(_translate("CommandWidget", "Form"))
self.label.setText(_translate("CommandWidget", "X."))
self.label_2.setText(_translate("CommandWidget", "Command:"))
self.commandEdit.setPlaceholderText(_translate("CommandWidget", "put command (e.g. konsole -e htop or cowsay \"nvidia sucks\")"))
28 changes: 24 additions & 4 deletions src/gui/Ui_mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(906, 627)
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(":/icons/assets/input-keyboard-virtual.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
MainWindow.setWindowIcon(icon)
MainWindow.setStyleSheet("QLabel#asd {\n"
" image: url(:/icons/MEMORY_1.png);\n"
" border: 4px solid black;\n"
Expand Down Expand Up @@ -147,6 +144,9 @@ def setupUi(self, MainWindow):
self.addDelay.setIcon(icon)
self.addDelay.setObjectName("addDelay")
self.horizontalLayout_4.addWidget(self.addDelay)
self.addCommand = QtWidgets.QPushButton(self.centralwidget)
self.addCommand.setObjectName("addCommand")
self.horizontalLayout_4.addWidget(self.addCommand)
self.clearAllButton = QtWidgets.QPushButton(self.centralwidget)
self.clearAllButton.setFocusPolicy(QtCore.Qt.NoFocus)
self.clearAllButton.setText("")
Expand Down Expand Up @@ -180,8 +180,16 @@ def setupUi(self, MainWindow):
self.disableNotifications = QtWidgets.QCheckBox(self.centralwidget)
self.disableNotifications.setObjectName("disableNotifications")
self.horizontalLayout_3.addWidget(self.disableNotifications)
self.minimizeOnStart = QtWidgets.QCheckBox(self.centralwidget)
self.minimizeOnStart.setObjectName("minimizeOnStart")
self.horizontalLayout_3.addWidget(self.minimizeOnStart)
spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_3.addItem(spacerItem2)
self.toTrayButton = QtWidgets.QPushButton(self.centralwidget)
icon = QtGui.QIcon.fromTheme("go-bottom")
self.toTrayButton.setIcon(icon)
self.toTrayButton.setObjectName("toTrayButton")
self.horizontalLayout_3.addWidget(self.toTrayButton)
self.saveButton = QtWidgets.QPushButton(self.centralwidget)
icon = QtGui.QIcon.fromTheme("document-save")
self.saveButton.setIcon(icon)
Expand Down Expand Up @@ -209,6 +217,8 @@ def setupUi(self, MainWindow):
self.actionReport_issue.setIcon(icon)
self.actionReport_issue.setObjectName("actionReport_issue")
self.actionAbout_Qt = QtWidgets.QAction(MainWindow)
icon = QtGui.QIcon.fromTheme("help-about")
self.actionAbout_Qt.setIcon(icon)
self.actionAbout_Qt.setObjectName("actionAbout_Qt")
self.actionAbout = QtWidgets.QAction(MainWindow)
icon = QtGui.QIcon.fromTheme("help-about")
Expand All @@ -227,10 +237,16 @@ def setupUi(self, MainWindow):
self.actionExit.setIcon(icon)
self.actionExit.setObjectName("actionExit")
self.actionCheck_service_status = QtWidgets.QAction(MainWindow)
self.actionCheck_service_status.setEnabled(False)
icon = QtGui.QIcon.fromTheme("system-help")
self.actionCheck_service_status.setIcon(icon)
self.actionCheck_service_status.setObjectName("actionCheck_service_status")
self.actionOpenLogfile = QtWidgets.QAction(MainWindow)
icon = QtGui.QIcon.fromTheme("text")
self.actionOpenLogfile.setIcon(icon)
self.actionOpenLogfile.setObjectName("actionOpenLogfile")
self.menuFile.addAction(self.actionOpenConfigFolder)
self.menuFile.addAction(self.actionOpenLogfile)
self.menuFile.addSeparator()
self.menuFile.addAction(self.actionCheck_service_status)
self.menuFile.addSeparator()
Expand Down Expand Up @@ -262,9 +278,12 @@ def retranslateUi(self, MainWindow):
self.gameModeTime.setSuffix(_translate("MainWindow", " ms"))
self.addKey.setText(_translate("MainWindow", "Add Key"))
self.addDelay.setText(_translate("MainWindow", "Add Delay"))
self.addCommand.setText(_translate("MainWindow", "Add Command"))
self.resetButton.setText(_translate("MainWindow", "Reset"))
self.disableNotifications.setToolTip(_translate("MainWindow", "disables notifications when switching memory profiles"))
self.disableNotifications.setText(_translate("MainWindow", "disable profile notification"))
self.minimizeOnStart.setText(_translate("MainWindow", "minimize on start"))
self.toTrayButton.setText(_translate("MainWindow", "To Tray"))
self.saveButton.setText(_translate("MainWindow", "Save"))
self.menuFile.setTitle(_translate("MainWindow", "File"))
self.menuAbout.setTitle(_translate("MainWindow", "About"))
Expand All @@ -273,10 +292,11 @@ def retranslateUi(self, MainWindow):
self.actionAbout_Qt.setText(_translate("MainWindow", "About Qt"))
self.actionAbout.setText(_translate("MainWindow", "About"))
self.actionExport_config.setText(_translate("MainWindow", "Export config...(soon)"))
self.actionOpenConfigFolder.setText(_translate("MainWindow", "Open config folder..."))
self.actionOpenConfigFolder.setText(_translate("MainWindow", "Open config folder"))
self.actionExit.setText(_translate("MainWindow", "Exit"))
self.actionExit.setShortcut(_translate("MainWindow", "Ctrl+Q"))
self.actionCheck_service_status.setText(_translate("MainWindow", "Check service status..."))
self.actionCheck_service_status.setToolTip(_translate("MainWindow", "check status of the background service"))
self.actionOpenLogfile.setText(_translate("MainWindow", "Open log file"))
from gui.customwidgets import CListWidgetContent
from . import ressources_rc
2 changes: 1 addition & 1 deletion src/gui/aboutWindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
<item>
<widget class="QLabel" name="about_maintext">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Keyboard Center - $$$&lt;/p&gt;&lt;p&gt;made by zocker_160&lt;/p&gt;&lt;p&gt;licensed under GPLv3 | 2021&lt;/p&gt;&lt;p&gt;source code: &lt;a href=&quot;https://github.com/zocker-160/keyboard-center&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#2980b9;&quot;&gt;https://github.com/zocker-160/keyboard-center&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Keyboard Center - $$$&lt;/p&gt;&lt;p&gt;made by zocker_160&lt;/p&gt;&lt;p&gt;licensed under GPLv3 | 2021 - 2022&lt;/p&gt;&lt;p&gt;source code: &lt;a href=&quot;https://github.com/zocker-160/keyboard-center&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#2980b9;&quot;&gt;https://github.com/zocker-160/keyboard-center&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
Expand Down
Loading

0 comments on commit 110bcac

Please sign in to comment.