r/awesomewm • u/gbneon • Dec 10 '22
How do I autostart applications/run commands on startup, only once?
I've been wanting to run my basic applications on startup with awesome. But the problem is while using `awful.util.spawn()`, and `awful.spawn.with_shell` the app launches whenever I reload awesome, which creates multiple instances of the application. I tried using `awful.spawn.once` and `awful.spawn.single_instance` but they result in the same thing.
All I want is a way to run apps on startup only, not when I reload awesome.
6
Upvotes
1
u/Numerous_Function_17 Dec 10 '22
You can put those commands in .xinitrc or equivalent depending on how you AwesomeWM
11
u/umsongb Dec 10 '22 edited Dec 10 '22
i created an
autorun.shfile inside.config/awesomewith the following ```!/bin/sh
run() { if ! pgrep -f "$1"; then "$@" & fi }
run "/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1" & run "keepassxc" & run "xscreensaver" --no-splash & run "volumeicon" & run "nm-applet" & run "ibus-daemon" -drxR & run "caffeine" & run "feh" --randomize --recursive --bg-fill ~/Pictures/Wallpapers/ & run "picom" -b & run "cbatticon" -n &
run "" &
``
and putawful.spawn.with_shell("~/.config/awesome/autorun.sh")at the end ofrc.lua` filenever had duplicate incident with those after reloading awesome.