summaryrefslogtreecommitdiff
path: root/session_choice.sh
blob: 4e2bc9e4fb75f9fa538d0798c7e5ffe9885dc8fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/sh
systemctl --user unset-environment DISPLAY
systemctl --user unset-environment I3SOCK
systemctl --user unset-environment SWAYSOCK
systemctl --user unset-environment WAYLAND_DISPLAY
systemctl --user unset-environment XAUTHORITY
systemctl --user unset-environment XDG_CURRENT_DESKTOP
systemctl --user unset-environment XDG_SESSION_TYPE
XCURSOR_SIZE=24
XCURSOR_THEME="Simple-and-Soft"
command -v dialog || {
	printf 'dialog not found\n' && exit 1
}
session=$(dialog --erase-on-exit --ascii-lines \
  --menu "Choose session:" 25 80 25 \
	sway Sway \
	i3 "i3/X.org" \
	yaft "yaft" \
	console "Plain console" \
	3>&1 1>&2 2>&3 3>&1)
case $session in
	sway)
		exec env XDG_SESSION_TYPE=wayland \
			BEMENU_BACKEND=wayland \
			CLUTTER_BACKEND=wayland \
			SDL_VIDEODRIVER=wayland \
			QT_QPA_PLATFORM=wayland \
			XDG_CURRENT_DESKTOP=sway \
			QT_WAYLAND_FORCE_DPI=physical \
			MOZ_ENABLE_WAYLAND=1 \
			QT_WAYLAND_DISABLE_WINDOWDECORATION=1 \
			TERMINAL=foot \
			TERM=foot \
			sway 1>/tmp/sway.log 2>&1
	;;
	i3)
		convert_sway_cfg_to_i3.sh
		exec env XDG_CURRENT_DESKTOP=i3 XDG_SESSION_TYPE=x11 BEMENU_BACKEND=x11 \
			sx i3 -c $I3RCTMP
	;;
	yaft)
		export BROWSER=links
		yaft
	;;
	console)
		echo "$0"
	;;
esac
printf "Killing stuff after session\n"
systemctl --user stop dunst.service
pkill -e dunst
systemctl --user stop gammastep.service
systemctl --user stop geoclue-agent.service
unset XCURSOR_SIZE
unset XCURSOR_THEME