-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathx11_pulseaudio_snap_shift
103 lines (103 loc) · 3.91 KB
/
x11_pulseaudio_snap_shift
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
config:
security.nesting: "true"
security.syscalls.intercept.mknod: "true"
security.syscalls.intercept.setxattr: "true"
cloud-init.user-data: |
#cloud-config
package_update: true
package_upgrade: true
package_reboot_if_required: true
packages:
- libxcb-cursor0
- pulseaudio-utils
- alsa-base
- alsa-utils
- pavucontrol
- vlc
- dbus-user-session
- dbus-x11
- ibus
- im-config
- nano
- micro
- dex
- xdg-utils
- exo-utils
- tilix
- tilix-common
- thunar
write_files:
- path: /var/lib/cloud/scripts/per-boot/set_up_sockets.sh
permissions: 0755
content: |
#!/bin/bash
user_uid=1000
user_name=$( getent passwd ${user_uid} | cut -d: -f1 )
user_gid=$( getent passwd ${user_name} | cut -d: -f4 )
if [[ -n ${user_name} ]]; then
mnt_dir=/mnt/.container_sockets
run_dir=/run/user/${user_uid}
[[ ! -d "${run_dir}" ]] && mkdir -p "${run_dir}" && chmod 700 "${run_dir}" && chown ${user_uid}:${user_gid} "${run_dir}"
[[ ! -d "${run_dir}/pulse" ]] && mkdir -p "${run_dir}/pulse" && chmod 700 "${run_dir}/pulse" && chown ${user_uid}:${user_gid} "${run_dir}/pulse"
[[ -S "${mnt_dir}/native" ]] && [[ -d "${run_dir}/pulse" ]] && [[ ! -e "${run_dir}/pulse/native" ]] && touch "${run_dir}/pulse/native" && sudo mount --bind "${mnt_dir}/native" "${run_dir}/pulse/native"
fi
- path: /var/lib/cloud/scripts/per-once/set_up_env_vars.sh
permissions: 0755
content: |
#!/bin/bash
user_uid=1000
home_dir="$( getent passwd ${user_uid} | cut -d: -f6 )"
profile="${home_dir}/.profile"
if [[ -f "${profile}" ]]; then
echo "export DISPLAY=:1" >> "${profile}"
echo "export NO_AT_BRIDGE=1" >> "${profile}"
echo "export QT_QPA_PLATFORM=xcb" >> "${profile}"
echo "export QT_QPA_PLATFORMTHEME=qt5ct" >> "${profile}"
echo "export CLUTTER_BACKEND=x11" >> "${profile}"
echo "export SDL_VIDEODRIVER=x11" >> "${profile}"
echo "export GDK_BACKEND=x11" >> "${profile}"
echo "export WINIT_UNIX_BACKEND=x11" >> "${profile}"
#echo "export LC_CTYPE=zh_CN.UTF-8" >> "${profile}"
echo "export XIM=ibus" >> "${profile}"
echo "export XIM_PROGRAM=/usr/bin/ibus" >> "${profile}"
echo "export QT_IM_MODULE=ibus" >> "${profile}"
echo "export GTK_IM_MODULE=ibus" >> "${profile}"
echo "export XMODIFIERS=ibus" >> "${profile}"
echo "export DefaultIMModule=ibus" >> "${profile}"
echo "ibus-daemon -drx" >> "${profile}"
fi
- path: /var/lib/cloud/scripts/per-once/change_gid.sh
permissions: 0755
content: |
#!/bin/bash
user_uid=1000
user_name=$( getent passwd ${user_uid} | cut -d: -f1 )
user_gid=$( getent passwd ${user_name} | cut -d: -f4 )
home_dir=$( getent passwd ${user_name} | cut -d: -f6 )
if [[ -n ${user_name} && ! ${user_uid} == ${user_gid} ]]; then
group_to_move=$( getent group ${user_uid} | cut -d: -f1 )
if [[ -n ${group_to_move} ]]; then
for gid in {1000..6000}; do
return_value=$( getent group ${gid} )
if [[ -z ${return_value} ]]; then
groupmod -g ${gid} ${group_to_move}
break
fi
done
fi
users_group=$( getent group ${user_gid} | cut -d: -f1 )
groupmod -g ${user_uid} ${users_group}
chown -R ${user_uid}:${user_uid} "${home_dir}"
fi
description: GUI X11 profile with pulseaudio
devices:
x11_server:
bind: container
connect: unix:@/tmp/.X11-unix/X1
listen: unix:@/tmp/.X11-unix/X1
type: proxy
pulseaudio_socket:
path: /mnt/.container_sockets/native
shift: "true"
source: /run/user/1000/pulse/native
type: disk