mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2024-11-29 07:51:04 +01:00
Attempted to safe some bugs
This commit is contained in:
parent
df6e2c7fc5
commit
ee84cf2024
@ -38,12 +38,6 @@ else
|
|||||||
r=$(awk "BEGIN { value = 255 - 255 * $transition_ratio; printf(\"%.0f\", value) }")
|
r=$(awk "BEGIN { value = 255 - 255 * $transition_ratio; printf(\"%.0f\", value) }")
|
||||||
g=0
|
g=0
|
||||||
b=0
|
b=0
|
||||||
|
|
||||||
# Convert the RGB values to hexadecimal format
|
|
||||||
current_color=$(printf '%02x%02x%02x' $r $g $b)
|
|
||||||
|
|
||||||
# Set the color using msi-perkeyrgb
|
|
||||||
sudo msi-perkeyrgb --model GS65 -s "$current_color" --id "$vendor_and_product_id"
|
|
||||||
else
|
else
|
||||||
# Calculate the transition ratio based on the time of day
|
# Calculate the transition ratio based on the time of day
|
||||||
start_seconds=$(date -d "$transition_end" +%s)
|
start_seconds=$(date -d "$transition_end" +%s)
|
||||||
@ -55,11 +49,10 @@ else
|
|||||||
r=$(awk "BEGIN { value = 255 * $transition_ratio; printf(\"%.0f\", value) }")
|
r=$(awk "BEGIN { value = 255 * $transition_ratio; printf(\"%.0f\", value) }")
|
||||||
g=$(awk "BEGIN { value = 0 + (255 - 0) * $transition_ratio; printf(\"%.0f\", value) }")
|
g=$(awk "BEGIN { value = 0 + (255 - 0) * $transition_ratio; printf(\"%.0f\", value) }")
|
||||||
b=$(awk "BEGIN { value = 0 + (255 - 0) * $transition_ratio; printf(\"%.0f\", value) }")
|
b=$(awk "BEGIN { value = 0 + (255 - 0) * $transition_ratio; printf(\"%.0f\", value) }")
|
||||||
|
fi
|
||||||
# Convert the RGB values to hexadecimal format
|
# Convert the RGB values to hexadecimal format
|
||||||
current_color=$(printf '%02x%02x%02x' $r $g $b)
|
current_color=$(printf '%02x%02x%02x' $r $g $b)
|
||||||
|
|
||||||
# Set the color using msi-perkeyrgb
|
# Set the color using msi-perkeyrgb
|
||||||
sudo msi-perkeyrgb --model GS65 -s "$current_color" --id "$vendor_and_product_id"
|
msi-perkeyrgb --model GS65 -s "$current_color" --id "$vendor_and_product_id"
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
- name: Copy keyboard-color.timer file
|
- name: Copy keyboard-color.timer file
|
||||||
template:
|
template:
|
||||||
src: keyboard-color.timer
|
src: keyboard-color.timer.j2
|
||||||
dest: /etc/systemd/system/keyboard-color.j2
|
dest: /etc/systemd/system/keyboard-color.j2
|
||||||
mode: 0644
|
mode: 0644
|
||||||
tags:
|
tags:
|
||||||
@ -24,7 +24,7 @@
|
|||||||
- name: Enable and start keyboard-color.timer
|
- name: Enable and start keyboard-color.timer
|
||||||
systemd:
|
systemd:
|
||||||
name: keyboard-color.timer
|
name: keyboard-color.timer
|
||||||
state: started
|
state: restarted
|
||||||
enabled: yes
|
enabled: yes
|
||||||
tags:
|
tags:
|
||||||
- keyboard-color
|
- keyboard-color
|
||||||
|
@ -4,6 +4,3 @@ Description=Keyboard Color Service
|
|||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
ExecStart=/opt/keyboard_color.sh {{ vendor_and_product_id }}
|
ExecStart=/opt/keyboard_color.sh {{ vendor_and_product_id }}
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=default.target
|
|
||||||
|
Loading…
Reference in New Issue
Block a user