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
12 # architecture detection
14 if uname -m | grep -q '^arm'; then
18 if [ "$(ps aux | grep bash | grep instantautostart | wc -l)" -gt 3 ]; then
19 echo "already running"
29 if ! iconf -i rangerplugins; then
31 echo "installing ranger plugins"
32 mkdir -p ~/.config/ranger/plugins
33 cp -r /usr/share/rangerplugins/* ~/.config/ranger/plugins/
37 # find out if it's a live session
38 if [ -e /usr/share/liveutils ] &>/dev/null; then
40 echo "live session detected"
43 # fix small graphical glitch on status bar startup
44 NMON=$(iconf names | wc -l)
45 for i in $(eval "echo {1..$NMON}"); do
46 echo "found monitor $i"
47 xdotool key super+comma
48 if iconf -i nobar; then
53 if [ -n "$ISRASPI" ]; then
54 # enable double drawing for moving floating windows
55 # greatly increases smoothness
57 if ! [ -e ~/.config/instantos/israspi ]; then
58 echo "marking machine as raspi"
59 mkdir -p ~/.config/instantos
60 touch ~/.config/instantos/israspi
61 # logo does not work on raspi
66 if iconf -i islaptop; then
67 export ISLAPTOP="true"
68 echo "laptop detected"
73 if ! iconf -i notheming; then
76 iconf -i instantthemes 1
78 # dynamically switch between light and dark gtk theme
80 if [ "$DATEHOUR" -gt "20" ] || [ "$DATEHOUR" -lt "7" ]; then
82 touch /tmp/instantdarkmode
83 [ -e /tmp/instantlightmode ] && rm /tmp/instantlightmode
86 touch /tmp/instantlightmode
87 [ -e /tmp/instantdarkmode ] && rm /tmp/instantdarkmode
90 touch /tmp/instantlightmode
93 mkdir -p /tmp/notifications &>/dev/null
94 if ! pgrep dunst; then
96 # wait for theming before starting dunst
97 if [ -e /tmp/instantdarkmode ] || [ -e /tmp/instantlightmode ]; then
108 # set up oh-my-zsh config if not existing already
110 if ! [ iconf -i userinstall ]; then
111 bash /usr/share/instantutils/userinstall.sh
114 # fix resolution on virtual machine
115 if ! iconf -i novmfix && cat /proc/cpuinfo | grep -q hypervisor; then
116 # indicator file only exists on kvm/QEMU on amd
117 if [ -e /opt/instantos/kvm ]; then
119 if lshw -c video | grep -i 'qxl' || xrandr | grep -i '^qxl'; then
121 # iconf -i noanimations 1
122 if ! iconf -i potato && ! iconf -i nopotato; then
123 if echo "please set your video card to virtio or passthrough
124 QXL on AMD on QEMU/kvm has been known to cause a severe Xorg memory leak.
125 Disabling compositing makes this somewhat bearable,
126 but switching really is recommended.
127 (or switch to virtualbox, no issues there...)
128 Disable compositing for this VM?" | imenu -C; then
132 if ! imenu -c "ask again next time?"; then
141 if echo "virtual machine detected.
142 Would you like to switch to a 1080p resolution?" | imenu -C; then
143 echo "applying virtual machine workaround"
144 /opt/instantos/menus/dm/tv.sh
146 if ! imenu -c "ask again next session"; then
152 if [ -z "$ISLIVE" ]; then
153 echo "not a live session"
154 if [ -e /opt/instantos/installtrigger ]; then
155 zenity --info --text "finishing installation in background" &
157 # ask for password if postinstall already ran
158 if ! timeout 2 sudo echo test; then
159 instantsudo instantpostinstall
160 sudo rm /opt/instantos/installtrigger
162 sudo instantpostinstall
169 if ! iconf -i max; then
173 if [ -e ~/instantos/monitor.sh ]; then
174 bash ~/instantos/monitor.sh &
175 elif [ -e ~/.config/autorandr/instantos/config ]; then
176 autorandr instantos &
179 if checkinternet; then
182 # fall back to already installed wallpapers
183 instantwallpaper offline
184 for i in $(seq 10); do
185 if checkinternet; then
194 # apply keybpard layout
195 if [ -e ~/instantos/keyboard ]; then
196 setxkbmap -layout $(cat ~/instantos/keyboard)
198 CURLOCALE=$(locale | grep LANG | sed 's/.*=\(.*\)\..*/\1/')
204 echo "no keyboard layout found for your locale"
210 if iconf mousespeed; then
211 echo "setting mousespeed"
212 instantmouse s "$(iconf mousespeed)"
215 if ! iconf -i noconky; then
216 shuf /usr/share/instantwidgets/tooltips.txt | head -1 >~/.cache/tooltip
217 conky -c /usr/share/instantwidgets/tooltips.conf &
221 echo "live session detected"
224 echo "disabling compositing for qxl graphics"
225 if lshw -c video | grep -i 'qxl' || xrandr | grep -i '^qxl'; then
230 iconf -i wifiapplet 1
231 instantwallpaper set /usr/share/instantwallpaper/defaultphoto.png
232 conky -c /usr/share/instantwidgets/install.conf &
235 if ! pgrep python; then
243 # make built in status optional
244 if ! iconf -i nostatus; then
245 source /usr/bin/instantstatus &
248 iconf -i potato || ipicom &
251 xfce4-power-manager &
253 while iconf -i wifiapplet:; do
254 if ! pgrep nm-applet; then
260 # welcome greeter app
261 if iconf -b welcome; then
265 # prompt to fix configuration if installed from the AUR
266 if ! iconf -i norootinstall && [ -z "$ISLIVE" ]; then
267 if ! command -v imenu || ! command -v instantmenu; then
268 notify-send "please install instantmenu and imenu"
270 if ! [ -e /opt/instantos/rootinstall ]; then
271 imenu -m "instantOS is missing some configuration"
272 while ! [ -e /tmp/rootskip ]; do
273 if imenu -c "would you like to fix that?"; then
274 touch /tmp/topinstall
275 instantsudo bash -c "instantutils root"
278 if imenu -c "Are you sure? this will prevent parts of instantOS from functioning correctly"; then
288 # displays message user opens the terminal for the first time
289 if ! iconf -i nohelp; then
290 if ! grep -q 'instantterminalhelp' ~/.zshrc; then
291 echo '[[ $- == *i* ]] && instantterminalhelp' >>~/.zshrc
295 if iconf -i highfps; then
296 xdotool key super+alt+shift+d
299 if iconf -i noanimations; then
300 xdotool key super+alt+shift+s
304 if iconf -i desktopicons; then
305 rox --pinboard Default
308 # user declared autostart
309 if [ -e ~/.instantautostart ]; then
310 bash ~/.instantautostart