Skip to content

Instantly share code, notes, and snippets.

@Drallas
Last active February 21, 2024 15:16
Show Gist options
  • Save Drallas/a496282dabcd2a5d781263a05a0ba266 to your computer and use it in GitHub Desktop.
Save Drallas/a496282dabcd2a5d781263a05a0ba266 to your computer and use it in GitHub Desktop.

Wezterm Terminal Lua Config

This is my config for the WezTerm Terminal.

-- Created by: Drallas
-- Date: 14-02-2023

wezterm = require "wezterm"

-- Folder with local wallpaper files.
local prefix = "/Users/allards/.warp/themes/jpg/"

-- Table with wallpaper file names. 
local images = {
    "blade-runner-3.jpg",
    "blade-runner.jpg",
    "bombusb-desktop.jpg",
    "butterfly-desktop.jpg",
    "dragoncable-desktop.jpg",
    "dragonfly-desktop.jpg",
    "playerhacker-desktop.jpg",
    "usbarcher-desktop.jpg",
    "yamato.jpg",
}

-- Returns a path from where to load a randon image.
function get_random_image()
    return prefix ..images[math.random(#images)]
end

-- Main Settings for Wezterm
return {

  -- Set the initial size of the terminal.
  initial_cols = 170,
  initial_rows = 50,

  -- Fonts
  -- https://wezfurlong.org/wezterm/config/fonts.html
  font = wezterm.font("Hack Nerd Font Mono"),
  font_size=17.5,

  -- Scrollback
  -- https://wezfurlong.org/wezterm/config/scrollback.html
  enable_scroll_bar = false,
  scrollback_lines = 3333,
  -- default_cursor_style = "BlinkingUnderline",

  -- Window control
  window_background_opacity = 0.85, -- Background opacity / transparency
  window_background_image = get_random_image(), -- Get random background image

  window_background_image_hsb = {
  -- Darken the background image by reducing it to 1/3rd
  brightness = 0.1,
  -- You can adjust the hue by scaling its value.
  -- a multiplier of 1.0 leaves the value unchanged.
  hue = 1.0,
  -- You can adjust the saturation also.
  saturation = 0.95,
  },

  keys = {
  -- custom keybindings
  -- wezterm show-keys cmd shows all
  -- CTRL|SHIFT d to close
  { key = "k", mods = "CTRL|SHIFT", action = wezterm.action({ SplitHorizontal = { domain = "CurrentPaneDomain" } }) },
  { key = "l", mods = "CTRL|SHIFT", action = wezterm.action({ SplitVertical = { domain = "CurrentPaneDomain" } }) },
  { key = "c", mods = "CTRL|SHIFT", action = wezterm.action{CopyTo = "Clipboard"}},
  { key = "v", mods = "CTRL|SHIFT", action = wezterm.action{PasteFrom = "Clipboard"}},
  { key = "f", mods = "CTRL|SHIFT", action = "ToggleFullScreen" },
  { key = "r", mods = "CTRL|SHIFT", action = "ReloadConfiguration" },
  },

  -- Controls the behavior when the terminal exits.
  exit_behavior = "CloseOnCleanExit"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment