0

Say for instance I want to start up the emacs server for my user when I log in. In a systemd Linux system, I might make a unit file at ~/.config/systemd/user/emacs.service and enable it with systemctl --user enable emacs.service.

Is there something equivalent in FreeBSD? Ideally, I'd like a solution that doesn't require root permissions.

1
  • Yes, of course, since the beginning of time but I've forgotten the way.
    – Rob
    Commented Aug 21, 2022 at 14:49

3 Answers 3

1

I'm not very familiar with FreeBSD specifically, but the traditional Linux/Unix way is to start things through your login shell's configuration, i.e. ~/.profile for sh/bash/ksh or ~/.login for csh.

That is, you just add emacs --daemon & somewhere near the end of your profile, optionally with a check to make sure it's not already running, or to run it only if $DISPLAY is set, etc.

1

You could also, just to be different, use ‘daemon’. Man daemon(8). Daemon -u user program program-arguments.

1
  • 1
    Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Oct 6, 2022 at 23:28
1

Depending on your Window Manager / Desktop environment, you can chooser to utilize its built in functionality.

For instance, Fluxbox can start applications on start up by configuring ~/.fluxbox/startup

A universal way to ensure your application will auto start independent of which WM/DE you use, is it add a line inside your ~/.xinitrc file.

If your WM/DE uses ~/.xsession instead of ~/.xinitrc, create a symlink to point ~/.xsession to ~/.xinitrc.

Editing ~/.xinitrc will now also edit ~/.xsession. However, it does not work in reverse. Any change in ~/.xsession will not appear in ~/.xinitrc. Think of it as a UDP connection, a one way street. :)

ln -s ~/.xinitrc ~/.xsession

To add a startup application, add a line now in ~/.xinitrc with the specified app.

For example, too have flameshot auto start on startup, add the below somewhere BEFORE your WM/DE exec command in the ~/.xinitrc file.

flameshot &

The & is very important, as without it the wanted program will run and close before continuing down your ~/.xinitrc resulting in no open window on startup.

This is my ~/.xinitrc for reference

# SET PROPER locale(1) with LC_ALL VARIABLE
export LC_ALL=en_US.UTF-8

# GTK ANTIALIASING
export GDK_USE_XFT=1

# FORCE LIBREOFFICE TO USE GTK THEME
export OOO_FORCE_DESKTOP=gnome

# QT SETTINGS
export QT_XFT=1                           # ANTIALIASING
export GTK2_RC_FILES="${HOME}/.gtkrc-2.0" # QT MUST KNOW GTK2 LOCATION
export QT_QPA_PLATFORMTHEME=qt5ct         # QT QT5CT

# PICOM/OPACITY
picom --config ~/.config/picom.conf &

# PRESTARTED APPS 
claws-mail &
networkmgr &
xscreensaver -no-splash &
flameshot &

# CREATE TASKBAR
fbpanel &

# SET WALLPAPER WITH FEH
~/.fehbg &

# WINDOW MANAGER
fluxbox

I hope this helps. :)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .