diff --git a/README.org b/README.org index 52b9422..d3746bf 100644 --- a/README.org +++ b/README.org @@ -26,11 +26,13 @@ Legacy dotfiles that I don't use anymore * Configured Applications - [[https://dwm.suckless.org/][dwm]] +- [[https://dunst-project.org/][dunst]] - [[https://i3wm.org/][i3wm]] - [[https://moc.daper.net/][moc]] - [[https://www.newsbeuter.org/][newsbeuter]] - [[https://github.com/davatorium/rofi][rofi]] - [[https://www.spacemacs.org/][spacemacs]] +- [[https://vifm.info/][vifm]] - [[http://zsh.sourceforge.net/][zsh]] * Zsh diff --git a/dunst/.config/dunst/dunstrc b/dunst/.config/dunst/dunstrc new file mode 100644 index 0000000..1d725a8 --- /dev/null +++ b/dunst/.config/dunst/dunstrc @@ -0,0 +1,148 @@ +[global] + monitor = 0 + follow = keyboard + geometry = "0x0-30+20" + indicate_hidden = yes + shrink = no + transparency = 0 + notification_height = 0 + separator_height = 2 + padding = 0 + horizontal_padding = 8 + frame_width = 3 + frame_color = "#aaaaaa" + + # Define a color for the separator. + # possible values are: + # * auto: dunst tries to find a color fitting to the background; + # * foreground: use the same color as the foreground; + # * frame: use the same color as the frame; + # * anything else will be interpreted as a X color. + separator_color = frame + + # Sort messages by urgency. + sort = yes + + idle_threshold = 120 + font = JetBrainsMono Font Medium 10 + + line_height = 0 + markup = full + + # The format of the message. Possible variables are: + # %a appname + # %s summary + # %b body + # %i iconname (including its path) + # %I iconname (without its path) + # %p progress value if set ([ 0%] to [100%]) or nothing + # %n progress value if set without any extra characters + # %% Literal % + # Markup is allowed + format = "%s\n%b" + + alignment = center + show_age_threshold = 60 + word_wrap = yes + ellipsize = middle + ignore_newline = no + stack_duplicates = true + hide_duplicate_count = false + show_indicators = yes + icon_position = left + max_icon_size = 32 + icon_path = /usr/share/icons/Papirus-Dark/24x24/panel/:/usr/share/icons/Papirus-Dark/24x24/devices/:/usr/share/icons/Papirus-Dark/24x24/apps:/usr/share/icons/Papirus-Dark/24x24/actions + sticky_history = yes + history_length = 20 + dmenu = dmenu -p dunst: + browser = /usr/local/bin/brave + + # Always run rule-defined scripts, even if the notification is suppressed + always_run_script = true + + title = Dunst + class = Dunst + startup_notification = false + corner_radius = 5 + force_xinerama = false +[experimental] + per_monitor_dpi = false + +[shortcuts] + close = ctrl+space + close_all = ctrl+shift+space + history = ctrl+grave + context = ctrl+shift+period + +# Every section that isn't one of the above is interpreted as a rules to +# override settings for certain messages. +# Messages can be matched by "appname", "summary", "body", "icon", "category", +# "msg_urgency" and you can override the "timeout", "urgency", "foreground", +# "background", "new_icon" and "format". +# Shell-like globbing will get expanded. +# +# SCRIPTING +# You can specify a script that gets run when the rule matches by +# setting the "script" option. +# The script will be called as follows: +# script appname summary body icon urgency +# where urgency can be "LOW", "NORMAL" or "CRITICAL". +# +# NOTE: if you don't want a notification +# to be displayed, set the format +# to "". +# NOTE: It might be helpful to run dunst -print in a terminal in order +# to find fitting options for rules. + +#[espeak] +# summary = "*" +# script = dunst_espeak.sh + +#[script-test] +# summary = "*script*" +# script = dunst_test.sh + +#[ignore] +# # This notification will not be displayed +# summary = "foobar" +# format = "" + +#[history-ignore] +# # This notification will not be saved in history +# summary = "foobar" +# history_ignore = yes + +#[signed_on] +# appname = Pidgin +# summary = "*signed on*" +# urgency = low +# +#[signed_off] +# appname = Pidgin +# summary = *signed off* +# urgency = low +# +#[says] +# appname = Pidgin +# summary = *says* +# urgency = critical +# +#[twitter] +# appname = Pidgin +# summary = *twitter.com* +# urgency = normal +# +# vim: ft=cfg + +[urgency_low] + background = "#2b2b2b" + foreground = "#ffffff" + +[urgency_normal] + background = "#2b2b2b" + foreground = "#ffffff" + +[urgency_critical] + background = "#900000" + foreground = "#ffffff" + frame_color = "#ff0000" diff --git a/vifm/.config/vifm/SETUP b/vifm/.config/vifm/SETUP new file mode 100644 index 0000000..634e69c --- /dev/null +++ b/vifm/.config/vifm/SETUP @@ -0,0 +1,71 @@ +" Ranger devicons for ViFM +" https://github.com/cirala/vifm_devicons +" +" Filetypes/directories +set classify=' :dir:/, :exe:, :reg:, :link:,? :?:, ::../::' + +" Specific files +set classify+=' ::.Xdefaults,,.Xresources,,.bashprofile,,.bash_profile,,.bashrc,,.dmrc,,.d_store,,.fasd,,.gitconfig,,.gitignore,,.jack-settings,,.mime.types,,.nvidia-settings-rc,,.pam_environment,,.profile,,.recently-used,,.selected_editor,,.xinitpurc,,.zprofile,,.yarnc,,.snclirc,,.tmux.conf,,.urlview,,.config,,.ini,,.user-dirs.dirs,,.mimeapps.list,,.offlineimaprc,,.msmtprc,,.Xauthority,,config::' +set classify+=' ::dropbox::' +set classify+=' ::favicon.*,,README,,readme::' +set classify+=' ::.vim,,.vimrc,,.gvimrc,,.vifm::' +set classify+=' ::gruntfile.coffee,,gruntfile.js,,gruntfile.ls::' +set classify+=' ::gulpfile.coffee,,gulpfile.js,,gulpfile.ls::' +set classify+=' ::ledger::' +set classify+=' ::license,,copyright,,copying,,LICENSE,,COPYRIGHT,,COPYING::' +set classify+=' ::node_modules::' +set classify+=' ::react.jsx::' + +" File extensions +set classify+='λ ::*.ml,,*.mli::' +set classify+=' ::*.styl::' +set classify+=' ::*.scss::' +set classify+=' ::*.py,,*.pyc,,*.pyd,,*.pyo::' +set classify+=' ::*.php::' +set classify+=' ::*.markdown,,*.md::' +set classify+=' ::*.json::' +set classify+=' ::*.js::' +set classify+=' ::*.bmp,,*.gif,,*.ico,,*.jpeg,,*.jpg,,*.png,,*.svg,,*.svgz,,*.tga,,*.tiff,,*.xmb,,*.xcf,,*.xpm,,*.xspf,,*.xwd,,*.cr2,,*.dng,,*.3fr,,*.ari,,*.arw,,*.bay,,*.crw,,*.cr3,,*.cap,,*.data,,*.dcs,,*.dcr,,*drf,,*.eip,,*.erf,,*.fff,,*.gpr,,*.iiq,,*.k25,,*.kdc,,*.mdc,,.*mef,,*.mos,,.*.mrw,,.*.obm,,*.orf,,*.pef,,*.ptx,,*.pxn,,*.r3d,,*.raf,,*.raw,,*.rwl,,*.rw2,,*.rwz,,*.sr2,,*.srf,,*.srf,,*.srw,,*.tif,,*.x3f::' +set classify+=' ::*.ejs,,*.htm,,*.html,,*.slim,,*.xml::' +set classify+=' ::*.mustasche::' +set classify+=' ::*.css,,*.less,,*.bat,,*.conf,,*.ini,,*.rc,,*.yml,,*.cfg,,*.rc::' +set classify+=' ::*.rss::' +set classify+=' ::*.coffee::' +set classify+=' ::*.twig::' +set classify+=' ::*.c++,,*.cc,,*.c,,*.cpp,,*.cxx,,*.c,,*.h::' +set classify+=' ::*.hs,,*.lhs::' +set classify+=' ::*.lua::' +set classify+=' ::*.jl::' +set classify+=' ::*.go::' +set classify+=' ::*.ts::' +set classify+=' ::*.db,,*.dump,,*.sql::' +set classify+=' ::*.sln,,*.suo::' +set classify+=' ::*.exe::' +set classify+=' ::*.diff,,*.sum,,*.md5,,*.sha512::' +set classify+=' ::*.scala::' +set classify+=' ::*.java,,*.jar::' +set classify+=' ::*.xul::' +set classify+=' ::*.clj,,*.cljc::' +set classify+=' ::*.pl,,*.pm,,*.t::' +set classify+=' ::*.cljs,,*.edn::' +set classify+=' ::*.rb::' +set classify+=' ::*.fish,,*.sh,,*.bash::' +set classify+=' ::*.dart::' +set classify+=' ::*.f#,,*.fs,,*.fsi,,*.fsscript,,*.fsx::' +set classify+=' ::*.rlib,,*.rs::' +set classify+=' ::*.d::' +set classify+=' ::*.erl,,*.hrl::' +set classify+=' ::*.ai::' +set classify+=' ::*.psb,,*.psd::' +set classify+=' ::*.jsx::' +set classify+=' ::*.vim,,*.vimrc::' +set classify+=' ::*.aac,,*.anx,,*.asf,,*.au,,*.axa,,*.flac,,*.m2a,,*.m4a,,*.mid,,*.midi,,*.mp3,,*.mpc,,*.oga,,*.ogg,,*.ogx,,*.ra,,*.ram,,*.rm,,*.spx,,*.wav,,*.wma,,*.ac3::' +set classify+=' ::*.avi,,*.flv,,*.mkv,,*.mov,,*.mov,,*.mp4,,*.mpeg,,*.mpg,,*.webm::' +set classify+=' ::*.epub,,*.pdf,,*.fb2,,*.djvu::' +set classify+=' ::*.7z,,*.apk,,*.bz2,,*.cab,,*.cpio,,*.deb,,*.gem,,*.gz,,*.gzip,,*.lh,,*.lzh,,*.lzma,,*.rar,,*.rpm,,*.tar,,*.tgz,,*.xz,,*.zip::' +set classify+=' ::*.cbr,,*.cbz::' +set classify+=' ::*.log::' +set classify+=' ::*.doc,,*.docx,,*.adoc::' +set classify+=' ::*.xls,,*.xls,,*.xlsmx::' +set classify+=' ::*.pptx,,*.ppt::' + diff --git a/vifm/.config/vifm/colors/Default.vifm b/vifm/.config/vifm/colors/Default.vifm new file mode 100644 index 0000000..7434b36 --- /dev/null +++ b/vifm/.config/vifm/colors/Default.vifm @@ -0,0 +1,80 @@ +" You can edit this file by hand. +" The " character at the beginning of a line comments out the line. +" Blank lines are ignored. + +" The Default color scheme is used for any directory that does not have +" a specified scheme and for parts of user interface like menus. A +" color scheme set for a base directory will also +" be used for the sub directories. + +" The standard ncurses colors are: +" Default = -1 = None, can be used for transparency or default color +" Black = 0 +" Red = 1 +" Green = 2 +" Yellow = 3 +" Blue = 4 +" Magenta = 5 +" Cyan = 6 +" White = 7 + +" Light versions of colors are also available (set bold attribute): +" LightBlack +" LightRed +" LightGreen +" LightYellow +" LightBlue +" LightMagenta +" LightCyan +" LightWhite + +" Available attributes (some of them can be combined): +" bold +" underline +" reverse or inverse +" standout +" italic (on unsupported systems becomes reverse) +" none + +" Vifm supports 256 colors you can use color numbers 0-255 +" (requires properly set up terminal: set your TERM environment variable +" (directly or using resources) to some color terminal name (e.g. +" xterm-256color) from /usr/lib/terminfo/; you can check current number +" of colors in your terminal with tput colors command) + +" highlight group cterm=attrs ctermfg=foreground_color ctermbg=background_color + +highlight clear + +highlight Win cterm=none ctermfg=white ctermbg=black +highlight Directory cterm=bold ctermfg=cyan ctermbg=default +highlight Link cterm=bold ctermfg=yellow ctermbg=default +highlight BrokenLink cterm=bold ctermfg=red ctermbg=default +highlight Socket cterm=bold ctermfg=magenta ctermbg=default +highlight Device cterm=bold ctermfg=red ctermbg=default +highlight Fifo cterm=bold ctermfg=cyan ctermbg=default +highlight Executable cterm=bold ctermfg=green ctermbg=default +highlight Selected cterm=bold ctermfg=magenta ctermbg=default +highlight CurrLine cterm=bold,reverse ctermfg=default ctermbg=default +highlight TopLine cterm=none ctermfg=black ctermbg=white +highlight TopLineSel cterm=bold ctermfg=black ctermbg=default +highlight StatusLine cterm=bold ctermfg=black ctermbg=white +highlight WildMenu cterm=underline,reverse ctermfg=white ctermbg=black +highlight CmdLine cterm=none ctermfg=white ctermbg=black +highlight ErrorMsg cterm=none ctermfg=red ctermbg=black +highlight Border cterm=none ctermfg=black ctermbg=white +highlight JobLine cterm=bold,reverse ctermfg=black ctermbg=white +highlight SuggestBox cterm=bold ctermfg=default ctermbg=default +highlight CmpMismatch cterm=bold ctermfg=white ctermbg=red +highlight AuxWin cterm=bold,underline,reverse,standout,italic ctermfg=default ctermbg=default +highlight TabLine cterm=none ctermfg=white ctermbg=black +highlight TabLineSel cterm=bold,reverse ctermfg=default ctermbg=default +highlight User1 cterm=bold,underline,reverse,standout,italic ctermfg=default ctermbg=default +highlight User2 cterm=bold,underline,reverse,standout,italic ctermfg=default ctermbg=default +highlight User3 cterm=bold,underline,reverse,standout,italic ctermfg=default ctermbg=default +highlight User4 cterm=bold,underline,reverse,standout,italic ctermfg=default ctermbg=default +highlight User5 cterm=bold,underline,reverse,standout,italic ctermfg=default ctermbg=default +highlight User6 cterm=bold,underline,reverse,standout,italic ctermfg=default ctermbg=default +highlight User7 cterm=bold,underline,reverse,standout,italic ctermfg=default ctermbg=default +highlight User8 cterm=bold,underline,reverse,standout,italic ctermfg=default ctermbg=default +highlight User9 cterm=bold,underline,reverse,standout,italic ctermfg=default ctermbg=default diff --git a/vifm/.config/vifm/colors/molokai.vifm b/vifm/.config/vifm/colors/molokai.vifm new file mode 100644 index 0000000..482c423 --- /dev/null +++ b/vifm/.config/vifm/colors/molokai.vifm @@ -0,0 +1,31 @@ +" Molokai +" by Miguel Madrid Mencia +" https://github.com/vifm/vifm-colors + +highlight clear + +highlight Border cterm=none ctermfg=black ctermbg=default +highlight BrokenLink cterm=bold ctermfg=red ctermbg=default +highlight CmdLine cterm=none ctermfg=white ctermbg=default +highlight CurrLine cterm=bold ctermfg=default ctermbg=208 +highlight Device cterm=bold ctermfg=red ctermbg=default +highlight Directory cterm=bold ctermfg=12 ctermbg=default +highlight ErrorMsg cterm=none ctermfg=red ctermbg=black +highlight Executable cterm=bold ctermfg=green ctermbg=default +highlight Fifo cterm=bold ctermfg=cyan ctermbg=default +highlight Link cterm=bold ctermfg=green ctermbg=default +highlight OtherLine cterm=bold ctermfg=default ctermbg=130 +highlight Selected cterm=bold ctermfg=magenta ctermbg=default +highlight Socket cterm=bold ctermfg=magenta ctermbg=default +highlight StatusLine cterm=none ctermfg=white ctermbg=default +highlight SuggestBox cterm=none ctermfg=white ctermbg=black +highlight TopLine cterm=none ctermfg=15 ctermbg=default +highlight TopLineSel cterm=none ctermfg=148 ctermbg=default +highlight WildMenu cterm=underline,reverse ctermfg=white ctermbg=black +highlight Win cterm=none ctermfg=white ctermbg=default + +if $USER == 'root' + highlight Border cterm=none ctermfg=default ctermbg=red + highlight StatusLine cterm=none ctermfg=white ctermbg=red + highlight TopLine cterm=none ctermfg=default ctermbg=red +endif diff --git a/vifm/.config/vifm/colors/solarized-dark.vifm b/vifm/.config/vifm/colors/solarized-dark.vifm new file mode 100644 index 0000000..a792bd9 --- /dev/null +++ b/vifm/.config/vifm/colors/solarized-dark.vifm @@ -0,0 +1,45 @@ +" VIFM COLORS +" solarized dark +" based on: https://github.com/istib/dotfiles/blob/master/vifm/vifm-colors + +" Default = -1 = None, can be used for transparency or default color +" Black = 0 +" Red = 1 +" Green = 2 +" Yellow = 3 +" Blue = 4 +" Magenta = 5 +" Cyan = 6 +" White = 7 + +" STYLES +" bold +" underline +" reverse or inverse +" standout +" none + + +highlight clear + +highlight Win cterm=none ctermfg=default ctermbg=none + +highlight TopLine cterm=none ctermfg=blue ctermbg=none +highlight TopLineSel cterm=none ctermfg=blue ctermbg=none +highlight StatusLine cterm=none ctermfg=blue ctermbg=none +highlight Border cterm=none ctermfg=blue ctermbg=none + +highlight Selected cterm=bold ctermfg=magenta ctermbg=default +highlight CurrLine cterm=bold ctermfg=default ctermbg=blue + +highlight WildMenu cterm=underline,reverse ctermfg=white ctermbg=black +highlight CmdLine cterm=none ctermfg=white ctermbg=black +highlight ErrorMsg cterm=none ctermfg=red ctermbg=black + +highlight Directory cterm=none ctermfg=cyan ctermbg=default +highlight Link cterm=none ctermfg=yellow ctermbg=default +highlight BrokenLink cterm=none ctermfg=red ctermbg=default +highlight Socket cterm=none ctermfg=magenta ctermbg=default +highlight Device cterm=none ctermfg=red ctermbg=default +highlight Fifo cterm=none ctermfg=cyan ctermbg=default +highlight Executable cterm=none ctermfg=green ctermbg=default diff --git a/vifm/.config/vifm/scripts/README b/vifm/.config/vifm/scripts/README new file mode 100644 index 0000000..7694952 --- /dev/null +++ b/vifm/.config/vifm/scripts/README @@ -0,0 +1,6 @@ +This directory is dedicated for user-supplied scripts/executables. +vifm modifies its PATH environment variable to let user run those +scripts without specifying full path. All subdirectories are added +as well. File in a subdirectory overrules file with the same name +in parent directories. Restart might be needed to recognize files +in newly created or renamed subdirectories. \ No newline at end of file diff --git a/vifm/.config/vifm/vifmrc b/vifm/.config/vifm/vifmrc new file mode 100644 index 0000000..2ff765a --- /dev/null +++ b/vifm/.config/vifm/vifmrc @@ -0,0 +1,377 @@ +" vim: filetype=vifm : + +" vim alias +set vicmd=nvim +" set vicmd=elvis\ -G\ termcap +" set vicmd=vile + +" This makes vifm perform file operations on its own instead of relying on +" standard utilities like `cp`. While using `cp` and alike is a more universal +" solution, it's also much slower when processing large amounts of files and +" doesn't support progress measuring. + +set syscalls + +" Trash Directory +" The default is to move files that are deleted with dd or :d to +" the trash directory. If you change this you will not be able to move +" files by deleting them and then using p to put the file in the new location. +" I recommend not changing this until you are familiar with vifm. +" This probably shouldn't be an option. + +set trash + +" This is how many directories to store in the directory history. + +set history=100 + +" Automatically resolve symbolic links on l or Enter. + +set nofollowlinks + +" Natural sort of (version) numbers within text. + +set sortnumbers + +" Maximum number of changes that can be undone. + +set undolevels=100 + +" If you installed the vim.txt help file set vimhelp. +" If would rather use a plain text help file set novimhelp. + +set novimhelp + +" If you would like to run an executable file when you +" press return on the file name set this. + +set norunexec + +" Selected color scheme + +colorscheme molokai + +" Format for displaying time in file list. For example: +" TIME_STAMP_FORMAT=%m/%d-%H:%M +" See man date or man strftime for details. + +set timefmt=%m-%d-%Y\ %H:%M + +" Show list of matches on tab completion in command-line mode + +set wildmenu + +" Display completions in a form of popup with descriptions of the matches + +set wildstyle=popup + +" Display suggestions in normal, visual and view modes for keys, marks and +" registers (at most 5 files). In other view, when available. + +set suggestoptions=normal,visual,view,otherpane,keys,marks,registers + +" Ignore case in search patterns unless it contains at least one uppercase +" letter + +set ignorecase +set smartcase + +" Don't highlight search results automatically + +set nohlsearch + +" Use increment searching (search while typing) + +set incsearch + +" Try to leave some space from cursor to upper/lower border in lists + +set scrolloff=4 + +" Set custom status line look + +set statusline=" Hint: %z%= %A %10u:%-7g %15s %20d " + +" ------------------------------------------------------------------------------ + +" :mark mark /full/directory/path [filename] + +mark h ~/ +mark b ~/.local/bin +mark d ~/Documents +mark w ~/Pictures/wallpaper + +" ------------------------------------------------------------------------------ + +" :com[mand][!] command_name action +" The following macros can be used in a command +" %a is replaced with the user arguments. +" %c the current file under the cursor. +" %C the current file under the cursor in the other directory. +" %f the current selected file, or files. +" %F the current selected file, or files in the other directory. +" %b same as %f %F. +" %d the current directory name. +" %D the other window directory name. +" %m run the command in a menu window + +command! df df -h %m 2> /dev/null +command! diff nvim -d %f %F +command! zip zip -r %f.zip %f +command! run !! ./%f +command! make !!make %a +command! mkcd :mkdir %a | cd %a +command! vgrep nvim "+grep %a" +command! reload :write | restart +command! ncdu ncdu %d 2> /dev/null +command! lockwallpaper generate-lock-image %f 2> /dev/null +command! backgroundwallpaperone switch-background-image %f 1 2> /dev/null +command! backgroundwallpapertwo switch-background-image %f 2 2> /dev/null + +" Fuzzy file search +command! FZFfind :set noquickview | :execute 'goto "'.system('find | fzf --height 10 2>/dev/tty ').'"%IU' | redraw + +" ------------------------------------------------------------------------------ + +" The file type is for the default programs to be used with +" a file extension. +" :filetype pattern1,pattern2 defaultprogram,program2 +" :fileviewer pattern1,pattern2 consoleviewer +" The other programs for the file type can be accessed with the :file command +" The command macros %f, %F, %d, %F may be used in the commands. +" The %a macro is ignored. To use a % you must put %%. + +" For automated FUSE mounts, you must register an extension with :file[x]type +" in one of following formats: +" +" :filetype extensions FUSE_MOUNT|some_mount_command using %SOURCE_FILE and %DESTINATION_DIR variables +" %SOURCE_FILE and %DESTINATION_DIR are filled in by vifm at runtime. +" A sample line might look like this: +" :filetype *.zip,*.jar,*.war,*.ear FUSE_MOUNT|fuse-zip %SOURCE_FILE %DESTINATION_DIR +" +" :filetype extensions FUSE_MOUNT2|some_mount_command using %PARAM and %DESTINATION_DIR variables +" %PARAM and %DESTINATION_DIR are filled in by vifm at runtime. +" A sample line might look like this: +" :filetype *.ssh FUSE_MOUNT2|sshfs %PARAM %DESTINATION_DIR +" %PARAM value is filled from the first line of file (whole line). +" Example first line for SshMount filetype: root@127.0.0.1:/ +" +" You can also add %CLEAR if you want to clear screen before running FUSE +" program. + +" Inline previews +fileviewer *.pdf + \ vifmimg pdfpreview %px %py %pw %ph %c + \ %pc + \ vifmimg clear + +fileviewer *.epub + \ vifmimg epubpreview %px %py %pw %ph %c + \ %pc + \ vifmimg clear + +fileviewer *.avi,*.mp4,*.wmv,*.dat,*.3gp,*.ogv,*.mkv,*.mpg,*.mpeg,*.vob, + \*.fl[icv],*.m2v,*.mov,*.webm,*.ts,*.mts,*.m4v,*.r[am],*.qt,*.divx, + \ vifmimg videopreview %px %py %pw %ph %c + \ %pc + \ vifmimg clear + +fileviewer *.bmp,*.jpg,*.jpeg,*.png,*.xpm + \ vifmimg draw %px %py %pw %ph %c + \ %pc + \ vifmimg clear + +fileviewer *.gif + \ vifmimg gifpreview %px %py %pw %ph %c + \ %pc + \ vifmimg clear + +fileviewer *.ico + \ vifmimg magickpreview %px %py %pw %ph %c + \ %pc + \ vifmimg clear +fileviewer *.mp3 mp3info +fileviewer *.flac soxi + +fileviewer *.zip,*.tgz,*.tar.gz,*.rar pistol %c + +" Man page +filetype *.[1-8] man ./%c +fileviewer *.[1-8] man ./%c | col -b + +" MD5 +filetype *.md5 + \ {Check MD5 hash sum} + \ md5sum -c %f %S, + +" SHA1 +filetype *.sha1 + \ {Check SHA1 hash sum} + \ sha1sum -c %f %S, + +" SHA256 +filetype *.sha256 + \ {Check SHA256 hash sum} + \ sha256sum -c %f %S, + +" SHA512 +filetype *.sha512 + \ {Check SHA512 hash sum} + \ sha512sum -c %f %S, + +" GPG signature +filetype *.asc + \ {Check signature} + \ !!gpg --verify %c, + +" FuseZipMount +filetype *.zip,*.jar,*.war,*.ear,*.oxt,*.apkg + \ {Mount with fuse-zip} + \ FUSE_MOUNT|fuse-zip %SOURCE_FILE %DESTINATION_DIR, + \ {View contents} + \ zip -sf %c | less, + \ {Extract here} + \ tar -xf %c, + +" ArchiveMount +filetype *.tar,*.tar.bz2,*.tbz2,*.tgz,*.tar.gz,*.tar.xz,*.txz + \ {Mount with archivemount} + \ FUSE_MOUNT|archivemount %SOURCE_FILE %DESTINATION_DIR, + +" Rar2FsMount and rar archives +filetype *.rar + \ {Mount with rar2fs} + \ FUSE_MOUNT|rar2fs %SOURCE_FILE %DESTINATION_DIR, + + +" Office files +fileviewer *.doc catdoc %c +fileviewer *.docx docx2txt.pl %f - +fileviewer *.odt,*.ods,*.odp,*.sxw odt2txt %c + +" default file view/preview +filetype * gio open +fileviewer * env -uCOLORTERM bat -r 0:50 --color always --wrap never --pager never %c -p + +" ------------------------------------------------------------------------------ + +" What should be saved automatically between vifm runs +" Like in previous versions of vifm +" set vifminfo=options,filetypes,commands,bookmarks,dhistory,state,cs +" Like in vi +set vifminfo=dhistory,savedirs,chistory,state,tui,shistory, + \phistory,fhistory,dirstack,registers,bookmarks,bmarks + +" ------------------------------------------------------------------------------ + +" Examples of configuring both panels + +" Customize view columns a bit (enable ellipsis for truncated file names) +" +" set viewcolumns=-{name}..,6{}. + +" Filter-out build and temporary files +" +" filter! /^.*\.(lo|o|d|class|py[co])$|.*~$/ + +" ------------------------------------------------------------------------------ + +" Sample mappings + +" Start shell in current directory +nnoremap s :shell + +" Display sorting dialog +nnoremap S :sort + +" Toggle visibility of preview window +nnoremap w :view +vnoremap w :viewgv + +" Open file in existing instance of gvim +nnoremap o :!gvim --remote-tab-silent %f +" Open file in new instance of gvim +nnoremap O :!gvim %f + +" Open file in the background using its default program +nnoremap gb :file &l + +" Yank current directory path into the clipboard +nnoremap yd :!echo %d | xclip -selection clipboard %i + +" Yank current file path into the clipboard +nnoremap yf :!echo %c:p | xclip -selection clipboard %i + +" yank current filename without path into the clipboard +nnoremap yn :!echo -n %c | xclip -selection clipboard %i + +" yank root of current file's name into the clipboard +nnoremap yr :!echo -n %c:r | xclip -selection clipboard %i + +" Mappings for faster renaming +nnoremap I cw +nnoremap cc cw +nnoremap A cw + +" Open console in current directory +nnoremap ,t :!st & + +" Open editor to edit vifmrc and apply settings after returning to vifm +nnoremap ,c :write | edit $MYVIFMRC | restart +" Open gvim to edit vifmrc +nnoremap ,C :!st -e nvim %i $MYVIFMRC & + +" Toggle wrap setting on ,w key +nnoremap ,w :set wrap! + +" Example of standard two-panel file managers mappings +nnoremap :!less %f +nnoremap :edit +nnoremap :copy +nnoremap :move +nnoremap :mkdir +nnoremap :delete + +" Generate lock wallapaper +nnoremap ,l :lockwallpaper +" Generate background image wallpaper +nnoremap ,w1 :backgroundwallpaperone +nnoremap ,w2 :backgroundwallpapertwo + +" quit +nnoremap q :q! + +" Fuzzy search +nnoremap :FZFfind + +" ------------------------------------------------------------------------------ + +" Various customization examples + +" Use ag (the silver searcher) instead of grep +" +" set grepprg='ag --line-numbers %i %a %s' + +" Add additional place to look for executables +" +" let $PATH = $HOME.'/bin/fuse:'.$PATH + +" Block particular shortcut +" +" nnoremap + +" Export IPC name of current instance as environment variable and use it to +" communicate with the instance later. +" +" It can be used in some shell script that gets run from inside vifm, for +" example, like this: +" vifm --server-name "$VIFM_SERVER_NAME" --remote +"cd '$PWD'" +" +" let $VIFM_SERVER_NAME = v:servername + +" pdf review keybindings +map > :!vifmimg inc +map < :!vifmimg dec + +" load devicons +source ~/.config/vifm//SETUP diff --git a/vifm/.local/bin/generate-lock-image b/vifm/.local/bin/generate-lock-image new file mode 100755 index 0000000..e6c49e1 --- /dev/null +++ b/vifm/.local/bin/generate-lock-image @@ -0,0 +1,3 @@ +#!/usr/bin/env sh + +betterlockscreen -u $1 diff --git a/vifm/.local/bin/switch-background-image b/vifm/.local/bin/switch-background-image new file mode 100755 index 0000000..8ad2af1 --- /dev/null +++ b/vifm/.local/bin/switch-background-image @@ -0,0 +1,32 @@ +#!/usr/bin/env sh + +clear + +if [ "${2}" = "2" ]; then + OUTPUT_IMAGE="$HOME/.cache/wall2.png" + WIDTH=$(xrandr | grep '\*' | sed -n '1p' | awk -F 'x' '{print $2}' | awk -F '_' '{print $1}' | sed 's/ //g') + HEIGHT=$(xrandr | grep '\*' | sed -n '1p' | awk -F 'x' '{print $1}' | sed 's/ //g') +else + OUTPUT_IMAGE="$HOME/.cache/wall1.png" + # Use tail -n 1 to get last monitor so this works with laptop as well + WIDTH=$(xrandr | grep '\*' | tail -n 1 | awk -F 'x' '{print $1}' | sed 's/ //g') + HEIGHT=$(xrandr | grep '\*' | tail -n 1 | awk -F 'x' '{print $2}' | awk '{print $1}' | sed 's/ //g') +fi + +echo "Converting ${1} to ${OUTPUT_IMAGE}" +convert "${1}" "${OUTPUT_IMAGE}" + +echo "Resizing ${OUTPUT_IMAGE} to ${WIDTH}x${HEIGHT}" +convert "${OUTPUT_IMAGE}" -resize "${WIDTH}x${HEIGHT}^" -gravity center -extent "${WIDTH}"x"${HEIGHT}" "${OUTPUT_IMAGE}" + +echo "Setting background images...." +if [ -e ~/.cache/wall1.png ] && [ -e ~/.cache/wall2.png ]; then + xwallpaper --output HDMI-2 --zoom ~/.cache/wall2.png --output DP-1 --zoom ~/.cache/wall1.png & + wal -i ~/.cache/wall1.png +elif [ -e ~/.cache/wall1.png ]; then + xwallpaper --output eDP1 --zoom ~/.cache/wall1.png & +fi + +betterlockscreen -u ~/.cache/wall1.png + +echo "done!" diff --git a/vifm/.local/bin/vifmimg b/vifm/.local/bin/vifmimg new file mode 100755 index 0000000..668a340 --- /dev/null +++ b/vifm/.local/bin/vifmimg @@ -0,0 +1,154 @@ +#!/usr/bin/env bash +readonly ID_PREVIEW="preview" + +#PLAY_GIF="yes" +# By enabling this option the GIF will be animated, by leaving it commented like it +# is now will make the gif previews behave the same way as video previews. + +#AUTO_REMOVE="yes" +# By enabling this option the script will remove the preview file after it is drawn +# and by doing so the preview will always be up-to-date with the file. +# This however, requires more CPU and therefore affects the overall performance. + +# The messy code below is for moving pages in pdf files in the vifm file preview by +# utilizing the < and > keys which will be bound to `vifmimg inc` or `vifmimg dec`. +PDF_PAGE_CONFIG="$HOME/.config/vifm/vifmimgpdfpage" +PDF_FILE_CONFIG="$HOME/.config/vifm/vifmimgpdffile" +PDF_PAGE=1 +PDF_FILE="" +# Initialize the variables and required files +[[ -f "$PDF_PAGE_CONFIG" ]] && PDF_PAGE=$(cat $PDF_PAGE_CONFIG) || touch $PDF_PAGE_CONFIG +[[ -f "$PDF_FILE_CONFIG" ]] && PDF_FILE=$(cat $PDF_FILE_CONFIG) || touch $PDF_FILE_CONFIG + + +# Create temporary working directory if the directory structure doesn't exist +if [[ ! -d "/tmp$PWD/" ]]; then + mkdir -p "/tmp$PWD/" +fi + +function inc() { + VAL="$(cat $PDF_PAGE_CONFIG)" + echo "$(expr $VAL + 1)" > $PDF_PAGE_CONFIG +} + +function dec() { + VAL="$(cat $PDF_PAGE_CONFIG)" + echo "$(expr $VAL - 1)" > $PDF_PAGE_CONFIG + if [[ $VAL -le 0 ]]; then + echo 0 > $PDF_PAGE_CONFIG + fi +} + +function previewclear() { + declare -p -A cmd=([action]=remove [identifier]="$ID_PREVIEW") \ + > "$FIFO_UEBERZUG" +} + +function fileclean() { + if [[ -f "/tmp$PWD/$6.png" ]]; then + rm -f "/tmp$PWD/$6.png" + elif [[ -d "/tmp$PWD/$6/" ]]; then + rm -rf "/tmp$PWD/$6/" + fi +} + +function preview() { + declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" + [x]="$2" [y]="$3" [width]="$4" [height]="$5" \ + [path]="$PWD/$6") \ + > "$FIFO_UEBERZUG" +} + +function previewvideo() { + if [[ ! -f "/tmp$PWD/$6.png" ]]; then + ffmpegthumbnailer -i "$PWD/$6" -o "/tmp$PWD/$6.png" -s 0 -q 10 + fi + declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" + [x]="$2" [y]="$3" [width]="$4" [height]="$5" \ + [path]="/tmp$PWD/$6.png") \ + > "$FIFO_UEBERZUG" +} + +function previewepub() { + if [[ ! -f "/tmp$PWD/$6.png" ]]; then + epub-thumbnailer "$6" "/tmp$PWD/$6.png" 1024 + fi + declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" + [x]="$2" [y]="$3" [width]="$4" [height]="$5" \ + [path]="/tmp$PWD/$6.png") \ + > "$FIFO_UEBERZUG" +} + +function previewgif() { + if [[ ! -d "/tmp$PWD/$6/" ]]; then + mkdir -p "/tmp$PWD/$6/" + convert -coalesce "$PWD/$6" "/tmp$PWD/$6/$6.png" + fi + if [[ ! -z "$PLAY_GIF" ]]; then + for frame in $(ls -1 /tmp$PWD/$6/$6*.png | sort -V); do + declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" + [x]="$2" [y]="$3" [width]="$4" [height]="$5" \ + [path]="$frame") \ + > "$FIFO_UEBERZUG" + # Sleep between frames to make the animation smooth. + sleep .07 + done + else + declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" + [x]="$2" [y]="$3" [width]="$4" [height]="$5" \ + [path]="/tmp$PWD/$6/$6-0.png") \ + > "$FIFO_UEBERZUG" + fi +} + +function previewpdf() { + if [[ ! "$6" == "$PDF_FILE" ]]; then + PDF_PAGE=1 + echo 1 > $PDF_PAGE_CONFIG + rm -f "/tmp$PWD/$6.png" + fi + + if [[ ! "$PDF_PAGE" == "1" ]] && [[ -f "/tmp$PWD/$6.png" ]]; then + rm -f "/tmp$PWD/$6.png" + fi + + if [[ ! -f "/tmp$PWD/$6.png" ]]; then + pdftoppm -png -f $PDF_PAGE -singlefile "$6" "/tmp$PWD/$6" + fi + echo "$6" > $PDF_FILE_CONFIG + + declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" + [x]="$2" [y]="$3" [width]="$4" [height]="$5" \ + [path]="/tmp$PWD/$6.png") \ + > "$FIFO_UEBERZUG" +} + + +function previewmagick() { + if [[ ! -f "/tmp$PWD/$6.png" ]]; then + convert -thumbnail $(identify -format "%wx%h" "$6") "$PWD/$6" "/tmp$PWD/$6.png" + fi + declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" + [x]="$2" [y]="$3" [width]="$4" [height]="$5" \ + [path]="/tmp$PWD/$6.png") \ + > "$FIFO_UEBERZUG" +} + + + +function main() { + case "$1" in + "inc") inc "$@" ;; + "dec") dec "$@" ;; + "clear") previewclear "$@" ;; + "clean") fileclean "$@" ;; + "draw") preview "$@" ;; + "videopreview") previewvideo "$@" ;; + "epubpreview") previewepub "$@" ;; + "gifpreview") previewgif "$@" ;; + "pdfpreview") previewpdf "$@" ;; + "magickpreview") previewmagick "$@" ;; + "*") echo "Unknown command: '$@'" ;; + esac +} +main "$@" diff --git a/vifm/.local/bin/vifmrun b/vifm/.local/bin/vifmrun new file mode 100755 index 0000000..a032b41 --- /dev/null +++ b/vifm/.local/bin/vifmrun @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +export FIFO_UEBERZUG="/tmp/vifm-ueberzug-${PPID}" + +function cleanup { + rm "$FIFO_UEBERZUG" 2>/dev/null + pkill -P $$ 2>/dev/null +} +pkill -P $$ 2>/dev/null +rm "$FIFO_UEBERZUG" 2>/dev/null +mkfifo "$FIFO_UEBERZUG" >/dev/null +trap cleanup EXIT 2>/dev/null +tail --follow "$FIFO_UEBERZUG" | ueberzug layer --silent --parser bash 2>&1 >/dev/null & + +vifm +cleanup