#!/bin/bash start_wm() { if [ -n "$my_res" ] && [ "`xrandr | grep ${XWidth}x$XHeight`" != "" ]; then xrandr -s ${XWidth}x${XHeight} else XWidth="`xwininfo -root | grep Width | awk '{print $2}'`" XHeight="`xwininfo -root | grep Height | awk '{print $2}'`" fi export XWidth XHeight echo "Risoluzione impostata: ${XWidth}x${XHeight}" # Carico lo sfondo # N.B.: potrei usare lo script my_load_background ma preferisco tenere # queste impostazioni di default a parte senza complicare ulteriormente # il programma if [ -d "$my_bckgr_dir" ]; then lista=`find $my_bckgr_dir -type f -iname '*.jpg'` tot=`echo $lista | wc -w` if [ $tot -gt 0 ]; then num=$[RANDOM % tot + 1] my_bckgr=`find $my_bckgr_dir -type f -name '*.jpg' | head -n $num | tail -n 1` else echo "Nessuna immagine trovata nella directory $my_bckgr_dir" fi fi if [ -f "$my_bckgr" ]; then echo "Imposto lo sfondo: $my_bckgr" display -window root -resize ${XWidth}x${XHeight}\! "$my_bckgr" & else # se non trovo nessun file, imposto uno sfondo colorato (es. "#112288") xsetroot -solid "#101040" fi } # BEGIN # Carico il mio profilo (percorsi, variabili, etc) if [ -f ~/.bash_profile ]; then source ~/.bash_profile fi # Carico le impostazioni dal file di configurazione personalizzato; # in .xsession_conf ci devono essere alcune impostazioni tra le quali il nome # del file di log e il terminale preferito if [ -f ~/.xsession_conf ]; then source ~/.xsession_conf # Creo backup del vecchio file di log if [ -f "$file_log" ]; then mv -f $file_log $file_log.old fi else # Alcune impostazioni di default file_log=~/.xsession-errors my_term=xterm fi exec >> $file_log 2>> $file_log export session_pid=$$ if [ -d "$my_bckgr_dir" ]; then export my_bckgr_dir fi # # Configurazione di X # if [ -f ~/.Xresources ]; then # in teoria dovrebbe essere già incluso dall'Xsession di default # ma anche due volte con l'opzione -merge non fa mai male xrdb -merge ~/.Xresources fi if [ -f ~/.Xmodmap ]; then # idem come sopra xmodmap ~/.Xmodmap else if [ -n "$multikey" ]; then # xmodmap -e "keycode 117 = Multi_key" # 115 --> tasto windows sx # 116 --> tasto windows dx # 117 --> tasto "menu" dx xmodmap -e "keycode $multikey = Multi_key" # come inserire sequenze per iso-8859-15? #xmodmap -e " <=> : currency" fi fi # Aggiungo il percorso per alcuni font # xset +fp $HOME/.usr/share/latex/chess12/fonts xset +fp $HOME/.usr/share/fonts # # Applicazioni da lanciare solo all'inizio # #$my_term -bg `choose_color.sh -d -l` & #rxvt -sl 20000 +sb -vb -fn 9x15 -fb 9x15bold -bg white -fg black & #gnome-terminal --hide-menubar --full-screen & $my_term -rv & if [ -n "$vol_man" ]; then ivman --nofork & vol_man_pid=$! fi if [ -n "$scrsvr" ]; then if [ "$scrsvr" = "gnome" ]; then gnome-screensaver & scrsvr_pid=$! else xscreensaver -nosplash & scrsvr_pid=$! fi fi if [ -n "$power" ]; then gnome-power-manager & power_pid=$! fi if [ -n "$gnomesettings" ]; then /usr/libexec/gnome-settings-daemon & export gnomesettings_pid=$! fi # # Avvio del Window Manager: # export WM="dwm" dwm_bar & while true; do start_wm dwm dwmres=$? if [ $dwmres -ne 0 ] then break fi done # old style dwm # /location/of/stdin-script | while true; do /usr/bin/dwm > /dev/null; done; # # Chiusura applicazioni in background # my_umount_usb -e # e se volessi lasciare qualcosa montato? if [ -n "$vol_man" ]; then kill -9 $vol_man_pid fi if [ -n "$scrsvr" ]; then kill -9 $scrsvr_pid fi if [ -n "$power" ]; then kill -9 $power_pid fi if [ -n "$gnomesettings" ]; then #kill -9 $gnomesettings_pid # il PID non è quello giusto! killall -9 gnome-settings-daemon fi #killall -9 pulseaudio