Changing the default terminal emulator on Manjaro Sway

Hi!

I know I’m not the first person to post about this here (as I had to reopen my account for some reason, it’s now fresh and I’m not allowed to share links), but the proposed solutions don’t work for me. Let me reiterate:

  • I’d like to exchange foot with wezterm and have it spin up on $mod+Return
  • in ~/.config/sway/config, I tried set $term wezterm, as well as /usr/bin/wezterm, which doesn’t change anything
  • in the same file, I tried rebinding $mod+Return not to exec $term, but to exec wezterm (and exec /usr/local/wezterm ), with the same non-result
  • also, I tried creating ~/.config/sway/definitions.d/terminal.conf with this content:
set $term /usr/bin/wezterm
set $term_cwd $term --working-directory "$(swaycwd 2>/dev/null || echo $HOME)" 

That didn’t do anything as well, except but now my $mod+Return shortcut doesn’t do anything amymore, no matter if I have the set $term in my config file or not.

I’m out of my wits and I already wasted way too much time on this issue. What’s the canonical way to do what I want? Sway’s online documentation is rather sparse and man -k sway only gives me nothing appropriate.
If there is a one file solution instead of using multiple ones, I’m in, but that would only be the icing on the cake.

Thanks in advance.

I have never used sway (when I tried to install it in a VM it didn’t want to work) so I have only the idea that you likely already had:
where does $term
which apparently is foot or /usr/bin/foot or wherever …
currently come from?
Where is that defined?

With “where is $term defined” you’re asking precisely the question that bogs me. :slight_smile:
I can’t really tell you more than that there is another sway config file tree under /etc/sway. Whether the config file living there is just a template you’re meant to copy to your home directory and customize to your liking or if it’s actually parsed eludes me. I don’t think it’s meant to be edited as I believe it might be subject to change when Sway becomes updated or so, but I’m not 100% sure on this.

Edit: If I do swaymsg 'exec $term' now, it indeed opens up a new windows of wezterm.

Well, there was a similar issue I had and what I did to find out was to look at
(adapted for your case, assuming that “foot” is the actual binaries name of the current terminal)
which foot
and look for possible symlinks in that directory

Also my crude approach would be to just search the whole /etc directory for the mention of the term “foot”
and look at every file it is mentioned in.
An when there is nothing, I’d look recursively in all of /usr

It has to be assigned somewhere …

That file can likely be copied to your $HOME directory and then be edited there.
That is how most config files work - what is in $HOME supersedes the system wide setting
and isn’t affected by updates.
But I can’t be sure - I don’t have or use sway or that terminal.

Well that seems correct. Did you reload the config?

swaymsg reload

or SUPER+SHIFT+C

Is the terminal Wayland compatible?

See the Manjaro Sway related desktop settings.

@boredland & @simonb would be the most knowledgeable as they manage the Sway edition.

I was curious, but:
sign up/sign in needed to see that

Ah, it appears one must be signed in to search code on GitHub.

Just search for foot here:

1 Like

@megavolt Yes and yes. I reload the config after every change I want to try out, and I even found WezTerm listed among the terminals being natively compatible with Wayland out of the box.

@Yochanan Where foot is mentioned outside of e.g. scripts configuring its server, I found the analogues in my home directory and changed them to wezterm or /usr/bin/wezterm. Like I said, swaymsg 'exec $term' now gives me a wezterm window, so I’d say the variable is set correctly.
Furthermore, when I comment out everything in ~/.config/sway/definitions.d/terminal.conf, my Super+Return shortcut works again, but starts the foot terminal while swaymsg 'exec $term' still gives me a WezTerm window. :thinking:

Take a look here. That seems not to be a valid parameter: wezterm set-working-directory - Wez's Terminal Emulator

Just FYI:
I was trying to assess the situation you are in.

I just downloaded the latest ISO and tried to use it in a VM (Virt Manager - kvm/qemu - like all the others I have …)
I could start it (not in UEFI mode, though), but I’m not able to log in to the default session on the live ISO.

It even tells the default login and password (manjaro for both).
But, typing that simply returns to the starting point and I get nowhere.

I can change to a TTY and access the command line/log in that way -
perhaps that is all I need to install.
We’ll see.

What is the magic word to start the installer in text mode?
If such a thing does exist …

Or:
how do I (try to) start the graphical session from there?

Just typing:
sway
results in a crash and core dump and return to command line
with some mention of swaybg failing

perhaps @megavolt knows, or @Yochanan (probably both of you :grimacing: )

/etc/sway/config

says:
copy this file to:
~/.config/sway/config
and then edit it to your liking

and a few lines in:

#Your preferred terminal emulator
set $term foot

So, that is what I’d edit/change/adapt
in that file, once it has been copied to your $HOME folder.

But you already did that.
So: IDK :man_shrugging:

@megavolt Thanks for the hint, that at least explains my broken keyboard command.

I also tried this out on another, more recent installation of Manjaro Sway, with the exact same results. So far, I’m considering this as a distribution bug. At least I don’t believe other distros have the same problem, otherwise this issue would be more widespread.
How can such a simple task be impossible like this? I’m growing more and more frustrated. :exploding_head:

Example with alacritty:

file: $HOME/.config/sway/definitions.d/terminal.conf

set $term /usr/bin/alacritty
set $term_cwd $term --working-directory "$(swaycwd 2>/dev/null || echo $HOME)"

Run: swaymsg reload → works for me.

I am sorry but :man_facepalming:

Please read this bloody documentation of wezterm… it is not a distribution issue. Well now I have done the work for you:

file: $HOME/.config/sway/definitions.d/terminal.conf

set $term /usr/bin/wezterm
set $term_cwd $term start --cwd "$(swaycwd 2>/dev/null || echo $HOME)"

Run: swaymsg reload → works for me. (Phew… now I can remove that terminal.)

Sway is nothing for noobs and people who resist reading documentations.

Whoops, that escalated quickly. I’m honestly sorry if I flipped some switches at your side that I shouldn’t have. Allow me to elaborate.

While I’m obviously by no means that sort of uber-geek that can recite the flags his kernel was compiled with from the top of his head, neither am I the half-wit your post makes me look like. And truth be told, it hurts to be treated like this. Different than you imply, I’m not at all a stranger to documentation (for instance, I’ve read the better part of man 5 sway with a focus on variables, and I’ve found the documentation for WezTerm on how to set the working directory myself, believe it or not).
I’ve spent literally hours on this issue and I already feel like a fool, especially since the task at hand looks so simple.
Why am I blaming the distribution? Maye I’m oversimplifying things in my head, but when I read Your preferred terminal emulator in a config file, I assume that changing the variable documented that way has some impact. If that makes me a lazy noob in your book, feel free to disengage. Your “Works for me” tells me I’m probably wrong in addressing Manjaro, yet like I already wrote, I tried the same on another installation, with the same yield. And honestly, this is the attitude that keeps people away from Linux in general, at least in my experience.

To comment on your solution: It doesn’t work for me. Copied it verbatim, nothing changed. I doubt anyone wants to read my full config file, but just in case I glossed over something important:

# New windows appear on the longer face of a current one
exec_always autotiling

# Put Icons On Workspaces
exec_always --no-startup-id piow --syslog

set $term wezterm

# styles - set the folder for your theme definition file
set $theme /usr/share/sway/themes/matcha-green

# theme variables
include $theme/definitions

# global variables
include /etc/sway/definitions

# user variables
include $HOME/.config/sway/definitions.d/*.conf

include /etc/sway/inputs/*
include /etc/sway/outputs/*

# enable modes
include /etc/sway/modes/*

# only enable this if every app you use is compatible with wayland
# xwayland disable

# include additional configs e.g. to autostart applications
include /etc/sway/config.d/*

# user config
# include $HOME/.config/sway/config.d/*.conf

include $HOME/.config/sway/definitions

input "type:keyboard" {
        xkb_layout de
        xkb_variant nodeadkeys
        xkb_options grp:alt_shift_toggle
}
input * xkb_numlock enable

exec swayidle -w \
	timeout 300 'swaylock' \
	timeout 305 'swaymsg "output * dpms off"' \
	resume 'swaymsg "output * dpms on"' \
    before-sleep 'playerctl pause' \
    before-sleep 'swaylock'

for_window {
    [window_role="(pop-up|bubble|dialog)"] floating enable
}

# Keybindings

bindsym $mod+r mode "resize"
### Key bindings
#
# Basics:
#
    # Start a terminal
    bindsym $mod+Return exec $term

    # Kill focused window
    bindsym $mod+Shift+q kill

    # Start your launcher
    bindsym $mod+d exec $menu

    # Drag floating windows by holding down $mod and left mouse button.
    # Resize them with right mouse button + $mod.
    # Despite the name, also works for non-floating windows.
    # Change normal to inverse to use left mouse button for resizing and right
    # mouse button for dragging.
    floating_modifier $mod normal

    # Reload the configuration file
    bindsym $mod+Shift+c reload

    # Exit sway (logs you out of your Wayland session)
    bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit'
#
# Moving around:
#
    # Move your focus around
    bindsym $mod+$left focus left
    bindsym $mod+$down focus down
    bindsym $mod+$up focus up
    bindsym $mod+$right focus right
    # Or use $mod+[up|down|left|right]

    # Move the focused window with the same, but add Shift
    bindsym $mod+Shift+$left move left
    bindsym $mod+Shift+$down move down
    bindsym $mod+Shift+$up move up
    bindsym $mod+Shift+$right move right
#
# Workspaces:
#
    # Switch to workspace
    bindsym $mod+1 workspace number 1
    bindsym $mod+2 workspace number 2
    bindsym $mod+3 workspace number 3
    bindsym $mod+4 workspace number 4
    bindsym $mod+5 workspace number 5
    bindsym $mod+6 workspace number 6
    bindsym $mod+7 workspace number 7
    bindsym $mod+8 workspace number 8
    bindsym $mod+9 workspace number 9
    bindsym $mod+0 workspace number 10
    # Move focused container to workspace
    bindsym $mod+Shift+1 move container to workspace number 1
    bindsym $mod+Shift+2 move container to workspace number 2
    bindsym $mod+Shift+3 move container to workspace number 3
    bindsym $mod+Shift+4 move container to workspace number 4
    bindsym $mod+Shift+5 move container to workspace number 5
    bindsym $mod+Shift+6 move container to workspace number 6
    bindsym $mod+Shift+7 move container to workspace number 7
    bindsym $mod+Shift+8 move container to workspace number 8
    bindsym $mod+Shift+9 move container to workspace number 9
    bindsym $mod+Shift+0 move container to workspace number 10
    # Note: workspaces can have any name you want, not just numbers.
    # We just use 1-10 as the default.
#
# Layout stuff:
#
    # You can "split" the current object of your focus with
    # $mod+b or $mod+v, for horizontal and vertical splits
    # respectively.
    bindsym $mod+b splith
    bindsym $mod+v splitv

    # Switch the current container between different layout styles
    bindsym $mod+s layout stacking
    bindsym $mod+w layout tabbed
    bindsym $mod+e layout toggle split

    # Make the current focus fullscreen
    bindsym $mod+f fullscreen

    # Toggle the current focus between tiling and floating mode
    bindsym $mod+Shift+space floating toggle

    # Swap focus between the tiling area and the floating area
    bindsym $mod+space focus mode_toggle

    # Move focus to the parent container
    bindsym $mod+a focus parent

I hope that I’m stupid and it’s not the distribution’s fault, but I can’t see how that should be the case. Glad to be corrected, though.

Look, I am not mad at you or have any personal reasons to be that. It is just the rational fact that I cannot reproduce your issue, and in that case I cannot blame the distribution for that, plus the fact that sway or i3 is not made to please absolute newbies.

If you have the will to learn, I am with you and I also learn new things day by day. My motto is:

There are no stupid questions, but stupid people who don’t know how you use web search.

I changed nothing in ~/.config/sway/config, it is the same as in /etc/skel/.config/sway/config. I simply just followed what was preset.

Important is the order of the reading, e.g. priority. You can easily overwrite variables, thus make them useless.

I would advise you to start over. Backup your sway configs in $HOME and copy the default ones from /etc/skel again. Then apply your changes step by step (reload after every change) and discover what configuration could cause your issue.

In general, It is not a good practice to sudo arround your system and play with global configurations.
Everything you need for customization should be in your home directory.
A good practice to see what is wrong is make a new user and start from scratch.

Anyway, the reason I’m writing this reply so late, is because I wonder why the moderators tolerate such behavior. At least words like “s… people” in answer bodies should be scanned automatically. It is not much of an overhead. It surprises me, not in a good way…

1 Like

@Aarkon I think i figured your situation out.

You are correctly setting $term, but guess what - there is also $term_cwd which is what is used for $mod+return. You already tried this but since your command was broken, it didnt start anything at all.

I am using kitty, and have the following contents in my
$HOME/.config/sway/definitions.d/00-kitty.conf

set $term /usr/bin/kitty
set $term_cwd $term --directory "$(swaycwd 2>/dev/null || echo $HOME)"
set $term_float $term --class floating_shell

This topic was automatically closed 3 hours after the last reply. New replies are no longer allowed.