OpenRGB port

This commit is contained in:
Anthony Wang 2021-05-28 12:09:46 -05:00
parent b05e0bf206
commit e5bd706684
Signed by: a
GPG Key ID: BC96B00AEC5F2D76
12 changed files with 1789 additions and 15 deletions

View File

@ -1,6 +1,6 @@
PREFIX = '/usr'
DESTDIR = ''
CFLAGS = -march=native -mtune=native -O2 -ansi -pedantic -Wall
CFLAGS = -march=native -mtune=native -O2 -ansi -pedantic -Wall -std=c11
PROGRAM_NAME := $(shell grep ^PROGRAM_NAME INFO | cut -d= -f2)

View File

@ -12,7 +12,7 @@ url='https://github.com/mdomlop/rgbtemp'
source=()
license=('GPL3')
arch=('any')
depends=('msi-rgb')
depends=('openrgb')
changelog=ChangeLog
build() {

1727
pkg/rgbtemp/.BUILDINFO Normal file

File diff suppressed because it is too large Load Diff

19
pkg/rgbtemp/.CHANGELOG Normal file
View File

@ -0,0 +1,19 @@
rgbtemp
=======
Release 0.2
-----------
By Manuel <mdomlop@gmail.com> Thu, 14 Jan 2021 09:55:25 +0100
- No hardcoded values for hwmon file.
- Supply such file by RGBTEMP environment variable or by command line.
Release 0.1
-----------
By Manuel <mdomlop@gmail.com > Wed, 03 Apr 2020 14:34:17 +0200
- First release.

BIN
pkg/rgbtemp/.MTREE Normal file

Binary file not shown.

13
pkg/rgbtemp/.PKGINFO Normal file
View File

@ -0,0 +1,13 @@
# Generated by makepkg 5.2.2
# using fakeroot version 1.25.3
pkgname = rgbtemp
pkgbase = rgbtemp
pkgver = 0.1-1
pkgdesc = Change RGB colors according to temperature.
url = https://github.com/mdomlop/rgbtemp
builddate = 1622221718
packager = Unknown Packager
size = 14545
arch = any
license = GPL3
depend = openrgb

BIN
pkg/rgbtemp/usr/bin/rgbtemp Executable file

Binary file not shown.

View File

@ -0,0 +1,12 @@
[Unit]
Description=Change RGB colors according to temperature
[Service]
Environment=RGBTEMP=/sys/class/hwmon/hwmon1/temp1_input
Type=simple
ExecStart=rgbtemp
KillMode=process
KillSignal=SIGUSR1
[Install]
WantedBy=multi-user.target

Binary file not shown.

BIN
src/rgbtemp Executable file

Binary file not shown.

View File

@ -9,7 +9,7 @@ unsigned int sleep(unsigned int seconds);
#define FALSE 0
#define TRUE 1
#define SLEEP 2 /* Sleeping time in seconds */
#define SLEEP 0.1 /* Sleeping time in seconds */
#define BLACK "00000000 00000000 00000000" /* off */
#define WHITE "FFFFFFFF FFFFFFFF FFFFFFFF" /* >20º */
@ -28,15 +28,16 @@ int running = TRUE;
void set_color(int celsius) {
/* printf("Los grados son: %i\n", celsius); */
int exitstatus = 0;
if (celsius > 90000) { exitstatus = system("msi-rgb --base-port 4e --pulse " PINK); }
else if (celsius > 80000) { exitstatus = system("msi-rgb --base-port 4e --pulse " RED); }
else if (celsius > 70000) { exitstatus = system("msi-rgb --base-port 4e --pulse " ORANGE); }
else if (celsius > 60000) { exitstatus = system("msi-rgb --base-port 4e --pulse " YELLOW); }
else if (celsius > 50000) { exitstatus = system("msi-rgb --base-port 4e --pulse " GREEN); }
else if (celsius > 40000) { exitstatus = system("msi-rgb --base-port 4e --pulse " BLUE); }
else if (celsius > 30000) { exitstatus = system("msi-rgb --base-port 4e --pulse " CYAN); }
else if (celsius > 20000) { exitstatus = system("msi-rgb --base-port 4e --pulse " WHITE); }
else { exitstatus = system("msi-rgb --base-port 4e --pulse " BLACK); }
char s[50];
if (celsius >= 90000) { snprintf(s, 50, "openrgb -c FF00%X", (celsius-90000)*256/10000); exitstatus = system(s); } // PINK
else if (celsius >= 80000) { snprintf(s, 50, "openrgb -c FF%X00", (90000-celsius)*64/10000); exitstatus = system(s); } // RED
else if (celsius >= 70000) { snprintf(s, 50, "openrgb -c FF%X00", (80000-celsius)*192/10000); exitstatus = system(s); } // ORANGE
else if (celsius >= 60000) { snprintf(s, 50, "openrgb -c %XFF00", (celsius-60000)*256/10000); exitstatus = system(s); } // YELLOW
else if (celsius >= 50000) { snprintf(s, 50, "openrgb -c 00%X%X", (celsius-50000)*256/10000, (60000-celsius)*256/10000); exitstatus = system(s); } // GREEN
else if (celsius >= 40000) { snprintf(s, 50, "openrgb -c 00%XFF", (50000-celsius)*256/10000); exitstatus = system(s); } // BLUE
else if (celsius >= 30000) { snprintf(s, 50, "openrgb -c %XFFFF", (40000-celsius)*256/10000); exitstatus = system(s); } // CYAN
else if (celsius >= 20000) { exitstatus = system("openrgb -c FFFFFF"); }
else { exitstatus = system("openrgb -c 000000"); }
if (exitstatus) running = FALSE;
}
@ -115,7 +116,9 @@ int main(int argc, char *argv[]) {
/* Reads text until newline is encountered */
fscanf_ok = fscanf(fptr, "%[^\n]", c);
fclose(fptr);
system("openrgb -m Static");
if (!fscanf_ok) { return 0; }
i = atoi(c);
@ -124,7 +127,7 @@ int main(int argc, char *argv[]) {
}
/* system("msi-rgb --disable --base-port 4e " WHITE); */
cleanexit = system("msi-rgb --base-port 4e " BLACK); /* No pulsing */
cleanexit = system("openrgb -m Off"); /* No pulsing */
if (cleanexit) { return 1; }

View File

@ -2,7 +2,7 @@
Description=Change RGB colors according to temperature
[Service]
Environment=RGBTEMP=/path/to/sys/hwmon/temp_input_file
Environment=RGBTEMP=/sys/class/hwmon/hwmon1/temp1_input
Type=simple
ExecStart=rgbtemp
KillMode=process