I can not export or source variables from Sway's config definitions


I migrated from vanilla Arch Linux and Endeavour OS, after a pink screen bug I could not solve, now I am using Manjaro Sway Edition, maintained by @boredland and @simonb.

As I wanted to fully customise my Sway and Waybar, I worked a lot on editing, modifying and readjusting the user files, commented all files included by Sway’s and Waybar’s system files. I copied the whole files and folders from /etc/sway to ~/.config/sway, then modified all. Everything worked, except the Manjaro icon (to open the menu) and help icon because the definitions file has variables as:

set $share_dir /usr/share/sway
set $config_dir /etc/sway
set $user_config_dir $HOME/.config/sway/

set $theme_dir $share_dir/themes
set $script_dir $share_dir/scripts

set $term kitty

set $term_float_portrait $term --name=floating_shell_portrait --exec
set $term_float_landscape $term --name=floating_shell_landscape --exec
set $menu exec $term_float_portrait sway-launcher-desktop
set $locking swaylock --daemonize --config $theme/swaylock
set $pulseaudio $term_float_landscape pulsemixer
set $help $term_float_landscape "man $user_config_dir/help.man"
set $onscreen_bar bash $script_dir/wob.sh

These variables can’t be exported or sourced by Sway. It is why Waybar config searched and did not find the variables. I tried to set #!/bin/bash or #!/bin.zsh at the start of the definitions file, but they can’t be exported or sourced by Sway. If I uncommented all these Sway system files, everything would work, but Sway prevents me from overwriting the system files with user files and limits me to system customisation files, then I want a full customisation.

See how the ~/.config/sway tree looks like:

β”œβ”€β”€ config
β”œβ”€β”€ config.d
β”‚   β”œβ”€β”€ 00-workspaces.conf
β”‚   β”œβ”€β”€ 01-applications.conf
β”‚   β”œβ”€β”€ 02-keybindgs.conf
β”‚   β”œβ”€β”€ 03-rofi.conf
β”‚   β”œβ”€β”€ 04-appearance.conf
β”‚   β”œβ”€β”€ 50-systemd-user.conf
β”‚   β”œβ”€β”€ 90-enable-gtk-theme
β”‚   β”œβ”€β”€ 91-enable-kvantum-theme
β”‚   β”œβ”€β”€ 92-enable-mako-theme
β”‚   β”œβ”€β”€ 93-link-theme-files
β”‚   β”œβ”€β”€ 94-enable-xterm-emulation
β”‚   β”œβ”€β”€ 95-generate-help
β”‚   β”œβ”€β”€ 98-application-defaults
β”‚   └── 99-autostart-applications
β”œβ”€β”€ definitions
β”œβ”€β”€ help.man
β”œβ”€β”€ inputs
β”‚   β”œβ”€β”€ default-keyboard
β”‚   └── default-touchpad
β”œβ”€β”€ modes
β”‚   β”œβ”€β”€ default
β”‚   β”œβ”€β”€ recording
β”‚   β”œβ”€β”€ resize
β”‚   β”œβ”€β”€ scratchpad
β”‚   └── screenshot
β”œβ”€β”€ outputs
β”‚   └── default-screen
└── scripts
    └── insync.sh

how the sway is launched, no "-c " arguments in launcher?

DO you realy have ~/.config/sway/config file? If not then it might default to the /etc one.

EDIT: oups I see the tree output.

What do you have in it?

In the config file?

Then you can get it and analyse: Dropbox - swaybar.tar.gz - Simplify your life

You can check the config and definitions files at the folder sway.

I will have a look,

Firstly I would change the $HOME variable for plain tilde expansion ~ at the ~/.config/sway/config

I think I had problem using env variables in config directly.

If they (the variables) indeed didn’t work, try to add at the top set $HOME "$(echo $HOME)"

But I am guessing.

It worked, but I could not touch the Manjaro and help icons in the menu bar.

It broke my Sway. :frowning:

But it turned that it was Kitty, because the scripts of icons of Manjaro and help in the menu bar depend on Termite, instead of Kitty.

I changed variable from $term to termite, while I keep $term for my favourite terminal. Only $HOME does not work, but your ~ worked.

The Manjaro Sway Edition maintainers should inform the users that, if they want to use Kitty or another terminal as a new default and favourite terminal instead of Termite, they have to change the variable, so the icons of Manjaro and help would work.

1 Like

I am dropping here my sensible-terminal

I was drunk and tired when writting so don’t judge


I use it as this

bindsym $mod+Return exec sensible-terminal > /dev/null 2> /dev/null
bindsym $mod+Shift+Ctrl+Return exec sensible-terminal set 
bindsym $mod+Shift+Return exec sensible-terminal open 

It uses bemenu ( you can change it to rofi/wofi or whatever u use )

It will spawn a terminal and allows you to set default one.

I changed to:

MENU=${DYNAMIC_MENU:-rofi -modi drun -show drun}

When I pressed $mod + Shift + Ctrl + Return, Rofi open and showed all the applications, but I set Kitty, then I pressed $mod + Shift + Return, it opens Rofi instead of Kitty. I also pressed $mod + Return, it does not open Kitty.

I think it should be just β€œrofi -dmenu”.

The scripts has the list of available terminals piped to it and rofi -modi drun -show drun is probably doing something else than listing piped list and outputing the selection.

1 Like

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