wez / wezterm

A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust
https://wezfurlong.org/wezterm/
Other
16.75k stars 751 forks source link

Strange wezterm dash prompt on Linux Mint 21.2 Xfce #5295

Closed oOosys closed 4 months ago

oOosys commented 5 months ago

What Operating System(s) are you seeing this problem on?

Linux X11

Which Wayland compositor or X11 Window manager(s) are you using?

xfwm4

WezTerm version

wezterm 20240203-110809-5046fc22

Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?

No, and I'll explain why below

Describe the bug

dash prompt in wezterm if started with dash as default shell: \t \w $ dash prompt in wezterm if dash run from bash: \[\e]0;\u@\h: \w\a\]\[\033[01;32m\]~ $ \[\033[00m\] dash prompt in xfce4-terminal and any other terminals: $

Why not nightly? I am on volume limited Internet connection, only extremely rare using dash and one of my guidelines is 'never change an already tested running system".

To Reproduce

Start wezterm with bash as default shell and then run the command: ~ $ dash

Configuration

    local  coOo = require 'wezterm' -- load Lua/Rust API interface module (REQUIRED)
--          ^--   oOo   prefers 'round' over   f,k,t,v,w,z   in symbol names
    local  config   = coOo.config_builder() --> table describing a subset of all  settings
    local  _        = config --> '_' for brevity of in this script most repeated symbol name
    _.enable_wayland = false
    _.bold_brightens_ansi_colors = "No" 
--[[        The CONFIGURATION file is by default instantly re-run if changed/updated        ]]
--  /usr/local/sbin/coOo
--      -->  link to a shell script raising/opening/starting a Console Window : 
--          --> /home/o/oOo/ooo/root/usr/local/sbin/coOo     
--                  created by to   coOo   renamed   wezterm  Terminal  executable                                                      \
-- ======================================================================-
--[[                    SETTING   OF  INTERFACE  SYMBOL   NAMES                         ]]
-- ======================================================================-
local T         = coOo.time.now
local msleep    = coOo.sleep_ms
local runAfter  = coOo.time.call_after --> delay function call by x seconds ( 0.001 is OK )
local mux       = coOo.mux  --> settings for panes, tabs, windows and workspaces
local run       = coOo.action --> alias expressing what the method is about
--[[        ^-- run.DecreaseFontSize, run.DisableDefaultAssignment (of a key), ...          ]]
local On        = coOo.on --> alias increasing readability and brevity
local colorSchemes = coOo.get_builtin_color_schemes --> brevity alias
--  for name, scheme in pairs(colorSchemes()) do  print( name )   end --> see the .log file
local gui       = coOo.gui  -- table providing following  FUNCTIONS:  
    --  default_key_tables()    default_keys()     enumerate_gpus()   get_appearance()
    --          gui_window_for_mux_window()   gui_windows()   screens()
-- ======================================================================-
--[[            DEFINITION OF CALLBACK FUNCTIONS TO RUN ON GIVEN EVENTS         ]]
-- ======================================================================-
guiStartup = function() -- setting the initial Window position/size to drop-down style: 
    tab, pane, window = mux.spawn_window( { -- ??? 2024-03-08_00:11 ???
    args        =   { 'bash' }, -- { 'bash' }, -- same as { } ( bash is default ),   = { 'top' }   to run '~ $ top'  
    width       =   152, -- multiple of default font character width at default font size
    height      =     15, -- multiple of default font character height at default font size
    position    =   {x=35,y=0}, --[[ y=-1 hides the curr. working directory listing title bar   ]]
    origin      =   "ScreenCoordinateSystem" -- "MainScreen", "ActiveScreen", {Named="HDMI-1"} <- see coOo.gui.screens()
    } )
    --[[        v--  On()  runs ^ --THIS --^  function at 'gui-startup':                            ]]
end         On('gui-startup', guiStartup )

--[[                    REGISTER AND USE CUSTOM EVENTS  
--> wezterm.time.call_after(floatTIMEseconds, callbackFunctionToRunAfterTIMEsecondsPassed)
--> ^-- alias runAfter

run.EmitEvent 'editWith_eoOo' -- for example on keypress to pass the text for editing:
local io            = require 'io'
local os            = require 'os'
coOo.on('editWith_eoOo',    -- register a custom event
    function(window, pane)
        -- Retrieve the text from the pane
        local text = pane:get_lines_as_text(    pane:get_dimensions().scrollback_rows   )
        -- Create a temporary file to pass to eoOo
        local tmpFname = os.tmpname()
        local f = io.open(tmpFname, 'w+')
        f:write(text)
        f:flush()
        f:close()
        -- Open a new window running eoOo and tell it to open the file
        window:perform_action( act.SpawnCommandInNewWindow { args = { 'eoOo', tmpFname },  }, pane )
        -- Wait "enough" time so eoOo can read the file before we remove it.
        -- msleep(1000)
        -- os.remove(tmpFname)
    end
)
--  coOo.open_with 'http://example.com' -- opens in default Internet browser
--  coOo.open_with(  'http://example.com', 'firefox'  )
--  local success, stdout, stderr = coOo.run_child_process { 'ls', '-l' }
--  coOo.shell_split("ls -a")               -- gives: [ "ls", "-a",]
--  coOo.shell_split("echo 'hello there'")  -- gives:   [ "echo", "hello there",]
--  coOo.column_width(string)           -- gives: number of chars ( string.len gives number of bytes for utf-8 encoding )
--  local example = 'hello\nthere\n'
--  for _, line in ipairs(coOo.split_by_newlines(example)) do
--      print(line)                 -- INFO:
--      --coOo.log_error(line)  -- ERROR:
--  end     -- WHY two times the output??? Second time after 0.2 seconds???
 - ======================================================================-  ]]

-- ======================================================================-
--[[                THE LAUNCHER MENU ( + NEW TAB RIGHT MOUSE CLICK )               ]]
-- ======================================================================-
    _.launch_menu = {
        {   label = 'SystemMonitor' ,   -- is shown in the Menu
            args = { 'htop' }           ,   -- is run when selected in the Menu
        },      
        {   label = 'FishShell'     ,
            args = { 'fish' }           ,
            cwd = '/home/o/oOo'     ,
            set_environment_variables = { oOo = '/home/o/oOo' },
        },
    }   

-- ======================================================================-
--[[                SHELL, DEFAULT·FONT, SCROLLBACK, PANE/WINDOW LAYOUT         ]]
--    -- Settings specified before   guiStartup = function()   fail to be updated on file save --
-- ======================================================================-
    --_.default_prog                    = { '/usr/bin/bash' }  -- is already the default one
    --_.font                            = coOo.font('B612 Mono')  -- 'JetBrains Mono') -- is the default one  ('B612 Mono') -- other than Mono give double spacing
    --  ^-- the   coOo   BUILTIN monospace font is the best I have seen yet ...
    --_.font = coOo.font_with_fallback {
    --              { family = 'JetBrains Mono', weight = 'Medium'  },
    --              { family = 'Terminus', weight = 'Bold'              },
    --              'Noto Color Emoji', }
                                                                                        --[[    
--Font shaping-- : e.g. using ligatures or applying other by the font provided  features.
    Wezterm uses the   HarfBuzz   library for font shaping and provides
        config.harfbuzz_features
    table for disabling/enabling usage of available features. 
If you want to disable ligatures in most fonts, then you may want to use a setting like this:
    config.harfbuzz_features = { 'calt=0', 'clig=0', 'liga=0' }
Some fonts make available extended options via stylistic sets. If you use the Fira Code 
    font, it lists available stylistic sets here: 
        https://github.com/tonsky/FiraCode/wiki/How-to-enable-stylistic-sets
and you can set them in wezterm:
    Use this for a zero with a line through it rather than a dot when using Fira Code font
        config.harfbuzz_features = { 'zero' }
You can specify harfbuzz_features also  on a per-font basis:
    config.font = wezterm.font_with_fallback {
        {   family = 'JetBrains Mono',
            weight = 'Medium',
            harfbuzz_features = { 'calt=0', 'clig=0', 'liga=0' },
        },{ 
            family = 'Terminus', weight = 'Bold' 
        },
        'Noto Color Emoji',
    }                                                                                   ]]
    _.harfbuzz_features = { 'calt=0' }
    _.window_decorations            = "RESIZE" --"NONE" -- else: "TITLE | RESIZE" other: "TITLE" or "RESIZE" only
    --_.window_background_opacity   = 0.0       -- else: 1.0   range: 0.0 .. 1.0
    _.font_size                     = 10.7      -- no idea if 11 is better
    --_.font_size                       = 11        -- no idea if 11 is better
    -- PAY attention to vertical position of single letters as e,g. G or e : are they at same hight as all other ones?
    --  ^-- JetBrains Mono as native font has the least amount of issues so use it whenever possible
    --_.line_height                 = 1.1       -- less lines in same vertical space than with 0.9
    _.line_height                   = 0.9       -- more lines in same vertical space than with 1,1
    _.cell_width                        = 0.95      -- else: 1.0 of primary font width at font size
    _.adjust_window_size_when_changing_font_size = false
    _.initial_cols                  = 150       -- characters
    _.initial_rows                  = 15        -- characters
    _.window_frame = { font = coOo.font { family = 'Noto Sans', weight = 'Regular' }, }

    _.window_padding = {    left        = 23,       -- pixels, else: '1cell'
                            right   = 11,       -- pixels, else: '1cell' ( width of the scrollbar )
                            top     = '9px',    -- pixels, else: '0.5cell'
                            bottom  = 9,    }   -- pixels, else: '0.5cell'
    _.enable_scroll_bar             = true      -- false/true
    _.min_scroll_bar_height         = '17px'    -- width -> one cell if _.window_padding.right= 0 else padding.right=
    _.scrollback_lines              = 10000000  -- ... best use coOo record instead

    -- _.automatically_reload_config    = true -- true/false -> default: true

    --_.window_decorations  = "RESIZE" -- removes left upper menu from Window title bar
    _.use_fancy_tab_bar         = false         -- false/true   -- true enlarges Tab text
    _.hide_tab_bar_if_only_one_tab  = true      -- use Ctrl+Shift+T for additional Tab

    --_.exit_behavior               = "Hold"    -- else: "CloseOnCleanExit"  other: "Close", "Hold" 
    --_.clean_exit_codes                = { 0 }     -- {0,130}->sameAs {130} as zero is ALWAYS considered "clean" 

    _.inactive_pane_hsb             = { saturation = 0.8 , brightness = 0.7 }   -- ???

    _.warn_about_missing_glyphs = false -- popup with much text and ugly icon

    _.default_cursor_style  = 'SteadyBar' -- 'BlinkingBlock' -- Acceptable values are SteadyBlock, BlinkingBlock, SteadyUnderline, BlinkingUnderline, SteadyBar, and BlinkingBar.
    _.cursor_blink_rate     = 0 -- 369
    _.animation_fps         = 11
    _.cursor_blink_ease_in  = 'Constant' -- 'Eease', 'EaseIn', 'EaseInOut', 'EaseOut', 
    _.cursor_blink_ease_out = 'Ease'     -- 'Linear',  'Constant', {CubicBezier={0.0, 0.0, 0.58, 1.0}}
    _.visual_bell           =   {   
                                    fade_in_function        = 'EaseIn',
                                    fade_in_duration_ms = 300,
                                    fade_out_function       = 'EaseOut',
                                    fade_out_duration_ms    = 300,          
                                }
    _.audible_bell          = 'SystemBeep'  -- 'Disabled' 

    _.allow_square_glyphs_to_overflow_width = 'Always'  -- 'WhenFollowedBySpace',  'Always', 'Never'

    --  _.default_cwd                   = '/home/o/Desktop'

-- ======================================================================-
--[[                                COLOR  SCHEME                                       ]]
-- ======================================================================-
    -- see: ~/oOo/o/_o--coOo--_oo--tuiTUI--O--configure-Theme-list-available--_oo0.log
    _.color_scheme                  = 'Grass' -- 'Andromeda' -- 'mono-green'  --'Grey-green' -- makes the scrollbar 'invisible'
    --  for name, scheme in pairs(coOo.get_builtin_color_schemes()) do
    --      print( name )   
    --  end                                                                             
    _.colors = { 
        background  = 'rgb('..'11'..','.. 33+tonumber(T():format '%M')  ..','..'11'..')',  -- '#114323',    -- default background color
        scrollbar_thumb = '#779988',
        ansi = {        'black',
                    '#ff5555',
                    'green',
                    'olive',
                    'blue',
                    'purple',
                    'teal',
                    'silver',   },
        brights = {     'grey',
                    '#ff8888',
                    'lime',
                    'yellow',
                    'light blue',
                    'fuchsia',
                    'aqua',
                    'white',        },
        cursor_bg   = '#52ad70',        -- caret/cursor/point background color
        visual_bell = '#008888',        -- nice ocean blue ...
    }   -- ist the part representing the current viewport
    -- Reload the configuration every minute
    runAfter(  60,   coOo.reload_configuration )

    --[[
    -- 'none' as color means fully transparent
    -- alpha color value is ignored except when used with selection_fg and selection_bg
    -- supported is a very wide range of color specification methods (see documentation)    ]]--[[
    _.colors = {
        foreground  = 'silver'  ,   -- default color of text characters (glyphs)
        background  = 'black'   ,   -- default background color

        cursor_bg   = '#52ad70' ,   -- overrides background of current Block cursor cell
        cursor_fg   = 'black'   ,   -- overrides text color of current cursor cell
        cursor_border = '#52ad70',  -- of Block cursor or color of  Bar or Underline cursor

        selection_fg    = 'black',
        selection_bg    = '#fffacd',

        scrollbar_thumb = '#222222',    -- ist the part representing the current viewport
        split   = '#444444' ,   --  split lines between panes
        ansi = {        'black',
                    'maroon',
                    'green',
                    'olive',
                    'navy',
                    'purple',
                    'teal',
                    'silver',   },
        brights = {     'grey',
                    'red',
                    'lime',
                    'yellow',
                    'blue',
                    'fuchsia',
                    'aqua',
                    'white',        },
        indexed = { [136] = '#af8700' },    -- arbitrary colors of the palette in the range from 16 to 255

        compose_cursor = 'orange',  -- color feedback about pressing IME, dead or leader key

        -- Notice that In copy_mode, the color of the active text can be:
            --  copy_mode_active_highlight_*     if additional text was selected using the mouse 
            --  selection_*                     otherwise
        copy_mode_active_highlight_bg       = { Color       = '#000000' },  
        copy_mode_active_highlight_fg       = { AnsiColor   = 'Black' },
        copy_mode_inactive_highlight_bg = { Color       = '#52ad70' },
        copy_mode_inactive_highlight_fg = { AnsiColor   = 'White' }, -- valid as `AnsiColor`: 
        --  "Black" , "Maroon"  , "Green"   , "Olive"   , "Navy"    , "Purple"  , "Teal",   "Silver", 
        --  "Grey"  , "Red"     , "Lime"        ,  "Yellow" , "Blue"    , "Fuchsia" , "Aqua","White"
        quick_select_label_bg   = { Color       = 'peru' },
        quick_select_label_fg   = { Color       = '#ffffff' },
        quick_select_match_bg   = { AnsiColor   = 'Navy' },
        quick_select_match_fg   = { Color       = '#ffffff' },
    }
--                                                                                      ]]
-- ======================================================================-
--[[                                KEBOARD KEY SHORTCUTS                               ]]
-- ======================================================================-
--[[    resulting in actual input ( double Shift/Ctrl have same effect as single keypresses )   ]]
    -- run.SendKey { key = 'L', mods = 'CTRL' } -- sending fake user input to the shell
    _.use_dead_keys             = true  -- one of false/true
    _.disable_default_key_bindings  = false -- one of false/true
    _.leader = { key = '/', mods = 'CMD', timeout_milliseconds = 2000 } 
    -- ^._  the leader key followed by another key may bey used to trigger a  function
    --    \__  NOTICE: differs from hotkeys which require pressing keys simultaneously
    --  \__   usage:  mods = 'LEADER' 
    _.set_environment_variables = {
    -- set prompt to working directory using OSC 7, along with current time and prompt colors:
        -- prompt = '$E]7;file://localhost/$P$E\\$E[32m$T$E[0m $E[35m$P$E[36m$_$G$E[0m '
        PS1="\27[1;37;40m\\t \27[7;37m\\w\27[0m $ ", -- show time in bash prompt
    } -- setting will be used for spawned processes while using 
    --                                  coOo.action.SpawnCommandInNewWindow
    --  run.CloseCurrentPane    { confirm = true }
    --  run.CloseCurrentTab { confirm = true }
    --  run.
    _.keys = {
        {   key         = 'T',
            mods        = 'CMD|SHIFT',  -- CMD is the left  SUPER  key. 
            action      = run.PromptInputLine {
                description = 'Enter new name for tab',
                action      = coOo.action_callback(function(window, _, line)
                if line then    -- -TAB- tiltle will be emty on Enter or set to the text input: 
                    window:active_tab():set_title(line)
                end
            end ),
            },
        },
        -- -----------------------------------------------------------------------------------------------------------------------
        {
            key     = ',',
            mods    = 'CMD',
            action  = run.SpawnCommandInNewTab {
                cwd = '/home/o/oOo/o',
                -- set_environment_variables = { TERM = 'screen-256color', },
                -- set_environment_variables = { PS1="\27[1;37;40m\\t \27[7;37m\\w\27[0m $ ", }, -- show time in bash prompt
                args = { 'bash' },
            },
        },
        -- -----------------------------------------------------------------------------------------------------------------------
        {
            key     =   'r', 
            mods    = 'LEADER', 
            action  = run.SpawnCommandInNewTab { -- Tab will be closed on clean exit, except:   _.exit_behavior="HOLD"
                -- label="EDIT coOo_init.lua",
                cwd = '/home/o/oOo/o',
                -- set_environment_variables = { TERM = 'screen-256color', },
                args = { 'bash', '-c', 'e /home/o/oOo/ooo/root/usr/local/sbin/coOo_init.lua'  },
            },
        },
        -- -----------------------------------------------------------------------------------------------------------------------
        --  {
        --      key = 'K',
        --      mods = 'CTRL|SHIFT',
        --      action = run.Multiple {
        --          act.ClearScrollback 'ScrollbackAndViewport',
        --          act.SendKey { key = 'L', mods = 'CTRL' },
        --      },
        --  },
        -- -----------------------------------------------------------------------------------------------------------------------
        --  {
        --  key = 'c',
        --  mods = 'CTRL',
        --  action = coOo.action_callback(
        --      function(window, pane)
        --          local has_selection = window:get_selection_text_for_pane(pane) ~= ''
        --          if has_selection then
        --              window:perform_action(act.CopyTo 'ClipboardAndPrimarySelection', pane)
        --              window:perform_action(act.ClearSelection, pane)
        --          else
        --              window:perform_action(act.SendKey { key = 'c', mods = 'CTRL' }, pane)
        --          end
        --      end),
        --  },
        -- -----------------------------------------------------------------------------------------------------------------------
        { key = 'l', mods = 'ALT', action = run.ShowLauncher },
        -- -----------------------------------------------------------------------------------------------------------------------
        -- -----------------------------------------------------------------------------------------------------------------------
        -- -----------------------------------------------------------------------------------------------------------------------
        --  ^-- add more more key blocks if necessary
    }-- _.keys
    -- ===============
    _.mouse_bindings = {  
        -- change the default click behavior so that it only selects text and doesn't open 
        -- hyperlinks, and that it populates the Clipboard rather the PrimarySelection 
        -- which is part of the default assignment for a left mouse click:
        {
            event   = { Up = { streak = 1, button = 'Left' } },
            mods    = 'NONE',
            action  = run.CompleteSelection 'Clipboard',    --> 'PrimarySelect,ion',s 'ClipboardAndPrimarySelection'
            --action    = run.CompleteSelectionOrOpenLinkAtMouseCursor 'Clipboard',
        },
        -- -----------------------------------------------------------------------------------------------------------------------
        -- -----------------------------------------------------------------------------------------------------------------------
        -- -----------------------------------------------------------------------------------------------------------------------
        -- -----------------------------------------------------------------------------------------------------------------------
        --  ^-- add more more mouse bindings if necessary
    }-- _.mouse_bindings

return  config  -- make the configuration changes known to coOo

Expected Behavior

I expect wezterm to behave similar to all the other terminals available on my system:

Logs

No response

Anything else?

No response

wez commented 4 months ago

Is this a login shell vs. non-login shell issue? Try launching as a non-login shell https://wezfurlong.org/wezterm/config/launch.html#launching-programs

github-actions[bot] commented 4 months ago

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.

github-actions[bot] commented 3 months ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.