xfce4starter

Submitted scripts and programs
Forum rules
Your own work only.
User avatar
Alad
should take a shower
Posts: 447
Joined: Wed May 21, 2014 12:52 am

xfce4starter

Unread post by Alad » Tue Jul 22, 2014 1:55 am

xfce4-session is shit. After complaining about it on IRC, mb gave me some advice on a possible replacement. Here's the result, based on i3exit:

Updates: https://raw.githubusercontent.com/AladW ... ce4starter

Code: Select all

#!/bin/bash
# xfce4starter - GTFO License
# credits: archwiki (i3), machinebacon
#
# "Magic process" - kill, session dies
# put last in ~/.xinitrc:
# exec /usr/local/bin/xfce4starter

## AUTOSTART
# only run this once
if ! pidof xfwm4; then
	xfsettingsd &
	xfce4-panel &
	xfdesktop &
	xfwm4 # must be run foreground
fi

## SESSION
# sudoers for no password
LOCK=i3lock
case "$1" in
	lock)
		$LOCK
		;;
	logout)
		killall "$0"
		;;
	suspend)
		$LOCK && sudo pm-suspend
		;;
	hibernate)
		$LOCK && sudo pm-hibernate
		;;
	reboot)
		sudo reboot
		;;
	shutdown)
		sudo shutdown
		;;
	*)
		echo "Usage: $0 {lock|logout|suspend|hibernate|reboot|shutdown}"
		exit 2
esac

Last edited by Alad on Wed Jul 23, 2014 6:35 pm, edited 2 times in total.
It's funny how we used to be able to do real stuff with rudimentary computers, but now we can't. -- ratcheer

User avatar
Alad
should take a shower
Posts: 447
Joined: Wed May 21, 2014 12:52 am

Re: xfce4starter

Unread post by Alad » Tue Jul 22, 2014 1:05 pm

edit: derp.
Last edited by Alad on Fri Jul 25, 2014 8:18 pm, edited 1 time in total.
It's funny how we used to be able to do real stuff with rudimentary computers, but now we can't. -- ratcheer

User avatar
Alad
should take a shower
Posts: 447
Joined: Wed May 21, 2014 12:52 am

Re: xfce4starter

Unread post by Alad » Tue Jul 22, 2014 7:47 pm

I like to run multiple X servers, but killall "$0" exited them all. As ctrl+alt+delete is so mainstream (and didn't work reliably for me), I got the WM PID from xprop.

Code: Select all

WM_PID=$(xprop -id $(xprop -root _NET_SUPPORTING_WM_CHECK \
| awk -F'#' '{ print $2 }') _NET_WM_PID \
| awk -F' = ' '{ print $2 }')

case "$1" in
	exit)
		kill -15 $WM_PID
source: http://unix.stackexchange.com/questions/20370
It's funny how we used to be able to do real stuff with rudimentary computers, but now we can't. -- ratcheer

Post Reply