Skip to content

Commit

Permalink
fix: oppacity toggle mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
mike325 committed Aug 16, 2023
1 parent 36563fe commit 3be83e8
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 21 deletions.
4 changes: 2 additions & 2 deletions config/wezterm/events.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ end)

wezterm.on('toggle-opacity', function(window, _)
local overrides = window:get_config_overrides() or {}
if not overrides.window_background_opacity then
if not overrides.window_background_opacity or overrides.window_background_opacity == 1.0 then
overrides.window_background_opacity = 0.9
else
overrides.window_background_opacity = nil
overrides.window_background_opacity = 1.0
end
window:set_config_overrides(overrides)
end)
17 changes: 13 additions & 4 deletions config/wezterm/functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,23 @@ local wezterm = require 'wezterm'
local M = {}

function M.get_windows()
-- return wezterm.gui.gui_windows()
return wezterm.mux.all_windows()
return wezterm.gui.gui_windows()
end

function M.get_active_window()
local windows = wezterm.gui.gui_windows()
local win
for _, win in ipairs(windows) do
if win:is_focused() then
return win
end
end
return windows[1]
end

function M.get_active_tab(window)
if not window then
local windows = wezterm.mux.all_windows()
window = windows[1]
window = M.get_active_window()
end
local tab = window:active_tab()
return tab
Expand Down
16 changes: 2 additions & 14 deletions config/wezterm/sys.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- NOTE: We cannot import anything outside of the wezterm confif dir yet
-- NOTE: We cannot import anything outside of the wezterm config dir yet
-- we first need to patch the runtime
local wezterm = require 'wezterm'
local is_windows = wezterm.target_triple == 'x86_64-pc-windows-msvc'
Expand Down Expand Up @@ -65,19 +65,7 @@ function sys.basename(str)
end

function sys.open(uri)
local cmd = {}
if sys.name == 'windows' then
table.insert(cmd, 'powershell')
require('utils.tables').list_extend(cmd, { '-noexit', '-executionpolicy', 'bypass', 'Start-Process' })
elseif sys.name == 'linux' then
table.insert(cmd, 'xdg-open')
else
-- Problably macos
table.insert(cmd, 'open')
end
table.insert(cmd, uri)
local success, _, _ = wezterm.run_child_process(cmd)
return success
wezterm.open_with(uri)
end

return sys
4 changes: 3 additions & 1 deletion config/wezterm/wezterm.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
_G['unpack'] = _G['unpack'] or _G['table'].unpack
if not unpack then
_G['unpack'] = _G['table'].unpack
end

require 'patch_runtime'

Expand Down

0 comments on commit 3be83e8

Please sign in to comment.