eventmanager 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  1. #!/bin/sh
  2. #Barry Kauler 2008.
  3. #Lesser GPL licence v2 (http://www.fsf.org/licensing/licenses/lgpl.html). 2007 www.puppylinux.com
  4. #a gui to provide choices for "events" -- things that occur at a systems level,
  5. #usually hardware related.
  6. #v411 checkbox to redraw/realign icons.
  7. #v412 workaround, someone exited with invalid settings.
  8. #w007 mouse inactivity computer power-down.
  9. #w464 /etc/puppyversion is now history.
  10. #v424 automatic unmounting (see pup_event_frontend_d).
  11. #110505 support sudo for non-root user.
  12. #120201 BK: internationalized.
  13. #130212 /var/local/pup_event_icon_change_flag path changed from /tmp (see /sbin/clean_desk_icons)
  14. #131123 zigbert: gui (gtkdialog) improvements.
  15. #140101 SFR: added 'partitions labels' + 'placement' options
  16. #140418 SFR: added 'ask at shutdown to save session' checkbox
  17. [ "`whoami`" != "root" ] && exec sudo -A ${0} ${@} #110505
  18. export TEXTDOMAIN=eventmanager
  19. export OUTPUT_CHARSET=UTF-8
  20. SHOWMODE=$1 #v405 optional to modify gui.
  21. . /etc/rc.d/PUPSTATE
  22. . /etc/DISTRO_SPECS
  23. PUPPYVERSION="$DISTRO_VERSION"
  24. KERNVER="`uname -r`"
  25. . /etc/rc.d/MODULESCONFIG
  26. [ -f /etc/eventmanager ] && . /etc/eventmanager
  27. [ "$ICONDESK" != "true" -a "$ICONDESK" != "false" ] && ICONDESK="true"
  28. [ ! $RAMSAVEINTERVAL ] && RAMSAVEINTERVAL=30
  29. [ "$ASKTOSAVE" != "true" -a "$ASKTOSAVE" != "false" ] && ASKTOSAVE="false"
  30. [ "$HOTPLUGNOISY" != "true" -a "$HOTPLUGNOISY" != "false" ] && HOTPLUGNOISY="false"
  31. [ "$AUTOTARGET" != "true" -a "$AUTOTARGET" != "false" ] && AUTOTARGET="true"
  32. [ "$ICONPARTITIONS" != "true" -a "$ICONPARTITIONS" != "false" ] && ICONPARTITIONS="true"
  33. [ "$LABELPARTITIONS" != "true" -a "$LABELPARTITIONS" != "false" ] && LABELPARTITIONS="false"
  34. [ "$HOTPLUGON" != "true" -a "$HOTPLUGON" != "false" ] && HOTPLUGON="true"
  35. [ "$BACKENDON" != "true" -a "$BACKENDON" != "false" ] && BACKENDON="true"
  36. [ "$FD0ICON" != "true" -a "$FD0ICON" != "false" ] && FD0ICON="true"
  37. [ ! $POWERTIMEOUT ] && POWERTIMEOUT=0 #w007 0=never.
  38. [ ! $AUTOUNMOUNT ] && AUTOUNMOUNT="false" #v424
  39. [ "$ICON_PLACE_ORIENTATION" != "bottom" -a "$ICON_PLACE_ORIENTATION" != "top" -a "$ICON_PLACE_ORIENTATION" != "right" -a "$ICON_PLACE_ORIENTATION" != "left" ] && ICON_PLACE_ORIENTATION="bottom"
  40. [ ! "$ICON_PLACE_EDGE_GAP" ] && ICON_PLACE_EDGE_GAP=64
  41. [ ! "$ICON_PLACE_START_GAP" ] && ICON_PLACE_START_GAP=32
  42. [ ! "$ICON_PLACE_SPACING" ] && ICON_PLACE_SPACING=64
  43. #w007 as have a optional cutdown gui, make sure these are all preset...
  44. NEWICONDESK="$ICONDESK"
  45. NEWRAMSAVEINTERVAL=$RAMSAVEINTERVAL
  46. NEWHOTPLUGNOISY="$HOTPLUGNOISY"
  47. NEWAUTOTARGET="$AUTOTARGET"
  48. NEWICONPARTITIONS="$ICONPARTITIONS"
  49. NEWLABELPARTITIONS="$LABELPARTITIONS"
  50. NEWHOTPLUGON="$HOTPLUGON"
  51. NEWBACKENDON="$BACKENDON"
  52. NEWFD0ICON="$FD0ICON"
  53. NEWPOWERTIMEOUT=$POWERTIMEOUT
  54. NEWAUTOUNMOUNT="$AUTOUNMOUNT"
  55. case "$ICON_PLACE_ORIENTATION" in
  56. bottom) ICON_PLACE_ORIENTATION="$(gettext "Bottom")" ;;
  57. top) ICON_PLACE_ORIENTATION="$(gettext "Top")" ;;
  58. right) ICON_PLACE_ORIENTATION="$(gettext "Right")" ;;
  59. left) ICON_PLACE_ORIENTATION="$(gettext "Left")" ;;
  60. esac
  61. NEWICON_PLACE_ORIENTATION="$ICON_PLACE_ORIENTATION"
  62. NEWICON_PLACE_EDGE_GAP="$ICON_PLACE_EDGE_GAP"
  63. NEWICON_PLACE_START_GAP="$ICON_PLACE_START_GAP"
  64. NEWICON_PLACE_SPACING="$ICON_PLACE_SPACING"
  65. [ "$SHOWMODE" = "desktop" ] && PAGE_NR=2 || PAGE_NR=0
  66. export Puppy_Event_Manager='
  67. <window title="'$(gettext 'Puppy Event Manager')'" icon-name="gtk-execute">
  68. <vbox space-expand="true" space-fill="true">
  69. <notebook tab-pos="2" page="'$PAGE_NR'" labels="'$(gettext 'Activate')'|'$(gettext 'Save Session')'|'$(gettext 'Desktop Icons')'|'$(gettext 'Power')'">
  70. <frame '$(gettext 'Activate Puppy Event Manager')'>
  71. '"`/usr/lib/gtkdialog/xml_info scale execute_yes.svg 60 "$(gettext "The 'pup_event' Puppy Event Manager runs in the background and handles hotplugging of drives, including the desktop drive icons. This also includes automatic module and firmware loading if new hardware is detected. However, turn it all off, and Puppy will revert to the same behaviour as versions prior to 4.x, in which there is no hotplug support. This reduces resource usage, so try unticking these on very old slow PCs. Pmount can still be run manually to mount and unmount partitions.")"`"'
  72. <vbox space-expand="false" space-fill="false">
  73. <text height-request="20"><label>""</label></text>
  74. <checkbox>
  75. <label>'$(gettext 'Activate Puppy Event Manager')'</label>
  76. <default>'${BACKENDON}'</default>
  77. <variable>NEWBACKENDON</variable>
  78. <action>if true enable:NEWHOTPLUGON</action>
  79. <action>if true enable:NEWAUTOUNMOUNT</action>
  80. <action>if false disable:NEWHOTPLUGON</action>
  81. <action>if false disable:NEWAUTOUNMOUNT</action>
  82. </checkbox>
  83. <checkbox>
  84. <label>'$(gettext 'Activate desktop hotplug support')'</label>
  85. <default>'${HOTPLUGON}'</default>
  86. <variable>NEWHOTPLUGON</variable>
  87. </checkbox>
  88. <checkbox tooltip-text="'$(gettext 'WARNING: auto unmounting is highly experimental')'">
  89. <label>'$(gettext 'Activate auto unmounting of partitions (-EXPERIMENTAL-)')'</label>
  90. <default>'${AUTOUNMOUNT}'</default>
  91. <variable>NEWAUTOUNMOUNT</variable>
  92. </checkbox>
  93. <text height-request="5"><label>""</label></text>
  94. </vbox>
  95. </frame>
  96. <frame '$(gettext 'Periodic save from RAM')'>
  97. <vbox space-expand="true" space-fill="true">
  98. '"`/usr/lib/gtkdialog/xml_info scale puppy_save.svg 60 "$(gettext "Puppy runs in a particular 'state' that we call the PUPMODE. This depends on the type of installation and the type of hardware. Currently, PUPMODE=")${PUPMODE}. $(gettext "If it is an odd number, for example 13, then Puppy is doing everything in RAM and saving the current session to a drive periodically -- this is done in the case of Flash memory to make it last longer. When Puppy runs in an odd PUPMODE, there will be a 'save' icon on the desktop, also a save occurs at shutdown. You can also specify a periodic save here")" " " "<b>$(gettext 'Note!')</b> $(gettext 'PUPMODE=77 (multisession DVD) excluded, only manual save with desktop icon and at shutdown.')" "<b>$(gettext 'Note!')</b> $(gettext 'PUPMODE=5 there are no saves, above value ignored.')"`"'
  99. <vbox space-expand="false" space-fill="false">
  100. <text height-request="20"><label>""</label></text>
  101. <hbox>
  102. <text space-expand="true" space-fill="true"><label>""</label></text>
  103. <text space-expand="false" space-fill="false"><label>"'$(gettext 'Save interval (0=never)')' "</label></text>
  104. <entry max_length="4" width-request="40" space-expand="false" space-fill="false">
  105. <default>'${RAMSAVEINTERVAL}'</default>
  106. <variable>NEWRAMSAVEINTERVAL</variable>
  107. <action signal="key-release-event" condition="command_is_true([ \"`echo ${NEWRAMSAVEINTERVAL//[!0-9]} | tr -s '0'`\" = \"0\" ] && echo true )">show:VARASK</action>
  108. <action signal="key-release-event" condition="command_is_true([ \"`echo ${NEWRAMSAVEINTERVAL//[!0-9]} | tr -s '0'`\" != \"0\" ] && echo true )">hide:VARASK</action>
  109. <action signal="button-release-event" condition="command_is_true([ \"`echo ${NEWRAMSAVEINTERVAL//[!0-9]} | tr -s '0'`\" = \"0\" ] && echo true )">show:VARASK</action>
  110. <action signal="button-release-event" condition="command_is_true([ \"`echo ${NEWRAMSAVEINTERVAL//[!0-9]} | tr -s '0'`\" != \"0\" ] && echo true )">hide:VARASK</action>
  111. </entry>
  112. <text><label>"'$(gettext 'minutes')' "</label></text>
  113. </hbox>
  114. <text height-request="5"><label>""</label></text>
  115. <vbox>
  116. <hseparator></hseparator>
  117. <hbox homogeneous="true">
  118. <checkbox>
  119. <default>'${ASKTOSAVE}'</default>
  120. <variable>NEWASKTOSAVE</variable>
  121. <label>"'$(gettext 'Ask at shutdown whether to save session or not.')'"</label>
  122. </checkbox>
  123. </hbox>
  124. <text><label>"'$(gettext '(if unticked, session will be saved automatically)')'"</label></text>
  125. <variable>VARASK</variable>
  126. </vbox>
  127. </vbox>
  128. </vbox>
  129. </frame>
  130. <notebook tab-pos="2" labels="'$(gettext 'Show Icons')'|'$(gettext 'Icon Handler')'|'$(gettext 'Floppy drive')'|'$(gettext 'Power')'">
  131. <frame '$(gettext 'Drive icons on desktop')'>
  132. <vbox space-expand="true" space-fill="true">
  133. '"`/usr/lib/gtkdialog/xml_info scale desktop_icons.svg 60 "$(gettext "When this box is ticked, there will be an icon for each drive. If you plugin a USB pen drive for example, an icon will appear. Unplug and it will disappear. If you don't want these drive icons on the desktop, untick this box (but there will still remain just one icon that will launch Pmount when clicked on). The individual drive icons are purely a convenience and Puppy works fine without them.")"`"'
  134. <vbox space-expand="false" space-fill="false">
  135. <text height-request="20"><label>""</label></text>
  136. <hbox>
  137. <vbox homogeneous="true">
  138. <checkbox>
  139. <label>'$(gettext 'Show desktop icons for each DRIVE')'</label>
  140. <default>'${ICONDESK}'</default>
  141. <variable>NEWICONDESK</variable>
  142. <action>if true enable:NEWICONPARTITIONS</action>
  143. <action>if true enable:NEWICON_PLACE_ORIENTATION</action>
  144. <action>if true enable:NEWICON_PLACE_EDGE_GAP</action>
  145. <action>if true enable:NEWICON_PLACE_START_GAP</action>
  146. <action>if true enable:NEWICON_PLACE_SPACING</action>
  147. <action>if false disable:NEWICONPARTITIONS</action>
  148. <action>if false disable:NEWICON_PLACE_ORIENTATION</action>
  149. <action>if false disable:NEWICON_PLACE_EDGE_GAP</action>
  150. <action>if false disable:NEWICON_PLACE_START_GAP</action>
  151. <action>if false disable:NEWICON_PLACE_SPACING</action>
  152. <action condition="sensitive_is_true(NEWICONPARTITIONS)">enable:NEWLABELPARTITIONS</action>
  153. <action condition="sensitive_is_false(NEWICONPARTITIONS)">disable:NEWLABELPARTITIONS</action>
  154. <action condition="active_is_false(NEWICONPARTITIONS)">disable:NEWLABELPARTITIONS</action>
  155. </checkbox>
  156. <checkbox>
  157. <label>'$(gettext 'Show desktop icons for each PARTITION')'</label>
  158. <default>'${ICONPARTITIONS}'</default>
  159. <variable>NEWICONPARTITIONS</variable>
  160. <action>if true enable:NEWLABELPARTITIONS</action>
  161. <action>if false disable:NEWLABELPARTITIONS</action>
  162. </checkbox>
  163. <checkbox>
  164. <label>'$(gettext 'Show labels for each PARTITION')'</label>
  165. <default>'${LABELPARTITIONS}'</default>
  166. <variable>NEWLABELPARTITIONS</variable>
  167. </checkbox>
  168. <checkbox>
  169. <label>'$(gettext 'Refresh / Realign existing icons')'</label>
  170. <default>false</default>
  171. <variable>NEWICONWIPE</variable>
  172. </checkbox>
  173. </vbox>
  174. <vseparator></vseparator>
  175. <text space-fill="true" space-expand="true"><label>""</label></text>
  176. <vbox>
  177. <hbox>
  178. <text xalign="0"><label>'$(gettext 'Placement: ')'</label></text>
  179. <text space-fill="true" space-expand="true"><label>""</label></text>
  180. <comboboxtext>
  181. <default>'${ICON_PLACE_ORIENTATION}'</default>
  182. <variable>NEWICON_PLACE_ORIENTATION</variable>
  183. <item>'$(gettext 'Top')'</item>
  184. <item>'$(gettext 'Bottom')'</item>
  185. <item>'$(gettext 'Left')'</item>
  186. <item>'$(gettext 'Right')'</item>
  187. </comboboxtext>
  188. </hbox>
  189. <hbox>
  190. <text xalign="0"><label>'$(gettext 'Start gap: ')'</label></text>
  191. <text space-fill="true" space-expand="true"><label>""</label></text>
  192. <spinbutton range-min="32" range-max="1024" range-step="1" range-value="'${ICON_PLACE_START_GAP}'">
  193. <variable>NEWICON_PLACE_START_GAP</variable>
  194. </spinbutton>
  195. </hbox>
  196. <hbox>
  197. <text xalign="0"><label>'$(gettext 'Edge gap: ')'</label></text>
  198. <text space-fill="true" space-expand="true"><label>""</label></text>
  199. <spinbutton range-min="32" range-max="1024" range-step="1" range-value="'${ICON_PLACE_EDGE_GAP}'">
  200. <variable>NEWICON_PLACE_EDGE_GAP</variable>
  201. </spinbutton>
  202. </hbox>
  203. <hbox>
  204. <text xalign="0"><label>'$(gettext 'Spacing: ')'</label></text>
  205. <text space-fill="true" space-expand="true"><label>""</label></text>
  206. <spinbutton range-min="48" range-max="256" range-step="1" range-value="'${ICON_PLACE_SPACING}'">
  207. <variable>NEWICON_PLACE_SPACING</variable>
  208. </spinbutton>
  209. </hbox>
  210. </vbox>
  211. </hbox>
  212. <text height-request="5"><label>""</label></text>
  213. </vbox>
  214. </vbox>
  215. </frame>
  216. <frame '$(gettext "Drive 'handler'")'>
  217. <vbox space-expand="true" space-fill="true">
  218. '"`/usr/lib/gtkdialog/xml_info scale cd_audio.svg 60 "$(gettext "The 'handler' decides what to do when you click on a desktop drive icon. Normally, this just starts Pmount if you click on a drive icon. For partitions, it mounts and shows content in a file browser. This behavior can be extended...")"`"'
  219. <vbox space-expand="false" space-fill="false">
  220. <checkbox>
  221. <label>'$(gettext 'Auto-play video-DVD and audio-CD')'</label>
  222. <default>'${AUTOTARGET}'</default>
  223. <variable>NEWAUTOTARGET</variable>
  224. </checkbox>
  225. <text height-request="5"><label>""</label></text>
  226. </vbox>
  227. </vbox>
  228. <vbox space-expand="true" space-fill="true">
  229. '"`/usr/lib/gtkdialog/xml_info scale cd_mount.svg 60 "$(gettext "Normally you have to click on a drive icon to run the 'handler', but this checkbox makes the 'handler' run as soon as a media is plugged in. For example, plug in a DVD and it will immediately either get mounted, or if the above checkbox is ticked the media player will run.")"`"'
  230. <vbox space-expand="false" space-fill="false">
  231. <checkbox>
  232. <label>'$(gettext "Auto-launch 'handler' when media plugged in")'</label>
  233. <default>'${HOTPLUGNOISY}'</default>
  234. <variable>NEWHOTPLUGNOISY</variable>
  235. </checkbox>
  236. <text height-request="5"><label>""</label></text>
  237. </vbox>
  238. </vbox>
  239. </frame>
  240. <frame Floppy drive>
  241. <vbox space-expand="true" space-fill="true">
  242. '"`/usr/lib/gtkdialog/xml_info scale floppy.svg 60 "$(gettext 'Linux does not support hotplug detection of when a legacy floppy diskette is inserted or removed. Periodic probing requires starting the drive motor, which is very slow -- and do you want the motor to startup every 4 seconds? Therefore, if your PC has a floppy drive, tick this box to have a permanent icon on desktop (regardless whether a diskette is actually inserted, or even a floppy drive!).')"`"'
  243. <vbox space-expand="false" space-fill="false">
  244. <text height-request="20"><label>""</label></text>
  245. <checkbox>
  246. <label>'$(gettext 'Add floppy drive icon on desktop')'</label>
  247. <default>'${FD0ICON}'</default>
  248. <variable>NEWFD0ICON</variable>
  249. </checkbox>
  250. <text height-request="5"><label>""</label></text>
  251. </vbox>
  252. </vbox>
  253. </frame>
  254. </notebook>
  255. <frame '$(gettext 'Power')'>
  256. <vbox space-expand="true" space-fill="true">
  257. '"`/usr/lib/gtkdialog/xml_info scale shutdown_interval.svg 60 "$(gettext 'Puppy is able to power-off your computer after a period of mouse inactivity. This will occur if the mouse cursor has not been moved for the designated interval.')"`"'
  258. <vbox space-expand="false" space-fill="false">
  259. <text height-request="20"><label>""</label></text>
  260. <hbox>
  261. <text space-expand="true" space-fill="true"><label>""</label></text>
  262. <text space-expand="false" space-fill="false"><label>"'$(gettext 'Inactivity interval (0=never)')' "</label></text>
  263. <entry max_length="4" width-request="40" space-expand="false" space-fill="false">
  264. <default>'${POWERTIMEOUT}'</default>
  265. <variable>NEWPOWERTIMEOUT</variable>
  266. </entry>
  267. <text><label>"'$(gettext 'minutes')' "</label></text>
  268. </hbox>
  269. <text height-request="5"><label>""</label></text>
  270. </vbox>
  271. </vbox>
  272. </frame>
  273. </notebook>
  274. <hbox space-expand="false" space-fill="false">
  275. <text use-markup="true" space-expand="false" space-fill="false"><label>" <b>'$(gettext 'Restart X for changes to take effect')'</b>"</label></text>
  276. <text space-expand="true" space-fill="true"><label>""</label></text>
  277. <button space-expand="false" space-fill="false">
  278. <label>'$(gettext "Cancel")'</label>
  279. '"`/usr/lib/gtkdialog/xml_button-icon cancel`"'
  280. <action>exit:Cancel</action>
  281. </button>
  282. <button space-expand="false" space-fill="false">
  283. <label>'$(gettext "Ok")'</label>
  284. '"`/usr/lib/gtkdialog/xml_button-icon ok`"'
  285. <action>exit:OK</action>
  286. </button>
  287. </hbox>
  288. </vbox>
  289. <action signal="show" condition="command_is_true([[ '${BACKENDON}' != true ]] && echo true)">disable:NEWHOTPLUGON</action>
  290. <action signal="show" condition="command_is_true([[ '${BACKENDON}' != true ]] && echo true)">disable:NEWAUTOUNMOUNT</action>
  291. <action signal="show" condition="command_is_true([[ '${ICONDESK}' != true ]] && echo true)">disable:NEWICONPARTITIONS</action>
  292. <action signal="show" condition="command_is_true([[ '${ICONDESK}' != true ]] && echo true)">disable:NEWLABELPARTITIONS</action>
  293. <action signal="show" condition="command_is_true([[ '${ICONPARTITIONS}' != true ]] && echo true)">disable:NEWLABELPARTITIONS</action>
  294. <action signal="show" condition="command_is_true([[ '${ICONDESK}' != true ]] && echo true)">disable:NEWICON_PLACE_ORIENTATION</action>
  295. <action signal="show" condition="command_is_true([[ '${ICONDESK}' != true ]] && echo true)">disable:NEWICON_PLACE_EDGE_GAP</action>
  296. <action signal="show" condition="command_is_true([[ '${ICONDESK}' != true ]] && echo true)">disable:NEWICON_PLACE_START_GAP</action>
  297. <action signal="show" condition="command_is_true([[ '${ICONDESK}' != true ]] && echo true)">disable:NEWICON_PLACE_SPACING</action>
  298. <action signal="show" condition="command_is_true([ '${RAMSAVEINTERVAL}' -ne 0 ] && echo true )">hide:VARASK</action>
  299. </window>'
  300. . /usr/lib/gtkdialog/xml_info gtk #build bg_pixmap for gtk-theme
  301. RETSTRING="`gtkdialog -p Puppy_Event_Manager`"
  302. [ $? -ne 0 ] && exit
  303. eval "$RETSTRING"
  304. #echo "$RETSTRING" #TEST
  305. [ "$EXIT" = "abort" ] && exit
  306. [ "$EXIT" = "Cancel" ] && exit
  307. [ "$EXIT" = "" ] && exit
  308. #v405 it is running with 'desktop' param, now rerun with all tabs...
  309. [ "$EXIT" = "fullem" ] && exec eventmanager
  310. #make sure that RAMSAVEINTERVAL is an integer only...
  311. [ "$NEWRAMSAVEINTERVAL" = "" ] && NEWRAMSAVEINTERVAL=30 #412
  312. NEWRAMSAVEINTERVAL=`echo -n "$NEWRAMSAVEINTERVAL" | sed -e 's/[^0-9]//g'`
  313. #do not allow too-frequent saves...
  314. [ $NEWRAMSAVEINTERVAL -gt 0 -a $NEWRAMSAVEINTERVAL -lt 5 ] && NEWRAMSAVEINTERVAL=5
  315. #make sure 'ask to save' dialog won't appear at shutdown, if save interval > 0
  316. [ $NEWRAMSAVEINTERVAL -ne 0 ] && NEWASKTOSAVE=false
  317. #w007 make sure that POWERTIMEOUT is integer only...
  318. [ "$NEWPOWERTIMEOUT" = "" ] && NEWPOWERTIMEOUT=0
  319. NEWPOWERTIMEOUT=`echo -n "$NEWPOWERTIMEOUT" | sed -e 's/[^0-9]//g'`
  320. #do not allow too-frequent power-down...
  321. [ $NEWPOWERTIMEOUT -gt 0 -a $NEWPOWERTIMEOUT -lt 5 ] && NEWPOWERTIMEOUT=5
  322. #v403 if major-switch has turned off hotplug support, only show one icon...
  323. [ "$NEWBACKENDON" = "" ] && NEWBACKENDON="true" #v412
  324. [ "$NEWHOTPLUGON" = "" ] && NEWHOTPLUGON="true" #v412
  325. [ "$NEWBACKENDON" = "false" ] && NEWHOTPLUGON="false"
  326. if [ "$NEWHOTPLUGON" = "false" ];then
  327. NEWICONDESK="false"
  328. NEWICONPARTITIONS="false"
  329. NEWLABELPARTITIONS="false"
  330. NEWHOTPLUGNOISY="false"
  331. NEWAUTOTARGET="false"
  332. NEWAUTOUNMOUNT="false" #v424
  333. fi
  334. #v403 /sbin/clean_desk_icons can read this, then wipe all current icons... 120213 path changed from /tmp (see /sbin/clean_desk_icons)...
  335. [ "$LABELPARTITIONS" != "$NEWLABELPARTITIONS" ] && echo "LABELPARTITIONS" > /var/local/pup_event_icon_change_flag
  336. [ "$ICONPARTITIONS" != "$NEWICONPARTITIONS" ] && echo "ICONPARTITIONS" > /var/local/pup_event_icon_change_flag
  337. [ "$ICONDESK" != "$NEWICONDESK" ] && echo "ICONDESK" > /var/local/pup_event_icon_change_flag
  338. [ "$NEWICONWIPE" = "true" ] && echo "ICONWIPE" > /var/local/pup_event_icon_change_flag #v411
  339. case "$NEWICON_PLACE_ORIENTATION" in
  340. "$(gettext "Bottom")") NEWICON_PLACE_ORIENTATION="bottom" ;;
  341. "$(gettext "Top")") NEWICON_PLACE_ORIENTATION="top" ;;
  342. "$(gettext "Left")") NEWICON_PLACE_ORIENTATION="left" ;;
  343. "$(gettext "Right")") NEWICON_PLACE_ORIENTATION="right" ;;
  344. *) NEWICON_PLACE_ORIENTATION="bottom" ;; #precaution
  345. esac
  346. CONFIG="`cat /etc/eventmanager`"
  347. rsPATTERN="s/^RAMSAVEINTERVAL=.*/RAMSAVEINTERVAL=${NEWRAMSAVEINTERVAL}/"
  348. CONFIG="`echo "$CONFIG" | sed -e "$rsPATTERN"`"
  349. asPATTERN="s/^ASKTOSAVE=.*/ASKTOSAVE=${NEWASKTOSAVE}/"
  350. CONFIG="`echo "$CONFIG" | sed -e "$asPATTERN"`"
  351. #w007...
  352. ptPATTERN="s/^POWERTIMEOUT=.*/POWERTIMEOUT=${NEWPOWERTIMEOUT}/"
  353. CONFIG="`echo "$CONFIG" | sed -e "$ptPATTERN"`"
  354. idPATTERN="s/^ICONDESK=.*/ICONDESK=${NEWICONDESK}/"
  355. CONFIG="`echo "$CONFIG" | sed -e "$idPATTERN"`"
  356. ipPATTERN="s/^ICONPARTITIONS=.*/ICONPARTITIONS=${NEWICONPARTITIONS}/"
  357. CONFIG="`echo "$CONFIG" | sed -e "$ipPATTERN"`"
  358. lpPATTERN="s/^LABELPARTITIONS=.*/LABELPARTITIONS=${NEWLABELPARTITIONS}/"
  359. CONFIG="`echo "$CONFIG" | sed -e "$lpPATTERN"`"
  360. hnPATTERN="s/^HOTPLUGNOISY=.*/HOTPLUGNOISY=${NEWHOTPLUGNOISY}/"
  361. CONFIG="`echo "$CONFIG" | sed -e "$hnPATTERN"`"
  362. atPATTERN="s/^AUTOTARGET=.*/AUTOTARGET=${NEWAUTOTARGET}/"
  363. CONFIG="`echo "$CONFIG" | sed -e "$atPATTERN"`"
  364. hoPATTERN="s/^HOTPLUGON=.*/HOTPLUGON=${NEWHOTPLUGON}/"
  365. CONFIG="`echo "$CONFIG" | sed -e "$hoPATTERN"`"
  366. boPATTERN="s/^BACKENDON=.*/BACKENDON=${NEWBACKENDON}/"
  367. CONFIG="`echo "$CONFIG" | sed -e "$boPATTERN"`"
  368. fiPATTERN="s/^FD0ICON=.*/FD0ICON=${NEWFD0ICON}/"
  369. CONFIG="`echo "$CONFIG" | sed -e "$fiPATTERN"`"
  370. auPATTERN="s/^AUTOUNMOUNT=.*/AUTOUNMOUNT=${NEWAUTOUNMOUNT}/" #v424
  371. CONFIG="`echo "$CONFIG" | sed -e "$auPATTERN"`"
  372. poPATTERN="s/^ICON_PLACE_ORIENTATION=.*/ICON_PLACE_ORIENTATION=${NEWICON_PLACE_ORIENTATION}/"
  373. CONFIG="`echo "$CONFIG" | sed -e "$poPATTERN"`"
  374. egPATTERN="s/^ICON_PLACE_EDGE_GAP=.*/ICON_PLACE_EDGE_GAP=${NEWICON_PLACE_EDGE_GAP}/"
  375. CONFIG="`echo "$CONFIG" | sed -e "$egPATTERN"`"
  376. sgPATTERN="s/^ICON_PLACE_START_GAP=.*/ICON_PLACE_START_GAP=${NEWICON_PLACE_START_GAP}/"
  377. CONFIG="`echo "$CONFIG" | sed -e "$sgPATTERN"`"
  378. psPATTERN="s/^ICON_PLACE_SPACING=.*/ICON_PLACE_SPACING=${NEWICON_PLACE_SPACING}/"
  379. CONFIG="`echo "$CONFIG" | sed -e "$psPATTERN"`"
  380. echo "$CONFIG" > /etc/eventmanager
  381. ###END###