diff options
Diffstat (limited to 'config/ghostty')
| -rw-r--r-- | config/ghostty/colors/molokai | 25 | ||||
| -rw-r--r-- | config/ghostty/colors/onehalfdark | 25 | ||||
| -rw-r--r-- | config/ghostty/colors/onehalflight | 25 | ||||
| -rw-r--r-- | config/ghostty/colors/papercolorlight | 25 | ||||
| -rw-r--r-- | config/ghostty/colors/pencillight | 25 | ||||
| -rw-r--r-- | config/ghostty/colors/solarizedlight | 29 | ||||
| -rw-r--r-- | config/ghostty/config | 46 | ||||
| -rw-r--r-- | config/ghostty/shader.glsl | 142 |
8 files changed, 342 insertions, 0 deletions
diff --git a/config/ghostty/colors/molokai b/config/ghostty/colors/molokai new file mode 100644 index 0000000..5e8059b --- /dev/null +++ b/config/ghostty/colors/molokai @@ -0,0 +1,25 @@ +# Molokai color scheme (converted from Alacritty) + +# Primary colors +background = #000000 +foreground = #f8f8f2 + +# Normal colors (palette 0-7) +palette = 0=#333333 +palette = 1=#c4265e +palette = 2=#86b42b +palette = 3=#b3b42b +palette = 4=#6a7ec8 +palette = 5=#8c6bc8 +palette = 6=#56adbc +palette = 7=#e3e3dd + +# Bright colors (palette 8-15) +palette = 8=#666666 +palette = 9=#f92672 +palette = 10=#a6e22e +palette = 11=#e2e22e +palette = 12=#819aff +palette = 13=#ae81ff +palette = 14=#66d9ef +palette = 15=#f8f8f2 diff --git a/config/ghostty/colors/onehalfdark b/config/ghostty/colors/onehalfdark new file mode 100644 index 0000000..6dd7f5e --- /dev/null +++ b/config/ghostty/colors/onehalfdark @@ -0,0 +1,25 @@ +# One Half Dark color scheme (converted from Alacritty) + +# Primary colors +background = #282c34 +foreground = #dcdfe4 + +# Normal colors (palette 0-7) +palette = 0=#282c34 +palette = 1=#e06c75 +palette = 2=#98c379 +palette = 3=#e5c07b +palette = 4=#61afef +palette = 5=#c678dd +palette = 6=#56b6c2 +palette = 7=#dcdfe4 + +# Bright colors (palette 8-15) +palette = 8=#282c34 +palette = 9=#e06c75 +palette = 10=#98c379 +palette = 11=#e5c07b +palette = 12=#61afef +palette = 13=#c678dd +palette = 14=#56b6c2 +palette = 15=#dcdfe4 diff --git a/config/ghostty/colors/onehalflight b/config/ghostty/colors/onehalflight new file mode 100644 index 0000000..0369f86 --- /dev/null +++ b/config/ghostty/colors/onehalflight @@ -0,0 +1,25 @@ +# One Half Light color scheme (converted from Alacritty) + +# Primary colors +background = #fafafa +foreground = #383a42 + +# Normal colors (palette 0-7) +palette = 0=#383a42 +palette = 1=#e45649 +palette = 2=#50a14f +palette = 3=#c18401 +palette = 4=#0184bc +palette = 5=#a626a4 +palette = 6=#0997b3 +palette = 7=#fafafa + +# Bright colors (palette 8-15) +palette = 8=#383a42 +palette = 9=#e45649 +palette = 10=#50a14f +palette = 11=#c18401 +palette = 12=#0184bc +palette = 13=#a626a4 +palette = 14=#0997b3 +palette = 15=#fafafa diff --git a/config/ghostty/colors/papercolorlight b/config/ghostty/colors/papercolorlight new file mode 100644 index 0000000..b916f9c --- /dev/null +++ b/config/ghostty/colors/papercolorlight @@ -0,0 +1,25 @@ +# PaperColor Light color scheme (converted from Alacritty) + +# Primary colors +background = #eeeeee +foreground = #4d4d4c + +# Normal colors (palette 0-7) +palette = 0=#ededed +palette = 1=#d7005f +palette = 2=#718c00 +palette = 3=#d75f00 +palette = 4=#4271ae +palette = 5=#8959a8 +palette = 6=#3e999f +palette = 7=#4d4d4c + +# Bright colors (palette 8-15) +palette = 8=#969694 +palette = 9=#d7005f +palette = 10=#718c00 +palette = 11=#d75f00 +palette = 12=#4271ae +palette = 13=#8959a8 +palette = 14=#3e999f +palette = 15=#f5f5f5 diff --git a/config/ghostty/colors/pencillight b/config/ghostty/colors/pencillight new file mode 100644 index 0000000..26d44c0 --- /dev/null +++ b/config/ghostty/colors/pencillight @@ -0,0 +1,25 @@ +# Pencil Light color scheme (converted from Alacritty) + +# Primary colors +background = #f1f1f1 +foreground = #424242 + +# Normal colors (palette 0-7) +palette = 0=#212121 +palette = 1=#c30771 +palette = 2=#10a778 +palette = 3=#a89c14 +palette = 4=#008ec4 +palette = 5=#523c79 +palette = 6=#20a5ba +palette = 7=#e0e0e0 + +# Bright colors (palette 8-15) +palette = 8=#212121 +palette = 9=#fb007a +palette = 10=#5fd7af +palette = 11=#f3e430 +palette = 12=#20bbfc +palette = 13=#6855de +palette = 14=#4fb8cc +palette = 15=#f1f1f1 diff --git a/config/ghostty/colors/solarizedlight b/config/ghostty/colors/solarizedlight new file mode 100644 index 0000000..009dbf9 --- /dev/null +++ b/config/ghostty/colors/solarizedlight @@ -0,0 +1,29 @@ +# Solarized Light color scheme (converted from Alacritty) + +# Primary colors +background = #fdf6e3 +foreground = #657b83 + +# Cursor colors +cursor-color = #657b83 +cursor-text = #fdf6e3 + +# Normal colors (palette 0-7) +palette = 0=#073642 +palette = 1=#dc322f +palette = 2=#859900 +palette = 3=#b58900 +palette = 4=#268bd2 +palette = 5=#d33682 +palette = 6=#2aa198 +palette = 7=#eee8d5 + +# Bright colors (palette 8-15) +palette = 8=#002b36 +palette = 9=#cb4b16 +palette = 10=#586e75 +palette = 11=#657b83 +palette = 12=#839496 +palette = 13=#6c71c4 +palette = 14=#93a1a1 +palette = 15=#fdf6e3 diff --git a/config/ghostty/config b/config/ghostty/config new file mode 100644 index 0000000..67393b4 --- /dev/null +++ b/config/ghostty/config @@ -0,0 +1,46 @@ +# Shell configuration +command = /bin/zsh --login -ic "exec tmux new-session -As 0 -f ~/.tmux.conf" + +# Window settings +title = +background-opacity = 1 +# background-blur = true + +# Do not confirm before closing. +confirm-close-surface = false + +# Terminal settings +# term = xterm-256color +scrollback-limit = 0 + +# Keyboard bindings +keybind = alt+enter=toggle_fullscreen +keybind = super+enter=toggle_fullscreen + +# Font configuration +# font-family = FiraCode Nerd Font Ret +# font-family = Agave Nerd Font Mono +font-family = Mononoki Nerd Font Mono +font-size = 12 + +# Default theme (can be overridden by theme script via color file) +# Available themes: ghostty +list-themes +# theme = Brogrammer +# theme = Monokai Pro Spectrum +# theme = Monokai Soda +# theme = Builtin Light + +# Import color scheme (managed by theme script) +config-file = ~/.local/share/ghostty/color + +# Shader +# custom-shader = ~/.config/ghostty/shader.glsl + +# macOS specific +click-repeat-interval = 500 +macos-titlebar-proxy-icon = hidden +macos-titlebar-style = hidden +auto-update-channel = tip + +# Text selection +selection-background = #ff5a00 diff --git a/config/ghostty/shader.glsl b/config/ghostty/shader.glsl new file mode 100644 index 0000000..2bb9a12 --- /dev/null +++ b/config/ghostty/shader.glsl @@ -0,0 +1,142 @@ +// Based on https://gist.github.com/chardskarth/95874c54e29da6b5a36ab7b50ae2d088 +float ease(float x) { + return pow(1.0 - x, 10.0); +} + +float sdBox(in vec2 p, in vec2 xy, in vec2 b) +{ + vec2 d = abs(p - xy) - b; + return length(max(d, 0.0)) + min(max(d.x, d.y), 0.0); +} + +float getSdfRectangle(in vec2 p, in vec2 xy, in vec2 b) +{ + vec2 d = abs(p - xy) - b; + return length(max(d, 0.0)) + min(max(d.x, d.y), 0.0); +} +// Based on Inigo Quilez's 2D distance functions article: https://iquilezles.org/articles/distfunctions2d/ +// Potencially optimized by eliminating conditionals and loops to enhance performance and reduce branching +float seg(in vec2 p, in vec2 a, in vec2 b, inout float s, float d) { + vec2 e = b - a; + vec2 w = p - a; + vec2 proj = a + e * clamp(dot(w, e) / dot(e, e), 0.0, 1.0); + float segd = dot(p - proj, p - proj); + d = min(d, segd); + + float c0 = step(0.0, p.y - a.y); + float c1 = 1.0 - step(0.0, p.y - b.y); + float c2 = 1.0 - step(0.0, e.x * w.y - e.y * w.x); + float allCond = c0 * c1 * c2; + float noneCond = (1.0 - c0) * (1.0 - c1) * (1.0 - c2); + float flip = mix(1.0, -1.0, step(0.5, allCond + noneCond)); + s *= flip; + return d; +} + +float getSdfParallelogram(in vec2 p, in vec2 v0, in vec2 v1, in vec2 v2, in vec2 v3) { + float s = 1.0; + float d = dot(p - v0, p - v0); + + d = seg(p, v0, v3, s, d); + d = seg(p, v1, v0, s, d); + d = seg(p, v2, v1, s, d); + d = seg(p, v3, v2, s, d); + + return s * sqrt(d); +} + +vec2 normalize(vec2 value, float isPosition) { + return (value * 2.0 - (iResolution.xy * isPosition)) / iResolution.y; +} + +float blend(float t) +{ + float sqr = t * t; + return sqr / (2.0 * (sqr - t) + 1.0); +} + +float antialising(float distance) { + return 1. - smoothstep(0., normalize(vec2(2., 2.), 0.).x, distance); +} + +float determineStartVertexFactor(vec2 a, vec2 b) { + // Conditions using step + float condition1 = step(b.x, a.x) * step(a.y, b.y); // a.x < b.x && a.y > b.y + float condition2 = step(a.x, b.x) * step(b.y, a.y); // a.x > b.x && a.y < b.y + + // If neither condition is met, return 1 (else case) + return 1.0 - max(condition1, condition2); +} +vec2 getRectangleCenter(vec4 rectangle) { + return vec2(rectangle.x + (rectangle.z / 2.), rectangle.y - (rectangle.w / 2.)); +} + +const vec4 TRAIL_COLOR = vec4(1.0, 0.725, 0.161, 1.0); // yellow +const vec4 CURRENT_CURSOR_COLOR = TRAIL_COLOR; +const vec4 PREVIOUS_CURSOR_COLOR = TRAIL_COLOR; +const vec4 TRAIL_COLOR_ACCENT = vec4(1.0, 0., 0., 1.0); // red-orange +const float DURATION = .5; +const float OPACITY = .2; +// Don't draw trail within that distance * cursor size. +// This prevents trails from appearing when typing. +const float DRAW_THRESHOLD = 1.5; +// Don't draw trails within the same line: same line jumps are usually where +// people expect them. +const bool HIDE_TRAILS_ON_THE_SAME_LINE = false; + +void mainImage(out vec4 fragColor, in vec2 fragCoord) +{ + #if !defined(WEB) + fragColor = texture(iChannel0, fragCoord.xy / iResolution.xy); + #endif + //Normalization for fragCoord to a space of -1 to 1; + vec2 vu = normalize(fragCoord, 1.); + vec2 offsetFactor = vec2(-.5, 0.5); + + //Normalization for cursor position and size; + //cursor xy has the postion in a space of -1 to 1; + //zw has the width and height + vec4 currentCursor = vec4(normalize(iCurrentCursor.xy, 1.), normalize(iCurrentCursor.zw, 0.)); + vec4 previousCursor = vec4(normalize(iPreviousCursor.xy, 1.), normalize(iPreviousCursor.zw, 0.)); + + //When drawing a parellelogram between cursors for the trail i need to determine where to start at the top-left or top-right vertex of the cursor + float vertexFactor = determineStartVertexFactor(currentCursor.xy, previousCursor.xy); + float invertedVertexFactor = 1.0 - vertexFactor; + + //Set every vertex of my parellogram + vec2 v0 = vec2(currentCursor.x + currentCursor.z * vertexFactor, currentCursor.y - currentCursor.w); + vec2 v1 = vec2(currentCursor.x + currentCursor.z * invertedVertexFactor, currentCursor.y); + vec2 v2 = vec2(previousCursor.x + currentCursor.z * invertedVertexFactor, previousCursor.y); + vec2 v3 = vec2(previousCursor.x + currentCursor.z * vertexFactor, previousCursor.y - previousCursor.w); + + vec4 newColor = vec4(fragColor); + + float progress = blend(clamp((iTime - iTimeCursorChange) / DURATION, 0.0, 1)); + float easedProgress = ease(progress); + + //Distance between cursors determine the total length of the parallelogram; + vec2 centerCC = getRectangleCenter(currentCursor); + vec2 centerCP = getRectangleCenter(previousCursor); + float cursorSize = max(currentCursor.z, currentCursor.w); + float trailThreshold = DRAW_THRESHOLD * cursorSize; + float lineLength = distance(centerCC, centerCP); + // + bool isFarEnough = lineLength > trailThreshold; + bool isOnSeparateLine = HIDE_TRAILS_ON_THE_SAME_LINE ? currentCursor.y != previousCursor.y : true; + if (isFarEnough && isOnSeparateLine) { + float distanceToEnd = distance(vu.xy, centerCC); + float alphaModifier = distanceToEnd / (lineLength * (easedProgress)); + + if (alphaModifier > 1.0) { // this change fixed it for me. + alphaModifier = 1.0; + } + + float sdfCursor = getSdfRectangle(vu, currentCursor.xy - (currentCursor.zw * offsetFactor), currentCursor.zw * 0.5); + float sdfTrail = getSdfParallelogram(vu, v0, v1, v2, v3); + + newColor = mix(newColor, TRAIL_COLOR_ACCENT, 1.0 - smoothstep(sdfTrail, -0.01, 0.001)); + newColor = mix(newColor, TRAIL_COLOR, antialising(sdfTrail)); + newColor = mix(fragColor, newColor, 1.0 - alphaModifier); + fragColor = mix(newColor, fragColor, step(sdfCursor, 0)); + } +} |
