From 2ea0fe53c4bf492d1069df03eedb6be0bbf5ca90 Mon Sep 17 00:00:00 2001 From: rootiest Date: Thu, 3 Oct 2024 21:04:56 -0400 Subject: [PATCH] feat: adds platform options - Determines the OS/platform - Configures OS-specific options --- configs.lua | 19 +++++++++++++++---- platform.lua | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 4 deletions(-) create mode 100644 platform.lua diff --git a/configs.lua b/configs.lua index a0a50cc..42efc0c 100644 --- a/configs.lua +++ b/configs.lua @@ -3,14 +3,14 @@ -- ╰─────────────────────────────────────────────────────────╯ local wezterm = WEZTERM local act = wezterm.action -local gpus = wezterm.gui.enumerate_gpus() +-- local gpus = wezterm.gui.enumerate_gpus() local types = require("types") local cur_hour = wezterm.time.now():format("%H") local hour_angle = require("funcs").get_hour_angle(cur_hour) -return { +local opts = { -- Color Scheme color_scheme = "Catppuccin Mocha", -- Tab Bar Colors @@ -123,11 +123,14 @@ return { -- Rendering front_end = "WebGpu", + -- webgpu_power_preference = "HighPerformance", + -- webgpu_power_preference = "LowPower", + -- webgpu_preferred_adapter = gpus[1], -- front_end = "OpenGL", - webgpu_power_preference = "HighPerformance", - webgpu_preferred_adapter = gpus[1], + -- Scrollback Lines scrollback_lines = 20000, + -- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Leader key ━━━━━━━━━━━━━━━━━━━━━━━━━━ leader = { key = " ", mods = "CTRL", timeout_milliseconds = 1500 }, -- ━━━━━━━━━━━━━━━━━━━━━━━━━ Global Key Mappings ━━━━━━━━━━━━━━━━━━━━━ @@ -343,3 +346,11 @@ return { }, }, } + +-- merge the table in os_opts.lua into opts +local os_opts = require("platform") +for k, v in pairs(os_opts) do + opts[k] = v +end + +return opts diff --git a/platform.lua b/platform.lua new file mode 100644 index 0000000..1c3524b --- /dev/null +++ b/platform.lua @@ -0,0 +1,36 @@ +-- ╭─────────────────────────────────────────────────────────╮ +-- │ OS OPTIONS │ +-- ╰─────────────────────────────────────────────────────────╯ + +-- Load WezTerm module +local wezterm = WEZTERM + +-- Define the opts table +local opts = {} + +-- Get the OS string +local os_string = wezterm.target_triple:lower() +local myos = "" + +-- Determine the OS +if os_string:find("windows") then + myos = "win" +else + if os_string:find("darwin") then + myos = "mac" + else + myos = "linux" + end +end + +-- Set OS-specific options +if myos == "win" then + opts.default_prog = { "pwsh.exe" } + opts.window_background_opacity = 0 + opts.win32_system_backdrop = "Mica" +else + opts.default_prog = { "bash" } +end + +-- Return the opts table +return opts