|
#!/usr/bin/env bash |
|
|
|
# ----------------------------------------------------------- |
|
# Script : f2m.sh |
|
# Description : Suckless file manager for CLI and GE |
|
# Author : Blau Araujo <[email protected]> |
|
# Version : 0.01 (dev) |
|
# Date : Dec 07, 2019 |
|
# License : GNU/GPL v3.0 |
|
# ----------------------------------------------------------- |
|
# Copyright Note: |
|
# |
|
# This program is free software: you can redistribute it |
|
# and/or modify it under the terms of the GNU General Public |
|
# License as published by the Free Software Foundation, |
|
# either version 3 of the License, or (at your option) any |
|
# later version. |
|
# |
|
# This program is distributed in the hope that it will be |
|
# useful, but WITHOUT ANY WARRANTY; without even the implied |
|
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
|
# PURPOSE. |
|
# |
|
# See the GNU General Public License for more details: |
|
# |
|
# https://www.gnu.org/licenses/gpl-3.0.txt |
|
# ----------------------------------------------------------- |
|
# Dependencies: bash, fzf, dmenu (suckless-tools) |
|
# ----------------------------------------------------------- |
|
|
|
# [Sandbox] ------------------------------------------------- |
|
|
|
# fzf --reverse -e -i --tiebreak=begin <<< $fm_menu |
|
# dmenu -i -l 15 -p "~/" <<< $fm_menu |
|
|
|
# fm_home="$HOME" |
|
# fm_root="/" |
|
|
|
# fm_topmenu="\ |
|
# <: Pasta anterior --> só se existir um histórico de navegação |
|
# >: Próxima pasta --> só se existir um histórico de navegação |
|
# p: Pasta acima --> só se não estiver na raiz |
|
# m: Marcadores --> só se existir algum marcador |
|
# /: Raiz do sistema de arquivos |
|
# h: Exibir/Ocultar arquivos invisíveis |
|
# q: Sair |
|
# " |
|
|
|
# fm_dirs=$(for f in *; do [[ -d "$f" ]] && echo "$f/"; done) |
|
# fm_dotdirs=$(for f in .*; do [[ -d "$f" ]] && echo "$f/"; done) |
|
# fm_files=$(for f in *; do [[ -f "$f" ]] && echo "$f"; done) |
|
# fm_dotfiles=$(for f in *; do [[ -f "$f" ]] && echo "$f"; done) |
|
|
|
|
|
# PARA 11/12/2019 - 20:00H |
|
# |
|
# TODO #1 - Fazer a montagem das variáveis de arquivos e pastas |
|
# numa passada só do FOR. |
|
# TODO #2 - Evitar que listagens vazias insiram nova linha |
|
# em branco no menu. |
|
|
|
caminho="$HOME" |
|
|
|
fm_dirs=$(for f in $caminho/*; do [[ -d "$f" ]] && echo "${f##*/}/"; done) |
|
fm_dotdirs=$(for f in $caminho/.*; do [[ -d "$f" ]] && echo "${f##*/}/"; done) |
|
fm_files=$(for f in $caminho/*; do [[ -f "$f" ]] && echo "${f##*/}"; done) |
|
fm_dotfiles=$(for f in $caminho/.*; do [[ -f "$f" ]] && echo "${f##*/}"; done) |
|
|
|
fm_menu="\ |
|
$fm_dotdirs |
|
$fm_dirs |
|
$fm_files |
|
$fm_dotfiles |
|
" |
|
|
|
# dmenu -i -l 15 -fn "Monaco-16" -p "$caminho/" <<< $fm_menu |
|
fzf --reverse -e -i --tiebreak=begin <<< $fm_menu |
|
|
|
|
|
|
|
# [Help] ---------------------------------------------------- |
|
|
|
# [Checks] -------------------------------------------------- |
|
# [ ] UID - Não pode executar como root! |
|
# [ ] Dependências |
|
# [ ] Arquivo de configurações |
|
# [ ] Argumentos |
|
|
|
# [Sources] ------------------------------------------------- |
|
|
|
# [Environment] --------------------------------------------- |
|
|
|
# [Functions] ----------------------------------------------- |
|
|
|
# [Modules] ------------------------------------------------- |
|
|
|
# [Main] ---------------------------------------------------- |
|
|
|
|