Updated startup scripts

* Moved starting apps from .update_x into .start_desktop_apps
  * This allowed .update_x to be shown on screen during startup
* Included "<Action>... Done" messages for clarity
* Removed x_ok logic (didn't really work)
  * Replaced with a generic message that _should_ be left on screen if X fails
This commit is contained in:
2Shirt 2019-06-27 20:14:14 -06:00
parent 18daa41e2a
commit 91d8185ede
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
8 changed files with 58 additions and 34 deletions

View file

@ -3,9 +3,12 @@
## Setup network and update hostname
# Wait for WiFi
echo -n "Waiting for network... "
sleep 3s
echo "Done"
# Set hostname
echo -n "Updating hostname... "
IP="$(ip a show scope global \
| grep inet \
| head -1 \
@ -19,4 +22,5 @@ fi
if [[ "${NEW_HOSTNAME:+x}" ]]; then
sudo hostnamectl set-hostname "${NEW_HOSTNAME}"
fi
echo "Done"

View file

@ -320,4 +320,4 @@ bar {
height 26
}
exec --no-startup-id /home/tech/.update_x
exec urxvt -title "Initializing..." -e /home/tech/.update_x

View file

@ -1,3 +1,5 @@
#openbox-autostart
$HOME/.update_x &
/usr/bin/urxvt -title "Initializing..." -e "$HOME/.update_x"
"$HOME/.start_desktop_apps" &

View file

@ -0,0 +1,24 @@
#!/bin/env bash
#
## Start desktop apps based on WM
# Start common apps
feh --bg-fill "$HOME/.wallpaper"
compton --backend xrender --xrender-sync --xrender-sync-fence &
sleep 1s
x0vncserver -display :0 -passwordfile $HOME/.vnc/passwd -AlwaysShared &
conky &
nm-applet &
volumeicon &
# Start WM specific apps
if fgrep -q "i3" /proc/cmdline; then
# i3
i3-msg restart
else
# openbox
openbox --restart
tint2 &
cbatticon --hide-notification &
fi

View file

@ -5,6 +5,8 @@
REGEX_XRANDR='^.* ([0-9]+)x([0-9]+)\+[0-9]+\+[0-9]+.* ([0-9]+)mm x ([0-9]+)mm.*$'
REGEX_URXVT='(URxvt.geometry:\s+).*'
echo -n "Getting display details... "
# Get screen data
xrandr_str="$(xrandr | grep mm | head -1)"
width_px="$(echo "${xrandr_str}" | sed -r "s/${REGEX_XRANDR}/\1/")"
@ -29,8 +31,12 @@ width_urxvt="$(echo "${width_px} * 112/1280" | bc)"
height_urxvt="$(echo "${height_px} * 33/720" | bc)"
offset_urxvt="24"
echo "Done"
# Update settings if necessary
if [[ "${dpi}" -ge 192 ]]; then
echo -n "Updating settings for HiDPI... "
# Conky
sed -i 's/minimum_size 180 0/minimum_size 360 0/' "${HOME}/.conkyrc_base"
sed -i 's/maximum_width 180/maximum_width 360/' "${HOME}/.conkyrc_base"
@ -64,6 +70,9 @@ if [[ "${dpi}" -ge 192 ]]; then
width_urxvt="$(echo "${width_urxvt} / 2" | bc)"
height_urxvt="$(echo "${height_urxvt} / 2" | bc)"
offset_urxvt="$(echo "${offset_urxvt} * 2" | bc)"
# Done
echo "Done"
fi
# Update URxvt (Always)
@ -71,33 +80,19 @@ urxvt_geometry="${width_urxvt}x${height_urxvt}+${offset_urxvt}+${offset_urxvt}"
sed -i -r "s/${REGEX_URXVT}/\1${urxvt_geometry}/" "${HOME}/.Xresources"
# Update conky
echo -n "Updating conky... "
$HOME/.update_conky
echo "Done"
# Update X
echo -n "Updating X... "
xset s off
xset -dpms
xrdb -merge $HOME/.Xresources
echo "Done"
# Start common desktop apps
feh --bg-fill "$HOME/.wallpaper"
compton --backend xrender --xrender-sync --xrender-sync-fence &
sleep 1s
x0vncserver -display :0 -passwordfile $HOME/.vnc/passwd -AlwaysShared &
conky &
nm-applet &
volumeicon &
# Start WM specific apps
# Start desktop apps for i3
if fgrep -q "i3" /proc/cmdline; then
# i3
i3-msg restart
else
# openbox
openbox --restart
tint2 &
cbatticon --hide-notification &
i3-msg exec $HOME/.start_desktop_apps
fi
# Prevent Xorg from being killed by .zlogin
touch "/tmp/x_ok"

View file

@ -3,5 +3,6 @@
dbus-update-activation-environment --systemd DISPLAY
eval $(ssh-agent)
export SSH_AUTH_SOCK
xrdb -merge $HOME/.Xresources
exec openbox-session

View file

@ -1,7 +1,7 @@
setterm -blank 0 -powerdown 0 2>/dev/null
if [ "$(fgconsole 2>/dev/null)" -eq "1" ]; then
# Connect to network and update hostname
$HOME/.update_network
"${HOME}/.update_network"
# Update settings if using i3
if fgrep -q "i3" /proc/cmdline; then
@ -11,18 +11,16 @@ if [ "$(fgconsole 2>/dev/null)" -eq "1" ]; then
# Start X or HW-diags
if ! fgrep -q "nox" /proc/cmdline; then
# Kill Xorg after 30 seconds if it doesn't fully initialize
(sleep 30s; if ! [[ -f "/tmp/x_ok" ]]; then pkill '(Xorg|startx)'; fi) &
# Show freeze warning
echo ""
echo "NOTE: Not all GPUs/displays are supported."
echo " If the system is frozen on this screen"
echo " please restart and try CLI mode instead"
echo ""
# Try starting X
startx >/dev/null
# Run Hw-Diags CLI if necessary
if ! [[ -f "/tmp/x_ok" ]]; then
echo "There was an issue starting Xorg, starting CLI interface..."
sleep 2s
hw-diags --cli
fi
# Start x
echo "Starting X..."
startx >/dev/null 2>&1
else
hw-diags --cli
fi