/ de-omarchy / bin / omarchy-theme-set-keyboard-f16
swadhinbiswas Initial de-omarchy: Omarchy UI layer for Arch-based distros · 8/22/2026
9f393b2
29 lines · 872 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash

# omarchy:summary=Apply the current theme keyboard color to Framework Laptop 16 keyboards
# omarchy:hidden=true

FRAMEWORK16_THEME=$HOME/.local/state/omarchy/current/theme/keyboard.rgb

if omarchy-cmd-present qmk_hid && [[ -f $FRAMEWORK16_THEME ]]; then
  hex=$(cat "$FRAMEWORK16_THEME")
  hex="${hex#\#}"

  [[ $hex =~ ^[0-9A-Fa-f]{6}$ ]] || exit 0

  # Convert hex to QMK HSV (0-255 scale) using Python's colorsys
  read -r h s <<< $(python3 -c "
import sys, colorsys
hex = sys.argv[1]
r, g, b = int(hex[:2],16)/255, int(hex[2:4],16)/255, int(hex[4:6],16)/255
h, s, v = colorsys.rgb_to_hsv(r, g, b)
print(int(h * 255), int(s * 255))
" "$hex")

  qmk_hid via --rgb-effect 1 2>/dev/null
  qmk_hid via --rgb-hue "$h" 2>/dev/null
  qmk_hid via --rgb-saturation "$s" 2>/dev/null
  qmk_hid via --rgb-brightness 100 2>/dev/null
  qmk_hid via --save 2>/dev/null
fi