User Tools

Site Tools


software:gui:alacritty

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
software:gui:alacritty [2023/11/22 14:32] warnaudsoftware:gui:alacritty [2023/11/23 10:08] (current) warnaud
Line 1: Line 1:
 +====== Very nice terminal ======
 +===== Download =====
 +-> https://alacritty.org/
  
 +===== config file example =====
 +<code perl>
 +window:
 +  # Window dimensions (changes require restart)
 +  #
 +  # Number of lines/columns (not pixels) in the terminal. The number of columns
 +  # must be at least `2`, while using a value of `0` for columns and lines will
 +  # fall back to the window manager's recommended size.
 +  dimensions:
 +    columns: 200
 +    lines: 50
 +
 +  # Window position (changes require restart)
 +  #
 +  # Specified in number of pixels.
 +  # If the position is not set, the window manager will handle the placement.
 +  position:
 +    x: 70
 +    y: 70
 +
 +  # Window padding (changes require restart)
 +  #
 +  # Blank space added around the window in pixels. This padding is scaled
 +  # by DPI and the specified value is always added at both opposing sides.
 +  #padding:
 +  #  x: 0
 +  #  y: 0
 +  padding:
 +    x: 3
 +    y: 3
 +
 +  # Spread additional padding evenly around the terminal content.
 +  dynamic_padding: false
 +
 +  # Window decorations
 +  #
 +  # Values for `decorations`:
 +  #     - full: Borders and title bar
 +  #     - none: Neither borders nor title bar
 +  #
 +  # Values for `decorations` (macOS only):
 +  #     - transparent: Title bar, transparent background and title bar buttons
 +  #     - buttonless: Title bar, transparent background and no title bar buttons
 +  #decorations: none
 +  decorations: full
 +
 +scrolling:
 +  # Maximum number of lines in the scrollback buffer.
 +  # Specifying '0' will disable scrolling.
 +  history: 5000
 +# Font configuration
 +font:
 +  # Normal (roman) font face
 +  normal:
 +    # Font family
 +    #
 +    # Default:
 +    #   - (macOS) Menlo
 +    #   - (Linux/BSD) monospace
 +    #   - (Windows) Consolas
 +    # family: SauceCodePro Nerd Font
 +    # family: CodeNewRoman Nerd Font
 +    # family: RobotoMono Nerd Font
 +    # family: Hack
 +    # family: JetBrains Mono
 +    # family: UbuntuMono Nerd Font
 +    # family: Monofur Nerd Font
 +    # family: TerminessTTF Nerd Font
 +    family: MesloLGS NF
 +
 +    # The `style` can be specified to pick a specific face.
 +    style: Regular
 +  # Bold font face
 +  bold:
 +    # Font family
 +    #
 +    # If the bold family is not specified, it will fall back to the
 +     #
 +    # If the bold family is not specified, it will fall back to the
 +    # value specified for the normal font.
 +    # family: SauceCodePro Nerd Font
 +    # family: CodeNewRoman Nerd Font
 +    # family: RobotoMono Nerd Font
 +    # family: Hack
 +    # family: JetBrains Mono
 +    # family: UbuntuMono Nerd Font
 +    # family: Monofur Nerd Font
 +    # family: TerminessTTF Nerd Font
 +    family: MesloLGS NF
 +
 +    # The `style` can be specified to pick a specific face.
 +    style: Bold
 +
 +  # Italic font face
 +  italic:
 +    # Font family
 +    #
 +    # If the italic family is not specified, it will fall back to the
 +    # value specified for the normal font.
 +    # family: SauceCodePro Nerd Font Mono
 +    # family: CodeNewRoman Nerd Font
 +    # family: RobotoMono Nerd Font
 +    # family: Hack
 +    # family: JetBrains Mono
 +    # family: UbuntuMono Nerd Font
 +    # family: Monofuritalic Nerd Font Mono
 +    # family: TerminessTTF Nerd Font
 +    family: MesloLGS NF
 +
 +    # The `style` can be specified to pick a specific face.
 +    style: Italic
 +
 +  # Bold italic font face
 +  bold_italic:
 +    # Font family
 +    #
 +    # If the bold italic family is not specified, it will fall back to the
 +    # value specified for the normal font.
 +    # family: SauceCodePro Nerd Font Mono
 +    # family: CodeNewRoman Nerd Font
 +    # family: RobotoMono Nerd Font
 +    # family: Hack
 +    # family: JetBrains Mono
 +    # family: UbuntuMono Nerd Font
 +    # family: Monofuritalic Nerd Font Mono
 +    # family: TerminessTTF Nerd Font
 +    family: MesloLGS NF
 +
 +    # The `style` can be specified to pick a specific face.
 +    style: Bold Italic
 +
 +  # Point size
 +  size: 14.0
 +
 +# Background opacity
 +#
 +# Window opacity as a floating point number from `0.0` to `1.0`.
 +# The value `0.0` is completely transparent and `1.0` is opaque.
 +# background_opacity: 1.0
 +# background_opacity: 0.95
 +
 +#cursor:
 +  # Cursor style
 +  #
 +  # Values for `style`:
 +  #   - ▇ Block
 +  #   - _ Underline
 +  #   - | Beam
 +  style: Beam
 +
 +key_bindings:
 +  - { key: Return,          mods: Command,                    action: ToggleSimpleFullscreen } 
 +</code>
 +
 +===== Toggle fullscreen =====
 +<code bash>vi ~/.hammerspoon/init.lua</code>
 +<code lua>
 +local spaces = require("hs.spaces") -- https://github.com/asmagill/hs._asm.spaces
 +
 +-- Switch alacritty
 +hs.hotkey.bind({'command'}, 'escape', function ()
 +  local BUNDLE_ID = 'org.alacritty' -- more accurate to avoid mismatching on browser titles
 +  function moveWindow(alacritty, space, mainScreen)
 +    -- move to main space
 +    local win = nil
 +    while win == nil do
 +      win = alacritty:mainWindow()
 +    end
 +    print("win="..tostring(win))
 +    print("space="..tostring(space))
 +    print("screen="..tostring(win:screen()))
 +    print("mainScr="..tostring(mainScreen))
 +    if win:isFullScreen() then
 +      hs.eventtap.keyStroke('cmd', 'return', 0, alacritty)
 +    end
 +    winFrame = win:frame()
 +    scrFrame = mainScreen:fullFrame()
 +    winFrame.w = scrFrame.w
 +    winFrame.y = scrFrame.y
 +    winFrame.x = scrFrame.x
 +    print("winFrame="..tostring(winFrame))
 +    win:setFrame(winFrame, 0)
 +    print("win:frame=" .. tostring(win:frame()))
 +    spaces.moveWindowToSpace(win, space)
 +    if win:isFullScreen() then
 +      hs.eventtap.keyStroke('cmd', 'return', 0, alacritty)
 +    end
 +    win:focus()
 +  end
 +  local alacritty = hs.application.get(BUNDLE_ID)
 +  if alacritty ~= nil and alacritty:isFrontmost() then
 +    alacritty:hide()
 +  else
 +    local space = spaces.activeSpaceOnScreen()
 +    local mainScreen = hs.screen.mainScreen()
 +    if alacritty == nil and hs.application.launchOrFocusByBundleID(BUNDLE_ID) then
 +      local appWatcher = nil
 +      print('create app watcher')
 +      appWatcher = hs.application.watcher.new(function(name, event, app)
 +        print('name='..name)
 +        print('event='..event)
 +        if event == hs.application.watcher.launched and app:bundleID() == BUNDLE_ID then
 +          app:hide()
 +          moveWindow(app, space, mainScreen)
 +          print("stop watcher")
 +          appWatcher:stop()
 +        end
 +      end)
 +      print('start watcher')
 +      appWatcher:start()
 +    end
 +    if alacritty ~= nil then
 +      moveWindow(alacritty, space, mainScreen)
 +    end
 +  end
 +end)
 +</code>
 +
 +===== Reference/tips =====
 +
 +  * [[https://github.com/alacritty/alacritty/issues/286| increase/deceae size]] TL;DR; Cmd+"=" /Cmd +"-" Reset: Cmd +0
 +  * [[https://sunnnychan.github.io/cheatsheet/linux/config/alacritty.yml.html|config file CheatSheet]]
 +  * [[https://world.hey.com/jonash/alacritty-drop-down-guake-quake-style-terminal-setup-on-macos-6eef7d73|quaketerm]]