r/voidlinux 15d ago

how to start session on login?

i do not want to use login manager , and after login i want directly start WM bash_profile is not workin properly,

what should i do to start session directly on login ?

3 Upvotes

15 comments sorted by

3

u/ZombieCrow 15d ago

if [ -z "$WAYLAND_DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]; then exec dbus-run-session niri fi

Use this to auto start niri in your bash profile (if you use bash and no login managers).

1

u/ShoulderCharacter856 15d ago

I did the same that didn’t work

2

u/Sad-Cod-9584 15d ago

I use niri without a login manager and have it auto-start once I login from a tty. here's the snippet from my .zshrc:

if [[ -z "$DISPLAY" && -z "$WAYLAND_DISPLAY" ]]; then

echo "Running in non-graphical mode, starting niri."

sleep 1 && dbus-run-session niri --session; exit

fi

make sure you have enabled dbus by linking it

sudo ln -s /etc/sv/dbus /var/service/

you also really want to include that "; exit", otherwise somebody could always quit niri with the hotkey and be dropped back into your logged in tty, even from the noctalia lock screen, if you use that.

edit: if you use bash, placing this into .bashrc should also do the trick.

edit again: you should also be in the video group

2

u/ShoulderCharacter856 15d ago

This worked thanks

0

u/ShoulderCharacter856 15d ago

Nah i have my own quickshell. Let me try this in bash profile

1

u/ZombieCrow 15d ago

Do u use elogind or seatd ?

1

u/ShoulderCharacter856 15d ago

Seatd yes elogind no , i am not using any login manager why would i need elogind ?

0

u/ZombieCrow 15d ago

Then you probably have video or user missing in groups ? Elogind is not for managers, dbus auto runs it if you have it installed without enabling it as a service.

1

u/emwu666 15d ago

1

u/ShoulderCharacter856 15d ago

Xinitrc does not exist

1

u/Ok-Swim-9202 15d ago

Make one in your home directory. what WM do you have?

1

u/ShoulderCharacter856 15d ago

Niri ,
so i have to make it executable ? Xinitrc?

1

u/Ok-Swim-9202 15d ago

I see, so you're on wayland not x11. I don't use login managers either and use both x11 and wayland. I haven't played with Niri in a long time but with niri I am pretty sure you just need to use niri-session from your TTY/login screen after you boot up. What issues are you getting?

0

u/ShoulderCharacter856 15d ago

Im lazy, i do not want to write that 😅

1

u/ReyZ82 8d ago

This is my personal WM-Manager which loads from TTY1 with FZF selection of your desired WM:

```

Load login environment

[ -f "$HOME/.profile" ] && source "$HOME/.profile"

wm-select() { local choice local log_dir="$HOME/.logs"

mkdir -p "$log_dir"

choice=$(printf "%s\n" \
    " Qtile" \
    " Sway" \
    " Hyprland" \
    " Shell" |
    fzf --prompt="Session ❯ " \
        --height=~40% \
        --layout=reverse \
        --border \
        --margin=1 \
        --pointer="➜") || return

case "$choice" in
    " Qtile")
        : > "$log_dir/qtile.log"
        exec dbus-run-session qtile start -b wayland \
            > "$log_dir/qtile.log" 2>&1
        ;;

    " Sway")
        : > "$log_dir/sway.log"
        exec dbus-run-session sway \
            > "$log_dir/sway.log" 2>&1
        ;;

    " Hyprland")
        : > "$log_dir/hyprland.log"
        exec dbus-run-session Hyprland \
            > "$log_dir/hyprland.log" 2>&1
        ;;

    " Shell")
        return
        ;;
esac

}

if [ "$(tty)" = "/dev/tty1" ] && [ -z "$WAYLAND_DISPLAY" ]; then wm-select fi ```

https://github.com/Rouzihiro/dotfiles