387 Commits

Author SHA1 Message Date
Jan200101
6fd901fd3d don't error when gtk4 could not be found via pkg-config 2025-01-03 23:12:11 +01:00
Mitchell Hashimoto
1a530cb96a core: add build option to disable sentry (#3934)
This disables compiling/linking Sentry automatically on platforms other
than macOS, which removes a potential blocker for getting Ghostty
running on *BSD or other systems.

This is also useful for the security paranoid that don't want any chance
that sensitive information could be captured in a crash dump.
2025-01-02 13:49:54 -08:00
Mitchell Hashimoto
f60068eabd add option to strip build regardless of optimization (#3945)
adds the option "strip" which can be used to override the default strip
setting, which is based on the optimization mode.

Useful for a distro setting where you want a release build but still
keep symbols.

Also reuses the option for the shared and static library
2025-01-02 13:41:47 -08:00
Mitchell Hashimoto
7a5ef3da2b remove sentry test for macOS, remove windows check 2025-01-02 13:34:23 -08:00
Jeffrey C. Ollie
cb8d30f938 core: add build option to disable sentry 2025-01-02 13:32:45 -08:00
Yorick Peterse
96fd18f994 Don't install 1024x1024 icons for Flatpak
Per the Flatpak spec (https://docs.flatpak.org/en/latest/conventions.html#application-icons)
the maximum icon size is 512x512. Trying to build a Flatpak with an icon
larger than this will fail.

To solve this, installing the icon is skipped when building with
-Dflatpak=true.
2025-01-01 20:43:52 +01:00
Mitchell Hashimoto
1d71196de3 up version to 1.0.2 for development 2024-12-31 14:12:00 -08:00
Jan200101
6a8b31571b reuse strip option for libraries 2024-12-31 12:09:11 +01:00
Jan200101
061a730dd3 move strip switch behind option 2024-12-31 12:06:45 +01:00
Jan200101
c87e3e98a3 give strip option a proper description 2024-12-30 18:37:59 +01:00
Arvin Verain
cfeed2b7a2 gtk: Install 1024x1024 icon 2024-12-30 13:05:57 +08:00
Jan200101
2bb3353672 add option to strip build regardless of optimization 2024-12-29 22:06:30 +01:00
Jeffrey C. Ollie
b6e45d49a3 gtk/x11: link directly to libX11, no more dlopen 2024-12-29 01:15:01 -06:00
Jeffrey C. Ollie
8ecb11a602 gtk: add option to not link against libX11 2024-12-28 13:40:17 -06:00
Mitchell Hashimoto
8111f5b995 Fix DESTDIR handling for terminfo installation (#3426)
## Description:

Fix `DESTDIR` handling when installing terminfo database files by using
`install_path` instead of `install_prefix`. This ensures files are
correctly installed under `$DESTDIR/$prefix` during packaging.

## Changes:

- Replace `b.install_prefix` with `b.install_path` for terminfo database
installation paths

- This change properly respects the `DESTDIR` environment variable
during installation

## Testing:

I've verified this fix by:

1. Setting `DESTDIR=/tmp/ghostty`

2. Building with: 
```bash
DESTDIR=/tmp/ghostty \
zig build \
  --prefix /usr \
  --system /tmp/offline-cache/p \
  -Doptimize=ReleaseFast \
  -Dcpu=baseline
```

3. Confirming files are correctly installed to:

```
/tmp/ghostty/usr/share/terminfo/ghostty.terminfo
/tmp/ghostty/usr/share/terminfo/ghostty.termcap
```

The files are now properly installed under `$DESTDIR/$prefix` path
structure as expected.

cc @BratishkaErik - Since you suggested this fix in #3152, would you
mind reviewing this implementation?

Fixes #3152
2024-12-27 12:09:37 -08:00
Yorick Peterse
50f7632d81 Fix building with -Dflatpak=true
While running a Ghostty instance built with this option currently
crashes under Flatpak, at least it ensures we're able to build it again.
2024-12-27 16:27:19 +01:00
Bryan Lee
2114e0a613 Fix DESTDIR handling for terminfo installation
Use `install_path` instead of `install_prefix` when installing terminfo
database files to properly respect the `DESTDIR` environment variable.
This ensures files are correctly installed under `$DESTDIR/$prefix`
when packaging.

Fixes #3152
2024-12-27 23:12:42 +08:00
Mitchell Hashimoto
35b9ceee21 up the version to 1.0.1 everywhere for dev 2024-12-26 15:21:50 -08:00
Mitchell Hashimoto
4b4d4062df build.zig: v1.0.0 2024-12-26 12:00:22 -08:00
Mitchell Hashimoto
270d454c4e webgen: update config to support callouts, emit keybind actions 2024-12-19 17:15:39 -08:00
Mitchell Hashimoto
82c9787fd3 build: generate reference page for config for website 2024-12-18 07:06:35 -08:00
Mitchell Hashimoto
0ad4b6bf44 bash: add bash completion generation (#2963)
Bash completions on par with fish and zsh completions. There's a lot of
room to add additional custom completions in all three languages. (see
`key) return;;` for cases)

I've noticed a few mistakes with the other completions I'll raise as a
separate PR.

<details>
  <summary>Generated ghostty.bash - updated</summary>

```bash

# -o nospace requires we add back a space when a completion is finished
# and not part of a --key= completion
addSpaces() {
  for idx in "${!COMPREPLY[@]}"; do
    [ -n "${COMPREPLY[idx]}" ] && COMPREPLY[idx]="${COMPREPLY[idx]} ";
  done
}

_fonts() {
  local IFS=$'\n'
  mapfile -t COMPREPLY < <( compgen -P '"' -S '"' -W "$($ghostty +list-fonts | grep '^[A-Z]' )" -- "$cur")
}

_themes() {
  local IFS=$'\n'
  mapfile -t COMPREPLY < <( compgen -P '"' -S '"' -W "$($ghostty +list-themes | sed -E 's/^(.*) \(.*$/\1/')" -- "$cur")
}

_files() {
  mapfile -t COMPREPLY < <( compgen -o filenames -f -- "$cur" )
  for i in "${!COMPREPLY[@]}"; do
    if [[ -d "${COMPREPLY[i]}" ]]; then
      COMPREPLY[i]="${COMPREPLY[i]}/";
    fi
    if [[ -f "${COMPREPLY[i]}" ]]; then
      COMPREPLY[i]="${COMPREPLY[i]} ";
    fi
  done
}

_dirs() {
  mapfile -t COMPREPLY < <( compgen -o dirnames -d -- "$cur" )
  for i in "${!COMPREPLY[@]}"; do
    if [[ -d "${COMPREPLY[i]}" ]]; then
      COMPREPLY[i]="${COMPREPLY[i]}/";
    fi
  done
  if [[ "${#COMPREPLY[@]}" == 0 && -d "$cur" ]]; then
    COMPREPLY=( "$cur " )
  fi
}

config="--help"
config+=" --version"
config+=" --font-family="
config+=" --font-family-bold="
config+=" --font-family-italic="
config+=" --font-family-bold-italic="
config+=" --font-style="
config+=" --font-style-bold="
config+=" --font-style-italic="
config+=" --font-style-bold-italic="
config+=" --font-synthetic-style="
config+=" --font-feature="
config+=" --font-size="
config+=" --font-variation="
config+=" --font-variation-bold="
config+=" --font-variation-italic="
config+=" --font-variation-bold-italic="
config+=" --font-codepoint-map="
config+=" --font-thicken="
config+=" --adjust-cell-width="
config+=" --adjust-cell-height="
config+=" --adjust-font-baseline="
config+=" --adjust-underline-position="
config+=" --adjust-underline-thickness="
config+=" --adjust-strikethrough-position="
config+=" --adjust-strikethrough-thickness="
config+=" --adjust-cursor-thickness="
config+=" --grapheme-width-method="
config+=" --freetype-load-flags="
config+=" --theme="
config+=" --background="
config+=" --foreground="
config+=" --selection-foreground="
config+=" --selection-background="
config+=" --selection-invert-fg-bg="
config+=" --minimum-contrast="
config+=" --palette="
config+=" --cursor-color="
config+=" --cursor-invert-fg-bg="
config+=" --cursor-opacity="
config+=" --cursor-style="
config+=" --cursor-style-blink="
config+=" --cursor-text="
config+=" --cursor-click-to-move="
config+=" --mouse-hide-while-typing="
config+=" --mouse-shift-capture="
config+=" --mouse-scroll-multiplier="
config+=" --background-opacity="
config+=" --background-blur-radius="
config+=" --unfocused-split-opacity="
config+=" --unfocused-split-fill="
config+=" --command="
config+=" --initial-command="
config+=" --wait-after-command="
config+=" --abnormal-command-exit-runtime="
config+=" --scrollback-limit="
config+=" --link="
config+=" --link-url="
config+=" --fullscreen="
config+=" --title="
config+=" --class="
config+=" --x11-instance-name="
config+=" --working-directory="
config+=" --keybind="
config+=" --window-padding-x="
config+=" --window-padding-y="
config+=" --window-padding-balance="
config+=" --window-padding-color="
config+=" --window-vsync="
config+=" --window-inherit-working-directory="
config+=" --window-inherit-font-size="
config+=" --window-decoration="
config+=" --window-title-font-family="
config+=" --window-theme="
config+=" --window-colorspace="
config+=" --window-height="
config+=" --window-width="
config+=" --window-save-state="
config+=" --window-step-resize="
config+=" --window-new-tab-position="
config+=" --resize-overlay="
config+=" --resize-overlay-position="
config+=" --resize-overlay-duration="
config+=" --focus-follows-mouse="
config+=" --clipboard-read="
config+=" --clipboard-write="
config+=" --clipboard-trim-trailing-spaces="
config+=" --clipboard-paste-protection="
config+=" --clipboard-paste-bracketed-safe="
config+=" --image-storage-limit="
config+=" --copy-on-select="
config+=" --click-repeat-interval="
config+=" --config-file="
config+=" --config-default-files="
config+=" --confirm-close-surface="
config+=" --quit-after-last-window-closed="
config+=" --quit-after-last-window-closed-delay="
config+=" --initial-window="
config+=" --quick-terminal-position="
config+=" --quick-terminal-screen="
config+=" --quick-terminal-animation-duration="
config+=" --shell-integration="
config+=" --shell-integration-features="
config+=" --osc-color-report-format="
config+=" --vt-kam-allowed="
config+=" --custom-shader="
config+=" --custom-shader-animation="
config+=" --macos-non-native-fullscreen="
config+=" --macos-titlebar-style="
config+=" --macos-titlebar-proxy-icon="
config+=" --macos-option-as-alt="
config+=" --macos-window-shadow="
config+=" --macos-auto-secure-input="
config+=" --macos-secure-input-indication="
config+=" --linux-cgroup="
config+=" --linux-cgroup-memory-limit="
config+=" --linux-cgroup-processes-limit="
config+=" --linux-cgroup-hard-fail="
config+=" --gtk-single-instance="
config+=" --gtk-titlebar="
config+=" --gtk-tabs-location="
config+=" --adw-toolbar-style="
config+=" --gtk-wide-tabs="
config+=" --gtk-adwaita="
config+=" --desktop-notifications="
config+=" --bold-is-bright="
config+=" --term="
config+=" --enquiry-response="
config+=" --auto-update="

_handleConfig() {
  case "$prev" in
    --font-family) _fonts ;;
    --font-family-bold) _fonts ;;
    --font-family-italic) _fonts ;;
    --font-family-bold-italic) _fonts ;;
    --font-style) return ;;
    --font-style-bold) return ;;
    --font-style-italic) return ;;
    --font-style-bold-italic) return ;;
    --font-synthetic-style) mapfile -t COMPREPLY < <( compgen -W "bold no-bold italic no-italic bold-italic no-bold-italic" -- "$cur" ); addSpaces ;;
    --font-feature) return ;;
    --font-size) return ;;
    --font-variation) return ;;
    --font-variation-bold) return ;;
    --font-variation-italic) return ;;
    --font-variation-bold-italic) return ;;
    --font-codepoint-map) return ;;
    --font-thicken) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
    --adjust-cell-width) return ;;
    --adjust-cell-height) return ;;
    --adjust-font-baseline) return ;;
    --adjust-underline-position) return ;;
    --adjust-underline-thickness) return ;;
    --adjust-strikethrough-position) return ;;
    --adjust-strikethrough-thickness) return ;;
    --adjust-cursor-thickness) return ;;
    --grapheme-width-method) mapfile -t COMPREPLY < <( compgen -W "legacy unicode" -- "$cur" ); addSpaces ;;
    --freetype-load-flags) mapfile -t COMPREPLY < <( compgen -W "hinting no-hinting force-autohint no-force-autohint monochrome no-monochrome autohint no-autohint" -- "$cur" ); addSpaces ;;
    --theme) _themes ;;
    --background) return ;;
    --foreground) return ;;
    --selection-foreground) return ;;
    --selection-background) return ;;
    --selection-invert-fg-bg) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
    --minimum-contrast) return ;;
    --palette) return ;;
    --cursor-color) return ;;
    --cursor-invert-fg-bg) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
    --cursor-opacity) return ;;
    --cursor-style) mapfile -t COMPREPLY < <( compgen -W "bar block underline block_hollow" -- "$cur" ); addSpaces ;;
    --cursor-style-blink) return ;;
    --cursor-text) return ;;
    --cursor-click-to-move) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
    --mouse-hide-while-typing) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
    --mouse-shift-capture) mapfile -t COMPREPLY < <( compgen -W "false true always never" -- "$cur" ); addSpaces ;;
    --mouse-scroll-multiplier) return ;;
    --background-opacity) return ;;
    --background-blur-radius) return ;;
    --unfocused-split-opacity) return ;;
    --unfocused-split-fill) return ;;
    --command) return ;;
    --initial-command) return ;;
    --wait-after-command) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
    --abnormal-command-exit-runtime) return ;;
    --scrollback-limit) return ;;
    --link) return ;;
    --link-url) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
    --fullscreen) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
    --title) return ;;
    --class) return ;;
    --x11-instance-name) return ;;
    --working-directory) _dirs ;;
    --keybind) return ;;
    --window-padding-x) return ;;
    --window-padding-y) return ;;
    --window-padding-balance) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
    --window-padding-color) mapfile -t COMPREPLY < <( compgen -W "background extend extend-always" -- "$cur" ); addSpaces ;;
    --window-vsync) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
    --window-inherit-working-directory) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
    --window-inherit-font-size) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
    --window-decoration) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
    --window-title-font-family) return ;;
    --window-theme) mapfile -t COMPREPLY < <( compgen -W "auto system light dark ghostty" -- "$cur" ); addSpaces ;;
    --window-colorspace) mapfile -t COMPREPLY < <( compgen -W "srgb display-p3" -- "$cur" ); addSpaces ;;
    --window-height) return ;;
    --window-width) return ;;
    --window-save-state) mapfile -t COMPREPLY < <( compgen -W "default never always" -- "$cur" ); addSpaces ;;
    --window-step-resize) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
    --window-new-tab-position) mapfile -t COMPREPLY < <( compgen -W "current end" -- "$cur" ); addSpaces ;;
    --resize-overlay) mapfile -t COMPREPLY < <( compgen -W "always never after-first" -- "$cur" ); addSpaces ;;
    --resize-overlay-position) mapfile -t COMPREPLY < <( compgen -W "center top-left top-center top-right bottom-left bottom-center bottom-right" -- "$cur" ); addSpaces ;;
    --resize-overlay-duration) return ;;

    --clipboard-read) mapfile -t COMPREPLY < <( compgen -W "allow deny ask" -- "$cur" ); addSpaces ;;
    --clipboard-write) mapfile -t COMPREPLY < <( compgen -W "allow deny ask" -- "$cur" ); addSpaces ;;
    --clipboard-trim-trailing-spaces) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
    --clipboard-paste-protection) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
    --clipboard-paste-bracketed-safe) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
    --image-storage-limit) return ;;
    --copy-on-select) mapfile -t COMPREPLY < <( compgen -W "false true clipboard" -- "$cur" ); addSpaces ;;
    --click-repeat-interval) return ;;
    --config-file) _files ;;
    --config-default-files) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
    --confirm-close-surface) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
    --quit-after-last-window-closed) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
    --quit-after-last-window-closed-delay) return ;;
    --initial-window) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
    --quick-terminal-position) mapfile -t COMPREPLY < <( compgen -W "top bottom left right" -- "$cur" ); addSpaces ;;
    --quick-terminal-screen) mapfile -t COMPREPLY < <( compgen -W "main mouse macos-menu-bar" -- "$cur" ); addSpaces ;;
    --quick-terminal-animation-duration) return ;;
    --shell-integration) mapfile -t COMPREPLY < <( compgen -W "none detect bash elvish fish zsh" -- "$cur" ); addSpaces ;;
    --shell-integration-features) mapfile -t COMPREPLY < <( compgen -W "cursor no-cursor sudo no-sudo title no-title" -- "$cur" ); addSpaces ;;
    --osc-color-report-format) mapfile -t COMPREPLY < <( compgen -W "none 8-bit 16-bit" -- "$cur" ); addSpaces ;;
    --vt-kam-allowed) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
    --custom-shader) _files ;;
    --custom-shader-animation) mapfile -t COMPREPLY < <( compgen -W "false true always" -- "$cur" ); addSpaces ;;
    --macos-non-native-fullscreen) mapfile -t COMPREPLY < <( compgen -W "false true visible-menu" -- "$cur" ); addSpaces ;;
    --macos-titlebar-style) mapfile -t COMPREPLY < <( compgen -W "native transparent tabs hidden" -- "$cur" ); addSpaces ;;
    --macos-titlebar-proxy-icon) mapfile -t COMPREPLY < <( compgen -W "visible hidden" -- "$cur" ); addSpaces ;;
    --macos-option-as-alt) return ;;
    --macos-window-shadow) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
    --macos-auto-secure-input) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
    --macos-secure-input-indication) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
    --linux-cgroup) mapfile -t COMPREPLY < <( compgen -W "never always single-instance" -- "$cur" ); addSpaces ;;
    --linux-cgroup-memory-limit) return ;;
    --linux-cgroup-processes-limit) return ;;
    --linux-cgroup-hard-fail) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
    --gtk-single-instance) mapfile -t COMPREPLY < <( compgen -W "desktop false true" -- "$cur" ); addSpaces ;;
    --gtk-titlebar) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
    --gtk-tabs-location) mapfile -t COMPREPLY < <( compgen -W "top bottom left right" -- "$cur" ); addSpaces ;;
    --adw-toolbar-style) mapfile -t COMPREPLY < <( compgen -W "flat raised raised-border" -- "$cur" ); addSpaces ;;
    --gtk-wide-tabs) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
    --gtk-adwaita) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
    --desktop-notifications) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
    --bold-is-bright) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
    --term) return ;;
    --enquiry-response) return ;;
    --auto-update) mapfile -t COMPREPLY < <( compgen -W "off check download" -- "$cur" ); addSpaces ;;
    *) mapfile -t COMPREPLY < <( compgen -W "$config" -- "$cur" ) ;;
  esac

  return 0
}

list_fonts="--family= --style= --bold= --italic= --help"
list_keybinds="--default= --docs= --plain= --help"
list_themes="--path= --plain= --help"
list_actions="--docs= --help"
show_config="--default= --changes-only= --docs= --help"
validate_config="--config-file= --help"

_handleActions() {
  case "${COMP_WORDS[1]}" in
    +list-fonts)
      case $prev in
        --family) return;;
        --style) return;;
        --bold) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
        --italic) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
        *) mapfile -t COMPREPLY < <( compgen -W "$list_fonts" -- "$cur" ) ;;
      esac
    ;;
    +list-keybinds)
      case $prev in
        --default) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
        --docs) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
        --plain) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
        *) mapfile -t COMPREPLY < <( compgen -W "$list_keybinds" -- "$cur" ) ;;
      esac
    ;;
    +list-themes)
      case $prev in
        --path) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
        --plain) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
        *) mapfile -t COMPREPLY < <( compgen -W "$list_themes" -- "$cur" ) ;;
      esac
    ;;
    +list-actions)
      case $prev in
        --docs) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
        *) mapfile -t COMPREPLY < <( compgen -W "$list_actions" -- "$cur" ) ;;
      esac
    ;;
    +show-config)
      case $prev in
        --default) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
        --changes-only) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
        --docs) mapfile -t COMPREPLY < <( compgen -W "true false" -- "$cur" ); addSpaces ;;
        *) mapfile -t COMPREPLY < <( compgen -W "$show_config" -- "$cur" ) ;;
      esac
    ;;
    +validate-config)
      case $prev in
        --config-file) _files ;;
        *) mapfile -t COMPREPLY < <( compgen -W "$validate_config" -- "$cur" ) ;;
      esac
    ;;
    *) mapfile -t COMPREPLY < <( compgen -W "--help" -- "$cur" ) ;;
  esac

  return 0
}

topLevel="-e"
topLevel+=" --help"
topLevel+=" --version"
topLevel+=" +list-fonts"
topLevel+=" +list-keybinds"
topLevel+=" +list-themes"
topLevel+=" +list-colors"
topLevel+=" +list-actions"
topLevel+=" +show-config"
topLevel+=" +validate-config"
topLevel+=" +crash-report"

_ghostty() {
  cur=""; prev=""; prevWasEq=false; COMPREPLY=()
  ghostty="$1"

  if [ "$2" = "=" ]; then cur=""
  else                    cur="$2"
  fi

  if [ "$3" = "=" ]; then prev="${COMP_WORDS[COMP_CWORD-2]}"; prevWasEq=true;
  else                    prev="${COMP_WORDS[COMP_CWORD-1]}"
  fi

  # current completion is double quoted add a space so the curor progresses
  if [[ "$2" == \"*\" ]]; then
    COMPREPLY=( "$cur " );
    return;
  fi

  case "$COMP_CWORD" in
    1)
      case "${COMP_WORDS[1]}" in
        -e | --help | --version) return 0 ;;
        --*) _handleConfig ;;
        *) mapfile -t COMPREPLY < <( compgen -W "${topLevel}" -- "$cur" ); addSpaces ;;
      esac
      ;;
    *)
      case "$prev" in
        -e | --help | --version) return 0 ;;
        *)
          if [[ "=" != "${COMP_WORDS[COMP_CWORD]}" && $prevWasEq != true ]]; then
            # must be completing with a space after the key eg: '--<key> '
            # clear out prev so we don't run any of the key specific completions
            prev=""
          fi

          case "${COMP_WORDS[1]}" in
            --*) _handleConfig ;;
            +*) _handleActions ;;
          esac
          ;;
      esac
      ;;
  esac

  return 0
}

complete -o nospace -o bashdefault -F _ghostty ghostty
```
</details>

cc @jparise 
I agree to re-license my commits to MIT
Closes #2053
2024-12-15 18:14:56 -08:00
Anund
fddc880941 bash: add bash completion generation
closes #2053
2024-12-15 02:37:12 +11:00
Anthony
fb0f5519c1 Revert "Change oniguruma link target from oniguruma to onig"
This reverts commit daa0fe00b16989cf4696c686aab33b80763834a3.
It is correct to use the pkg-config name instead of the literal dylib name
2024-12-12 15:35:29 +11:00
Mitchell Hashimoto
3f21921568 Add zsh completions and improve fish completions (#2925)
Adds zsh completion generation and improves fish completion generation
to cover all actions with arguments.

<details>
  <summary>Generated _ghostty contents</summary>
  
  ```zsh
#compdef ghostty

_fonts () {
  local font_list=$(ghostty +list-fonts | grep -Z '^[A-Z]')
  local fonts=(${(f)font_list})
  _describe -t fonts 'fonts' fonts
}

_themes() {
  local theme_list=$(ghostty +list-themes | sed -E 's/^(.*) \(.*\$/\0/')
  local themes=(${(f)theme_list})
  _describe -t themes 'themes' themes
}
_config() {
  _arguments \
    "--help" \
    "--version" \
    "--font-family=-:::_fonts" \
    "--font-family-bold=-:::_fonts" \
    "--font-family-italic=-:::_fonts" \
    "--font-family-bold-italic=-:::_fonts" \
    "--font-style=-:::( )" \
    "--font-style-bold=-:::( )" \
    "--font-style-italic=-:::( )" \
    "--font-style-bold-italic=-:::( )" \
"--font-synthetic-style=-:::(bold no-bold italic no-italic bold-italic
no-bold-italic)" \
    "--font-feature=-:::( )" \
    "--font-size=-:::( )" \
    "--font-variation=-:::( )" \
    "--font-variation-bold=-:::( )" \
    "--font-variation-italic=-:::( )" \
    "--font-variation-bold-italic=-:::( )" \
    "--font-codepoint-map=-:::( )" \
    "--font-thicken=-:::(true false)" \
    "--adjust-cell-width=-:::( )" \
    "--adjust-cell-height=-:::( )" \
    "--adjust-font-baseline=-:::( )" \
    "--adjust-underline-position=-:::( )" \
    "--adjust-underline-thickness=-:::( )" \
    "--adjust-strikethrough-position=-:::( )" \
    "--adjust-strikethrough-thickness=-:::( )" \
    "--adjust-cursor-thickness=-:::( )" \
    "--grapheme-width-method=-:::(legacy unicode)" \
"--freetype-load-flags=-:::(hinting no-hinting force-autohint
no-force-autohint monochrome no-monochrome autohint no-autohint)" \
    "--theme=-:::_themes" \
    "--background=-:::( )" \
    "--foreground=-:::( )" \
    "--selection-foreground=-:::( )" \
    "--selection-background=-:::( )" \
    "--selection-invert-fg-bg=-:::(true false)" \
    "--minimum-contrast=-:::( )" \
    "--palette=-:::( )" \
    "--cursor-color=-:::( )" \
    "--cursor-invert-fg-bg=-:::(true false)" \
    "--cursor-opacity=-:::( )" \
    "--cursor-style=-:::(bar block underline block_hollow)" \
    "--cursor-style-blink=-:::( )" \
    "--cursor-text=-:::( )" \
    "--cursor-click-to-move=-:::(true false)" \
    "--mouse-hide-while-typing=-:::(true false)" \
    "--mouse-shift-capture=-:::(false true always never)" \
    "--mouse-scroll-multiplier=-:::( )" \
    "--background-opacity=-:::( )" \
    "--background-blur-radius=-:::( )" \
    "--unfocused-split-opacity=-:::( )" \
    "--unfocused-split-fill=-:::( )" \
    "--command=-:::( )" \
    "--initial-command=-:::( )" \
    "--wait-after-command=-:::(true false)" \
    "--abnormal-command-exit-runtime=-:::( )" \
    "--scrollback-limit=-:::( )" \
    "--link=-:::( )" \
    "--link-url=-:::(true false)" \
    "--fullscreen=-:::(true false)" \
    "--title=-:::( )" \
    "--class=-:::( )" \
    "--x11-instance-name=-:::( )" \
    "--working-directory=-:::{_files -/}" \
    "--keybind=-:::( )" \
    "--window-padding-x=-:::( )" \
    "--window-padding-y=-:::( )" \
    "--window-padding-balance=-:::(true false)" \
    "--window-padding-color=-:::(background extend extend-always)" \
    "--window-vsync=-:::(true false)" \
    "--window-inherit-working-directory=-:::(true false)" \
    "--window-inherit-font-size=-:::(true false)" \
    "--window-decoration=-:::(true false)" \
    "--window-title-font-family=-:::( )" \
    "--window-theme=-:::(auto system light dark ghostty)" \
    "--window-colorspace=-:::(srgb display-p3)" \
    "--window-height=-:::( )" \
    "--window-width=-:::( )" \
    "--window-save-state=-:::(default never always)" \
    "--window-step-resize=-:::(true false)" \
    "--window-new-tab-position=-:::(current end)" \
    "--resize-overlay=-:::(always never after-first)" \
"--resize-overlay-position=-:::(center top-left top-center top-right
bottom-left bottom-center bottom-right)" \
    "--resize-overlay-duration=-:::( )" \
    "--focus-follows-mouse=-:::(true false)" \
    "--clipboard-read=-:::(allow deny ask)" \
    "--clipboard-write=-:::(allow deny ask)" \
    "--clipboard-trim-trailing-spaces=-:::(true false)" \
    "--clipboard-paste-protection=-:::(true false)" \
    "--clipboard-paste-bracketed-safe=-:::(true false)" \
    "--image-storage-limit=-:::( )" \
    "--copy-on-select=-:::(false true clipboard)" \
    "--click-repeat-interval=-:::( )" \
    "--config-file=-:::_files" \
    "--config-default-files=-:::(true false)" \
    "--confirm-close-surface=-:::(true false)" \
    "--quit-after-last-window-closed=-:::(true false)" \
    "--quit-after-last-window-closed-delay=-:::( )" \
    "--initial-window=-:::(true false)" \
    "--quick-terminal-position=-:::(top bottom left right)" \
    "--quick-terminal-screen=-:::(main mouse macos-menu-bar)" \
    "--quick-terminal-animation-duration=-:::( )" \
    "--shell-integration=-:::(none detect bash elvish fish zsh)" \
"--shell-integration-features=-:::(cursor no-cursor sudo no-sudo title
no-title)" \
    "--osc-color-report-format=-:::(none 8-bit 16-bit)" \
    "--vt-kam-allowed=-:::(true false)" \
    "--custom-shader=-:::_files" \
    "--custom-shader-animation=-:::(false true always)" \
    "--macos-non-native-fullscreen=-:::(false true visible-menu)" \
    "--macos-titlebar-style=-:::(native transparent tabs hidden)" \
    "--macos-titlebar-proxy-icon=-:::(visible hidden)" \
    "--macos-option-as-alt=-:::(false true left right)" \
    "--macos-window-shadow=-:::(true false)" \
    "--macos-auto-secure-input=-:::(true false)" \
    "--macos-secure-input-indication=-:::(true false)" \
    "--linux-cgroup=-:::(never always single-instance)" \
    "--linux-cgroup-memory-limit=-:::( )" \
    "--linux-cgroup-processes-limit=-:::( )" \
    "--linux-cgroup-hard-fail=-:::(true false)" \
    "--gtk-single-instance=-:::(desktop false true)" \
    "--gtk-titlebar=-:::(true false)" \
    "--gtk-tabs-location=-:::(top bottom left right)" \
    "--adw-toolbar-style=-:::(flat raised raised-border)" \
    "--gtk-wide-tabs=-:::(true false)" \
    "--gtk-adwaita=-:::(true false)" \
    "--desktop-notifications=-:::(true false)" \
    "--bold-is-bright=-:::(true false)" \
    "--term=-:::( )" \
    "--enquiry-response=-:::( )" \
    "--auto-update=-:::(off check download)" \

}

_ghostty() {
  typeset -A opt_args
  local context state line
  local opt=('--help' '--version')

  _arguments -C \
    '1:actions:->actions' \
    '*:: :->rest' \

  if [[ "$line[1]" == "--help" || "$line[1]" == "--version" ]]; then
    return
  fi

  if [[ "$line[1]" == -* ]]; then
    _config
    return
  fi

  case "$state" in
    (actions)
      local actions; actions=(
        '+version'
        '+help'
        '+list-fonts'
        '+list-keybinds'
        '+list-themes'
        '+list-colors'
        '+list-actions'
        '+show-config'
        '+validate-config'
        '+crash-report'
      )
      _describe '' opt
      _describe -t action 'action' actions
    ;;
    (rest)
      if [[ "$line[2]" == "--help" ]]; then
        return
      fi

      local help=('--help')
      _describe '' help

      case $line[1] in
        (+list-fonts)
          _arguments \
            '--family=-:::( )' \
            '--style=-:::( )' \
            '--bold=-:::(true false)' \
            '--italic=-:::(true false)' \
        ;;
        (+list-keybinds)
          _arguments \
            '--default=-:::(true false)' \
            '--docs=-:::(true false)' \
            '--plain=-:::(true false)' \
        ;;
        (+list-themes)
          _arguments \
            '--path=-:::(true false)' \
            '--plain=-:::(true false)' \
        ;;
        (+list-actions)
          _arguments \
            '--docs=-:::(true false)' \
        ;;
        (+show-config)
          _arguments \
            '--default=-:::(true false)' \
            '--changes-only=-:::(true false)' \
            '--docs=-:::(true false)' \
        ;;
        (+validate-config)
          _arguments \
            '--config-file=-:::_files' \
        ;;
      esac
    ;;
  esac
}

_ghostty "$@"

  ```
</details>

I agree to relicense my commits to MIT
2024-12-11 08:57:59 -08:00
Anund
c7deea6a7f zsh: add completions generation 2024-12-11 21:11:38 +11:00
Mitchell Hashimoto
247409d705 New Ghostty icon
❤️👻

This is the icon that we'll launch Ghostty 1.0 with. It was designed by
Michael Flareup at PixelResort. It retains the style of the original
Ghostty icon by Alasdair Monk, but brings in the new Ghost character and
adds details that make it more Apple-like.

The new Ghost character is an important evolution from the original
since it separates us from looking too much like PacMan. The new Ghost
is more unique and recognizable to Ghostty (or, hopefully will be!).

The icon itself has more details: the aluminum around the edge has
texture for the large enough sizes, there are visible scanlines, the
glow of a screen emanates from the ghost.

The icon itself is stylistic more Apple-like than other platforms. I
think Apple icons tend to look very good in more environments than the
reverse and I'm a big fan of the Apple aesthetic so I wanted to bring
that to Ghostty for all platforms.
2024-12-09 10:01:18 -08:00
Andrej Daskalov
074312c5ef updated permissions and build process
Removed check for plasma in build.zig, it installs it anyways now
Added executable permissions for ghostty_dolphin.desktop since Plasma
requires them for context menu items
2024-11-29 11:14:17 +01:00
Andrej Daskalov
4be06d1c11 rename file to match package 2024-11-29 00:27:51 +01:00
Andrej Daskalov
62fe3eb652 added right click action for plasma 2024-11-28 23:41:55 +01:00
Mitchell Hashimoto
3392659e1f Revert "macos: enable Metal shader logging"
This reverts commit aad101565abff3368af76e8c2e93cbe7c278a89f.
2024-11-20 15:01:27 -08:00
Mitchell Hashimoto
5f49ffad6a Merge pull request #2736 from ghostty-org/push-sltwuokrztpt
macos: enable Metal shader logging
2024-11-20 06:37:29 -08:00
Anthony
daa0fe00b1 Change oniguruma link target from oniguruma to onig 2024-11-20 18:34:21 +11:00
Mitchell Hashimoto
aad101565a macos: enable Metal shader logging
This enables the compile options and Xcode configuration so that logging
in Metal shaders shows up in our Xcode debug console. This doesn't add
any log messages, but makes it so that when we iterate on the shaders in
the future, we can add and see logs to help us out.
2024-11-19 18:59:41 -08:00
Mitchell Hashimoto
cd214dbeac build: always emit-docs in system packaging mode
System packages are always going to want docs. This forces to true so a
build error can appear if `pandoc` is unavailable.
2024-11-18 08:15:19 -08:00
Mitchell Hashimoto
002832deb5 Merge pull request #2703 from furtidev/port-to-latest-vaxis
cli: update to latest libvaxis and fix `+list-themes` bugs
2024-11-16 08:49:02 -08:00
furtidev
eb9b7681c7 dep: add latest libvaxis and zf 2024-11-16 19:38:22 +06:00
Mitchell Hashimoto
d205f6a560 build: -Dpie default to true in system package mode
Fixes #2673

Rather than document this too much, I think it makes sense to just
default this to true when system package mode is enabled (`--system`)
since it seems that in multiple package ecosystems this is the desired
behavior.

This can still be overridden by setting `-Dpie=false`.
2024-11-14 09:34:07 -08:00
Mitchell Hashimoto
dfe33dc9bb build.zig: add -Dpie option for position independent executables
This is required by some packaging ecosytems.
2024-11-11 19:24:02 -08:00
Jeffrey C. Ollie
b353ddf46d core/gtk: unify libadwaita/adwaita options in the code
Fixes #2574
2024-11-08 22:19:04 -06:00
phillip-hirsch
b5ed4cb680 feat: Add syntax highlighting for bat 2024-11-06 17:06:24 -05:00
Tristan Partin
16e8095d52 feat: install neovim plugin
$prefix/share/vim/vimfiles is not always read by Neovim. It is
distribution dependent. $prefix/share/nvim/site is a default path for
Neovim however.

Signed-off-by: Tristan Partin <tristan@partin.io>
2024-11-04 19:58:50 -06:00
Mitchell Hashimoto
038b3dec79 update zig-objc
This fixes a hack we had around apple paths since we do this now
upstream in zig-objc. This also adds in support for NSFastEnumeration
needed for #2586
2024-11-03 15:21:26 -08:00
Nyaa97
7eb5563e9c Fix linking freetype and glslang 2024-10-30 16:43:41 -04:00
Rithul Kamesh
c625d43818 build: require exact major/minor Zig version 2024-10-27 08:33:36 -06:00
Mitchell Hashimoto
4095b189ed build: only default system libs to false on macOS 2024-10-24 15:28:53 -07:00
Mitchell Hashimoto
8bb8b01e54 build: use Zig system packaging options
This allows dynamically linking against system libraries, which is
particularly useful for packaging.
2024-10-24 14:46:37 -07:00
Mitchell Hashimoto
2bbbdf7433 build: strip symbols from release builds
This significantly reduces the size of the binary.
2024-10-15 09:46:15 -07:00
Qwerasd
d38d0f30c4 font/sprite: replace pixman with z2d, extend Box coverage
More complete coverage of the Symbols For Legacy Computing block,
including characters from Unicode 16.0.

Pixman and the web canvas impl for Canvas have been removed in favor of
z2d for drawing, since it has a nicer API with more powerful methods,
and is in Zig with no specific platform optimizations so should compile
to wasm no problem.
2024-10-14 17:50:49 -04:00
Mitchell Hashimoto
eec77e271c macos: change our minimum version to macOS 13
macOS 12 is officially EOL by Apple and the project only supports
officially supported versions of macOS. Once publicly released, users on
older macOS versions will have to use older released builds.
2024-10-09 14:41:57 -07:00