hyprland nxcolor-functions better
This commit is contained in:
@@ -52,6 +52,7 @@ in {
|
|||||||
hyprland-protocols
|
hyprland-protocols
|
||||||
hyprlock
|
hyprlock
|
||||||
hypridle
|
hypridle
|
||||||
|
hyprpicker
|
||||||
hyprcursor
|
hyprcursor
|
||||||
|
|
||||||
grim
|
grim
|
||||||
@@ -333,8 +334,8 @@ in {
|
|||||||
"SUPER, F6, exec, kitty -e 'htop'"
|
"SUPER, F6, exec, kitty -e 'htop'"
|
||||||
"SUPER, F7, exec, kitty -e 'nmtui'"
|
"SUPER, F7, exec, kitty -e 'nmtui'"
|
||||||
''SUPER, F8, exec, find ~/Pictures/wallpapers/* -type f -not -path "~/Pictures/wallpapers/.git/*" | sort -R | head -n 1 | xargs swww img --transition-type wipe --transition-angle 60 --transition-step 120 --transition-fps 120''
|
''SUPER, F8, exec, find ~/Pictures/wallpapers/* -type f -not -path "~/Pictures/wallpapers/.git/*" | sort -R | head -n 1 | xargs swww img --transition-type wipe --transition-angle 60 --transition-step 120 --transition-fps 120''
|
||||||
''SUPER, F9, exec, kitty -e sh -c 'change_colors_json $(swww query | sed -n 1p | sed -e "s-.*image: --g") && nh home switch && firefox /home/${user}/.config/color-pallete.html' ''
|
"SUPER, F9, execr, waybar_mode set ' '"
|
||||||
''SUPER SHIFT, F9, exec, firefox /home/${user}/.config/color-pallete.html ''
|
"SUPER, F9, submap, color"
|
||||||
# "SUPER, F10, hyprload,update"
|
# "SUPER, F10, hyprload,update"
|
||||||
"SUPER, F11, exec, waybar"
|
"SUPER, F11, exec, waybar"
|
||||||
"SUPER SHIFT, F11, exec, pkill waybar "
|
"SUPER SHIFT, F11, exec, pkill waybar "
|
||||||
@@ -424,6 +425,7 @@ in {
|
|||||||
"SUPER, X, exec, pkill wlogout || wlogout --protocol layer-shell -b 3"
|
"SUPER, X, exec, pkill wlogout || wlogout --protocol layer-shell -b 3"
|
||||||
# "SUPER, C, exec, /home/nx2/scripts/quickconfig/quickconfig.sh "
|
# "SUPER, C, exec, /home/nx2/scripts/quickconfig/quickconfig.sh "
|
||||||
"SUPER, C, exec, chatterino"
|
"SUPER, C, exec, chatterino"
|
||||||
|
"SUPER SHIFT, C, exec, hyprpicker -n -a"
|
||||||
"SUPER, V, togglefloating, "
|
"SUPER, V, togglefloating, "
|
||||||
"SUPER, B, exec, bitwarden"
|
"SUPER, B, exec, bitwarden"
|
||||||
"SUPER, N, togglesplit"
|
"SUPER, N, togglesplit"
|
||||||
@@ -505,6 +507,12 @@ in {
|
|||||||
# db 8D 88. .88 88 8D 88 88 88' '88 88 db 8D
|
# db 8D 88. .88 88 8D 88 88 88' '88 88 db 8D
|
||||||
# '8888Y' 'Y8888P' Y8888P' YP YP 88 YP YP '8888Y'
|
# '8888Y' 'Y8888P' Y8888P' YP YP 88 YP YP '8888Y'
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
|
extraConfig = let
|
||||||
|
action_simple = { mods ? "", key, cmd }: ''
|
||||||
|
bind=${mods},${key},execr,waybar_mode unset
|
||||||
|
bind=${mods},${key},${cmd}
|
||||||
|
bind=${mods},${key},submap,reset
|
||||||
|
'';
|
||||||
submap = browserSM
|
submap = browserSM
|
||||||
bind = , W, exec, waybar_mode unset
|
bind = , W, exec, waybar_mode unset
|
||||||
bind = , W, exec, hyprctl dispatch exec firefox
|
bind = , W, exec, hyprctl dispatch exec firefox
|
||||||
@@ -787,6 +795,13 @@ in {
|
|||||||
bind = , Escape, submap, reset
|
bind = , Escape, submap, reset
|
||||||
submap = reset
|
submap = reset
|
||||||
|
|
||||||
|
submap = color
|
||||||
|
${action_simple { key = "W"; cmd = ''exec,kitty -e sh -c 'change_colors_json img $(swww query | sed -n 1p | sed -e "s-.*image: --g") && nh home switch''; }}
|
||||||
|
${action_simple { key = "M"; cmd = ''exec,change_colors_json manual && kitty -e sh -c 'nh home switch && firefox /home/${user}/.config/color-pallete.html' ''; }}
|
||||||
|
${action_simple { key = "D"; cmd = ''exec,firefox /home/${user}/.config/color-pallete.html ''; }}
|
||||||
|
bind = , Escape, execr, waybar_mode unset
|
||||||
|
bind = , Escape, submap, reset
|
||||||
|
submap = reset
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
from colorsys import hls_to_rgb, rgb_to_hls
|
from colorsys import hls_to_rgb, rgb_to_hls
|
||||||
import json
|
import json
|
||||||
import sys
|
import sys
|
||||||
|
import subprocess
|
||||||
from typing import Literal, cast
|
from typing import Literal, cast
|
||||||
from numpy.typing import NDArray
|
from numpy.typing import NDArray
|
||||||
from sklearn.cluster import KMeans
|
from sklearn.cluster import KMeans
|
||||||
@@ -25,7 +26,7 @@ def fc(c: int) -> str:
|
|||||||
return s
|
return s
|
||||||
|
|
||||||
class Color(object):
|
class Color(object):
|
||||||
def __init__(self, rgb: tuple[int, ...], frequency: float):
|
def __init__(self, rgb: tuple[int, ...], frequency: float = 1):
|
||||||
assert len(rgb) == 3, "RGB values must be a tuple of length 3"
|
assert len(rgb) == 3, "RGB values must be a tuple of length 3"
|
||||||
self.rgb = cast(tuple[int, int, int], rgb)
|
self.rgb = cast(tuple[int, int, int], rgb)
|
||||||
self.freq: float = frequency
|
self.freq: float = frequency
|
||||||
@@ -115,14 +116,23 @@ def extract_colors(
|
|||||||
colors.sort(reverse=True)
|
colors.sort(reverse=True)
|
||||||
|
|
||||||
return Palette(colors)
|
return Palette(colors)
|
||||||
|
|
||||||
|
def hyprpicker() -> Color:
|
||||||
|
ret = str(subprocess.run(["${pkgs.hyprpicker}/bin/hyprpicker", "-f", "rgb"], capture_output=True).stdout)[2:-3]
|
||||||
|
return Color([int(c) for c in ret.split(" ")])
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
img = sys.argv[1]
|
if sys.argv[1] == "img":
|
||||||
|
img = sys.argv[2]
|
||||||
|
palette = extract_colors(image=img, palette_size=3)
|
||||||
|
accent = ensure_color(c=palette[0], alter_sat=False)
|
||||||
|
secondary = ensure_color(c=palette[1], alter_sat=True)
|
||||||
|
tertiary = ensure_color(c=palette[2], alter_sat=False)
|
||||||
|
elif sys.argv[1] == "manual":
|
||||||
|
accent = ensure_color(c=hyprpicker(), alter_sat=False)
|
||||||
|
secondary = ensure_color(c=hyprpicker(), alter_sat=True)
|
||||||
|
tertiary = ensure_color(c=hyprpicker(), alter_sat=False)
|
||||||
|
|
||||||
palette = extract_colors(image=img, palette_size=3)
|
|
||||||
|
|
||||||
accent = ensure_color(c=palette[0], alter_sat=False)
|
|
||||||
secondary = ensure_color(c=palette[1], alter_sat=True)
|
|
||||||
tertiary = ensure_color(c=palette[2], alter_sat=False)
|
|
||||||
weird = alter_hue(ilist=accent, hue=80)
|
weird = alter_hue(ilist=accent, hue=80)
|
||||||
special = alter_hue(ilist=accent, hue=180)
|
special = alter_hue(ilist=accent, hue=180)
|
||||||
foreground = alter_l(accent, 0.9)
|
foreground = alter_l(accent, 0.9)
|
||||||
|
|||||||
Reference in New Issue
Block a user