diff --git a/modules/users/modules/browser/default.nix b/modules/users/modules/browser/default.nix new file mode 100644 index 0000000..2443a80 --- /dev/null +++ b/modules/users/modules/browser/default.nix @@ -0,0 +1,34 @@ +{ + lib, + config, + pkgs, + ... +}: + +with lib; +{ + imports = [ + ./firefox/default.nix + ./qutebrowser/default.nix + ]; + + options.default.browser = mkOption { + type = types.str; + default = ""; + description = "Default browser"; + }; + + config = { + xdg.mimeApps = { + enable = true; + + defaultApplications = { + "text/html" = "${config.default.browser}"; + "x-scheme-handler/http" = "${config.default.browser}"; + "x-scheme-handler/https" = "${config.default.browser}"; + "x-scheme-handler/about" = "${config.default.browser}"; + "x-scheme-handler/unknown" = "${config.default.browser}"; + }; + }; + }; +} diff --git a/modules/users/modules/firefox/default.nix b/modules/users/modules/browser/firefox/default.nix similarity index 91% rename from modules/users/modules/firefox/default.nix rename to modules/users/modules/browser/firefox/default.nix index 12aff52..dc53da7 100644 --- a/modules/users/modules/firefox/default.nix +++ b/modules/users/modules/browser/firefox/default.nix @@ -10,9 +10,14 @@ let cfg = config.modules.firefox; in { - options.modules.firefox.enable = lib.mkEnableOption "firefox"; + options.modules.firefox = { + enable = lib.mkEnableOption "firefox"; + default = lib.mkEnableOption "default"; + }; config = lib.mkIf cfg.enable { + default.browser = mkIf cfg.default "firefox.desktop"; + # Enable NUR nixpkgs.config.packageOverrides = pkgs: { # TODO: Pin the version @@ -63,7 +68,6 @@ in colors = config.theming.colorsCSS; } ); - # userContent = builtins.readFile ./userContent.css; settings = { "browser.tabs.inTitlebar" = 0; diff --git a/modules/users/modules/browser/firefox/userChrome.css b/modules/users/modules/browser/firefox/userChrome.css new file mode 100644 index 0000000..821ba92 --- /dev/null +++ b/modules/users/modules/browser/firefox/userChrome.css @@ -0,0 +1,73 @@ +/* Import theme colors */ +@colors@ + +/* Configure titlebar */ +#titlebar { + /* Add consistent margins to tab bar */ + padding: 0 2px !important; + + /* Add emphasized color to background of tab bar */ + background-color: var(--nix-color-bg-status) !important; + + /* Set correct text color */ + color: var(--nix-color-fg) !important; +} + +.tab-background:is([selected], [multiselected]) { + /* Set correct background color */ + background-color: var(--nix-color-bg) !important; +} + +.tab-content { + /* Set correct text color */ + color: var(--nix-color-fg) !important; +} + +/* Configure navigation bar */ +#nav-bar { + /* Set correct background color */ + background-color: var(--nix-color-bg) !important; + + /* Set correct text color */ + color: var(--nix-color-fg) !important; +} + +#urlbar { + /* Set correct text color */ + color: var(--nix-color-fg) !important; +} + +#urlbar[open]>#urlbar-background { + /* Set correct background color when opened */ + background-color: var(--nix-color-bg) !important; + + /* Use same box-shadow as tabs when opened */ + border: none !important; + box-shadow: 0 0 4px rgba(0, 0, 0, .4) !important; +} + +#urlbar[focused]:not([suppress-focus-border])>#urlbar-background { + /* Set better outline for focused urlbar */ + outline-color: var(--nix-color-border-focused) !important; + outline-width: 1px !important; + outline-offset: 0 !important; +} + +#urlbar-background { + /* Set the correct background color */ + background-color: var(--nix-color-bg-status) !important; +} + +/* Configure popups */ +panelview { + /* Set correct background color for popups */ + background-color: var(--nix-color-bg) !important; + + /* Set correct text color */ + color: var(--nix-color-fg) !important; +} + +menupopup { + /* Set correct background color for context menus */ + --panel-background: var(--nix-color-bg) !important; +} \ No newline at end of file diff --git a/modules/users/modules/firefox/userContent.css b/modules/users/modules/browser/firefox/userContent.css similarity index 100% rename from modules/users/modules/firefox/userContent.css rename to modules/users/modules/browser/firefox/userContent.css diff --git a/modules/users/modules/qutebrowser/default.nix b/modules/users/modules/browser/qutebrowser/default.nix similarity index 74% rename from modules/users/modules/qutebrowser/default.nix rename to modules/users/modules/browser/qutebrowser/default.nix index 850de0c..9b05a00 100644 --- a/modules/users/modules/qutebrowser/default.nix +++ b/modules/users/modules/browser/qutebrowser/default.nix @@ -11,9 +11,14 @@ let theme = config.theming; in { - options.modules.qutebrowser.enable = mkEnableOption "qutebrowser"; + options.modules.qutebrowser = { + enable = mkEnableOption "qutebrowser"; + default = mkEnableOption "default"; + }; config = mkIf cfg.enable { + default.browser = mkIf cfg.default "org.qutebrowser.qutebrowser.desktop"; + programs.qutebrowser = { enable = true; diff --git a/modules/users/modules/default.nix b/modules/users/modules/default.nix index b53f9e0..0abfbe3 100644 --- a/modules/users/modules/default.nix +++ b/modules/users/modules/default.nix @@ -8,23 +8,23 @@ { imports = [ # Import all modules + ./browser/default.nix ./desktop/default.nix ./discord/default.nix ./feishin/default.nix - ./firefox/default.nix ./fontconfig/default.nix - ./foot/default.nix ./language/nix.nix ./language/rust.nix ./mako/default.nix ./neovim/default.nix ./obsidian/default.nix - ./qutebrowser/default.nix ./rofi/default.nix ./rofi/rofi-rbw.nix ./shell/bash.nix ./shell/fish.nix ./steam/default.nix + ./terminal/default.nix + ./terminal/foot/default.nix ./theming/default.nix ./vscode/default.nix ./winbox/default.nix diff --git a/modules/users/modules/desktop/background/glpaper/default.nix b/modules/users/modules/desktop/background/glpaper/default.nix new file mode 100644 index 0000000..4f52a2b --- /dev/null +++ b/modules/users/modules/desktop/background/glpaper/default.nix @@ -0,0 +1,23 @@ +{ + lib, + config, + pkgs, + ... +}: + +with lib; +let + cfg = config.modules.glpaper; +in +{ + options.modules.glpaper = { + enable = mkEnableOption "glpaper"; + shader = mkOption { + type = types.path; + default = ./shaders/waves.glsl; + description = "Shader to use for the background"; + }; + }; + + config = mkIf cfg.enable { home.packages = [ pkgs.glpaper ]; }; +} diff --git a/modules/users/modules/desktop/background/glpaper/shaders/galaxy.glsl b/modules/users/modules/desktop/background/glpaper/shaders/galaxy.glsl new file mode 100644 index 0000000..0e891f9 --- /dev/null +++ b/modules/users/modules/desktop/background/glpaper/shaders/galaxy.glsl @@ -0,0 +1,169 @@ +#define zoom 0.900 +#define tile 0.850 +#define speed2 0.0 + +#ifdef GL_ES +precision highp float; +#endif + +uniform float time; +uniform vec2 resolution; + +#define time3 (time * 0.01) + +#define mouse vec2(sin(time3)/48., cos(time3)/48.) +#define iterations 14 +#define formuparam2 0.79 + +#define volsteps 5 +#define stepsize 0.390 + +#define brightness 0.003 +#define darkmatter 0.400 +#define distfading 0.560 +#define saturation 0.800 + +#define transverseSpeed zoom*2.0 +#define cloud 0.11 + +float triangle(float x, float a) { + float output2 = 2.0 * abs(2.0 * ((x/a) - floor((x/a) + 0.5))) - 1.0; + return output2; +} + +float field(in vec3 p) { + float strength = 7. + .03 * log(1.e-6 + fract(sin(time3) * 4373.11)); + float accum = 0.; + float prev = 0.; + float tw = 0.; + + // Replace or uncomment the for-loop as intended in your logic + float mag = dot(p, p); + p = abs(p) / mag + vec3(-.5, -.8 + 0.1*sin(time3*0.7 + 2.0), -1.1+0.3*cos(time3*0.3)); + float w = exp(-float(0) / 7.); + accum += w * exp(-strength * pow(abs(mag - prev), 2.3)); + tw += w; + prev = mag; + + return max(0., 5. * accum / tw - .7); +} + +void main() { + + vec2 uv2 = 2. * gl_FragCoord.xy / vec2(512) - 1.; + vec2 uvs = uv2 * vec2(512) / 512.; + + float time2 = time3; + float speed = speed2; + speed = .01 * cos(time2*0.02 + 3.1415926/4.0); + + float formuparam = formuparam2; + + + vec2 uv = uvs; + + float a_xz = 0.9; + float a_yz = -.6; + float a_xy = 0.9 + time3*0.08; + + mat2 rot_xz = mat2(cos(a_xz),sin(a_xz),-sin(a_xz),cos(a_xz)); + mat2 rot_yz = mat2(cos(a_yz),sin(a_yz),-sin(a_yz),cos(a_yz)); + mat2 rot_xy = mat2(cos(a_xy),sin(a_xy),-sin(a_xy),cos(a_xy)); + + + float v2 =1.0; + vec3 dir=vec3(uv*zoom,1.); + vec3 from=vec3(0.0, 0.0,0.0); + from.x -= 5.0*(mouse.x-0.5); + from.y -= 5.0*(mouse.y-0.5); + + + vec3 forward = vec3(0.,0.,1.); + from.x += transverseSpeed*(1.0)*cos(0.01*time3) + 0.001*time3; + from.y += transverseSpeed*(1.0)*sin(0.01*time3) +0.001*time3; + from.z += 0.003*time3; + + dir.xy*=rot_xy; + forward.xy *= rot_xy; + dir.xz*=rot_xz; + forward.xz *= rot_xz; + dir.yz*= rot_yz; + forward.yz *= rot_yz; + + from.xy*=-rot_xy; + from.xz*=rot_xz; + from.yz*= rot_yz; + + float zooom = (time2-3311.)*speed; + from += forward* zooom; + float sampleShift = mod( zooom, stepsize ); + + float zoffset = -sampleShift; + sampleShift /= stepsize; + + + float s=0.24; + float s3 = s + stepsize/2.0; + vec3 v=vec3(0.); + float t3 = 0.0; + + vec3 backCol2 = vec3(0.); + for (int r=0; r 7 ? min( 12., D) : D; + pa=length(p2); + } + + + + a*=a*a; + + float s1 = s+zoffset; + + float fade = pow(distfading,max(0.,float(r)-sampleShift)); + + v+=fade; + + + + if( r == 0 ) + fade *= (1. - (sampleShift)); + + if( r == volsteps-1 ) + fade *= sampleShift; + v+=vec3(s1,s1*s1,s1*s1*s1*s1)*a*brightness*fade; + + backCol2 += mix(.11, 1., v2) * vec3(1.8 * t3 * t3 * t3, 1.4 * t3 * t3, t3) * fade; + + + s+=stepsize; + s3 += stepsize; + } + + v=mix(vec3(length(v)),v,saturation); + + vec4 forCol2 = vec4(v*.01,1.); + #ifdef cloud + backCol2 *= cloud; + #endif + backCol2.b *= 1.8; + backCol2.r *= 0.05; + + backCol2.b = 0.5*mix(backCol2.g, backCol2.b, 0.8); + backCol2.g = 0.0; + backCol2.bg = mix(backCol2.gb, backCol2.bg, 0.5*(cos(time3*0.01) + 1.0)); + gl_FragColor = forCol2 + vec4(backCol2, 1.0); +} \ No newline at end of file diff --git a/modules/users/modules/desktop/background/glpaper/shaders/next.glsl b/modules/users/modules/desktop/background/glpaper/shaders/next.glsl new file mode 100644 index 0000000..7c96afc --- /dev/null +++ b/modules/users/modules/desktop/background/glpaper/shaders/next.glsl @@ -0,0 +1,118 @@ +#ifdef GL_ES +precision mediump float; +#endif + +// glslsandbox uniforms +uniform float time; +uniform vec2 resolution; + +// shadertoy emulation +#define iTime time * 0.01 + 10.0 +#define iResolution resolution +#define fragCoord gl_FragCoord +#define fragColor gl_FragColor + +float colormap_red(float x) { + if (x < 0.0) { + return 54.0 / 255.0; + } else if (x < 20049.0 / 82979.0) { + return (829.79 * x + 54.51) / 255.0; + } else { + return 1.0; + } +} + +float colormap_green(float x) { + if (x < 20049.0 / 82979.0) { + return 0.0; + } else if (x < 327013.0 / 810990.0) { + return (8546482679670.0 / 10875673217.0 * x - 2064961390770.0 / 10875673217.0) / 255.0; + } else if (x <= 1.0) { + return (103806720.0 / 483977.0 * x + 19607415.0 / 483977.0) / 255.0; + } else { + return 1.0; + } +} + +float colormap_blue(float x) { + if (x < 0.0) { + return 54.0 / 255.0; + } else if (x < 7249.0 / 82979.0) { + return (829.79 * x + 54.51) / 255.0; + } else if (x < 20049.0 / 82979.0) { + return 127.0 / 255.0; + } else if (x < 327013.0 / 810990.0) { + return (792.02249341361393720147485376583 * x - 64.364790735602331034989206222672) / 255.0; + } else { + return 1.0; + } +} + +vec4 colormap(float x) { + return vec4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0); +} + +// https://iquilezles.org/articles/warp +/*float noise( in vec2 x ) +{ + vec2 p = floor(x); + vec2 f = fract(x); + f = f*f*(3.0-2.0*f); + float a = textureLod(iChannel0,(p+vec2(0.5,0.5))/256.0,0.0).x; + float b = textureLod(iChannel0,(p+vec2(1.5,0.5))/256.0,0.0).x; + float c = textureLod(iChannel0,(p+vec2(0.5,1.5))/256.0,0.0).x; + float d = textureLod(iChannel0,(p+vec2(1.5,1.5))/256.0,0.0).x; + return mix(mix( a, b,f.x), mix( c, d,f.x),f.y); +}*/ + + +float rand(vec2 n) { + return fract(sin(dot(n, vec2(12.9898, 4.1414))) * 43758.5453); +} + +float noise(vec2 p){ + vec2 ip = floor(p); + vec2 u = fract(p); + u = u*u*(3.0-2.0*u); + + float res = mix( + mix(rand(ip),rand(ip+vec2(1.0,0.0)),u.x), + mix(rand(ip+vec2(0.0,1.0)),rand(ip+vec2(1.0,1.0)),u.x),u.y); + return res*res; +} + +const mat2 mtx = mat2( 0.80, 0.60, -0.60, 0.80 ); + +float fbm( vec2 p ) +{ + float f = 0.0; + + f += 0.500000*noise( p + iTime ); p = mtx*p*2.02; + f += 0.031250*noise( p ); p = mtx*p*2.01; + f += 0.250000*noise( p ); p = mtx*p*2.03; + f += 0.125000*noise( p ); p = mtx*p*2.01; + f += 0.062500*noise( p ); p = mtx*p*2.04; + f += 0.015625*noise( p + sin(iTime) ); + + return f/0.96875; +} + +float pattern( in vec2 p ) +{ + return fbm( p + fbm( p + fbm( p ) ) ); +} + +void main() +{ + vec2 uv = fragCoord.xy/iResolution.x; + float shade = pattern(uv); + fragColor = vec4(colormap(shade).rgb, shade); +} + +/** SHADERDATA +{ + "title": "Base warp fBM", + "description": "Noise but Pink", + "model": "person" +} +*/ \ No newline at end of file diff --git a/modules/users/modules/desktop/background/glpaper/shaders/shadertoy.glsl b/modules/users/modules/desktop/background/glpaper/shaders/shadertoy.glsl new file mode 100644 index 0000000..37f8750 --- /dev/null +++ b/modules/users/modules/desktop/background/glpaper/shaders/shadertoy.glsl @@ -0,0 +1,13 @@ +#ifdef GL_ES +precision mediump float; +#endif + +// glslsandbox uniforms +uniform float time; +uniform vec2 resolution; + +// shadertoy emulation +#define iTime time +#define iResolution resolution +#define fragCoord gl_FragCoord +#define fragColor gl_FragColor \ No newline at end of file diff --git a/modules/users/modules/desktop/background/glpaper/shaders/water.glsl b/modules/users/modules/desktop/background/glpaper/shaders/water.glsl new file mode 100644 index 0000000..9301672 --- /dev/null +++ b/modules/users/modules/desktop/background/glpaper/shaders/water.glsl @@ -0,0 +1,208 @@ +#ifdef GL_ES +precision highp float; +#endif + +uniform float time; +uniform vec2 resolution; + +#define CHAR_SIZE vec2(6, 7) +#define CHAR_SPACING vec2(6, 9) + +vec2 start_pos = vec2(0); +vec2 print_pos = vec2(0); +vec2 print_pos_pre_move = vec2(0); +vec3 text_color = vec3(1); + +/* +Top left pixel is the most significant bit. +Bottom right pixel is the least significant bit. + + ███ | +█ █ | +█ █ | +█ █ | +█████ | +█ █ | +█ █ | + +000000 +100010 +100010 +100010 +111110 +100010 +100010 + +011100 (upper 21 bits) +100010 -> 011100 100010 100010 100 -> 935188 +100010 +100 + 010 (lower 21 bits) +111110 -> 010 111110 100010 100010 -> 780450 +100010 +100010 + +vec2(935188.0,780450.0) +*/ + +//Text coloring +#define HEX(i) text_color = mod(vec3(i / 65536,i / 256,i),vec3(256.0))/255.0; +#define RGB(r,g,b) text_color = vec3(r,g,b); + +#define STRWIDTH(c) (c * CHAR_SPACING.x) +#define STRHEIGHT(c) (c * CHAR_SPACING.y) +#define BEGIN_TEXT(x,y) print_pos = floor(vec2(x,y)); start_pos = floor(vec2(x,y)); + +//Automatically generated from the sprite sheet here: http://uzebox.org/wiki/index.php?title=File:Font6x8.png +#define _ col+=char(vec2(0.0,0.0),uv); +#define _spc col+=char(vec2(0.0,0.0),uv)*text_color; +#define _exc col+=char(vec2(276705.0,32776.0),uv)*text_color; +#define _quo col+=char(vec2(1797408.0,0.0),uv)*text_color; +#define _hsh col+=char(vec2(10738.0,1134484.0),uv)*text_color; +#define _dol col+=char(vec2(538883.0,19976.0),uv)*text_color; +#define _pct col+=char(vec2(1664033.0,68006.0),uv)*text_color; +#define _amp col+=char(vec2(545090.0,174362.0),uv)*text_color; +#define _apo col+=char(vec2(798848.0,0.0),uv)*text_color; +#define _lbr col+=char(vec2(270466.0,66568.0),uv)*text_color; +#define _rbr col+=char(vec2(528449.0,33296.0),uv)*text_color; +#define _ast col+=char(vec2(10471.0,1688832.0),uv)*text_color; +#define _crs col+=char(vec2(4167.0,1606144.0),uv)*text_color; +#define _per col+=char(vec2(0.0,1560.0),uv)*text_color; +#define _dsh col+=char(vec2(7.0,1572864.0),uv)*text_color; +#define _com col+=char(vec2(0.0,1544.0),uv)*text_color; +#define _lsl col+=char(vec2(1057.0,67584.0),uv)*text_color; +#define _0 col+=char(vec2(935221.0,731292.0),uv)*text_color; +#define _1 col+=char(vec2(274497.0,33308.0),uv)*text_color; +#define _2 col+=char(vec2(934929.0,1116222.0),uv)*text_color; +#define _3 col+=char(vec2(934931.0,1058972.0),uv)*text_color; +#define _4 col+=char(vec2(137380.0,1302788.0),uv)*text_color; +#define _5 col+=char(vec2(2048263.0,1058972.0),uv)*text_color; +#define _6 col+=char(vec2(401671.0,1190044.0),uv)*text_color; +#define _7 col+=char(vec2(2032673.0,66576.0),uv)*text_color; +#define _8 col+=char(vec2(935187.0,1190044.0),uv)*text_color; +#define _9 col+=char(vec2(935187.0,1581336.0),uv)*text_color; +#define _col col+=char(vec2(195.0,1560.0),uv)*text_color; +#define _scl col+=char(vec2(195.0,1544.0),uv)*text_color; +#define _les col+=char(vec2(135300.0,66052.0),uv)*text_color; +#define _equ col+=char(vec2(496.0,3968.0),uv)*text_color; +#define _grt col+=char(vec2(528416.0,541200.0),uv)*text_color; +#define _que col+=char(vec2(934929.0,1081352.0),uv)*text_color; +#define _ats col+=char(vec2(935285.0,714780.0),uv)*text_color; +#define _A col+=char(vec2(935188.0,780450.0),uv)*text_color; +#define _B col+=char(vec2(1983767.0,1190076.0),uv)*text_color; +#define _C col+=char(vec2(935172.0,133276.0),uv)*text_color; +#define _D col+=char(vec2(1983764.0,665788.0),uv)*text_color; +#define _E col+=char(vec2(2048263.0,1181758.0),uv)*text_color; +#define _F col+=char(vec2(2048263.0,1181728.0),uv)*text_color; +#define _G col+=char(vec2(935173.0,1714334.0),uv)*text_color; +#define _H col+=char(vec2(1131799.0,1714338.0),uv)*text_color; +#define _I col+=char(vec2(921665.0,33308.0),uv)*text_color; +#define _J col+=char(vec2(66576.0,665756.0),uv)*text_color; +#define _K col+=char(vec2(1132870.0,166178.0),uv)*text_color; +#define _L col+=char(vec2(1065220.0,133182.0),uv)*text_color; +#define _M col+=char(vec2(1142100.0,665762.0),uv)*text_color; +#define _N col+=char(vec2(1140052.0,1714338.0),uv)*text_color; +#define _O col+=char(vec2(935188.0,665756.0),uv)*text_color; +#define _P col+=char(vec2(1983767.0,1181728.0),uv)*text_color; +#define _Q col+=char(vec2(935188.0,698650.0),uv)*text_color; +#define _R col+=char(vec2(1983767.0,1198242.0),uv)*text_color; +#define _S col+=char(vec2(935171.0,1058972.0),uv)*text_color; +#define _T col+=char(vec2(2035777.0,33288.0),uv)*text_color; +#define _U col+=char(vec2(1131796.0,665756.0),uv)*text_color; +#define _V col+=char(vec2(1131796.0,664840.0),uv)*text_color; +#define _W col+=char(vec2(1131861.0,699028.0),uv)*text_color; +#define _X col+=char(vec2(1131681.0,84130.0),uv)*text_color; +#define _Y col+=char(vec2(1131794.0,1081864.0),uv)*text_color; +#define _Z col+=char(vec2(1968194.0,133180.0),uv)*text_color; +#define _lsb col+=char(vec2(925826.0,66588.0),uv)*text_color; +#define _rsl col+=char(vec2(16513.0,16512.0),uv)*text_color; +#define _rsb col+=char(vec2(919584.0,1065244.0),uv)*text_color; +#define _pow col+=char(vec2(272656.0,0.0),uv)*text_color; +#define _usc col+=char(vec2(0.0,62.0),uv)*text_color; +#define _a col+=char(vec2(224.0,649374.0),uv)*text_color; +#define _b col+=char(vec2(1065444.0,665788.0),uv)*text_color; +#define _c col+=char(vec2(228.0,657564.0),uv)*text_color; +#define _d col+=char(vec2(66804.0,665758.0),uv)*text_color; +#define _e col+=char(vec2(228.0,772124.0),uv)*text_color; +#define _f col+=char(vec2(401543.0,1115152.0),uv)*text_color; +#define _g col+=char(vec2(244.0,665474.0),uv)*text_color; +#define _h col+=char(vec2(1065444.0,665762.0),uv)*text_color; +#define _i col+=char(vec2(262209.0,33292.0),uv)*text_color; +#define _j col+=char(vec2(131168.0,1066252.0),uv)*text_color; +#define _k col+=char(vec2(1065253.0,199204.0),uv)*text_color; +#define _l col+=char(vec2(266305.0,33292.0),uv)*text_color; +#define _m col+=char(vec2(421.0,698530.0),uv)*text_color; +#define _n col+=char(vec2(452.0,1198372.0),uv)*text_color; +#define _o col+=char(vec2(228.0,665756.0),uv)*text_color; +#define _p col+=char(vec2(484.0,667424.0),uv)*text_color; +#define _q col+=char(vec2(244.0,665474.0),uv)*text_color; +#define _r col+=char(vec2(354.0,590904.0),uv)*text_color; +#define _s col+=char(vec2(228.0,114844.0),uv)*text_color; +#define _t col+=char(vec2(8674.0,66824.0),uv)*text_color; +#define _u col+=char(vec2(292.0,1198868.0),uv)*text_color; +#define _v col+=char(vec2(276.0,664840.0),uv)*text_color; +#define _w col+=char(vec2(276.0,700308.0),uv)*text_color; +#define _x col+=char(vec2(292.0,1149220.0),uv)*text_color; +#define _y col+=char(vec2(292.0,1163824.0),uv)*text_color; +#define _z col+=char(vec2(480.0,1148988.0),uv)*text_color; +#define _lpa col+=char(vec2(401542.0,66572.0),uv)*text_color; +#define _bar col+=char(vec2(266304.0,33288.0),uv)*text_color; +#define _rpa col+=char(vec2(788512.0,1589528.0),uv)*text_color; +#define _tid col+=char(vec2(675840.0,0.0),uv)*text_color; +#define _lar col+=char(vec2(8387.0,1147904.0),uv)*text_color; +#define _nl print_pos = start_pos - vec2(0,CHAR_SPACING.y); + +//Extracts bit b from the given number. +float extract_bit(float n, float b) +{ + b = clamp(b,-1.0,22.0); + return floor(mod(floor(n / pow(2.0,floor(b))),2.0)); +} + +//Returns the pixel at uv in the given bit-packed sprite. +float sprite(vec2 spr, vec2 size, vec2 uv) +{ + uv = floor(uv); + float bit = (size.x-uv.x-1.0) + uv.y * size.x; + bool bounds = all(greaterThanEqual(uv,vec2(0)))&& all(lessThan(uv,size)); + return bounds ? extract_bit(spr.x, bit - 21.0) + extract_bit(spr.y, bit) : 0.0; +} + +//Prints a character and moves the print position forward by 1 character width. +vec3 char(vec2 ch, vec2 uv) +{ + float px = sprite(ch, CHAR_SIZE, uv - print_pos); + print_pos.x += CHAR_SPACING.x; + print_pos.y += sin(4.*print_pos.x-time*10.); + return vec3(px); +} + + +vec3 Text(vec2 uv) +{ + vec3 col = vec3(0.0); + + vec2 center_pos = vec2(resolution.x/2.0 - STRWIDTH(20.0)/2.0,resolution.y/2.0 - STRHEIGHT(1.0)/2.0); + + BEGIN_TEXT(center_pos.x,center_pos.y) + HEX(0x00ffFF) _ _ _w _a _t _e _r _ _; + BEGIN_TEXT(resolution.x/2.0-STRWIDTH(11.0)/2.0,resolution.y/2.0) + print_pos += vec2(cos(time)*96.,sin(time)*96.); + + // RGB(1,0,0) _M RGB(1,.5,0)_o RGB(1,1,0)_v RGB(0,1,0)_i RGB(0,.5,1)_n RGB(0.5,0,1)_g _ RGB(1,0,0)_T RGB(1,.5,0)_e RGB(1,1,0)_x RGB(0,1,0)_t + + return col; +} + +void main( void ) +{ + vec2 uv = gl_FragCoord.xy; + vec2 duv = floor(gl_FragCoord.xy); + + vec3 pixel = Text(duv); + + vec3 col = pixel*0.9+0.1; + col *= (1.-distance(mod(uv,vec2(1.0)),vec2(0.65)))*1.2; + + gl_FragColor = vec4(vec3(col), 1.0); +} \ No newline at end of file diff --git a/modules/users/modules/desktop/background/glpaper/shaders/waves.glsl b/modules/users/modules/desktop/background/glpaper/shaders/waves.glsl new file mode 100644 index 0000000..526d10d --- /dev/null +++ b/modules/users/modules/desktop/background/glpaper/shaders/waves.glsl @@ -0,0 +1,108 @@ +#ifdef GL_ES +precision mediump float; +#endif + +uniform float time; +uniform vec2 resolution; + +#define iTime time * 0.01 + 10.0 +#define iResolution resolution +#define fragCoord gl_FragCoord +#define fragColor gl_FragColor + +float colormap_red(float x) { + if (x < 0.0) { + return 54.0 / 255.0; + } else if (x < 20049.0 / 82979.0) { + return (829.79 * x + 54.51) / 255.0; + } else { + return 1.0; + } +} + +float colormap_green(float x) { + if (x < 20049.0 / 82979.0) { + return 0.0; + } else if (x < 327013.0 / 810990.0) { + return (8546482679670.0 / 10875673217.0 * x - 2064961390770.0 / 10875673217.0) / 255.0; + } else if (x <= 1.0) { + return (103806720.0 / 483977.0 * x + 19607415.0 / 483977.0) / 255.0; + } else { + return 1.0; + } +} + +float colormap_blue(float x) { + if (x < 0.0) { + return 54.0 / 255.0; + } else if (x < 7249.0 / 82979.0) { + return (829.79 * x + 54.51) / 255.0; + } else if (x < 20049.0 / 82979.0) { + return 127.0 / 255.0; + } else if (x < 327013.0 / 810990.0) { + return (792.02249341361393720147485376583 * x - 64.364790735602331034989206222672) / 255.0; + } else { + return 1.0; + } +} + +vec4 colormap(float x) { + return vec4(colormap_red(x), colormap_green(x), colormap_blue(x), 1.0); +} + +// https://iquilezles.org/articles/warp +/*float noise( in vec2 x ) +{ + vec2 p = floor(x); + vec2 f = fract(x); + f = f*f*(3.0-2.0*f); + float a = textureLod(iChannel0,(p+vec2(0.5,0.5))/256.0,0.0).x; + float b = textureLod(iChannel0,(p+vec2(1.5,0.5))/256.0,0.0).x; + float c = textureLod(iChannel0,(p+vec2(0.5,1.5))/256.0,0.0).x; + float d = textureLod(iChannel0,(p+vec2(1.5,1.5))/256.0,0.0).x; + return mix(mix( a, b,f.x), mix( c, d,f.x),f.y); +}*/ + + +float rand(vec2 n) { + return fract(sin(dot(n, vec2(12.9898, 4.1414))) * 43758.5453); +} + +float noise(vec2 p){ + vec2 ip = floor(p); + vec2 u = fract(p); + u = u*u*(3.0-2.0*u); + + float res = mix( + mix(rand(ip),rand(ip+vec2(1.0,0.0)),u.x), + mix(rand(ip+vec2(0.0,1.0)),rand(ip+vec2(1.0,1.0)),u.x),u.y); + return res*res; +} + +const mat2 mtx = mat2( 0.80, 0.60, -0.60, 0.80 ); + +float fbm( vec2 p ) +{ + float f = 0.0; + + f += 0.500000*noise( p + iTime ); p = mtx*p*2.02; + f += 0.031250*noise( p ); p = mtx*p*2.01; + f += 0.250000*noise( p ); p = mtx*p*2.03; + f += 0.125000*noise( p ); p = mtx*p*2.01; + f += 0.062500*noise( p ); p = mtx*p*2.04; + f += 0.015625*noise( p + sin(iTime) ); + + return f/0.96875; +} + +float pattern( in vec2 p ) +{ + return fbm( p + fbm( p + fbm( p ) ) ); +} + +void main() +{ + vec2 uv = fragCoord.xy/iResolution.x; + float shade = pattern(uv); + fragColor = vec4(colormap(shade).rgb, shade); +} \ No newline at end of file diff --git a/modules/users/modules/desktop/default.nix b/modules/users/modules/desktop/default.nix index 63e6a24..ff59af8 100644 --- a/modules/users/modules/desktop/default.nix +++ b/modules/users/modules/desktop/default.nix @@ -12,6 +12,7 @@ in { imports = [ # Import desktop environment modules + ./background/glpaper/default.nix ./bar/waybar.nix ./lock-screen/waylock.nix ./window-manager/river.nix diff --git a/modules/users/modules/desktop/window-manager/river.nix b/modules/users/modules/desktop/window-manager/river.nix index 4425076..8fcea9d 100644 --- a/modules/users/modules/desktop/window-manager/river.nix +++ b/modules/users/modules/desktop/window-manager/river.nix @@ -36,15 +36,17 @@ in # Kill rivertile PATH="${pkgs.procps}/bin:$PATH" $DRY_RUN_CMD pkill rivertile + # Kill glpaper + PATH="${pkgs.procps}/bin:$PATH" $DRY_RUN_CMD pkill glpaper + # Restart river - PATH="${pkgs.river}/bin:$PATH" $DRY_RUN_CMD ~/.config/river/init + PATH="${pkgs.river}/bin:${pkgs.systemd}/bin:$PATH" $DRY_RUN_CMD ~/.config/river/init ''; }; # River setup wayland.windowManager.river = { enable = true; - systemd.enable = false; xwayland.enable = true; settings = let @@ -96,6 +98,7 @@ in spawn = [ "\"${layout} ${layoutOptions}\"" "waybar" + "\"glpaper eDP-1 ${toString config.modules.glpaper.shader}\"" ]; map = ( lib.attrsets.recursiveUpdate diff --git a/modules/users/modules/firefox/userChrome.css b/modules/users/modules/firefox/userChrome.css deleted file mode 100644 index 4df7c21..0000000 --- a/modules/users/modules/firefox/userChrome.css +++ /dev/null @@ -1 +0,0 @@ -@colors@ \ No newline at end of file diff --git a/modules/users/modules/language/nix.nix b/modules/users/modules/language/nix.nix index af8a19c..3cd9e4d 100644 --- a/modules/users/modules/language/nix.nix +++ b/modules/users/modules/language/nix.nix @@ -22,6 +22,14 @@ in nixd ]; + # Add nix tree + xdg.desktopEntries.nix-tree = { + exec = "${pkgs.nix-tree}/bin/nix-tree"; + name = "Nix Tree"; + terminal = true; + type = "Application"; + }; + # VSCode configuration programs.vscode = { extensions = with pkgs.vscode-extensions; [ jnoortheen.nix-ide ]; diff --git a/modules/users/modules/rofi/default.nix b/modules/users/modules/rofi/default.nix index c528068..67c80a0 100644 --- a/modules/users/modules/rofi/default.nix +++ b/modules/users/modules/rofi/default.nix @@ -17,6 +17,7 @@ in config = mkIf cfg.enable { programs.rofi = { enable = true; + terminal = config.default.terminal; package = pkgs.rofi-wayland; font = "${theme.fonts.monospace.name} ${toString theme.fonts.monospace.recommendedSize}"; theme = diff --git a/modules/users/modules/terminal/default.nix b/modules/users/modules/terminal/default.nix new file mode 100644 index 0000000..124f466 --- /dev/null +++ b/modules/users/modules/terminal/default.nix @@ -0,0 +1,14 @@ +{ + lib, + config, + pkgs, + ... +}: + +with lib; +{ + options.default.terminal = mkOption { + type = types.str; + description = "Default terminal application"; + }; +} diff --git a/modules/users/modules/foot/default.nix b/modules/users/modules/terminal/foot/default.nix similarity index 92% rename from modules/users/modules/foot/default.nix rename to modules/users/modules/terminal/foot/default.nix index 2eae4ff..2648ca5 100644 --- a/modules/users/modules/foot/default.nix +++ b/modules/users/modules/terminal/foot/default.nix @@ -13,6 +13,8 @@ in options.modules.foot.enable = mkEnableOption "foot"; config = mkIf cfg.enable { + default.terminal = mkDefault "${pkgs.foot}/bin/foot"; + programs.foot = { enable = true; settings = { diff --git a/modules/users/modules/theming/default.nix b/modules/users/modules/theming/default.nix index 21b7e90..6d0b509 100644 --- a/modules/users/modules/theming/default.nix +++ b/modules/users/modules/theming/default.nix @@ -99,8 +99,9 @@ in { imports = [ # Import all themes - ./themes/gruvbox.nix ./themes/catppuccin.nix + ./themes/gruvbox.nix + ./themes/sakura.nix ]; options.modules.theming.enable = mkEnableOption "theming"; @@ -166,7 +167,7 @@ in }; accent = mkOption { type = types.str; - default = colors.base0D; + default = colors.base0E; }; border-focused = mkOption { type = types.str; diff --git a/modules/users/modules/theming/themes/sakura.nix b/modules/users/modules/theming/themes/sakura.nix new file mode 100644 index 0000000..54c9bb2 --- /dev/null +++ b/modules/users/modules/theming/themes/sakura.nix @@ -0,0 +1,23 @@ +{ + config, + lib, + pkgs, + ... +}: + +with lib; +let + cfg = config.theming.themes.sakura; +in +{ + options = { + theming.themes.sakura = { + enable = mkEnableOption "sakura"; + }; + }; + + config.theming = mkIf cfg.enable { + darkMode = false; + colorScheme = "${pkgs.base16-schemes}/share/themes/sakura.yaml"; + }; +} diff --git a/users/jan.nix b/users/jan.nix index 037a8db..0475b22 100644 --- a/users/jan.nix +++ b/users/jan.nix @@ -13,6 +13,7 @@ river.enable = true; waylock.enable = true; waybar.enable = true; + glpaper.enable = true; # Theming theming.enable = true; @@ -27,7 +28,10 @@ fish.enable = true; winbox.enable = true; discord.enable = true; - qutebrowser.enable = true; + qutebrowser = { + enable = true; + default = true; + }; neovim.enable = true; rofi-rbw.enable = true; @@ -54,9 +58,10 @@ # Color scheme themes.catppuccin = { - enable = true; - flavor = "frappe"; + enable = false; + flavor = "latte"; }; + themes.sakura.enable = true; }; # TODO: Remove everything below, it is here out of convenience and should be elsewhere