3 ###############################################
4 ## script for instantOS autostart ##
5 ###############################################
7 # run userinstall to determine device properties
8 if ! iconf -i userinstall; then
9 /usr/share/instantutils/userinstall.sh
10 iconf -i userinstall 1
13 # architecture detection
15 if uname -m | grep -q '^arm'; then
19 if iconf -i noautostart; then
20 echo "autostart disabled"
24 if [ "$(ps aux | grep bash | grep instantautostart | wc -l)" -gt 3 ]; then
25 echo "already running"
33 command -v instantdotfiles && instantdotfiles
35 if ! iconf -i rangerplugins && command -v rangerplugins; then
37 echo "installing ranger plugins"
38 mkdir -p ~/.config/ranger/plugins
39 cp -r /usr/share/rangerplugins/* ~/.config/ranger/plugins/
40 iconf -i rangerplugins 1
43 # find out if it's a live session
44 if [ -e /usr/share/liveutils ] &>/dev/null; then
46 echo "live session detected"
49 if iconf -i islaptop; then
50 export ISLAPTOP="true"
51 echo "laptop detected"
57 if [ -n "$ISLIVE" ]; then
64 # optionally disable status bar
65 if iconf -i nobar; then
66 NMON=$(iconf names | wc -l)
67 for i in $(eval "echo {1..$NMON}"); do
68 echo "found monitor $i"
69 xdotool key super+comma
74 if [ -n "$ISRASPI" ]; then
75 # enable double drawing for moving floating windows
76 # greatly increases smoothness
78 if ! [ -e ~/.config/instantos/israspi ]; then
79 echo "marking machine as raspi"
80 mkdir -p ~/.config/instantos
81 touch ~/.config/instantos/israspi
82 # logo does not work on raspi
87 if ! iconf -i notheming; then
90 iconf -i instantthemes 1
92 # dynamically switch between light and dark gtk theme
94 if [ "$DATEHOUR" -gt "20" ] || [ "$DATEHOUR" -lt "7" ]; then
96 touch /tmp/instantdarkmode
97 [ -e /tmp/instantlightmode ] && rm /tmp/instantlightmode
100 touch /tmp/instantlightmode
101 [ -e /tmp/instantdarkmode ] && rm /tmp/instantdarkmode
104 touch /tmp/instantlightmode
107 mkdir -p /tmp/notifications &>/dev/null
108 if ! pgrep dunst; then
110 # wait for theming before starting dunst
111 if [ -e /tmp/instantdarkmode ] || [ -e /tmp/instantlightmode ]; then
122 # set up oh-my-zsh config if not existing already
123 iconf -i nozsh || instantshell &
125 # fix resolution on virtual machine
126 if ! iconf -i novmfix && grep -q 'hypervisor' /proc/cpuinfo; then
127 # indicator file only exists on kvm/QEMU on amd
128 if [ -e /opt/instantos/kvm ]; then
130 if lshw -c video | grep -i 'qxl' || xrandr | grep -i '^qxl'; then
132 # iconf -i noanimations 1
133 if ! iconf -i potato && ! iconf -i nopotato; then
134 if echo "please set your video card to virtio or passthrough
135 QXL on AMD on QEMU/kvm has been known to cause a severe Xorg memory leak.
136 Disabling compositing makes this somewhat bearable,
137 but switching really is recommended.
138 (or switch to virtualbox, no issues there...)
139 Disable compositing for this VM?" | imenu -C; then
143 if ! imenu -c "ask again next time?"; then
153 if ! [ -e /opt/instantos/guestadditions ]; then
154 if echo "virtual machine detected.
155 Would you like to switch to a 1080p resolution?" | imenu -C; then
156 echo "applying virtual machine workaround"
157 /usr/share/instantassist/assists/t/v.sh
159 if ! imenu -c "ask again next session"; then
167 echo "not a live session"
168 if [ -e /opt/instantos/installtrigger ]; then
169 zenity --info --text "finishing installation in background" &
171 # ask for password if postinstall already ran
172 if ! timeout 2 sudo echo test; then
173 instantsudo instantpostinstall
174 sudo rm /opt/instantos/installtrigger
176 sudo instantpostinstall
182 cd ~/instantos || exit 1
183 if ! iconf -i max; then
187 if [ -e ~/instantos/monitor.sh ]; then
188 bash ~/instantos/monitor.sh &
189 elif [ -e ~/.config/autorandr/instantos/config ]; then
190 autorandr instantos &
193 if checkinternet; then
196 # fall back to already installed wallpapers
197 instantwallpaper offline
198 for i in $(seq 10); do
199 if checkinternet; then
208 # apply keybpard layout
209 if iconf layout; then
210 setxkbmap -layout "$(iconf keyboard)"
212 CURLOCALE=$(locale | grep LANG | sed 's/.*=\(.*\)\..*/\1/')
218 echo "no keyboard layout found for your locale"
224 if iconf mousespeed; then
225 echo "setting mousespeed"
226 instantmouse s "$(iconf mousespeed)"
229 if iconf -i reversemouse; then
235 if ! iconf -i noconky; then
236 shuf /usr/share/instantwidgets/tooltips.txt | head -1 >~/.cache/tooltip
237 conky -c /usr/share/instantwidgets/tooltips.conf &
241 echo "live session detected"
244 echo "disabling compositing for qxl graphics"
245 if lshw -c video | grep -i 'qxl' || xrandr | grep -i '^qxl'; then
249 sudo systemctl start NetworkManager
252 iconf -i wifiapplet 1
253 instantwallpaper set /usr/share/instantwallpaper/defaultphoto.png
254 conky -c /usr/share/instantwidgets/install.conf &
257 if ! pgrep python; then
265 # make built in status optional
266 if ! iconf -i nostatus; then
267 source /usr/bin/instantstatus &
270 iconf -i potato || ipicom &
276 xfce4-power-manager &
278 while iconf -i wifiapplet:; do
279 echo "auto starting wifi applet"
280 if ! pgrep nm-applet; then
286 while iconf -i bluetoothapplet:; do
287 echo "auto starting bluetooth applet"
288 if ! pgrep blueman-applet; then
294 # welcome greeter app
295 if iconf -b welcome; then
299 # prompt to fix configuration if installed from the AUR
300 if ! iconf -i norootinstall && ! islive; then
301 if ! command -v imenu || ! command -v instantmenu; then
302 notify-send "please install instantmenu and imenu"
304 if ! [ -e /opt/instantos/rootinstall ]; then
305 imenu -m "instantOS is missing some configuration"
306 while ! [ -e /tmp/rootskip ]; do
307 if imenu -c "would you like to fix that?"; then
308 touch /tmp/topinstall
309 instantsudo bash -c "instantutils root"
312 if imenu -c "Are you sure? this will prevent parts of instantOS from functioning correctly"; then
322 # displays message user opens the terminal for the first time
323 if ! iconf -i nohelp; then
324 if ! grep -q 'instantterminalhelp' ~/.zshrc; then
325 echo '[[ $- == *i* ]] && instantterminalhelp' >>~/.zshrc
329 if iconf -i highfps; then
330 xdotool key super+alt+shift+d
333 if iconf -i noanimations; then
334 xdotool key super+alt+shift+s
338 if iconf -i desktopicons; then
339 rox --pinboard Default
343 if iconf -i udiskie; then
344 command -v udiskie && udiskie -t &
347 # user declared autostart
348 if [ -e ~/.instantautostart ]; then
349 bash ~/.instantautostart &
352 # symlink default applications
353 if ! iconf terminal; then
354 echo "setting up default applications"