forked from huijunchen9260/dmenufm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dmenufm-action
executable file
·575 lines (531 loc) · 17.4 KB
/
dmenufm-action
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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
#!/bin/sh
FM_Action () { # Usage: FM_Action
move=$(printf '%s\n' "$ACTLIST" | yprompt "Actions:" "${FM_OPTS_GENERIC--fn "$FM_GENERIC_FONT" -sb "$FM_GENERIC_COLOR"}")
case $move in
"$FM_PCP") FM_PCP ;;
"$FM_NEW") FM_NEW ;;
"$FM_MVV"|"$FM_YAK"|"$FM_LNK") FM_MYL ;;
"$FM_REM") FM_REM ;;
"$FM_DEL") FM_DEL ;;
"$FM_TRH") FM_TRH ;;
"$FM_HIS") FM_HIS ;;
"$FM_BMK") FM_BMK ;;
"$FM_CMD") FM_CMD ;;
"$FM_ZIP") FM_ZIP ;;
"$FM_SDO") FM_SDO ;;
"$FM_EYE") FM_EYE ;;
esac
MainMenu
}
BulkListAll () { # Usage: BulkListAll
SELECTED="$list"
[ -n "$SELECTED" ] && check=$(printf '%s' "$SELECTED" | yprompt "Check selections. (Enter to continue, ESC to quit)" "${FM_OPTS_ACTION_LV1--fn "$FM_GENERIC_FONT" -sb "$FM_ACTION_COLOR_LV1"}")
# add PWD back to selection's path
IFS="$nl"
set -- $SELECTED
unset IFS SELECTED
for selection do
SELECTED="$SELECTED${nl}$PWD/$selection"
done
SELECTED=${SELECTED#$nl}
}
BulkListMass () { # Usage: BulkListMass
SELECTED="$list"
[ -f "$FM_MASFILE" ] && rm "$FM_MASFILE"
printf '%s\n' "$SELECTED" > "$FM_MASFILE"
NotiPrompt "Remove unwanted names and remain the desire ones."
FileOpen "$FM_MASFILE"
SELECTED="$(cat -u $FM_MASFILE)"
[ -n "$SELECTED" ] && check=$(printf '%s' "$SELECTED" | yprompt "Check selections. (Enter to continue, ESC to quit)" "${FM_OPTS_ACTION_LV1--fn "$FM_GENERIC_FONT" -sb "$FM_ACTION_COLOR_LV1"}")
# add PWD back to selection's path
IFS="$nl"
set -- $SELECTED
unset IFS SELECTED
for selection do
SELECTED="$SELECTED${nl}$PWD/$selection"
done
SELECTED=${SELECTED#$nl}
rm "$FM_MASFILE"
}
BulkMode () { # Usage: BulkMode [MSG]
HERE=""
bulklist=""
ActionMenu "$1" "${FM_OPTS_ACTION_BULK--fn "$FM_GENERIC_FONT" -sb "$FM_ACTION_COLOR_BULK"}" || return && allowbulk="NotAllowed"
while [ "$bulkselection" = "true" ]; do
ActionMenu "$1" "${FM_OPTS_ACTION_BULK--fn "$FM_GENERIC_FONT" -sb "$FM_ACTION_COLOR_BULK"}" || return && allowbulk="NotAllowed"
HERE=$bulklist
allowbulk="NotAllowed"
done
SELECTED=$(printf '%s' "${HERE#${nl}}" | uniq)
allowbulk="NotAllowed"
[ "$actCHOICE" = "$ENDSELECTION" ] &&
[ -n "$SELECTED" ] &&
check=$(printf '%s' "$SELECTED" | yprompt "Check selections. (Enter to continue, ESC to quit) " "${FM_OPTS_ACTION_LV1--fn "$FM_GENERIC_FONT" -sb "$FM_ACTION_COLOR_LV1"}")
}
DirCheck () {
[ "$result" -eq 0 ] &&
case "$rollingmenu" in
"true")
rollmenu=""
cd "../" && result=""
rolldir="$PWD"
;;
*)
cd "../" && result=""
;;
esac || result=""
}
FM_BMK () { # Usage: FM_BMK
markmenu=$(printf '%s\n%s\n%s' "$(cat -u "$FM_BMKFILE")" "Add BMK" "Delete BMK" | yprompt "Dmenufm Bookmark" "${FM_OPTS_GENERIC--fn "$FM_GENERIC_FONT" -sb "$FM_GENERIC_COLOR"}")
# Add \n at end of file
[ "$(tail -c 1 "$FM_BMKFILE")" != "" ] && echo >> "$FM_BMKFILE"
case "$markmenu" in
"Add BMK")
ActionMenu "Choose file / directory and add to BMK: " "${FM_OPTS_ACTION_LV1--fn "$FM_GENERIC_FONT" -sb "$FM_ACTION_COLOR_LV1"}" || return
mark=${HERE##*/}
[ -n "$mark" ] && printf '%s' "$mark - $HERE" >> "$FM_BMKFILE" && NotiPrompt "$mark added."
;;
"Delete BMK")
BMK="$(cat -u "$FM_BMKFILE")"
delbmk=$(< "$FM_BMKFILE" yprompt "Delete chosen bookmark: " "darkred") || return
[ -n "$delbmk" ] &&
printf '%s' "${BMK%%$nl"$delbmk"*}" "${BMK##*"$delbmk"}" > "$FM_BMKFILE" &&
NotiPrompt "$delbmk deleted"
;;
*)
destination=${markmenu##* - }
[ -n "$destination" ] &&
case "$termpath" in
"true")
printf '%s' "$destination"
exit 0
;;
*)
cd "$destination" || FileOpen "$destination"
;;
esac
;;
esac
}
BulkCMD () { # Usage: BulkCMD
execfile="$SELECTED"
execmd=${execmd##$*}
IFS="$nl"
set -- $execfile
unset IFS
for selection do eval "$execmd \"$selection\""; done && NotiPrompt "Command executed on selected."
}
ExecCMD () { # Usage: ExecCMD [CMD]
software=$(printf '%s' "${1%% *}")
appdesktop=$(find "$XDGDIR1" "$XDGDIR2" -name "*$software*.desktop" | tail -n 1)
[ -n "$appdesktop" ] &&
grep 'Terminal=false' "$appdesktop" &&
printf '%s' "$1" | ${SHELL:-"/bin/sh"} ||
$TERMINAL -e $1 | ${SHELL:-"/bin/sh"}
}
FM_CMD () { # Usage: FM_CMD
cmdmenu=$(printf '%s\n' "$(cat -u "$FM_CMDFILE")" "Add CMD" "Delete CMD" | yprompt "Dmenufm Custom Command" "${FM_OPTS_GENERIC--fn "$FM_GENERIC_FONT" -sb "$FM_GENERIC_COLOR"}")
[ "$(tail -c 1 "$FM_CMDFILE")" != "" ] && echo >> "$FM_CMDFILE"
case "$cmdmenu" in
"Add CMD")
addcmd=$(xprompt "Recording your command: " "${FM_OPTS_ACTION_LV1--fn "$FM_GENERIC_FONT" -sb "$FM_ACTION_COLOR_LV1"}") || return
desp=$(xprompt "Enter command description: " "${FM_OPTS_ACTION_LV1--fn "$FM_GENERIC_FONT" -sb "$FM_ACTION_COLOR_LV1"}") || return
[ -n "$addcmd" ] &&
printf '%s' "$addcmd - $desp" >> "$FM_CMDFILE" &&
NotiPrompt "$addcmd added."
;;
"Delete CMD")
CMD="$(cat -u "$FM_CMDFILE")"
delcmd=$(< "$FM_CMDFILE" yprompt "Delete chosen command: " "darkred")
[ -n "$delcmd" ] &&
printf '%s' "${CMD%%$nl"$delcmd"*}" "${CMD##*"$delcmd"}" > "$FM_CMDFILE" &&
NotiPrompt "$delcmd deleted"
;;
*)
execmd=${cmdmenu%% - *}
if printf '%s' "$execmd" | grep '\$'; then
allowbulk="Bulk Execute"
allselection="Bulk Execute All"
masselection="Bulk Execute Mass"
ActionMenu "Choose and execute: " "${FM_OPTS_ACTION_LV1--fn "$FM_GENERIC_FONT" -sb "$FM_ACTION_COLOR_LV1"}"
case "$actCHOICE" in
"$allselection")
BulkListAll
[ -n "$check" ] && BulkCMD
;;
"$masselection")
BulkListMass
[ -n "$check" ] && BulkCMD
;;
*)
case "$bulkselection" in
"true")
BulkMode "Select to execute: "
[ -n "$check" ] && BulkCMD
;;
*)
SELECTED="$HERE"
BulkCMD
;;
esac
;;
esac
else
ExecCMD "$execmd"
fi
;;
esac
}
DangerMenu () { # Usage: DangerMenu [CMD] [MSG] (OPT: [Dest])
cmd="$1"
destination="$3"
if DangerPrompt "$2"; then
IFS="$nl"
set -- $SELECTED
unset IFS
for selection do [ -z "$destination" ] && eval "$cmd \"$selection\"" || eval "$cmd \"$selection\" \"$destination\""; done && NotiPrompt "Selected removed."
fi
}
FM_DEL () { # Usage: FM_DEL
allowbulk="Bulk Delete"
allselection="Bulk Delete All"
masselection="Bulk Delete Mass"
ActionMenu "Remove file / directory: " "${FM_OPTS_ACTION_LV1--fn "$FM_GENERIC_FONT" -sb "$FM_ACTION_COLOR_LV1"}" || return && allowbulk="NotAllowed"
case "$actCHOICE" in
"$allselection")
BulkListAll
[ -n "$check" ] && DangerMenu "rm -rf" "Delete all selected in $name?" ""
;;
"$masselection")
BulkListMass
[ -n "$check" ] && DangerMenu "rm -rf" "Delete all selected in $name?" ""
;;
*)
case "$bulkselection" in
"true")
BulkMode "Select files / directories to delete: "
[ -n "$check" ] && DangerMenu "rm -rf" "Delete all selected?" ""
;;
*)
# Single-selection mode
allowbulk="NotAllowed"
# Check the chosen on is directory or not
[ -n "$HERE" ] && [ -d "$HERE" ] && result=$?
[ -n "$HERE" ] && SELECTED="$HERE" && DangerMenu "rm -rf" "Remove all the files / directories in $name?" ""
DirCheck
;;
esac
;;
esac
}
History () { # Usage: History [DIR/FILE]
dirmark="${PWD##*/}"
case "$1" in
"$BACKWARD"|"$TARGET"|"$dirmark")
printf '%s\n' "$dirmark - $PWD" >> "$FM_HISFILE"
;;
*)
printf '%s\n' "$1 - $PWD/$1" >> "$FM_HISFILE"
;;
esac
# Limit the max number of history
TMP=$(wc -l "$FM_HISFILE" || grep -c ^ "$FM_HISFILE")
hisnum=${TMP%% *}
unset TMP
[ "$hisnum" -ge "$FM_MAX_HIS_LENGTH" ] &&
HIS="$(cat -u $FM_HISFILE)" &&
printf '%s\n' "${HIS#*"$nl"}" > "$FM_HISFILE"
}
FM_HIS () { # Usage: FM_HIS
# Use sed command to mimic reverse of cat for POSIX.
goto=$(sed '1!G;h;$!d' "$FM_HISFILE" | yprompt "Dmenufm History" "${FM_OPTS_GENERIC--fn "$FM_GENERIC_FONT" -sb "$FM_GENERIC_COLOR"}")
destination=${goto##* - }
cd "$destination" || FileOpen "$destination"
}
DestMenu () { # Usage: DestMenu
ActionMenu "Destination: " "${FM_OPTS_ACTION_LV2--fn "$FM_GENERIC_FONT" -sb "$FM_ACTION_COLOR_LV2"}" || return && allowbulk="NotAllowed" && actCHOICE="placeholder"
case "$HERE" in
'') ;;
*)
destination="$HERE"
destname="$name"
IFS="$nl"
set -- $SELECTED
unset IFS
for selection do eval "$cmd \"$selection\" \"$destination\""; done && NotiPrompt "Selected files / directories $cmdname to $destname"
;;
esac
}
FM_MYL () { # Usage: FM_MYL
case "$move" in
"$FM_MVV")
cmd="mv"
cmdname="moved"
cmdverb="move"
allowbulk="Bulk Move"
allselection="Bulk Move All"
masselection="Bulk Move Mass"
;;
"$FM_YAK")
cmd="cp -R"
cmdname="copied"
cmdverb="copy"
allowbulk="Bulk Copy"
allselection="Bulk Copy All"
masselection="Bulk Copy Mass"
;;
"$FM_LNK")
cmd="ln -s"
cmdname="linked"
cmdverb="link"
allowbulk="Bulk Link"
allselection="Bulk Link All"
masselection="Bulk Link Mass"
;;
esac
ActionMenu "Source: " "${FM_OPTS_ACTION_LV1--fn "$FM_GENERIC_FONT" -sb "$FM_ACTION_COLOR_LV1"}" || return && allowbulk="NotAllowed"
case "$actCHOICE" in
"$allselection")
BulkListAll
[ -n "$check" ] && DestMenu
;;
"$masselection")
BulkListMass
[ -n "$check" ] && DestMenu
;;
*)
[ -n "$HERE" ] &&
case "$bulkselection" in
"true")
BulkMode "Select files / directories to $cmdverb: "
[ -n "$check" ] && DestMenu
;;
*)
SELECTED="$HERE"
[ -d "$SELECTED" ] && cd "../"
[ -n "$SELECTED" ] && DestMenu
;;
esac
;;
esac
}
NewFileDir () { # Usage: NewFileDir
name=$(xprompt "Type name for $newmenu; Press ESC to leave" "${FM_OPTS_ACTION_LV1--fn "$FM_GENERIC_FONT" -sb "$FM_ACTION_COLOR_LV1"}") || return
case "$name" in
'~') NotiPrompt "Alias to $HOME; not a proper name." && continue ;;
'/') NotiPrompt "Alias to root; not a proper name." && continue ;;
':') NotiPrompt "Alias for command prompt; not a proper name." && continue ;;
'.') NotiPrompt "Alias for current directory; not a proper name." && continue ;;
'..') NotiPrompt "Alias for parent directory; not a proper name." && continue ;;
'*'|'!'|'?'|'+'|'['|']'|'^'|'$'|'{'|'}'|'-'|'('|')'|'|'|'\') NotiPrompt "Shell pattern; not a proper name." && FM_NEW ;;
*) $cmd "$name" ;;
esac
}
FM_NEW () { # Usage: FM_NEW
name="placeholder"
newmenu=$(printf '%s\n' "File" "Directory" | yprompt "Create new files or directories" "${FM_OPTS_GENERIC--fn "$FM_GENERIC_FONT" -sb "$FM_GENERIC_COLOR"}")
while [ -n "$newmenu" ] && [ -n "$name" ]; do
[ "$newmenu" = "File" ] &&
cmd='touch' ||
cmd="mkdir -p"
NewFileDir
done
}
FM_PCP () { # Usage: FM_PCP
# Copy path to xclip/xsel, and send notification.
ActionMenu "Copy file / directory path: " "${FM_OPTS_ACTION_LV1--fn "$FM_GENERIC_FONT" -sb "$FM_ACTION_COLOR_LV1"}" || return
[ -n "$HERE" ] &&
case "$clipcopy" in
"pbcopy") printf '%s' "$HERE" | pbcopy && NotiPrompt "Path $name copied to clipboard." ;;
"xclip") printf '%s' "$HERE" | xclip -selection clipboard && NotiPrompt "Path $name copied to clipboard." ;;
"xsel") printf '%s' "$HERE" | xsel --clipboard && NotiPrompt "Path $name copied to clipboard." ;;
esac
}
BulkRename () { # Usage: BulkRename
case "$SELECTED" in
'') return ;;
*)
[ -f "$FM_REMFILE" ] && rm "$FM_REMFILE" "$FM_REMFILE.dirname" "$FM_REMFILE.backup"
printf '%s' "$SELECTED" > "$FM_REMFILE.backup"
printf '%s' "$SELECTED" > "$FM_REMFILE"
FileOpen "$FM_REMFILE"
if [ $(wc -l "$FM_REMFILE") -ne $(wc -l "$FM_REMFILE.backup") ]; then
NotiPrompt "ERROR: Lines mismatch in rename file; do nothing." && return
else
renamevar=$(paste -d ':' "$FM_REMFILE.backup" "$FM_REMFILE")
# Set IFS for for loop as \n
IFS="$nl"
set -- $renamevar
unset IFS
for selection do
start=${selection%%:*}
destination="${selection##*:}"
[ "$start" != "$destination" ] && eval "mv \"$start\" \"$destination\""
done
fi
rm "$FM_REMFILE" "$FM_REMFILE.dirname" "$FM_REMFILE.backup"
;;
esac
}
FM_REM () { # Usage: FM_REM
allowbulk="Bulk Rename"
allselection="Bulk Rename All"
masselection="Bulk Rename Mass"
ActionMenu "Source: " "${FM_OPTS_ACTION_LV1--fn "$FM_GENERIC_FONT" -sb "$FM_ACTION_COLOR_LV1"}" || return && allowbulk="NotAllowed"
case "$actCHOICE" in
"$allselection")
BulkListAll
[ -n "$check" ] && BulkRename
;;
"$masselection")
BulkListMass
[ -n "$check" ] && BulkRename
;;
*)
case "$bulkselection" in
"true")
BulkMode "Select files / directories to rename: "
[ -n "$check" ] && BulkRename
;;
*)
[ -n "$HERE" ] && [ -d "$HERE" ] && result=$?
SELECTED="$HERE"
[ -n "$SELECTED" ] && BulkRename
DirCheck
;;
esac
;;
esac
}
FM_TRH () { # Usage: FM_TRH
allowbulk="Bulk Trash"
allselection="Bulk Trash All"
masselection="Bulk Trash Mass"
trashmenu=$(printf '%s\n' "Move to trash" "Go to trash" "Empty trash" | yprompt "Dmenufm Trash" "${FM_OPTS_GENERIC--fn "$FM_GENERIC_FONT" -sb "$FM_GENERIC_COLOR"}")
case $trashmenu in
"Move to trash")
ActionMenu "Move file / directory to trash: " "${FM_OPTS_ACTION_LV1--fn "$FM_GENERIC_FONT" -sb "$FM_ACTION_COLOR_LV1"}" || return && allowbulk="NotAllowed"
case "$actCHOICE" in
"$allselection")
BulkListAll
[ -n "$check" ] && DangerMenu "mv" "Move all selected to trash?" "$FM_TRASH"
;;
"$masselection")
BulkListMass
[ -n "$check" ] && DangerMenu "mv" "Move all selected to trash?" "$FM_TRASH"
;;
*)
if [ "$bulkselection" = "true" ]; then
BulkMode "Select files / directories to move to trash: "
[ -n "$check" ] && DangerMenu "mv" "Move all selected to trash?" "$FM_TRASH"
else
allowbulk="NotAllowed"
# Check the chosen on is directory or not
[ -n "$HERE" ] && [ -d "$HERE" ] && result=$?
SELECTED="$HERE"
[ -n "$SELECTED" ] && DangerMenu "mv" "Move $name to trash?" "$FM_TRASH"
DirCheck
fi
;;
esac
;;
"Go to trash")
cd "$FM_TRASH" || return
;;
"Empty trash")
# Lesson: You cannot quote a wildcard. No quote on *.
DangerPrompt "Remove all files and/or directory in trash?" &&
rm -rf "$FM_TRASH"/* &&
NotiPrompt "Trash is empty." ||
return
;;
esac
}
BulkCompress () { # Usage: BulkCompress
case $compression_type in
"tar.gz") cmd="tar -czvf" ;;
"tar.xz") cmd="tar -cJvf" ;;
"tar.bz2") cmd="tar -cjvf" ;;
"gz") cmd="gzip -k" ;;
"bz2") cmd="bzip2 -k" ;;
"xz") cmd="xz -k" ;;
"lzma") cmd="lzma -k" ;;
"7z") cmd="7z a" ;;
"zip") cmd="zip -r" ;;
*) return ;;
esac
if echo "$compression_type" | grep -E '^tar|^zip'; then
[ -d "$FM_ZIPATH" ] && rm -rf "$FM_ZIPATH"
mkdir "$FM_ZIPATH"
IFS="$nl"
set -- $SELECTED
unset IFS
for file do eval "cp -R \"$file\" \"$FM_ZIPATH\""; done
archive_name=$(xprompt "Please insert archive name: " "${FM_OPTS_ACTION_LV2--fn "$FM_GENERIC_FONT" -sb "$FM_ACTION_COLOR_LV2"}" | cut -d '.' -f1) || return
[ -n "$archive_name" ] &&
compressdir_name="$archive_name" &&
archive_name="$archive_name.$compression_type" &&
mv "$FM_ZIPATH" "./$compressdir_name" &&
$cmd "$archive_name" ./"$compressdir_name"/* &&
NotiPrompt "Compressed to $archive_name" &&
rm -rf ./"$compressdir_name"
rm -rf "$FM_ZIPATH"
else
IFS="$nl"
set -- $SELECTED
unset IFS
for file do eval "$cmd \"$file\" && NotiPrompt \"Compressed to ${file##*/}\""; done
fi
}
FM_ZIP () { # Usage: FM_ZIP
allowbulk="Bulk Compress"
allselection="Bulk Compress All"
masselection="Bulk Compress Mass"
compression_type=$(printf '%s\n' "$COMPRESSIONLIST" | yprompt "Compression type: " "${FM_OPTS_ACTION_LV1--fn "$FM_GENERIC_FONT" -sb "$FM_ACTION_COLOR_LV1"}" || return && allowbulk="NotAllowed")
! printf '%s' "$compression_type" | grep -E '^tar|^zip' && allowbulk="NotAllowed"
[ -n "$compression_type" ] && ActionMenu "Source: " "${FM_OPTS_ACTION_LV1--fn "$FM_GENERIC_FONT" -sb "$FM_ACTION_COLOR_LV1"}" || return && allowbulk="NotAllowed"
case "$actCHOICE" in
"$allselection")
BulkListAll
[ -n "$check" ] && BulkCompress
;;
"$masselection")
BulkListMass
[ -n "$check" ] && BulkCompress
;;
*)
case "$bulkselection" in
"true")
BulkMode "Select files / directories to compress: "
[ -n "$check" ] && BulkCompress
;;
*)
SELECTED="$HERE"
[ -n "$SELECTED" ] && BulkCompress
;;
esac
;;
esac
}
FM_SDO () {
sudo -A dmenufm
}
FM_EYE () {
preview="true"
yprompt () { # Usage yprompt [MSG] [BG_COLOR]
dmenu -f -fn "$FM_GENERIC_FONT" -b -i -sb "$2" -p "$1"
}
ActionMenu "Preview mode: " "${FM_OPTS_ACTION_LV1--fn "$FM_GENERIC_FONT" -sb "$FM_ACTION_COLOR_LV1"}" || return && allowbulk="NotAllowed"
[ -n "$HERE" ] && FileOpen "$HERE" &
while [ -n "$HERE" ]; do
wmctrl -ic "$eyeid" &
ActionMenu "Preview mode: " "${FM_OPTS_ACTION_LV1--fn "$FM_GENERIC_FONT" -sb "$FM_ACTION_COLOR_LV1"}" || return && allowbulk="NotAllowed"
eyeid="$(xprop -root _NET_ACTIVE_WINDOW | cut -d ' ' -f 5)"
[ -n "$HERE" ] && FileOpen "$HERE" &
done
wmctrl -ic "$eyeid"
yprompt () { # Usage yprompt [MSG] [BG_COLOR]
dmenu -f -fn "$FM_GENERIC_FONT" -i -sb "$2" -l 10 -p "$1"
}
preview="false"
}