3 ###############################################
4 ## script for instantOS autostart ##
5 ###############################################
7 INSTANTVERSION="$(cat /usr/share/instantutils/version)"
8 if iconf version && [ "$(iconf version)" = "$INSTANTVERSION" ]; then
9 echo "version check successful"
10 echo "running version $INSTANTVERSION"
12 echo "running update hooks"
13 /usr/share/instantutils/userinstall.sh
14 iconf -i userinstall 1
15 iconf version "$INSTANTVERSION"
19 # architecture detection
21 if uname -m | grep -q '^arm'; then
25 if iconf -i noautostart; then
26 echo "autostart disabled"
30 if [ "$(ps aux | grep bash | grep instantautostart | wc -l)" -gt 3 ]; then
31 echo "already running"
39 command -v instantdotfiles && instantdotfiles
41 if ! iconf -i rangerplugins && command -v rangerplugins; then
43 echo "installing ranger plugins"
44 mkdir -p ~/.config/ranger/plugins
45 cp -r /usr/share/rangerplugins/* ~/.config/ranger/plugins/
46 iconf -i rangerplugins 1
49 # find out if it's a live session
50 if [ -e /usr/share/liveutils ] &>/dev/null; then
52 echo "live session detected"
55 if iconf -i islaptop; then
56 export ISLAPTOP="true"
57 echo "laptop detected"
63 if [ -n "$ISLIVE" ]; then
70 # optionally disable status bar
71 if iconf -i nobar; then
72 NMON=$(iconf names | wc -l)
73 for i in $(eval "echo {1..$NMON}"); do
74 echo "found monitor $i"
75 xdotool key super+comma
80 if [ -n "$ISRASPI" ]; then
81 # enable double drawing for moving floating windows
82 # greatly increases smoothness
84 if ! [ -e ~/.config/instantos/israspi ]; then
85 echo "marking machine as raspi"
86 mkdir -p ~/.config/instantos
87 touch ~/.config/instantos/israspi
88 # logo does not work on raspi
93 if ! iconf -i notheming; then
96 iconf -i instantthemes 1
98 # dynamically switch between light and dark gtk theme
100 if [ "$DATEHOUR" -gt "20" ] || [ "$DATEHOUR" -lt "7" ]; then
102 touch /tmp/instantdarkmode
103 [ -e /tmp/instantlightmode ] && rm /tmp/instantlightmode
106 touch /tmp/instantlightmode
107 [ -e /tmp/instantdarkmode ] && rm /tmp/instantdarkmode
110 touch /tmp/instantlightmode
113 mkdir -p /tmp/notifications &>/dev/null
114 if ! pgrep dunst; then
116 # wait for theming before starting dunst
117 if [ -e /tmp/instantdarkmode ] || [ -e /tmp/instantlightmode ]; then
128 # set up oh-my-zsh config if not existing already
129 iconf -i nozsh || instantshell &
131 # fix resolution on virtual machine
132 if ! iconf -i novmfix && grep -q 'hypervisor' /proc/cpuinfo; then
133 # indicator file only exists on kvm/QEMU on amd
134 if [ -e /opt/instantos/kvm ]; then
136 if lshw -c video | grep -i 'qxl' || xrandr | grep -i '^qxl'; then
138 # iconf -i noanimations 1
139 if ! iconf -i potato && ! iconf -i nopotato; then
140 if echo "please set your video card to virtio or passthrough
141 QXL on AMD on QEMU/kvm has been known to cause a severe Xorg memory leak.
142 Disabling compositing makes this somewhat bearable,
143 but switching really is recommended.
144 (or switch to virtualbox, no issues there...)
145 Disable compositing for this VM?" | imenu -C; then
149 if ! imenu -c "ask again next time?"; then
159 if ! [ -e /opt/instantos/guestadditions ]; then
160 if echo "virtual machine detected.
161 Would you like to switch to a 1080p resolution?" | imenu -C; then
162 echo "applying virtual machine workaround"
163 /usr/share/instantassist/assists/t/v.sh
165 if ! imenu -c "ask again next session"; then
173 echo "not a live session"
174 if [ -e /opt/instantos/installtrigger ]; then
175 zenity --info --text "finishing installation in background" &
177 # ask for password if postinstall already ran
178 if ! timeout 2 sudo echo test; then
179 instantsudo instantpostinstall
180 sudo rm /opt/instantos/installtrigger
182 sudo instantpostinstall
188 cd ~/instantos || exit 1
189 if ! iconf -i max; then
193 if [ -e ~/instantos/monitor.sh ]; then
194 echo "restoring resolution"
195 bash ~/instantos/monitor.sh &
196 elif [ -e ~/.config/autorandr/instantos/config ]; then
197 echo "restoring autorandr resolution"
198 autorandr instantos &
201 if checkinternet; then
204 # fall back to already installed wallpapers
205 instantwallpaper offline
206 for i in $(seq 10); do
207 if checkinternet; then
216 # apply keybpard layout
217 if iconf layout; then
218 setxkbmap -layout "$(iconf layout)"
220 CURLOCALE=$(locale | grep LANG | sed 's/.*=\(.*\)\..*/\1/')
226 echo "no keyboard layout found for your locale"
232 if iconf mousespeed; then
233 echo "setting mousespeed"
234 instantmouse s "$(iconf mousespeed)"
237 if iconf -i reversemouse; then
243 if ! iconf -i noconky; then
244 shuf /usr/share/instantwidgets/tooltips.txt | head -1 >~/.cache/tooltip
245 conky -c /usr/share/instantwidgets/tooltips.conf &
249 echo "live session detected"
252 echo "disabling compositing for qxl graphics"
253 if lshw -c video | grep -i 'qxl' || xrandr | grep -i '^qxl'; then
257 sudo systemctl start NetworkManager
260 iconf -i wifiapplet 1
261 instantwallpaper set /usr/share/instantwallpaper/defaultphoto.png
262 conky -c /usr/share/instantwidgets/install.conf &
265 if ! pgrep python; then
273 # make built in status optional
274 if ! iconf -i nostatus; then
275 source /usr/bin/instantstatus &
279 if iconf -i potato || iconf -i nocompositing; then
280 echo "compositing disabled"
290 xfce4-power-manager &
292 # start processes that need to be kept running
295 if iconf -i wifiapplet && ! pgrep nm-applet; then
296 echo "starting bluetooth applet"
300 if iconf -i bluetoothapplet && ! pgrep blueman-applet; then
301 echo "starting bluetooth applet"
305 if iconf -i alttab && ! pgrep alttab; then
306 alttab -fg "#ffffff" -bg "#292F3A" -frame "#5293E1" -d 0 -s 1 -t 128x150 -i 127x64 -w 1 -vp pointer &
312 # auto open menu when connecting/disconnecting monitor
313 if ! (iconf -i noautoswitch && iconf -i islaptop) || iconf -i autoswitch; then
315 if nvidia-xconfig --query-gpu-info
317 DISPLAYCOUNT="$(nvidia-xconfig --query-gpu-info | grep -oi 'number of dis.*' | grep -o '[0-9]*')"
319 DISPLAYCOUNT="$(xrandr | grep -c '[^s]connected')"
322 if [ "$DISPLAYCOUNT" -eq "$DISPLAYCOUNT" ]; then
324 NEWDISPLAYCOUNT="$(xrandr | grep -c '[^s]connected')"
325 if ! [ "$DISPLAYCOUNT" = "$NEWDISPLAYCOUNT" ]; then
326 notify-send "display changed"
327 echo "displays changed"
328 if [ "$NEWDISPLAYCOUNT" -gt 1 ]; then
330 echo "multi monitor setup"
334 DISPLAYCOUNT="$NEWDISPLAYCOUNT"
340 echo "error detecting display count"
345 if iconf -b welcome; then
349 # prompt to fix configuration if installed from the AUR
350 if ! iconf -i norootinstall && ! islive; then
351 if ! command -v imenu || ! command -v instantmenu; then
352 notify-send "please install instantmenu and imenu"
354 if ! [ -e /opt/instantos/rootinstall ]; then
355 imenu -m "instantOS is missing some configuration"
356 while ! [ -e /tmp/rootskip ]; do
357 if imenu -c "would you like to fix that?"; then
358 touch /tmp/topinstall
359 instantsudo bash -c "instantutils root"
362 if imenu -c "Are you sure? this will prevent parts of instantOS from functioning correctly"; then
372 # displays message user opens the terminal for the first time
373 if ! iconf -i nohelp; then
374 if ! grep -q 'instantterminalhelp' ~/.zshrc; then
375 echo '[[ $- == *i* ]] && instantterminalhelp' >>~/.zshrc
380 [ -n "$2" ] || return
381 iconf -i "$1" || return
385 # run command if iconf option is set
387 if iconf -i "$1"; then
393 if iconf savebright; then
394 /usr/share/instantassist/utils/b.sh 2 "$(iconf savebright)"
397 confkey highfps "super+alt+shift+d"
398 confkey noanimations "super+alt+shift+s"
399 # disable wm alttab for graphical alttab
400 confkey alttab "super+alt+control+shift+Tab"
403 confcommand desktopicons rox --pinboard Default
405 confcommand udiskie udiskie -t
407 confcommand clipmanager clipmenud
409 # user declared autostart
410 if [ -e ~/.instantautostart ]; then
411 bash ~/.instantautostart
415 if ! iconf -i noupdates; then
417 if checkinternet; then
420 if command -v checkinternet; then
423 if checkinternet; then