From 59e3fec4f3b436fe5ab63cf9fb5ff5fb77287702 Mon Sep 17 00:00:00 2001 From: Hui-Jun Chen Date: Fri, 27 Dec 2019 12:33:41 -0500 Subject: [PATCH] Update readme --- README.md | 24 +++++++++++++++--------- dmenufm | 4 ++-- dmenufm-action | 10 ++++++---- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 045c171..1bfd3d9 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ A simple dmenu file manager written in POSIX-compliant shell script. - File management (*yank, move, symbolic link, **ranger style bulk rename**, etc*) - Remember you last path ([CD on Exit](#cd-on-exit)) - Rolling menu for dynamic file browsing ([Rolling Menu](#rolling-menu)) +- Able to **Preview** you file. (use [`EYE` to preview your file](#eye-to-preview-your-file)) + [![Distrotube introduced my project much better than I would](https://img.youtube.com/vi/EyW6pRlWv6Q/0.jpg)](https://www.youtube.com/watch?v=EyW6pRlWv6Q) @@ -120,7 +122,7 @@ OPTS: -h | --help - Show this usage information. Use `-p | --lastpath` option: -``` +```sh dmenufm -p ``` @@ -128,12 +130,12 @@ dmenufm -p Use `-r` option for rolling menu based on the file that you opened: -``` +```sh dmenufm -r ``` For example, the original list is -``` +```sh ../ ./ Actions @@ -145,7 +147,7 @@ file4 ``` You open `file3`. After you close `file3`, the menu would be -``` +```sh ../ ./ Actions @@ -197,7 +199,7 @@ Delete directories or files. #### `TRH` to put in trash. -- `$HOME/.config/dmenufm/trash` is the directory storing trashes for dmenufm. +- `$HOME/.cache/dmenufm/trash` is the directory storing trashes for dmenufm. - `Move file to trash` will generate a new dmenu prompt. - Choose any file to move to trash. - To move a directory to trash, enter the directory, and choose `./` to confirm this directory.. @@ -279,15 +281,18 @@ There are many environment variables you can use to configure dmenufm by exporti The default options are as follows: -``` +```sh # FILES LOCATION export FM_PATH="$HOME/.config/dmenufm" -export FM_TRASH="$FM_PATH/trash" +export FM_CACHE_PATH="$HOME/.cache/dmenufm" export FM_BMKFILE="$FM_PATH/dmenufm_bookmark" export FM_CMDFILE="$FM_PATH/dmenufm_command" export FM_HISFILE="$FM_PATH/dmenufm_history" -export FM_LASTPATH="$FM_PATH/dmenufm_lastpath" -export FM_REMFILE="$FM_PATH/dmenufm_bulk_rename" +export FM_SDOPROP="$FM_PATH/dmenufm_sudoprompt" +export FM_LASTPATH="$FM_CACHE_PATH/dmenufm_lastpath" +export FM_REMFILE="$FM_CACHE_PATH/dmenufm_bulk_rename" +export FM_ZIPATH="$FM_CACHE_PATH/compression/" +export FM_TRASH="$FM_CACHE_PATH/trash" # Max number for history export FM_MAX_HIS_LENGTH=5000 # FONTS @@ -380,6 +385,7 @@ export FM_GENERIC_COLOR="#005577" export FM_ACTION_COLOR_LV1="#33691e" export FM_ACTION_COLOR_LV2="#FF8C00" export FM_ACTION_COLOR_BULK="#CB06CB" +export FM_SUDO_COLOR="red" ``` Change the font / font size / color in the `""` to customize the appearance of dmenufm. diff --git a/dmenufm b/dmenufm index 9ad69c8..96cc613 100755 --- a/dmenufm +++ b/dmenufm @@ -6,11 +6,11 @@ # FILES LOCATION FM_PATH="${FM_PATH:-$HOME/.config/dmenufm}" FM_CACHE_PATH="${FM_CACHE_PATH:-$HOME/.cache/dmenufm}" -FM_TRASH="${FM_TRASH:-$FM_CACHE_PATH/trash}" FM_BMKFILE="${FM_BMKFILE:-$FM_PATH/dmenufm_bookmark}" FM_CMDFILE="${FM_CMDFILE:-$FM_PATH/dmenufm_command}" FM_HISFILE="${FM_HISFILE:-$FM_PATH/dmenufm_history}" FM_SDOPROP="${FM_SDOPROP:-$FM_PATH/dmenufm_sudoprompt}" +FM_TRASH="${FM_TRASH:-$FM_CACHE_PATH/trash}" FM_LASTPATH="${FM_LASTPATH:-$FM_CACHE_PATH/dmenufm_lastpath}" FM_REMFILE="${FM_REMFILE:-$FM_CACHE_PATH/dmenufm_bulk_rename}" FM_ZIPATH="${FM_ZIPATH:-$FM_CACHE_PATH/compression/}" @@ -82,7 +82,7 @@ CheckDeps () { unset CurDep } -CheckDeps find tail xdg-mime xdg-open sed grep wc cp mv rm paste cut id wmctrl +CheckDeps find tail xdg-mime xdg-open sed grep wc cp mv rm paste cut id wmctrl xclip UsageInfo () { while read -r CurLine; do diff --git a/dmenufm-action b/dmenufm-action index 1b387ce..a020017 100755 --- a/dmenufm-action +++ b/dmenufm-action @@ -253,9 +253,9 @@ FM_NEW () { # Usage: FM_NEW FM_PCP () { # Usage: FM_PCP # Copy path to xclip, and send notification. ActionMenu "Copy file / directory path: " "$FM_ACTION_COLOR_LV1" || return - if [ -n "$HERE" ] && CheckDeps xclip; then + if [ -n "$HERE" ] && command -v xclip; then printf '%s' "$HERE" | xclip -selection clipboard && NotiPrompt "Path $name copied to clipboard." - elif [ -n "$HERE" ] && CheckDeps xsel; then + elif [ -n "$HERE" ] && command -v xsel; then printf '%s' "$HERE" | xsel --clipboard && NotiPrompt "Path $name copied to clipboard." elif [ -n "$HERE" ]; then NotiPrompt "Need to install xclip or xsel as dependency" @@ -438,18 +438,20 @@ FM_SDO () { FM_EYE () { preview="true" + yprompt () { # Usage yprompt [MSG] [BG_COLOR] dmenu -f -fn "$FM_GENERIC_FONT" -b -i -h 40 -sb "$2" -p "$1" } - HERE="placeholder" + ActionMenu "Preview mode: " "$FM_ACTION_COLOR_LV1" || return && allowbulk="NotAllowed" [ -n "$HERE" ] && FileOpen "$HERE" & while [ -n "$HERE" ]; do + [ -n "$HERE" ] && wmctrl -c :ACTIVE: & ActionMenu "Preview mode: " "$FM_ACTION_COLOR_LV1" || return && allowbulk="NotAllowed" [ -n "$HERE" ] && FileOpen "$HERE" & - [ -n "$HERE" ] && wmctrl -c :ACTIVE: & done wmctrl -c :ACTIVE: + yprompt () { # Usage yprompt [MSG] [BG_COLOR] dmenu -f -fn "$FM_GENERIC_FONT" -i -sb "$2" -l 10 -p "$1" }