Posted By

s1w on 11/06/14


Tagged

crash icon icons desktop restore


Versions (?)

restore icons positions after ubuntu's desktop crash >> Bash


 / Published in: Bash
 

  • edit scripts_path and desktop_path in code header, then put this code into geticonpos.sh file in your scripts location (same as edited in script header); dont forget to chmod +x geticonpos.sh

  • launch this script to store current icons positions and restoration script named restoreiconpos.sh will be created

  • after any icon crashes, use restoreiconpos.sh to restore recent valid state (logout will be required)

  1. #!/bin/bash
  2. scripts_path="/home/user/scripts"; # must NOT end with backslash
  3. desktop_path="/home/user/Desktop"; # must NOT end with backslash
  4. icon_name="";
  5.  
  6. echo -e "#!/bin/bash\n" > "$script_path/restoreiconpos.sh"
  7. gvfs-info $desktop_path/* | grep -e 'standard::name: [^ ]\+\|nautilus-icon-position: [^ ]\+' | while read line; do
  8. [ `echo $line | grep -wc "standard"` -gt 0 ] && icon_name=`echo $line | sed 's/.*name: \(.\+\)/\1/'` && echo "echo \"--positioning $icon_name\"" >> "$script_path/restoreiconpos.sh" && echo -n "gvfs-set-attribute \"$desktop_path/$icon_name\" " >> "$script_path/restoreiconpos.sh" || echo $line | sed 's/\(.\+\):\( .\+\)/\1\2/' >> "$script_path/restoreiconpos.sh"
  9. done
  10.  
  11. echo -e "\nnotify-send --hint=int:transient:1 -a Icons \"Icon positions has been restored (logout needed)\"\ngnome-session-quit" >> "$script_path/restoreiconpos.sh"
  12. chmod +x "$script_path/restoreiconpos.sh"
  13.  
  14. notify-send --hint=int:transient:1 -a Icons "Icon positions has been saved";

Report this snippet  

You need to login to post a comment.