[*] Multiple new configs
This commit is contained in:
@@ -1,156 +1,23 @@
|
||||
local wezterm = require 'wezterm'
|
||||
|
||||
local workspace_switcher = wezterm.plugin.require("https://github.com/MLFlexer/smart_workspace_switcher.wezterm")
|
||||
local tabline = wezterm.plugin.require("https://github.com/michaelbrusegard/tabline.wez")
|
||||
-- local resurrect = wezterm.plugin.require("https://github.com/MLFlexer/resurrect.wezterm")
|
||||
|
||||
local function strsplit(inputstr, sep)
|
||||
if sep == nil then
|
||||
sep = "%s"
|
||||
end
|
||||
local t = {}
|
||||
for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
|
||||
table.insert(t, str)
|
||||
end
|
||||
return t
|
||||
end
|
||||
|
||||
local config = wezterm.config_builder()
|
||||
|
||||
config.color_scheme = 'Ayu Dark (Gogh)'
|
||||
-- config.color_scheme = 'Ayu Mirage'
|
||||
config.bidi_enabled = true
|
||||
config.enable_kitty_graphics = true
|
||||
config.default_cursor_style = 'BlinkingBlock'
|
||||
config.animation_fps = 24
|
||||
config.cursor_blink_rate = 600
|
||||
|
||||
-- config.leader = { key = 'Space', mods = 'CTRL', timeout_milliseconds = 1000 }
|
||||
config.keys = {
|
||||
-- {
|
||||
-- key = 'x',
|
||||
-- mods = 'CTRL',
|
||||
-- action = wezterm.action.CopyTo 'Clipboard',
|
||||
-- },
|
||||
|
||||
{ key = 'd', mods = 'LEADER', action = wezterm.action.QuitApplication },
|
||||
|
||||
{
|
||||
key = "s",
|
||||
mods = "LEADER",
|
||||
action = workspace_switcher.switch_workspace(),
|
||||
},
|
||||
{ key = 'L', mods = 'CTRL', action = wezterm.action.ShowDebugOverlay },
|
||||
{
|
||||
key = "n",
|
||||
mods = "LEADER",
|
||||
action = wezterm.action.PromptInputLine {
|
||||
description = wezterm.format {
|
||||
{ Attribute = { Intensity = 'Bold' } },
|
||||
{ Foreground = { AnsiColor = 'Fuchsia' } },
|
||||
{ Text = 'Enter name for new workspace' },
|
||||
},
|
||||
action = wezterm.action_callback(function(window, pane, line)
|
||||
if line then
|
||||
window:perform_action(
|
||||
wezterm.action.SwitchToWorkspace {
|
||||
name = line,
|
||||
},
|
||||
pane
|
||||
)
|
||||
end
|
||||
end),
|
||||
},
|
||||
},
|
||||
{
|
||||
key = "r",
|
||||
mods = "LEADER",
|
||||
action = wezterm.action.PromptInputLine {
|
||||
description = wezterm.format {
|
||||
{ Attribute = { Intensity = 'Bold' } },
|
||||
{ Foreground = { AnsiColor = 'Fuchsia' } },
|
||||
{ Text = 'Rename workspace' },
|
||||
},
|
||||
action = wezterm.action_callback(function(window, pane, line)
|
||||
if line then
|
||||
wezterm.run_child_process { 'wezterm', 'cli', 'rename-workspace', line}
|
||||
end
|
||||
end),
|
||||
},
|
||||
},
|
||||
{
|
||||
key = "t",
|
||||
mods = "LEADER",
|
||||
action = wezterm.action.PromptInputLine {
|
||||
description = wezterm.format {
|
||||
{ Attribute = { Intensity = 'Bold' } },
|
||||
{ Foreground = { AnsiColor = 'Fuchsia' } },
|
||||
{ Text = 'Rename tab' },
|
||||
},
|
||||
action = wezterm.action_callback(function(window, pane, line)
|
||||
if line then
|
||||
wezterm.run_child_process { 'wezterm', 'cli', 'set-tab-title', line}
|
||||
end
|
||||
end),
|
||||
},
|
||||
},
|
||||
-- {
|
||||
-- key = "l",
|
||||
-- mods = "LEADER",
|
||||
-- action = wezterm.action_callback(function(win, pane)
|
||||
-- resurrect.fuzzy_load(win, pane, function(id, label)
|
||||
-- local type = string.match(id, "^([^/]+)") -- match before '/'
|
||||
-- id = string.match(id, "([^/]+)$") -- match after '/'
|
||||
-- id = string.match(id, "(.+)%..+$") -- remove file extention
|
||||
-- local opts = {
|
||||
-- relative = true,
|
||||
-- restore_text = true,
|
||||
-- on_pane_restore = resurrect.tab_state.default_on_pane_restore,
|
||||
-- }
|
||||
-- if type == "workspace" then
|
||||
-- local state = resurrect.load_state(id, "workspace")
|
||||
-- resurrect.workspace_state.restore_workspace(state, opts)
|
||||
-- elseif type == "window" then
|
||||
-- local state = resurrect.load_state(id, "window")
|
||||
-- resurrect.window_state.restore_window(pane:window(), state, opts)
|
||||
-- elseif type == "tab" then
|
||||
-- local state = resurrect.load_state(id, "tab")
|
||||
-- resurrect.tab_state.restore_tab(pane:tab(), state, opts)
|
||||
-- end
|
||||
-- end)
|
||||
-- end),
|
||||
-- },
|
||||
-- {
|
||||
-- key = "w",
|
||||
-- mods = "LEADER",
|
||||
-- action = wezterm.action_callback(function(win, pane)
|
||||
-- resurrect.save_state(resurrect.workspace_state.get_workspace_state())
|
||||
-- end),
|
||||
-- },
|
||||
config.window_padding = {
|
||||
left = 0,
|
||||
right = 0,
|
||||
top = 0,
|
||||
bottom = 0
|
||||
}
|
||||
|
||||
local tl_config = require('tabline.config')
|
||||
-- local scheme = tl_config.colors.scheme
|
||||
config.font = wezterm.font 'Fira Code Nerd Font'
|
||||
|
||||
local fetch_cache = {
|
||||
['playing'] = {
|
||||
text = nil,
|
||||
last = 0,
|
||||
secs = 5,
|
||||
},
|
||||
['weather'] = {
|
||||
text = nil,
|
||||
last = 0,
|
||||
secs = 600,
|
||||
},
|
||||
}
|
||||
|
||||
local function currently_playing()
|
||||
if fetch_cache.playing.text == nil or os.clock() - fetch_cache.playing.last > fetch_cache.playing.secs then
|
||||
local success, stdout, _ = wezterm.run_child_process {'python', 'C:/Users/robea/Dev/scripts/currently_playing.py'}
|
||||
if success then
|
||||
fetch_cache.playing.text = stdout .. ' '
|
||||
else
|
||||
fetch_cache.playing.text = ''
|
||||
end
|
||||
fetch_cache.playing.last = os.clock()
|
||||
end
|
||||
return fetch_cache.playing.text
|
||||
end
|
||||
|
||||
local function weather()
|
||||
if fetch_cache.weather.text == nil or os.clock() - fetch_cache.weather.last > fetch_cache.weather.secs then
|
||||
@@ -245,7 +112,7 @@ tabline.setup{
|
||||
},
|
||||
},
|
||||
sections = {
|
||||
tabline_a = { { 'workspace', padding = {left = 1, right = 1}}},
|
||||
-- tabline_a = { { 'workspace', padding = {left = 1, right = 1}}},
|
||||
tabline_b = {},
|
||||
tabline_c = { ' ' },
|
||||
-- tab_active = {
|
||||
@@ -263,108 +130,41 @@ tabline.setup{
|
||||
-- },
|
||||
-- },
|
||||
-- tab_inactive = { 'index', { 'process', padding = { left = 0, right = 1 } } },
|
||||
tab_active = { {Attribute = {Intensity = "Bold"}}, 'index' },
|
||||
tab_active = { {Attribute = {Intensity = "Bold"}}, 'index', 'process' },
|
||||
tab_inactive = { 'index' },
|
||||
tabline_x = {
|
||||
-- currently_playing,
|
||||
},
|
||||
tabline_y = {
|
||||
weather,
|
||||
datetime,
|
||||
'cpu',
|
||||
'ram',
|
||||
-- weather,
|
||||
-- datetime,
|
||||
},
|
||||
tabline_z = {
|
||||
battery,
|
||||
'battery',
|
||||
-- battery,
|
||||
-- {
|
||||
-- 'hostname',
|
||||
-- },
|
||||
},
|
||||
},
|
||||
extensions = {
|
||||
'smart_workspace_switcher',
|
||||
-- 'smart_workspace_switcher',
|
||||
-- 'resurrect',
|
||||
}
|
||||
}
|
||||
|
||||
tabline.apply_to_config(config)
|
||||
-- workspace_switcher.apply_to_config(config, {})
|
||||
|
||||
-- config.default_prog = {'powershell.exe', '-NoExit', '-Command', '&{Import-Module "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Common7\\Tools\\Microsoft.VisualStudio.DevShell.dll"; Enter-VsDevShell 0fa0d336 -SkipAutomaticLocation -DevCmdArguments "-arch=x64 -host_arch=x64"}'}
|
||||
-- config.default_prog = {'nu.exe'}
|
||||
-- config.default_cwd = 'D:\\Dev'
|
||||
-- config.default_cwd = '~/Dev'
|
||||
config.default_prog = {'/usr/bin/nu'}
|
||||
|
||||
config.default_workspace = '~'
|
||||
|
||||
config.default_cursor_style = 'BlinkingBlock'
|
||||
config.animation_fps = 24
|
||||
-- config.cursor_blink_ease_in = 'Constant'
|
||||
-- config.cursor_blink_ease_out = 'Constant'
|
||||
config.cursor_blink_rate = 600;
|
||||
|
||||
config.window_padding = {
|
||||
left = 0,
|
||||
right = 0,
|
||||
top = 0,
|
||||
bottom = 0,
|
||||
}
|
||||
|
||||
-- config.window_background_opacity = 0.5
|
||||
-- config.win32_system_backdrop = 'Acrylic'
|
||||
|
||||
config.font = wezterm.font 'Fira Code'
|
||||
|
||||
-- config.window_frame = {
|
||||
-- font = require('wezterm').font 'Roboto',
|
||||
-- font_size = 10,
|
||||
-- border_left_width = '0.5cell',
|
||||
-- border_right_width = '0.5cell',
|
||||
-- border_bottom_height = '0.25cell',
|
||||
-- border_top_height = '0.25cell',
|
||||
-- border_left_color = 'purple',
|
||||
-- border_right_color = 'purple',
|
||||
-- border_bottom_color = 'purple',
|
||||
-- border_top_color = 'purple',
|
||||
-- }
|
||||
|
||||
-- config.window_decorations="INTEGRATED_BUTTONS|RESIZE"
|
||||
-- config.window_decorations="RESIZE"
|
||||
config.window_decorations="TITLE | RESIZE"
|
||||
config.use_fancy_tab_bar=false
|
||||
config.tab_bar_at_bottom=true
|
||||
config.show_tabs_in_tab_bar=true
|
||||
config.hide_tab_bar_if_only_one_tab=false
|
||||
config.show_new_tab_button_in_tab_bar=false
|
||||
config.tab_max_width=32
|
||||
config.colors = config.colors or {}
|
||||
config.colors.tab_bar = config.colors.tab_bar or {}
|
||||
config.colors.tab_bar.background = colors.bg
|
||||
config.status_update_interval = 500
|
||||
|
||||
config.bidi_enabled = true
|
||||
config.enable_kitty_graphics = true
|
||||
|
||||
-- config.unix_domains = {
|
||||
-- { name = 'unix' },
|
||||
-- }
|
||||
-- config.default_gui_startup_args = { 'connect', 'unix' }
|
||||
|
||||
-- -- loads the state whenever I create a new workspace
|
||||
-- wezterm.on("smart_workspace_switcher.workspace_switcher.created", function(window, _, label)
|
||||
-- local workspace_state = resurrect.workspace_state
|
||||
--
|
||||
-- workspace_state.restore_workspace(resurrect.load_state(label, "workspace"), {
|
||||
-- window = window,
|
||||
-- relative = true,
|
||||
-- restore_text = true,
|
||||
-- on_pane_restore = resurrect.tab_state.default_on_pane_restore,
|
||||
-- })
|
||||
-- end)
|
||||
|
||||
-- Saves the state whenever I select a workspace
|
||||
-- wezterm.on("smart_workspace_switcher.workspace_switcher.selected", function(window, path, label)
|
||||
-- local workspace_state = resurrect.workspace_state
|
||||
-- resurrect.save_state(workspace_state.get_workspace_state())
|
||||
-- end)
|
||||
|
||||
-- wezterm.on("gui-startup", function()
|
||||
-- local tab, pane, window = wezterm.mux.spawn_window{}
|
||||
-- -- window:gui_window():maximize()
|
||||
-- window:gui_window():toggle_fullscreen()
|
||||
-- end)
|
||||
|
||||
return config
|
||||
|
||||
Reference in New Issue
Block a user