Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add alacritty integration to change font size #122

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ https://user-images.githubusercontent.com/58336662/181860318-8834446a-e28f-4a75-
- integratons:
- [tmux](https://github.com/tmux/tmux)
- [kitty](https://sw.kovidgoyal.net/kitty/)
- [alacritty](https://alacritty.org/)
- [twilight.nvim](https://github.com/folke/twilight.nvim)
- [nvim-lualine](https://github.com/nvim-lualine/lualine.nvim)

Expand Down Expand Up @@ -161,6 +162,10 @@ true-zen comes with the following defaults:
enabled = false,
font = "+3"
},
alacritty = { -- increment font size in Alacrity. Requires v 0.10.0 or higher. Uses `alacritty msg` subcommand to toggle font size
enabled = false,
font = "24"
},
twilight = false, -- enable twilight (ataraxis)
lualine = false -- hide nvim-lualine (ataraxis)
},
Expand Down
4 changes: 4 additions & 0 deletions lua/true-zen/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ config.options = {
enabled = false,
font = "+3"
},
alacritty = {
enabled = false,
font = "24"
},
twilight = false, -- enable twilight (ataraxis)
lualine = false -- hide nvim-lualine (ataraxis)
},
Expand Down
27 changes: 27 additions & 0 deletions lua/true-zen/integrations/alacritty.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
local M = {}

local cnf = require("true-zen.config").options
local fn = vim.fn
local status

function M.on()
if not fn.executable("alacritty") then
return
end
local cmd = "alacritty msg config -w %s font.size=%s"
local win_id = fn.expand("$ALACRITTY_WINDOW_ID")
fn.system(cmd:format(win_id, cnf.integrations.alacritty.font))
vim.cmd([[redraw]])
status = true
end

function M.off()
if status == true then
local cmd = "alacritty msg config -w %s --reset"
local win_id = fn.expand("$ALACRITTY_WINDOW_ID")
fn.system(cmd:format(win_id))
end
status = nil
end

return M