From d216c70fa7ae8f5795874db3ee7afa0cf688c9a4 Mon Sep 17 00:00:00 2001 From: perremba <34656608+perremba@users.noreply.github.com> Date: Thu, 3 May 2018 01:55:33 +0200 Subject: [PATCH 1/8] correct indent (tab mixed with spaces) This program should not have worked as is : There was a tab instead of spaces in line 50 There are others after line 145 which shouldn't have caused problems since they were consistent, however, I also changed them because they were not in accord with the rest of the code, nor with pep8 style recommendation. --- main.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/main.py b/main.py index a1afc13..138aff8 100644 --- a/main.py +++ b/main.py @@ -47,7 +47,7 @@ def sendCycle(self): myG = G213Colors myG.connectG() myG.sendCycleCommand(self.sbGetValue(self.sbCycle)) - myG.saveData(myG.cycleCommand.format(str(format(self.sbGetValue(self.sbCycle), '04x')))) + myG.saveData(myG.cycleCommand.format(str(format(self.sbGetValue(self.sbCycle), '04x')))) myG.disconnectG() def sendSegments(self): @@ -142,18 +142,18 @@ def __init__(self): if "-t" in option: - myG = G213Colors - myG.connectG() - file = open(myG.confFile, "r") - commands = file.readline().split(',') - for command in commands: - print command - myG.sendData(command) - sleep(0.01) - - myG.disconnectG() - sys.exit(0) - + myG = G213Colors + myG.connectG() + file = open(myG.confFile, "r") + commands = file.readline().split(',') + for command in commands: + print command + myG.sendData(command) + sleep(0.01) + + myG.disconnectG() + sys.exit(0) +but win = Window() win.connect("delete-event", Gtk.main_quit) win.show_all() From 8cd5e6453ad0a4f1b157aae892c32ace6687fc68 Mon Sep 17 00:00:00 2001 From: Aaron Echols Date: Sun, 12 Aug 2018 00:08:27 -0700 Subject: [PATCH 2/8] NameError: name 'but' is not defined Remove undefined statement --- main.py | 1 - 1 file changed, 1 deletion(-) diff --git a/main.py b/main.py index 138aff8..2ad6517 100644 --- a/main.py +++ b/main.py @@ -153,7 +153,6 @@ def __init__(self): myG.disconnectG() sys.exit(0) -but win = Window() win.connect("delete-event", Gtk.main_quit) win.show_all() From ddc58e5ca203b871d38c0cc1be85669fc749d282 Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Sat, 28 Sep 2019 19:13:52 +0200 Subject: [PATCH 3/8] Using polkit instead of gksudo --- G213Colors.desktop | 2 +- be.jeroened.pkexec.g213colors.policy | 19 +++++++++++++++++++ makefile | 2 ++ 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 be.jeroened.pkexec.g213colors.policy diff --git a/G213Colors.desktop b/G213Colors.desktop index 916ae5c..36b6836 100755 --- a/G213Colors.desktop +++ b/G213Colors.desktop @@ -1,6 +1,6 @@ [Desktop Entry] Name=G213 Colors -Exec=gksudo g213colors-gui +Exec=pkexec g213colors-gui Comment=A gui to change the key colors on a Logitech G213 Prodigy Gaming Keyboard Icon=g213colors Type=Application diff --git a/be.jeroened.pkexec.g213colors.policy b/be.jeroened.pkexec.g213colors.policy new file mode 100644 index 0000000..fe10cab --- /dev/null +++ b/be.jeroened.pkexec.g213colors.policy @@ -0,0 +1,19 @@ + + + + + + Authentication is required to run G213 Colors + g213colors + + auth_admin + auth_admin + auth_admin + + /usr/bin/g213colors-gui + true + + + \ No newline at end of file diff --git a/makefile b/makefile index 393311f..38613e7 100644 --- a/makefile +++ b/makefile @@ -12,6 +12,7 @@ install : cp icons/G213Colors-128.png /usr/share/icons/hicolor/128x128/apps/g213colors.png cp icons/G213Colors-192.png /usr/share/icons/hicolor/192x192/apps/g213colors.png cp G213Colors.desktop /usr/share/applications/g213colors.desktop + cp be.jeroened.pkexec.g213colors.policy /usr/share/polkit-1/actions/ gtk-update-icon-cache -q /usr/share/icons/hicolor/ systemctl daemon-reload uninstall : @@ -26,5 +27,6 @@ uninstall : rm /usr/share/icons/hicolor/128x128/apps/g213colors.png rm /usr/share/icons/hicolor/192x192/apps/g213colors.png rm /usr/share/applications/g213colors.desktop + rm /usr/share/polkit-1/actions/be.jeroened.pkexec.g213colors.policy gtk-update-icon-cache -q /usr/share/icons/hicolor/ systemctl daemon-reload From a7d8e241eaad6bfa51e0ca335130110208bafa74 Mon Sep 17 00:00:00 2001 From: Michael L Date: Sat, 21 Nov 2020 12:12:11 -0600 Subject: [PATCH 4/8] Create g213colors.openrc --- g213colors.openrc | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 g213colors.openrc diff --git a/g213colors.openrc b/g213colors.openrc new file mode 100644 index 0000000..e59a513 --- /dev/null +++ b/g213colors.openrc @@ -0,0 +1,11 @@ +#!/sbin/openrc-run + +# https://github.com/goose121/initify systemd to openrc conversion perl script. +#opernrc service unit for g213colors + +command=/usr/bin/g213colors-gui +command_args="-t" +pidfile= + +name="g213colors" +description="Start G213Colors profile" From bb5183e9461fc10fc27ecf0e3314a4bcb024ef0c Mon Sep 17 00:00:00 2001 From: Michael L Date: Mon, 23 Nov 2020 19:19:51 -0600 Subject: [PATCH 5/8] Update makefile --- makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/makefile b/makefile index 38613e7..6a1d22e 100644 --- a/makefile +++ b/makefile @@ -3,6 +3,7 @@ install : cp main.py /usr/bin/g213colors-gui cp default.conf /etc/G213Colors.conf cp g213colors.service /etc/systemd/system/g213colors.service + cp g213colors.openrc /etc/init.d/g213colors chmod +x /usr/bin/G213Colors.py chmod +x /usr/bin/g213colors-gui cp icons/G213Colors-16.png /usr/share/icons/hicolor/16x16/apps/g213colors.png @@ -20,6 +21,7 @@ uninstall : rm /usr/bin/g213colors-gui rm /etc/G213Colors.conf rm /etc/systemd/system/g213colors.service + rm /etc/init.d/g213colors rm /usr/share/icons/hicolor/16x16/apps/g213colors.png rm /usr/share/icons/hicolor/24x24/apps/g213colors.png rm /usr/share/icons/hicolor/32x32/apps/g213colors.png From b7a4927398c77b58bfc5e646d454e24fc3c7fd4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Justin=20G=C3=BCse?= Date: Fri, 27 Nov 2020 15:39:01 +0100 Subject: [PATCH 6/8] Update README.md --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index d7add0f..24ee83e 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,19 @@ The "Wave" color effect that is available with the Logitech software could not b ## Installation Clone this project with git and run `sudo make install` +Remark Justin: The missing steps for me have been (Running Ubuntu) + +``` +sudo apt install python3-gi python3-gi-cairo gir1.2-gtk-3.0 +pip install -r requirements +sudo make install +sudo python main.py +``` + +The desktop entry didn't work for me. +In case your python is not found for sudo, check your python with `whereis python` using the normal user. For example I had to replace the last python command with +`sudo /home/justin/miniconda3/bin/python main.py` + ### Prerequisites * [Python](https://www.python.org/) 3.x (which is usually already installed) * [PyUSB](https://github.com/walac/pyusb) (please see their instructions on how to install) From 135675545d28e86252aeed770e847b2133444b67 Mon Sep 17 00:00:00 2001 From: Justin Guese Date: Fri, 27 Nov 2020 15:40:47 +0100 Subject: [PATCH 7/8] added fix script --- fix.sh | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100755 fix.sh diff --git a/fix.sh b/fix.sh new file mode 100755 index 0000000..f5bebba --- /dev/null +++ b/fix.sh @@ -0,0 +1,6 @@ +#!/bin/bash +sudo apt install python3-gi python3-gi-cairo gir1.2-gtk-3.0 +pip install -r requirements +sudo make install +sudo python main.py + From c85491e75e00fb7a8b1b29fbba7effc24980130c Mon Sep 17 00:00:00 2001 From: Justin Guese Date: Fri, 27 Nov 2020 15:44:13 +0100 Subject: [PATCH 8/8] fix for ciaro and gtk --- README.md | 6 +++--- fix.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 24ee83e..000c05c 100644 --- a/README.md +++ b/README.md @@ -26,18 +26,18 @@ The "Wave" color effect that is available with the Logitech software could not b ## Installation Clone this project with git and run `sudo make install` -Remark Justin: The missing steps for me have been (Running Ubuntu) +Remark: The PyUSB and PyGObject libraries can be installed with (Running Ubuntu) running the `fix.sh` file or by pasteing: ``` sudo apt install python3-gi python3-gi-cairo gir1.2-gtk-3.0 -pip install -r requirements +pip install pycairo PyGObject sudo make install sudo python main.py ``` The desktop entry didn't work for me. In case your python is not found for sudo, check your python with `whereis python` using the normal user. For example I had to replace the last python command with -`sudo /home/justin/miniconda3/bin/python main.py` +`sudo /home/user/miniconda3/bin/python main.py` ### Prerequisites * [Python](https://www.python.org/) 3.x (which is usually already installed) diff --git a/fix.sh b/fix.sh index f5bebba..4b31cee 100755 --- a/fix.sh +++ b/fix.sh @@ -1,6 +1,6 @@ #!/bin/bash sudo apt install python3-gi python3-gi-cairo gir1.2-gtk-3.0 -pip install -r requirements +pip install pycairo PyGObject sudo make install sudo python main.py