[THE 1st TIME] Our own login manager
Posted: Mon Feb 24, 2014 3:47 pm
Too many WMs installed and tired of editing the .xinitrc every time you want to switch? Users of recent (2014) BBQ releases can imply this neat method to have a login manager after boot.
1) The /usr/local/bin/bbqlogin file, it looks like this (sample!)
save and exit, and make it accessible and executable:
You can additionally make it writable for all:
2) The /usr/local/bin/openbox-start file looks like this:
save, exit, and chmod a+x over it. Now make a variant for /usr/local/bin/i3-start
Create as many <wm>-start scripts as you have window managers installed. Don't forget to make the <wm>-start scripts executable!
TIP: Use the "whereis" command to find the exact path to your window manager ;)
3) We need a replacement for .xinitrc, called /usr/bin/start-wm - it might look like this, edit to your needs!
Please really edit it! save it, and make it executable:
NOW TEST IF THE SCRIPTS WORK! Exit your X session, fall back to a normal login shell, and run "bbqlogin". Test all entries. If something fails, stop here and check for typos or ask us. Do not continue with step 4) if things don't work 100% perfect.
4) Optional: bbqlogin as login/display manager. Edit the .bash_profile file to look like this
Save and exit as normal user, not as root!
Now log out ("exit") and you will be greeted with this neat little dialog ;)
1) The /usr/local/bin/bbqlogin file, it looks like this (sample!)
Code: Select all
#!/usr/bin/env bash
# A simple dialog to start sessions via starter scripts
# put the release name here
RELEASE_NAME=Roasted
# create temporary file
INPUT=/tmp/menu.sh.$$
# main function: the menu
function mainmenu(){
dialog --backtitle "LinuxBBQ $RELEASE_NAME" --nocancel --title "Select your session" --menu " " 0 0 0 \
c "Change color scheme" \
o "Openbox session" \
3 "i3 session" \
x "Emacs session" \
v "VIM session" \
m "tmux session" \
h "bash prompt" \
b "BBQ Terminal Menu" \
s "Set up network" \
l "Radio" \
f "Start Framebuffer session" \
y "Edit startup" \
e "Edit this menu" \
9 "Reboot" \
0 "Poweroff" 2>"${INPUT}"
menuitem=$(<"${INPUT}")
# if X is pressed Y will be executed
case $menuitem in
o) exec xinit /usr/local/bin/openbox-start;;
3) exec xinit /usr/local/bin/i3-start;;
c) fbcolors;;
h) bash ;;
x) emacs ;;
v) vim;;
e) nano /usr/local/bin/bbqlogin ;;
y) nano /usr/bin/start-wm ;;
s) sudo ceni;;
l) bbqradio;;
m) tmux;;
b) bbq;;
f) fb;;
0) sudo /sbin/poweroff;;
9) sudo /sbin/reboot;;
esac
}
# remove temporary file
[ -f $INPUT ] && rm $INPUT
mainmenu
Code: Select all
sudo chmod a+x /usr/local/bin/bbqlogin
Code: Select all
sudo chmod 777 /usr/local/bin/bbqlogin
Code: Select all
#!/bin/bash
/usr/bin/start-wm /usr/bin/openbox-session
Code: Select all
#!/bin/bash
/usr/bin/start-wm /usr/bin/i3
TIP: Use the "whereis" command to find the exact path to your window manager ;)
3) We need a replacement for .xinitrc, called /usr/bin/start-wm - it might look like this, edit to your needs!
Code: Select all
#!/bin/bash
# This is a sample .xinitrc file (to be executed with xinit or startx)
# source the Xresources for the terminal
xrdb -merge ~/.Xresources &
# Ctrl-Alt-Backspace kills the X session
setxkbmap -option terminate:ctrl_alt_bksp
# sets your keyboard to 'us' keymap
setxkbmap us &
# read Xmodmap file - please edit it first
#xmodmap ~/.Xmodmap &
# call /usr/include/ulimit.h
ulimit -c unlimited &
# helpful to have keycombos set - see also ~/.xbindkeysrc
xbindkeys -f ~/.xbindkeysrc &
# set a solid background
xsetroot -solid "#1a1a1a" &
# make the cursor point in the 'right' direction
xsetroot -cursor_name left_ptr &
# set a wallpaper
hsetroot -tile /usr/share/wallpapers/1.png &
# this makes dual heads work better
#vgascript &
# got time?
#sleep 2s && osd_clock -f -*-terminus-*-*-*-*-12-*-*-*-*-*-*- -c brown -s 0 -r -t -o -8 &
# candy
#compton -bcCGf -i 0.8 -e 0.8 --no-fading-openclose &
# nice tty-clock
#sleep 3s && x-terminal-emulator -geometry 37x9-50+50 -e tty-clock &
# authoring terminal ready -> change 'tmux' to your preferred writing tool
# we give it enough sleep so that Xresources can be sourced, the wallpaper painted
# and compton fully activated before opening the terminals windows.
#sleep 4s && x-terminal-emulator -geometry 100x42+50+50 -e tmux &
#sleep 4s && x-terminal-emulator -geometry 37x30-50+206 -e hnb &
#sleep 4s && x-terminal-emulator -geometry 37x8-50-10 -e bbqalarm &
#sleep 4s && x-terminal-emulator -geometry 100x8+50-10 &
# execute session:
# if you have consolekit and dbus running:
#exec ck-launch-session dbus-launch --exit-with-session $1
# else something like:
exec $1
Code: Select all
sudo a+x /usr/bin/start-wm
Code: Select all
sudo chmod 777 /usr/bin/start-wm
4) Optional: bbqlogin as login/display manager. Edit the .bash_profile file to look like this
Code: Select all
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
. "$HOME/.bashrc"
[[ -z $DISPLAY && $TERM = "linux" ]] && exec bbqlogin
Now log out ("exit") and you will be greeted with this neat little dialog ;)