I'm configuring my i3 window manager (version 4) and sometimes I think the auto-start using its native exec
or exec_all
fail. (*)
So I decided to create a i3_autostart.sh
script to add all the stuff I need in a single organized place. Much like KDE
or GNOME
have their own folders to do that.
The script is called from ~/.config/i3/config
with the following line (**):
exec_always --no-startup-id /home/beco/.config/i3/i3_autostart.sh
Then enters the Autostart script that basically just calls a function that runs each program I want to auto start. This is an example:
Autostart()
{
# why, o my?
sleep 1
# set keyboard bindings
xkbcomp -w 0 /home/beco/.config/xkbmap_kde $DISPLAY
# toggle touchpad
/home/beco/bin/touchpad off
# set wallpaper
feh --bg-scale /home/beco/Pictures/wallpaper/Stonehenge-Desktop-Wallpaper-i3help.png
# clipboard
parcellite
# network manager
nm-tray
# why, o my?
sleep 1
}
All programs start just fine except nm-tray
. I've tried several command combinations and techniques to no avail.
From what I'm seeing, the problem is that nm-tray likes to run foreground, but needs to run background, and as far as I can tell it have no option to set that in the command line. So we need to use bash
facilities.
Here my attempts:
- simple background
# network manager
nm-tray &
- trying to disown
# network manager
nm-tray &>/dev/null &
disown $!
- nohup and disown
# network manager
nohup nm-tray &>/dev/null &
disown $!
I even tried to let the whole autostart script in background, just to be sure nm-tray kept running with: exec_always --no-startup-id /home/beco/.config/i3/i3_autostart.sh &>/dev/null &
I see the clipboard icon, the keyboard icon. Touchpad is set to off. But the nm-tray icon insists in not working.
Any suggestions? Thanks.
@drbeco
(*) I've read some bug reports, but this question is not about solving that issue. It is simply to create a good workaround that I can rely on, while the issue continues.
(**) This line with exec_always
have never failed to start, so I'm good with it.
nm_tray
as well as any stderr/stdout from that command (perhaps just redirect these to a file) from the script context that your are invoking that command?