1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
|
# Desktop icons for Fvwm-Crystal. Support any file manager.
#
# Version: 2.1.0
# License: GPL 3+
#
# Written by Dominique Michel <dominique_libre@users.sourceforge.net>, 2010-2015
# for Fvwm-Crystal.
#
# From Fvwm FAQ, 7.13 with huge modifications and added functions.
# This file will add nice 2 pictures icons (a standard feature on the Amiga OS) on the desktop:
# one mandatory for $HOME, the other are optional and are divided into 2 ranges:
# the XDG user directories and the mounted partitions.
# A left click will launch Thunar into the corresponding mount point.
# A middle click will do the same with mc (Thunar doesn't heve a built-in shell).
# A right click on the $HOME icon open the preferences.
#
# Requirement: gawk, sort, at least one file manager like Thunar or mc, mount, and /proc/mounts.
# Recommanded: pmount and pmount-gui, fusermount for some mobile phones.
#
# To use it in your recipe, add "LoadPreferences DefaultDesktopManager" after
# the EWMH-Desktop and EWMH-Panel-* configuration.
# Preferences {{{1
LoadPreferences ShowXDG
LoadPreferences ShowPartitions
LoadPreferences FileBrowser1
LoadPreferences FileBrowser2
LoadPreferences DeskIconsSign.$[infostore.Recipe]
LoadPreferences DeskIconsOnTop
# unique temporary file
AddToFunc ExitFunction I Test (Quit) Exec exec rm $[infostore.tmpdrivefile] $[infostore.SILENT]
AddToFunc ExitFunction I Test (ToRestart) Exec exec rm $[infostore.tmpdrivefile] $[infostore.SILENT]
# For the recipes
SetEnv DefaultDesktopManager Crystal
AddToFunc ExitFunction I UnsetEnv DefaultDesktopManager
# umount/pumount wrapper
DestroyFunc DesktopUmount
AddToFunc DesktopUmount
+ I PipeRead 'if [ "$(echo $* | grep -e media)" != "" ]; \
then exem="pumount"; \
else if [ "$(mount | grep \"$* \" | grep simple-mtpfs)" != "" ]; \
then exem="fusermount -u"; \
else exem="umount"; \
fi ; fi; \
echo "+ \\\"$[gt.Umount] $*\\\" Exec exec ${exem} $*"'
# Functions {{{1
DestroyMenu /Preferences/XDG
AddToMenu /Preferences/XDG
+ '%22x22/fvwm-crystal/On.png%$[gt.On]' ShowXDG
+ '%22x22/fvwm-crystal/Off.png%$[gt.Off]' DontShowXDG
DestroyFunc ShowXDG
AddToFunc ShowXDG
+ I SavePreferences ShowXDG "SetEnv ShowXDG yes"
+ I SetEnv ShowXDG yes
+ I LoadDesktopIcons
DestroyFunc DontShowXDG
AddToFunc DontShowXDG
+ I SavePreferences ShowXDG "SetEnv ShowXDG no"
+ I SetEnv ShowXDG no
+ I LoadDesktopIcons
DestroyMenu /Preferences/Partitions
AddToMenu /Preferences/Partitions
+ '%22x22/fvwm-crystal/On.png%$[gt.On]' ShowPartitions
+ '%22x22/fvwm-crystal/Off.png%$[gt.Off]' DontShowPartitions
DestroyFunc ShowPartitions
AddToFunc ShowPartitions
+ I SavePreferences ShowPartitions "SetEnv ShowPartitions yes"
+ I SetEnv ShowPartitions yes
+ I LoadDesktopIcons
DestroyFunc DontShowPartitions
AddToFunc DontShowPartitions
+ I SavePreferences ShowPartitions "SetEnv ShowPartitions no"
+ I SetEnv ShowPartitions no
+ I LoadDesktopIcons
DestroyMenu /Preferences/FileBrowser
AddToMenu /Preferences/FileBrowser
+ MissingSubmenuFunction FileBrowser-generator
+ '%22x22/categories/directory.png%$[gt.Action ]1: "$[infostore.FileBrowser1]"' Popup BrowserAction1
+ '%22x22/categories/directory.png%$[gt.Action ]2: "$[infostore.FileBrowser2]"' Popup BrowserAction2
+ '%22x22/categories/directory.png%$[gt.Custom action ]1' Module FvwmForm FileBrowser-Action1-Dialog
+ '%22x22/categories/directory.png%$[gt.Custom action ]2' Module FvwmForm FileBrowser-Action2-Dialog
DestroyFunc FileBrowser-generator
AddToFunc FileBrowser-generator
+ I DestroyMenu recreate $0
+ I AddToMenu $0
+ I PipeRead 'index=`echo "$0" | sed -e "s:BrowserAction::"`; $[FVWM_SYSTEMDIR]/scripts/DesktopActions "$0" ${index}'
All (FileBrowser-Action1-Dialog) Close
DestroyModuleConfig FileBrowser-Action1-Dialog: *
*FileBrowser-Action1-Dialog: Title "$[gt.File browser action]"
*FileBrowser-Action1-Dialog: Text "$[gt.Type a command to bind to the first mouse button.]"
*FileBrowser-Action1-Dialog: Line center
*FileBrowser-Action1-Dialog: Line center
*FileBrowser-Action1-Dialog: Text "$[gt.A console command must be prefixed by A and space,]"
*FileBrowser-Action1-Dialog: Line center
*FileBrowser-Action1-Dialog: Line center
*FileBrowser-Action1-Dialog: Text "$[gt.use X and space otherwise.]"
*FileBrowser-Action1-Dialog: Line center
*FileBrowser-Action1-Dialog: Line center
*FileBrowser-Action1-Dialog: Input ActionName 40 "$[infostore.FileBrowser1]"
*FileBrowser-Action1-Dialog: Line center
*FileBrowser-Action1-Dialog: Line center
*FileBrowser-Action1-Dialog: Button quit " $[gt.Save] " ^M
*FileBrowser-Action1-Dialog: Command SetFileBrowser 1 "$(ActionName)"
*FileBrowser-Action1-Dialog: Button quit " $[gt.Not now] " ^[
*FileBrowser-Action1-Dialog: Command Nop
*FileBrowser-Action1-Dialog: Line center
All (FileBrowser-Action2-Dialog) Close
DestroyModuleConfig FileBrowser-Action2-Dialog: *
*FileBrowser-Action2-Dialog: Title "$[gt.File browser action]"
*FileBrowser-Action2-Dialog: Text "$[gt.Type a command to bind to the second mouse button.]"
*FileBrowser-Action2-Dialog: Line center
*FileBrowser-Action2-Dialog: Line center
*FileBrowser-Action2-Dialog: Text "$[gt.A console command must be prefixed by A and space,]"
*FileBrowser-Action2-Dialog: Line center
*FileBrowser-Action2-Dialog: Line center
*FileBrowser-Action2-Dialog: Text "$[gt.use X and space otherwise.]"
*FileBrowser-Action2-Dialog: Line center
*FileBrowser-Action2-Dialog: Line center
*FileBrowser-Action2-Dialog: Input ActionName 40 "$[infostore.FileBrowser2]"
*FileBrowser-Action2-Dialog: Line center
*FileBrowser-Action2-Dialog: Line center
*FileBrowser-Action2-Dialog: Button quit " $[gt.Save] " ^M
*FileBrowser-Action2-Dialog: Command SetFileBrowser 2 "$(ActionName)"
*FileBrowser-Action2-Dialog: Button quit " $[gt.Not now] " ^[
*FileBrowser-Action2-Dialog: Command Nop
*FileBrowser-Action2-Dialog: Line center
DestroyFunc SetFileBrowser
AddToFunc SetFileBrowser
+ I SavePreferences FileBrowser$[0] "InfoStoreAdd FileBrowser$[0] \'$[1]\'"
+ I InfoStoreAdd FileBrowser$[0] '$[1]'
+ I Exec exec killall DesktopCheckMounts $[infostore.SILENT]
+ I KillModule FvwmButtons DesktopIcons
+ I DestroyModuleConfig DesktopIcons: *
+ I Exec exec FvwmCommand "Include components/apps/DesktopIcons"
AddToFunc ExitFunction I Test (Quit) Exec exec killall DesktopCheckMounts $[infostore.SILENT]
AddToFunc ExitFunction I Test (ToRestart) Exec exec killall DesktopCheckMounts $[infostore.SILENT]
DestroyMenu /Preferences/DeskIconsPlace
AddToMenu /Preferences/DeskIconsPlace
+ '%22x22/fvwm-crystal/Left.png%$[gt.Left]' SetDeskIconsPlace " "
+ '%22x22/fvwm-crystal/Right.png%$[gt.Right]' SetDeskIconsPlace "-"
DestroyFunc SetDeskIconsPlace
AddToFunc SetDeskIconsPlace
+ I Exec exec killall DesktopCheckMounts $[infostore.SILENT]
+ I SavePreferences DeskIconsSign.$[infostore.Recipe] "InfoStoreAdd DeskIconsSign \'$[0]\'"
+ I InfoStoreAdd DeskIconsSign '$[0]'
+ I KillModule FvwmButtons DesktopIcons
+ I DestroyModuleConfig DesktopIcons: *
+ I Exec exec rm $[infostore.tmpdrivefile] $[infostore.SILENT]
# Schedule time should be > DesktopCheckMounts time loop
+ I Schedule 4500 Exec exec FvwmCommand "Include components/apps/DesktopIcons"
DestroyMenu /Preferences/DeskIconsTop
AddToMenu /Preferences/DeskIconsTop
+ '%22x22/fvwm-crystal/On.png%$[gt.On]' DeskIconsOnTop
+ '%22x22/fvwm-crystal/Off.png%$[gt.Off]' DeskIconsOnBottom
DestroyFunc DeskIconsOnTop
AddToFunc DeskIconsOnTop
+ I SavePreferences DeskIconsOnTop "Style DesktopIcons State 30"
+ I All (DesktopIcons) WindowStyle State 30
DestroyFunc DeskIconsOnBottom
AddToFunc DeskIconsOnBottom
+ I SavePreferences DeskIconsOnTop "Style DesktopIcons !State 30"
+ I All (DesktopIcons) WindowStyle !State 30
DestroyFunc LoadDesktopIcons
AddToFunc LoadDesktopIcons
+ I PipeRead '$[FVWM_SYSTEMDIR]/scripts/desktop_manager \"$[infostore.DeskIconsSign]\" $[infostore.cs_transparent] "$[infostore.SILENT]" \"$[infostore.FileBrowser1]\" \"$[infostore.FileBrowser2]\" \
$[vp.height] $[infostore.tmpdrivefile]'
+ I Include tmp/DesktopIcons
+ I RedrawIconBox
LoadDesktopIcons
# vim:ft=fvwm
|