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 [ "$(ps aux | grep bash | grep instantautostart | wc -l)" -gt 3 ]; then
20 echo "already running"
30 if ! iconf -i rangerplugins; then
32 echo "installing ranger plugins"
33 mkdir -p ~/.config/ranger/plugins
34 cp -r /usr/share/rangerplugins/* ~/.config/ranger/plugins/
35 iconf -i rangerplugins 1
38 # find out if it's a live session
39 if [ -e /usr/share/liveutils ] &>/dev/null; then
41 echo "live session detected"
44 if iconf -i islaptop; then
45 export ISLAPTOP="true"
46 echo "laptop detected"
52 if [ -n "$ISLIVE" ]; then
59 # optionally disable status bar
60 if iconf -i nobar; then
61 NMON=$(iconf names | wc -l)
62 for i in $(eval "echo {1..$NMON}"); do
63 echo "found monitor $i"
64 xdotool key super+comma
69 if [ -n "$ISRASPI" ]; then
70 # enable double drawing for moving floating windows
71 # greatly increases smoothness
73 if ! [ -e ~/.config/instantos/israspi ]; then
74 echo "marking machine as raspi"
75 mkdir -p ~/.config/instantos
76 touch ~/.config/instantos/israspi
77 # logo does not work on raspi
82 if ! iconf -i notheming; then
85 iconf -i instantthemes 1
87 # dynamically switch between light and dark gtk theme
89 if [ "$DATEHOUR" -gt "20" ] || [ "$DATEHOUR" -lt "7" ]; then
91 touch /tmp/instantdarkmode
92 [ -e /tmp/instantlightmode ] && rm /tmp/instantlightmode
95 touch /tmp/instantlightmode
96 [ -e /tmp/instantdarkmode ] && rm /tmp/instantdarkmode
99 touch /tmp/instantlightmode
102 mkdir -p /tmp/notifications &>/dev/null
103 if ! pgrep dunst; then
105 # wait for theming before starting dunst
106 if [ -e /tmp/instantdarkmode ] || [ -e /tmp/instantlightmode ]; then
117 # set up oh-my-zsh config if not existing already
118 iconf -i nozsh || instantshell &
120 # fix resolution on virtual machine
121 if ! iconf -i novmfix && grep -q 'hypervisor' /proc/cpuinfo; then
122 # indicator file only exists on kvm/QEMU on amd
123 if [ -e /opt/instantos/kvm ]; then
125 if lshw -c video | grep -i 'qxl' || xrandr | grep -i '^qxl'; then
127 # iconf -i noanimations 1
128 if ! iconf -i potato && ! iconf -i nopotato; then
129 if echo "please set your video card to virtio or passthrough
130 QXL on AMD on QEMU/kvm has been known to cause a severe Xorg memory leak.
131 Disabling compositing makes this somewhat bearable,
132 but switching really is recommended.
133 (or switch to virtualbox, no issues there...)
134 Disable compositing for this VM?" | imenu -C; then
138 if ! imenu -c "ask again next time?"; then
148 if ! [ -e /opt/instantos/guestadditions ]; then
149 if echo "virtual machine detected.
150 Would you like to switch to a 1080p resolution?" | imenu -C; then
151 echo "applying virtual machine workaround"
152 /opt/instantos/menus/dm/tv.sh
154 if ! imenu -c "ask again next session"; then
162 echo "not a live session"
163 if [ -e /opt/instantos/installtrigger ]; then
164 zenity --info --text "finishing installation in background" &
166 # ask for password if postinstall already ran
167 if ! timeout 2 sudo echo test; then
168 instantsudo instantpostinstall
169 sudo rm /opt/instantos/installtrigger
171 sudo instantpostinstall
178 if ! iconf -i max; then
182 if [ -e ~/instantos/monitor.sh ]; then
183 bash ~/instantos/monitor.sh &
184 elif [ -e ~/.config/autorandr/instantos/config ]; then
185 autorandr instantos &
188 if checkinternet; then
191 # fall back to already installed wallpapers
192 instantwallpaper offline
193 for i in $(seq 10); do
194 if checkinternet; then
203 # apply keybpard layout
204 if [ -e ~/instantos/keyboard ]; then
205 setxkbmap -layout $(cat ~/instantos/keyboard)
207 CURLOCALE=$(locale | grep LANG | sed 's/.*=\(.*\)\..*/\1/')
213 echo "no keyboard layout found for your locale"
219 if iconf mousespeed; then
220 echo "setting mousespeed"
221 instantmouse s "$(iconf mousespeed)"
224 if ! iconf -i noconky; then
225 shuf /usr/share/instantwidgets/tooltips.txt | head -1 >~/.cache/tooltip
226 conky -c /usr/share/instantwidgets/tooltips.conf &
230 echo "live session detected"
233 echo "disabling compositing for qxl graphics"
234 if lshw -c video | grep -i 'qxl' || xrandr | grep -i '^qxl'; then
238 sudo systemctl start NetworkManager
241 iconf -i wifiapplet 1
242 instantwallpaper set /usr/share/instantwallpaper/defaultphoto.png
243 conky -c /usr/share/instantwidgets/install.conf &
246 if ! pgrep python; then
254 # make built in status optional
255 if ! iconf -i nostatus; then
256 source /usr/bin/instantstatus &
259 iconf -i potato || ipicom &
262 xfce4-power-manager &
264 while iconf -i wifiapplet:; do
265 if ! pgrep nm-applet; then
271 # welcome greeter app
272 if iconf -b welcome; then
276 # prompt to fix configuration if installed from the AUR
277 if ! iconf -i norootinstall && ! islive; then
278 if ! command -v imenu || ! command -v instantmenu; then
279 notify-send "please install instantmenu and imenu"
281 if ! [ -e /opt/instantos/rootinstall ]; then
282 imenu -m "instantOS is missing some configuration"
283 while ! [ -e /tmp/rootskip ]; do
284 if imenu -c "would you like to fix that?"; then
285 touch /tmp/topinstall
286 instantsudo bash -c "instantutils root"
289 if imenu -c "Are you sure? this will prevent parts of instantOS from functioning correctly"; then
299 # displays message user opens the terminal for the first time
300 if ! iconf -i nohelp; then
301 if ! grep -q 'instantterminalhelp' ~/.zshrc; then
302 echo '[[ $- == *i* ]] && instantterminalhelp' >>~/.zshrc
306 if iconf -i highfps; then
307 xdotool key super+alt+shift+d
310 if iconf -i noanimations; then
311 xdotool key super+alt+shift+s
315 if iconf -i desktopicons; then
316 rox --pinboard Default
320 if iconf -i udiskie; then
321 command -v udiskie && udiskie -t &
324 # user declared autostart
325 if [ -e ~/.instantautostart ]; then
326 bash ~/.instantautostart