diff --git a/README.md b/README.md index 329682f..c88e698 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,9 @@ Cross-platform terminal emulator built from the ground up with speed, good font Simple setup with automatic config reloading, a colorscheme, font and a couple other bits. +The `wezterm.local_linux.lua` file is meant as a template for creating a local configuration while also tracking generic linux xcursor configurations +required to fix an issue with cursor display. To use it, copy the file to `~/.config/wezterm/local.lua` and wezterm should reload configs automatically. + ### Zsh NOTE: Auto-installs oh-my-zsh directly from the github repository when a user opens Zsh for the first time diff --git a/deploy.sh b/deploy.sh index 1f06d83..7ac38fc 100755 --- a/deploy.sh +++ b/deploy.sh @@ -22,9 +22,10 @@ then ln -fs $PWD/tmux.conf $HOME/.tmux.conf fi -if [ ! -L $HOME/.wezterm.lua ] +if [ ! -L $HOME/.config/wezterm/wezterm.lua ] then - ln -fs $PWD/wezterm.lua $HOME/.wezterm.lua + mkdir -p $HOME/.config/wezterm + ln -fs $PWD/wezterm.lua $HOME/.config/wezterm/wezterm.lua fi if [ ! -L $HOME/.config/nvim/snippets ] diff --git a/wezterm.local_linux.lua b/wezterm.local_linux.lua new file mode 100644 index 0000000..1b5e38d --- /dev/null +++ b/wezterm.local_linux.lua @@ -0,0 +1,39 @@ +local wezterm = require('wezterm') + +local function setup(config) + -- Fixing the cursor theme + local xcursor_size = nil + local xcursor_theme = nil + + local success, stdout, _ = wezterm.run_child_process({ + "gsettings", + "get", + "org.gnome.desktop.interface", + "cursor-theme" + }) + + if success then + xcursor_theme = stdout:gsub("'(.+)'\n", "%1") + end + + local success, _, _ = wezterm.run_child_process({ + "gsettings", + "get", + "org.gnome.desktop.interface", + "cursor-size" + }) + + if success then + xcursor_size = tonumber(stdout) + end + + config.xcursor_theme = xcursor_theme + config.xcursor_size = xcursor_size + -- end cursor theme + + return config +end + +return { + setup = setup, +} diff --git a/wezterm.lua b/wezterm.lua index 553263f..7918d85 100644 --- a/wezterm.lua +++ b/wezterm.lua @@ -2,36 +2,6 @@ local wezterm = require 'wezterm' local config = wezterm.config_builder() --- Fixing the cursor theme -local xcursor_size = nil -local xcursor_theme = nil - -local success, stdout, _ = wezterm.run_child_process({ - "gsettings", - "get", - "org.gnome.desktop.interface", - "cursor-theme" -}) - -if success then - xcursor_theme = stdout:gsub("'(.+)'\n", "%1") -end - -local success, _, _ = wezterm.run_child_process({ - "gsettings", - "get", - "org.gnome.desktop.interface", - "cursor-size" -}) - -if success then - xcursor_size = tonumber(stdout) -end - -config.xcursor_theme = xcursor_theme -config.xcursor_size = xcursor_size --- end cursor theme - -- Visual options config.color_scheme = 's3r0 modified (terminal.sexy)' -- config.color_scheme = 'darkmatrix' @@ -54,4 +24,11 @@ config.window_padding = { config.automatically_reload_config = true +local local_config_filename = os.getenv('HOME') .. '/.config/wezterm/local.lua' +local local_config = io.open(local_config_filename, 'r') +if local_config~=nil then + local local_setup = require('local') + config = local_setup.setup(config) +end + return config