fix automapaper module
This commit is contained in:
parent
2771288792
commit
b5054673af
2 changed files with 246 additions and 142 deletions
|
|
@ -5,39 +5,42 @@ in
|
||||||
{
|
{
|
||||||
options.modules.automapaper = {
|
options.modules.automapaper = {
|
||||||
enable = lib.mkEnableOption "enable automapaper";
|
enable = lib.mkEnableOption "enable automapaper";
|
||||||
|
displays = lib.mkOption {
|
||||||
|
type = with lib.types; listOf str;
|
||||||
|
};
|
||||||
configurations = lib.mkOption {
|
configurations = lib.mkOption {
|
||||||
description = "automapaper configurations per monitor";
|
description = "automapaper configurations per monitor";
|
||||||
type = with lib.types; attrsOf (submodule {
|
type = with lib.types; attrsOf (submodule {
|
||||||
options = {
|
options = {
|
||||||
init = mkOption {
|
init = lib.mkOption {
|
||||||
type = str;
|
type = str;
|
||||||
description = "the shader executed to get the state for the initialisation, and re-initialisation steps";
|
description = "the shader executed to get the state for the initialisation, and re-initialisation steps";
|
||||||
};
|
};
|
||||||
state = mkOption {
|
state = lib.mkOption {
|
||||||
type = str;
|
type = str;
|
||||||
description = "the shader executed to increment the state to the next generation";
|
description = "the shader executed to increment the state to the next generation";
|
||||||
};
|
};
|
||||||
display = mkOption {
|
display = lib.mkOption {
|
||||||
type = str;
|
type = str;
|
||||||
description = "the shader executed to display the state to the monitor";
|
description = "the shader executed to display the state to the monitor";
|
||||||
};
|
};
|
||||||
horizontal = mkOption {
|
horizontal = lib.mkOption {
|
||||||
type = int;
|
type = int;
|
||||||
description = "the amount of horizontal cells in the state";
|
description = "the amount of horizontal cells in the state";
|
||||||
};
|
};
|
||||||
vertical = mkOption {
|
vertical = lib.mkOption {
|
||||||
type = int;
|
type = int;
|
||||||
description = "the amount of vertical cells in the state";
|
description = "the amount of vertical cells in the state";
|
||||||
};
|
};
|
||||||
tps = {
|
tps = lib.mkOption {
|
||||||
type = int;
|
type = int;
|
||||||
description = "the amount of ticks to simulate each second";
|
description = "the target amount of ticks to simulate each second";
|
||||||
};
|
};
|
||||||
cycles = {
|
cycles = lib.mkOption {
|
||||||
type = int;
|
type = int;
|
||||||
description = "the amount of state increments before the init shader is called again";
|
description = "the amount of state increments before the init shader is called again";
|
||||||
};
|
};
|
||||||
frames_per_tick = {
|
frames_per_tick = lib.mkOption {
|
||||||
type = int;
|
type = int;
|
||||||
description = "the amount of times to call the display shader for each iteration of the state shader";
|
description = "the amount of times to call the display shader for each iteration of the state shader";
|
||||||
};
|
};
|
||||||
|
|
@ -57,27 +60,126 @@ in
|
||||||
''
|
''
|
||||||
[display]
|
[display]
|
||||||
name="${displayName}"
|
name="${displayName}"
|
||||||
horizontal=${displayConfig.horizontal}
|
horizontal=${builtins.toString displayConfig.horizontal}
|
||||||
vertical=${displayConfig.vertical}
|
vertical=${builtins.toString displayConfig.vertical}
|
||||||
tps=${displayConfig.tps}
|
tps=${builtins.toString displayConfig.tps}
|
||||||
state_frag="${state}"
|
state_frag="${state}"
|
||||||
init_frag="${init}"
|
init_frag="${init}"
|
||||||
display_frag="${display}"
|
display_frag="${display}"
|
||||||
cycles=${displayConfig.cycles}
|
cycles=${builtins.toString displayConfig.cycles}
|
||||||
frames_per_tick=${displayConfig.frames_per_tick}
|
frames_per_tick=${builtins.toString displayConfig.frames_per_tick}
|
||||||
''
|
''
|
||||||
) cfg.configurations;
|
) cfg.configurations;
|
||||||
in
|
in {
|
||||||
{
|
modules.automapaper.configurations =
|
||||||
wayland.windowManager.hyprland.exec-once =
|
let
|
||||||
lib.mkIf config.modules.hyprland.enable (
|
conf = {
|
||||||
lib.mapAttrsToList (name: config:
|
horizontal = 256;
|
||||||
"${
|
vertical = 144;
|
||||||
inputs.automapaper.packages.${pkgs.system}.default
|
tps = 30;
|
||||||
}/bin/automapaper -C ${
|
init = ''
|
||||||
builtins.toFile "${name}.toml" config
|
#version 310 es
|
||||||
}") cfg.displays
|
precision highp float;
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
uniform float time;
|
||||||
|
uniform vec2 resolution;
|
||||||
|
|
||||||
|
out vec4 stateColor;
|
||||||
|
|
||||||
|
float PHI = 1.61803398874989484820459; // Φ = Golden Ratio
|
||||||
|
|
||||||
|
float gold_noise(in vec2 xy, in float seed){
|
||||||
|
return fract(tan(distance(xy*PHI, xy)*seed)*xy.x);
|
||||||
|
}
|
||||||
|
|
||||||
|
void main( void ) {
|
||||||
|
|
||||||
|
vec2 position = gl_FragCoord.xy;
|
||||||
|
float color = gold_noise(position.xy, fract(time));
|
||||||
|
|
||||||
|
|
||||||
|
stateColor = vec4(step(0.3, color), 0,0,step(0.3, color));
|
||||||
|
}'';
|
||||||
|
state= ''
|
||||||
|
#version 310 es
|
||||||
|
precision highp float;
|
||||||
|
|
||||||
|
uniform sampler2D state;
|
||||||
|
uniform vec2 scale;
|
||||||
|
|
||||||
|
out vec4 stateColor;
|
||||||
|
|
||||||
|
vec4 get(int x, int y) {
|
||||||
|
return texture(state, (gl_FragCoord.xy + vec2(x, y)) / scale);
|
||||||
|
}
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
int sum = int(get(-1, -1).r +
|
||||||
|
get(-1, 0).r +
|
||||||
|
get(-1, 1).r +
|
||||||
|
get( 0, -1).r +
|
||||||
|
get( 0, 1).r +
|
||||||
|
get( 1, -1).r +
|
||||||
|
get( 1, 0).r +
|
||||||
|
get( 1, 1).r);
|
||||||
|
vec4 current = get(0,0);
|
||||||
|
if (sum == 3) {
|
||||||
|
stateColor.r = 1.0;
|
||||||
|
stateColor.g = 1.0;
|
||||||
|
} else if (sum == 2) {
|
||||||
|
stateColor = current;
|
||||||
|
if (current.r == 0.0) {
|
||||||
|
stateColor.g = max(current.g - 0.01, 0.0);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
stateColor = vec4(0.0, max(current.g - 0.01, 0.0), 0.0, 1.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}'';
|
||||||
|
display = ''
|
||||||
|
#version 310 es
|
||||||
|
precision highp float;
|
||||||
|
|
||||||
|
uniform sampler2D tex2D;
|
||||||
|
uniform sampler2D old2D;
|
||||||
|
uniform ivec2 resolution;
|
||||||
|
uniform float frame_part;
|
||||||
|
|
||||||
|
in highp vec2 texCoords;
|
||||||
|
out vec4 stateColor;
|
||||||
|
|
||||||
|
const vec4 bgColor = vec4(38.0/255.0, 5.0/255.0, 46.0/255.0, 1.0); // #26052e
|
||||||
|
const vec4 fgColor = vec4(148.0/255.0, 15.0/255.0, 173.0/255.0, 1.0); // #950fad
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
vec2 canvasSize = vec2(textureSize(tex2D, 0));
|
||||||
|
vec4 state = texture(tex2D, texCoords);
|
||||||
|
vec4 ostate = texture(old2D, texCoords);
|
||||||
|
|
||||||
|
vec2 localCoords = fract(gl_FragCoord.xy / vec2(resolution) * canvasSize);
|
||||||
|
localCoords = localCoords - 0.5;
|
||||||
|
float dist = sqrt(dot(localCoords, localCoords));
|
||||||
|
|
||||||
|
float size = smoothstep(0.0, 1.0, pow(mix(ostate.g,state.g, frame_part), 3.0)) * 0.35;
|
||||||
|
float mask = 1.0 - step(size, dist);
|
||||||
|
|
||||||
|
float brightness = mix(ostate.r,state.r, frame_part) + 0.2 * pow(mix(ostate.g,state.g, frame_part), 3.0);
|
||||||
|
stateColor = mix(bgColor, fgColor, brightness * mask);
|
||||||
|
}'';
|
||||||
|
cycles = 2500;
|
||||||
|
frames_per_tick = 1;
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
"DP-3" = conf;
|
||||||
|
"DP-2" = conf;
|
||||||
|
};
|
||||||
|
modules.automapaper.displays =
|
||||||
|
lib.mapAttrsToList (name: config:
|
||||||
|
"${
|
||||||
|
inputs.automapaper.packages.${pkgs.system}.default
|
||||||
|
}/bin/automapaper -C ${
|
||||||
|
builtins.toFile "${name}.toml" config
|
||||||
|
}") displays;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,130 +30,132 @@ in
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
modules = {
|
modules = {
|
||||||
automapaper = {
|
automapaper = {
|
||||||
enable = lib.mkDefault true;
|
enable = lib.mkDefault true;
|
||||||
};
|
};
|
||||||
waybar = {
|
waybar = {
|
||||||
modules = {
|
modules = {
|
||||||
left = [ "hyprland/workspaces" "tray" "hyprland/window" ];
|
left = [ "hyprland/workspaces" "tray" "hyprland/window" ];
|
||||||
center = [ "clock" ];
|
center = [ "clock" ];
|
||||||
right = [ "custom/vpn" "wireplumber" "network" "cpu" "memory" "custom/poweroff" ];
|
right = [ "custom/vpn" "wireplumber" "network" "cpu" "memory" "custom/poweroff" ];
|
||||||
};
|
};
|
||||||
enable = lib.mkDefault true;
|
enable = lib.mkDefault true;
|
||||||
};
|
};
|
||||||
wofi.enable = lib.mkDefault true;
|
wofi.enable = lib.mkDefault true;
|
||||||
dunst.enable = lib.mkDefault true;
|
dunst.enable = lib.mkDefault true;
|
||||||
};
|
};
|
||||||
# these are necessary for the config to function correctly
|
# these are necessary for the config to function correctly
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
# I always want these with hyprland anyways
|
# I always want these with hyprland anyways
|
||||||
libnotify # to enable the notify-send command
|
libnotify # to enable the notify-send command
|
||||||
wl-clipboard
|
wl-clipboard
|
||||||
|
|
||||||
inputs.hyprpicker
|
inputs.hyprpicker
|
||||||
|
|
||||||
hypridle # TODO: remove when fixed with config
|
hypridle # TODO: remove when fixed with config
|
||||||
playerctl
|
playerctl
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
xdg.portal.configPackages = [ cfg.package ];
|
xdg.portal.configPackages = [ cfg.package ];
|
||||||
|
|
||||||
services.playerctld.enable = true;
|
services.playerctld.enable = true;
|
||||||
wayland.windowManager.hyprland = {
|
wayland.windowManager.hyprland = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = cfg.package;
|
package = cfg.package;
|
||||||
settings = {
|
settings = {
|
||||||
monitor = [
|
monitor = [
|
||||||
"DP-3,2560x1440@360,2560x0,1"
|
"DP-3,2560x1440@360,2560x0,1"
|
||||||
"DP-2,2560x1440@144,0x0,1"
|
"DP-2,2560x1440@144,0x0,1"
|
||||||
"Unknown-1,disable" # NOTE: due to a driver bug a third monitor appears
|
"Unknown-1,disable" # NOTE: due to a driver bug a third monitor appears
|
||||||
];
|
];
|
||||||
windowrulev2 = [
|
windowrulev2 = [
|
||||||
"opacity 1.0 0.6,class:^(kitty)$"
|
"opacity 1.0 0.6,class:^(kitty)$"
|
||||||
"stayfocused,class:^(wofi)$"
|
"stayfocused,class:^(wofi)$"
|
||||||
];
|
];
|
||||||
env = [
|
env = [
|
||||||
"WLR_NO_HARDWARE_CURSORS,1"
|
"WLR_NO_HARDWARE_CURSORS,1"
|
||||||
];
|
];
|
||||||
exec-once = [
|
exec-once = [
|
||||||
"${pkgs.waybar}/bin/waybar"
|
"${pkgs.waybar}/bin/waybar"
|
||||||
"${pkgs.dunst}/bin/dunst"
|
"${pkgs.dunst}/bin/dunst"
|
||||||
"${cfg.package}/bin/hyprctl dispatcher focusmonitor 1"
|
"${cfg.package}/bin/hyprctl dispatcher focusmonitor 1"
|
||||||
"${pkgs.hypridle}/bin/hypridle"
|
"${pkgs.hypridle}/bin/hypridle"
|
||||||
];
|
] ++ builtins.map (name:
|
||||||
general = {
|
"${inputs.automapaper.packages.${pkgs.system}.default}/bin/automapaper -C ${name}"
|
||||||
sensitivity = "1.2";
|
) config.modules.automapaper.displays;
|
||||||
gaps_in = "2";
|
general = {
|
||||||
gaps_out = "3";
|
sensitivity = "1.2";
|
||||||
border_size = "3";
|
gaps_in = "2";
|
||||||
"col.active_border"="0xff950fad";
|
gaps_out = "3";
|
||||||
"col.inactive_border"="0xff26052e";
|
border_size = "3";
|
||||||
};
|
"col.active_border"="0xff950fad";
|
||||||
misc = {
|
"col.inactive_border"="0xff26052e";
|
||||||
key_press_enables_dpms = true;
|
};
|
||||||
};
|
misc = {
|
||||||
decoration = {
|
key_press_enables_dpms = true;
|
||||||
rounding = "6";
|
};
|
||||||
active_opacity = "1";
|
decoration = {
|
||||||
inactive_opacity = "1";
|
rounding = "6";
|
||||||
};
|
active_opacity = "1";
|
||||||
workspace = [
|
inactive_opacity = "1";
|
||||||
"DP-3,1"
|
};
|
||||||
"DP-2,2"
|
workspace = [
|
||||||
];
|
"DP-3,1"
|
||||||
animations = {
|
"DP-2,2"
|
||||||
enabled = "1";
|
];
|
||||||
animation = [
|
animations = {
|
||||||
"windows,1,2,default"
|
enabled = "1";
|
||||||
"border,1,10,default"
|
animation = [
|
||||||
"fade,0,5,default"
|
"windows,1,2,default"
|
||||||
"workspaces,1,4,default"
|
"border,1,10,default"
|
||||||
];
|
"fade,0,5,default"
|
||||||
};
|
"workspaces,1,4,default"
|
||||||
"$mod" = "SUPER";
|
];
|
||||||
bind = [
|
};
|
||||||
"$mod,Return,exec,${cfg.terminal}/bin/${cfg.terminal.pname}"
|
"$mod" = "SUPER";
|
||||||
"$mod,tab,cyclenext"
|
bind = [
|
||||||
"SUPERSHIFT,Q,killactive"
|
"$mod,Return,exec,${cfg.terminal}/bin/${cfg.terminal.pname}"
|
||||||
"$mod,SPACE,exec,wofi-launch"
|
"$mod,tab,cyclenext"
|
||||||
"$mod,P,exec,wofi-power"
|
"SUPERSHIFT,Q,killactive"
|
||||||
"SUPERSHIFT,m,exit"
|
"$mod,SPACE,exec,wofi-launch"
|
||||||
"$mod,H,movefocus,l"
|
"$mod,P,exec,wofi-power"
|
||||||
"$mod,J,movefocus,u"
|
"SUPERSHIFT,m,exit"
|
||||||
"$mod,K,movefocus,d"
|
"$mod,H,movefocus,l"
|
||||||
"$mod,L,movefocus,r"
|
"$mod,J,movefocus,u"
|
||||||
"SUPERSHIFT,H,movewindow,l"
|
"$mod,K,movefocus,d"
|
||||||
"SUPERSHIFT,J,movewindow,u"
|
"$mod,L,movefocus,r"
|
||||||
"SUPERSHIFT,K,movewindow,d"
|
"SUPERSHIFT,H,movewindow,l"
|
||||||
"SUPERSHIFT,L,movewindow,r"
|
"SUPERSHIFT,J,movewindow,u"
|
||||||
"$mod,F,togglefloating"
|
"SUPERSHIFT,K,movewindow,d"
|
||||||
"$mod,X,togglespecialworkspace"
|
"SUPERSHIFT,L,movewindow,r"
|
||||||
"SUPERSHIFT,X,movetoworkspace,special"
|
"$mod,F,togglefloating"
|
||||||
"SUPERSHIFT,S,exec,${pkgs.hyprshot}/bin/hyprshot -m region --clipboard-only"
|
"$mod,X,togglespecialworkspace"
|
||||||
"$mod,f11,fullscreen,0"
|
"SUPERSHIFT,X,movetoworkspace,special"
|
||||||
",XF86AudioLowerVolume,exec,${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_SINK@ 1%-"
|
"SUPERSHIFT,S,exec,${pkgs.hyprshot}/bin/hyprshot -m region --clipboard-only"
|
||||||
",XF86AudioRaiseVolume,exec,${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_SINK@ 1%+"
|
"$mod,f11,fullscreen,0"
|
||||||
",XF86AudioMute,exec,${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_SINK@ toggle"
|
",XF86AudioLowerVolume,exec,${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_SINK@ 1%-"
|
||||||
",XF86AudioPlay,exec,${pkgs.playerctl}/bin/playerctl play-pause"
|
",XF86AudioRaiseVolume,exec,${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_SINK@ 1%+"
|
||||||
",XF86AudioPrev,exec,${pkgs.playerctl}/bin/playerctl previous"
|
",XF86AudioMute,exec,${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_SINK@ toggle"
|
||||||
",XF86AudioNext,exec,${pkgs.playerctl}/bin/playerctl next"
|
",XF86AudioPlay,exec,${pkgs.playerctl}/bin/playerctl play-pause"
|
||||||
]
|
",XF86AudioPrev,exec,${pkgs.playerctl}/bin/playerctl previous"
|
||||||
++ (
|
",XF86AudioNext,exec,${pkgs.playerctl}/bin/playerctl next"
|
||||||
builtins.concatLists (builtins.genList (
|
]
|
||||||
x: let
|
++ (
|
||||||
ws = builtins.toString (x);
|
builtins.concatLists (builtins.genList (
|
||||||
in [
|
x: let
|
||||||
"$mod,${ws},workspace,${ws}"
|
ws = builtins.toString (x);
|
||||||
"ALT,${ws},movetoworkspace,${ws}"
|
in [
|
||||||
]
|
"$mod,${ws},workspace,${ws}"
|
||||||
)
|
"ALT,${ws},movetoworkspace,${ws}"
|
||||||
10)
|
]
|
||||||
);
|
)
|
||||||
bindm = [
|
10)
|
||||||
"$mod,mouse:272,movewindow"
|
);
|
||||||
"$mod,mouse:273,resizewindow"
|
bindm = [
|
||||||
];
|
"$mod,mouse:272,movewindow"
|
||||||
};
|
"$mod,mouse:273,resizewindow"
|
||||||
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue