Updated: finished sway rice
This commit is contained in:
parent
3ce3790671
commit
5da9dc3be7
29 changed files with 7433 additions and 1018 deletions
67
user/.bashrc
67
user/.bashrc
|
@ -190,8 +190,8 @@ alias \
|
||||||
|
|
||||||
# file management
|
# file management
|
||||||
alias \
|
alias \
|
||||||
fm="ranger" \
|
fm="vifm" \
|
||||||
flm="ranger" \
|
flm="vifm" \
|
||||||
rm="rm -vI" \
|
rm="rm -vI" \
|
||||||
mv="mv -iv" \
|
mv="mv -iv" \
|
||||||
cp="cp -iv" \
|
cp="cp -iv" \
|
||||||
|
@ -228,64 +228,5 @@ alias \
|
||||||
wfi-off="nmcli radio wifi off" \
|
wfi-off="nmcli radio wifi off" \
|
||||||
blt="bluetoothctl"
|
blt="bluetoothctl"
|
||||||
|
|
||||||
# get current branch in git repo
|
# starship prompt
|
||||||
function parse_git_branch() {
|
eval "$(starship init bash)"
|
||||||
BRANCH=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
|
|
||||||
if [ ! "${BRANCH}" == "" ]
|
|
||||||
then
|
|
||||||
STAT=$(parse_git_dirty)
|
|
||||||
echo "[${BRANCH}${STAT}]"
|
|
||||||
else
|
|
||||||
echo ""
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# get current branch in git repo
|
|
||||||
function parse_git_branch() {
|
|
||||||
BRANCH=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
|
|
||||||
if [ ! "${BRANCH}" == "" ]
|
|
||||||
then
|
|
||||||
STAT=$(parse_git_dirty)
|
|
||||||
echo "[${BRANCH}${STAT}]"
|
|
||||||
else
|
|
||||||
echo ""
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# get current status of git repo
|
|
||||||
function parse_git_dirty {
|
|
||||||
status=$(git status 2>&1 | tee)
|
|
||||||
dirty=$(echo -n "${status}" 2> /dev/null | grep "modified:" &> /dev/null; echo "$?")
|
|
||||||
untracked=$(echo -n "${status}" 2> /dev/null | grep "Untracked files" &> /dev/null; echo "$?")
|
|
||||||
ahead=$(echo -n "${status}" 2> /dev/null | grep "Your branch is ahead of" &> /dev/null; echo "$?")
|
|
||||||
newfile=$(echo -n "${status}" 2> /dev/null | grep "new file:" &> /dev/null; echo "$?")
|
|
||||||
renamed=$(echo -n "${status}" 2> /dev/null | grep "renamed:" &> /dev/null; echo "$?")
|
|
||||||
deleted=$(echo -n "${status}" 2> /dev/null | grep "deleted:" &> /dev/null; echo "$?")
|
|
||||||
bits=''
|
|
||||||
if [ "${renamed}" == "0" ]; then
|
|
||||||
bits=">${bits}"
|
|
||||||
fi
|
|
||||||
if [ "${ahead}" == "0" ]; then
|
|
||||||
bits="*${bits}"
|
|
||||||
fi
|
|
||||||
if [ "${newfile}" == "0" ]; then
|
|
||||||
bits="+${bits}"
|
|
||||||
fi
|
|
||||||
if [ "${untracked}" == "0" ]; then
|
|
||||||
bits="?${bits}"
|
|
||||||
fi
|
|
||||||
if [ "${deleted}" == "0" ]; then
|
|
||||||
bits="x${bits}"
|
|
||||||
fi
|
|
||||||
if [ "${dirty}" == "0" ]; then
|
|
||||||
bits="!${bits}"
|
|
||||||
fi
|
|
||||||
if [ ! "${bits}" == "" ]; then
|
|
||||||
echo " ${bits}"
|
|
||||||
else
|
|
||||||
echo ""
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
export PS1="[\[\e[31m\]\u\[\e[m\]\[\e[35m\]@\[\e[m\]\[\e[32m\]\h\[\e[m\]] [\[\e[33m\]\W\[\e[m\]\[\e[34m\]\`parse_git_branch\`\[\e[m\]] "
|
|
||||||
if [ -n "$RANGER_LEVEL" ]; then export PS1="[ranger]$PS1"; fi
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ graph_symbol_proc = "default"
|
||||||
shown_boxes = "cpu mem net proc"
|
shown_boxes = "cpu mem net proc"
|
||||||
|
|
||||||
#* Update time in milliseconds, recommended 2000 ms or above for better sample times for graphs.
|
#* Update time in milliseconds, recommended 2000 ms or above for better sample times for graphs.
|
||||||
update_ms = 200
|
update_ms = 100
|
||||||
|
|
||||||
#* Processes sorting, "pid" "program" "arguments" "threads" "user" "memory" "cpu lazy" "cpu direct",
|
#* Processes sorting, "pid" "program" "arguments" "threads" "user" "memory" "cpu lazy" "cpu direct",
|
||||||
#* "cpu lazy" sorts top process over time (easier to follow), "cpu direct" updates top process directly.
|
#* "cpu lazy" sorts top process over time (easier to follow), "cpu direct" updates top process directly.
|
||||||
|
|
229
user/.config/fish/config.fish
Normal file
229
user/.config/fish/config.fish
Normal file
|
@ -0,0 +1,229 @@
|
||||||
|
## ____ __
|
||||||
|
## / __ \_________ _/ /_____
|
||||||
|
## / / / / ___/ __ `/ //_/ _ \
|
||||||
|
## / /_/ / / / /_/ / ,< / __/ Clay Gomera (Drake)
|
||||||
|
## /_____/_/ \__,_/_/|_|\___/ My custom fish config
|
||||||
|
##
|
||||||
|
|
||||||
|
### ADDING TO THE PATH
|
||||||
|
# First line removes the path; second line sets it. Without the first line,
|
||||||
|
# your path gets massive and fish becomes very slow.
|
||||||
|
set -e fish_user_paths
|
||||||
|
set -U fish_user_paths $HOME/.local/bin /var/lib/flatpak/exports/bin/ $fish_user_paths
|
||||||
|
|
||||||
|
### EXPORT ###
|
||||||
|
set fish_greeting # Supresses fish's intro message
|
||||||
|
set TERM "xterm-256color" # Sets the terminal type
|
||||||
|
set EDITOR "$HOME/.local/bin/lvim"
|
||||||
|
set VISUAL "$HOME/.local/bin/neovide"
|
||||||
|
|
||||||
|
### SET BAT AS MANPAGER
|
||||||
|
set -x PAGER "bat -p"
|
||||||
|
|
||||||
|
### SET EITHER DEFAULT EMACS MODE OR VI MODE ###
|
||||||
|
function fish_user_key_bindings
|
||||||
|
# fish_default_key_bindings
|
||||||
|
fish_vi_key_bindings
|
||||||
|
end
|
||||||
|
### END OF VI MODE ###
|
||||||
|
|
||||||
|
### AUTOCOMPLETE AND HIGHLIGHT COLORS ###
|
||||||
|
set fish_color_normal brcyan
|
||||||
|
set fish_color_autosuggestion '#504945'
|
||||||
|
set fish_color_command brcyan
|
||||||
|
set fish_color_error '#fb4934'
|
||||||
|
set fish_color_param brcyan
|
||||||
|
|
||||||
|
|
||||||
|
### FUNCTIONS ###
|
||||||
|
# Functions needed for !! and !$
|
||||||
|
function __history_previous_command
|
||||||
|
switch (commandline -t)
|
||||||
|
case "!"
|
||||||
|
commandline -t $history[1]; commandline -f repaint
|
||||||
|
case "*"
|
||||||
|
commandline -i !
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function __history_previous_command_arguments
|
||||||
|
switch (commandline -t)
|
||||||
|
case "!"
|
||||||
|
commandline -t ""
|
||||||
|
commandline -f history-token-search-backward
|
||||||
|
case "*"
|
||||||
|
commandline -i '$'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# The bindings for !! and !$
|
||||||
|
if [ "$fish_key_bindings" = "fish_vi_key_bindings" ];
|
||||||
|
bind -Minsert ! __history_previous_command
|
||||||
|
bind -Minsert '$' __history_previous_command_arguments
|
||||||
|
else
|
||||||
|
bind ! __history_previous_command
|
||||||
|
bind '$' __history_previous_command_arguments
|
||||||
|
end
|
||||||
|
|
||||||
|
# Function for creating a backup file
|
||||||
|
# ex: backup file.txt
|
||||||
|
# result: copies file as file.txt.bak
|
||||||
|
function backup --argument filename
|
||||||
|
cp $filename $filename.bak
|
||||||
|
end
|
||||||
|
|
||||||
|
# Function for copying files and directories, even recursively.
|
||||||
|
# ex: copy DIRNAME LOCATIONS
|
||||||
|
# result: copies the directory and all of its contents.
|
||||||
|
function copy
|
||||||
|
set count (count $argv | tr -d \n)
|
||||||
|
if test "$count" = 2; and test -d "$argv[1]"
|
||||||
|
set from (echo $argv[1] | trim-right /)
|
||||||
|
set to (echo $argv[2])
|
||||||
|
command cp -r $from $to
|
||||||
|
else
|
||||||
|
command cp $argv
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Function for printing a column (splits input on whitespace)
|
||||||
|
# ex: echo 1 2 3 | coln 3
|
||||||
|
# output: 3
|
||||||
|
function coln
|
||||||
|
while read -l input
|
||||||
|
echo $input | awk '{print $'$argv[1]'}'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Function for printing a row
|
||||||
|
# ex: seq 3 | rown 3
|
||||||
|
# output: 3
|
||||||
|
function rown --argument index
|
||||||
|
sed -n "$index p"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Function for ignoring the first 'n' lines
|
||||||
|
# ex: seq 10 | skip 5
|
||||||
|
# results: prints everything but the first 5 lines
|
||||||
|
function skip --argument n
|
||||||
|
tail +(math 1 + $n)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Function for taking the first 'n' lines
|
||||||
|
# ex: seq 10 | take 5
|
||||||
|
# results: prints only the first 5 lines
|
||||||
|
function take --argument number
|
||||||
|
head -$number
|
||||||
|
end
|
||||||
|
### END OF FUNCTIONS ###
|
||||||
|
|
||||||
|
### ALIASES ###
|
||||||
|
# navigation
|
||||||
|
alias ..='cd ..'
|
||||||
|
alias ...='cd ../..'
|
||||||
|
alias .3='cd ../../..'
|
||||||
|
alias .4='cd ../../../..'
|
||||||
|
alias .5='cd ../../../../..'
|
||||||
|
|
||||||
|
# emacs as vim
|
||||||
|
alias vim="~/.local/bin/lvim"
|
||||||
|
|
||||||
|
# bat as cat
|
||||||
|
alias cat='bat'
|
||||||
|
|
||||||
|
# Changing "ls" to "eza"
|
||||||
|
alias ls='eza -al --color=always --group-directories-first' # my preferred listing
|
||||||
|
alias la='eza -a --color=always --group-directories-first' # all files and dirs
|
||||||
|
alias ll='eza -l --color=always --group-directories-first' # long format
|
||||||
|
alias lt='eza -aT --color=always --group-directories-first' # tree listing
|
||||||
|
alias l.='eza -a | egrep "^\."'
|
||||||
|
|
||||||
|
# package management
|
||||||
|
alias pac-up='paru -Syu'
|
||||||
|
alias pac-get='paru -S'
|
||||||
|
alias pac-rmv='paru -Rcns'
|
||||||
|
alias pac-rmv-sec='paru -R'
|
||||||
|
alias pac-qry='paru -Ss'
|
||||||
|
alias pac-cln='paru -Scc && paru -Rns (pacman -Qtdq)'
|
||||||
|
|
||||||
|
# Colorize grep output (good for log files)
|
||||||
|
alias grep='grep --color=auto'
|
||||||
|
alias egrep='egrep --color=auto'
|
||||||
|
alias fgrep='fgrep --color=auto'
|
||||||
|
|
||||||
|
# file management
|
||||||
|
alias fm="vifm"
|
||||||
|
alias file="vifm"
|
||||||
|
alias flm="vifm"
|
||||||
|
alias cp='cp -iv'
|
||||||
|
alias mv='mv -iv'
|
||||||
|
alias rm='rm -vI'
|
||||||
|
alias mkd='mkdir -pv'
|
||||||
|
alias mkdir='mkdir -pv'
|
||||||
|
|
||||||
|
# audio
|
||||||
|
alias mx='pulsemixer'
|
||||||
|
alias amx='alsamixer'
|
||||||
|
alias mk='cmus'
|
||||||
|
alias ms='cmus'
|
||||||
|
alias music='cmus'
|
||||||
|
|
||||||
|
# multimedia scripts
|
||||||
|
alias fli='flix-cli'
|
||||||
|
alias ani='ani-cli'
|
||||||
|
alias aniq='ani-cli -q'
|
||||||
|
|
||||||
|
# adding flags
|
||||||
|
alias df='df -h' # human-readable sizes
|
||||||
|
alias free='free -m' # show sizes in MB
|
||||||
|
|
||||||
|
# ps
|
||||||
|
alias psa="ps auxf"
|
||||||
|
alias psgrep="ps aux | grep -v grep | grep -i -e VSZ -e"
|
||||||
|
alias psmem='ps auxf | sort -nr -k 4'
|
||||||
|
alias pscpu='ps auxf | sort -nr -k 3'
|
||||||
|
|
||||||
|
# git
|
||||||
|
alias addup='git add -u'
|
||||||
|
alias addall='git add .'
|
||||||
|
alias branch='git branch'
|
||||||
|
alias checkout='git checkout'
|
||||||
|
alias clone='git clone'
|
||||||
|
alias commit='git commit -m'
|
||||||
|
alias fetch='git fetch'
|
||||||
|
alias pull='git pull origin'
|
||||||
|
alias push='git push origin'
|
||||||
|
alias tag='git tag'
|
||||||
|
alias newtag='git tag -a'
|
||||||
|
|
||||||
|
# power management
|
||||||
|
alias po='systemctl poweroff'
|
||||||
|
alias sp='systemctl suspend'
|
||||||
|
alias rb='systemctl reboot'
|
||||||
|
|
||||||
|
# youtube-
|
||||||
|
alias yta-aac="yt-dlp --extract-audio --audio-format aac "
|
||||||
|
alias yta-best="yt-dlp --extract-audio --audio-format best "
|
||||||
|
alias yta-flac="yt-dlp --extract-audio --audio-format flac "
|
||||||
|
alias yta-m4a="yt-dlp --extract-audio --audio-format m4a "
|
||||||
|
alias yta-mp3="yt-dlp --extract-audio --audio-format mp3 "
|
||||||
|
alias yta-opus="yt-dlp --extract-audio --audio-format opus "
|
||||||
|
alias yta-vorbis="yt-dlp --extract-audio --audio-format vorbis "
|
||||||
|
alias yta-wav="yt-dlp --extract-audio --audio-format wav "
|
||||||
|
alias ytv-best="yt-dlp -f bestvideo+bestaudio "
|
||||||
|
alias yt='ytfzf -ftsl'
|
||||||
|
alias youtube='ytfzf -ftsl'
|
||||||
|
alias ytm='ytfzf -mtsl'
|
||||||
|
alias youtube-music='ytfzf -mtsl'
|
||||||
|
|
||||||
|
# network and bluetooth
|
||||||
|
alias netstats='nmcli dev'
|
||||||
|
alias wfi='nmtui-connect'
|
||||||
|
alias wfi-scan='nmcli dev wifi rescan && nmcli dev wifi list'
|
||||||
|
alias wfi-edit='nmtui-edit'
|
||||||
|
alias wfi-on='nmcli radio wifi on'
|
||||||
|
alias wfi-off='nmcli radio wifi off'
|
||||||
|
alias blt='bluetoothctl'
|
||||||
|
|
||||||
|
### SETTING THE STARSHIP PROMPT ###
|
||||||
|
starship init fish | source
|
|
@ -5,16 +5,19 @@ icons-enabled=yes
|
||||||
password-character=*
|
password-character=*
|
||||||
fuzzy=yes
|
fuzzy=yes
|
||||||
terminal=wezterm start
|
terminal=wezterm start
|
||||||
lines=15
|
lines=20
|
||||||
width=45
|
width=70
|
||||||
layer = top
|
inner-pad=12
|
||||||
exit-on-keyboard-focus-loss = yes
|
vertical-pad=12
|
||||||
|
horizontal-pad=12
|
||||||
|
layer= top
|
||||||
|
exit-on-keyboard-focus-loss=yes
|
||||||
|
|
||||||
[colors]
|
[colors]
|
||||||
background=1d2021ff
|
background=1d2021ff
|
||||||
text=ebdbb2ff
|
text=ebdbb2ff
|
||||||
match=8ec07cff
|
match=8ec07cff
|
||||||
selection-match=b8bb26ff
|
selection-match=1d2021ff
|
||||||
selection=cc241dff
|
selection=cc241dff
|
||||||
selection-text=ebdbb2ff
|
selection-text=ebdbb2ff
|
||||||
border=cc241dff
|
border=cc241dff
|
||||||
|
|
0
user/.config/gtk-3.0/bookmarks
Normal file
0
user/.config/gtk-3.0/bookmarks
Normal file
|
@ -1,5 +1,5 @@
|
||||||
-- neovide options
|
-- neovide options
|
||||||
vim.o.guifont = "mononoki Nerd Font:h08"
|
vim.o.guifont = "mononoki Nerd Font:h14"
|
||||||
vim.g.neovide_hide_mouse_when_typing = true
|
vim.g.neovide_hide_mouse_when_typing = true
|
||||||
vim.g.neovide_input_macos_alt_is_meta = true
|
vim.g.neovide_input_macos_alt_is_meta = true
|
||||||
vim.g.neovide_hide_mouse_when_typing = false
|
vim.g.neovide_hide_mouse_when_typing = false
|
||||||
|
@ -21,10 +21,10 @@ vim.g.neovide_padding_left = 0
|
||||||
|
|
||||||
-- Helper function for transparency formatting
|
-- Helper function for transparency formatting
|
||||||
local alpha = function()
|
local alpha = function()
|
||||||
return string.format("%x", math.floor(255 * (vim.g.transparency or 0.9)))
|
return string.format("%x", math.floor(255 * (vim.g.transparency or 0.98)))
|
||||||
end
|
end
|
||||||
vim.g.neovide_transparency = 0.9
|
vim.g.neovide_transparency = 0.98
|
||||||
vim.g.transparency = 0.9
|
vim.g.transparency = 0.98
|
||||||
vim.g.neovide_background_color = "#1d2021" .. alpha()
|
vim.g.neovide_background_color = "#1d2021" .. alpha()
|
||||||
|
|
||||||
-- nvim options
|
-- nvim options
|
||||||
|
|
|
@ -11,13 +11,13 @@ font=Mononoki Nerd Font 12
|
||||||
background-color=#282828
|
background-color=#282828
|
||||||
border-color=#cc241d
|
border-color=#cc241d
|
||||||
text-color=#ebdbb2
|
text-color=#ebdbb2
|
||||||
width=300
|
width=450
|
||||||
height=100
|
height=130
|
||||||
margin=10
|
margin=10
|
||||||
padding=15
|
padding=15
|
||||||
border-size=2
|
border-size=2
|
||||||
icons=1
|
icons=1
|
||||||
max-icon-size=128
|
max-icon-size=32
|
||||||
icon-location=left
|
icon-location=left
|
||||||
markup=1
|
markup=1
|
||||||
actions=1
|
actions=1
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
from ranger_udisk_menu.mounter import mount
|
|
|
@ -1,243 +0,0 @@
|
||||||
#!/usr/bin/python3
|
|
||||||
# coding: utf-8
|
|
||||||
# License: The MIT License
|
|
||||||
# Author: Alexander Lutsai <sl_ru@live.com>
|
|
||||||
# Year: 2021
|
|
||||||
# Description: This script draws menu to choose, mount and unmount drives
|
|
||||||
|
|
||||||
import curses
|
|
||||||
import curses.ascii
|
|
||||||
import subprocess
|
|
||||||
import json
|
|
||||||
import sys
|
|
||||||
|
|
||||||
|
|
||||||
class ChoosePartition:
|
|
||||||
blkinfo = None
|
|
||||||
screen = None
|
|
||||||
selected_partn = 1
|
|
||||||
selected_mountpoint = None
|
|
||||||
partn = 1
|
|
||||||
help_message = ["Press 'm' to mount, 'u' to unmount, 'g' to refresh",
|
|
||||||
" and 'e' to unmount, 'p' to poweroff drive, 'enter' to cd"]
|
|
||||||
message = ""
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
self.screen = curses.initscr()
|
|
||||||
curses.start_color()
|
|
||||||
curses.curs_set(0)
|
|
||||||
curses.noecho()
|
|
||||||
curses.cbreak()
|
|
||||||
self.screen.keypad(True)
|
|
||||||
curses.init_pair(1, curses.COLOR_BLACK, curses.COLOR_WHITE)
|
|
||||||
self.selected_partn = 1
|
|
||||||
self._read_partitions()
|
|
||||||
|
|
||||||
def _read_partitions(self):
|
|
||||||
r = subprocess.check_output(['lsblk', '--all', '--json', '-O'])
|
|
||||||
r = r.decode().replace('0B,', '\"0B\",')
|
|
||||||
self.blkinfo = json.loads(r.encode())
|
|
||||||
partn = 0
|
|
||||||
# filter for devices with children, none other are used by this script
|
|
||||||
# (this is not entirely correct, but goes beyond these lines)
|
|
||||||
self.blkinfo['blockdevices'] = [
|
|
||||||
bd
|
|
||||||
for bd in self.blkinfo['blockdevices']
|
|
||||||
if 'children' in bd]
|
|
||||||
for bd in self.blkinfo['blockdevices']:
|
|
||||||
if 'children' not in bd:
|
|
||||||
continue
|
|
||||||
for part in bd['children']:
|
|
||||||
partn += 1
|
|
||||||
|
|
||||||
self.partn = partn
|
|
||||||
if self.selected_partn > self.partn:
|
|
||||||
self.selected_partn = self.partn
|
|
||||||
if self.selected_partn <= 0:
|
|
||||||
self.selected_partn = 1
|
|
||||||
|
|
||||||
def _get_part_by_partn(self):
|
|
||||||
partn = 0
|
|
||||||
for bd in self.blkinfo['blockdevices']:
|
|
||||||
if 'children' not in bd:
|
|
||||||
continue
|
|
||||||
for part in bd['children']:
|
|
||||||
partn += 1
|
|
||||||
if self.selected_partn == partn:
|
|
||||||
return part
|
|
||||||
return None
|
|
||||||
|
|
||||||
def _get_drive_by_partn(self):
|
|
||||||
partn = 0
|
|
||||||
for bd in self.blkinfo['blockdevices']:
|
|
||||||
if 'children' not in bd:
|
|
||||||
continue
|
|
||||||
for part in bd['children']:
|
|
||||||
partn += 1
|
|
||||||
if self.selected_partn == partn:
|
|
||||||
return bd
|
|
||||||
return None
|
|
||||||
|
|
||||||
def _select_print_part(self, part, is_selected, i):
|
|
||||||
if not ('mountpoint' in part and
|
|
||||||
'name' in part and
|
|
||||||
'size' in part):
|
|
||||||
raise Exception('Wrong lsblk json format.' +
|
|
||||||
'No mountpoint, name or size in the partition')
|
|
||||||
label = ""
|
|
||||||
label_fields = ['label', 'partlabel', 'parttypename', 'fstype']
|
|
||||||
for f in label_fields:
|
|
||||||
if f not in part:
|
|
||||||
continue
|
|
||||||
if part[f] is not None:
|
|
||||||
label = part[f]
|
|
||||||
break
|
|
||||||
|
|
||||||
mp = None
|
|
||||||
if part['mountpoint'] is not None:
|
|
||||||
mp = part['mountpoint']
|
|
||||||
if is_selected:
|
|
||||||
self.selected_mountpoint = mp
|
|
||||||
if mp is None:
|
|
||||||
mp = "Not mounted"
|
|
||||||
|
|
||||||
s = "{name:<12} {size:<8} {label:<16} {mp}".format(
|
|
||||||
name=part['name'] if part['name'] is not None else "None",
|
|
||||||
label=label if label is not None else "None",
|
|
||||||
size=part['size'] if part['size'] is not None else "None",
|
|
||||||
mp=mp
|
|
||||||
)
|
|
||||||
self.screen.addstr(2 + i, 4, s, curses.color_pair(is_selected))
|
|
||||||
|
|
||||||
def _select_print_block_device(self, bd, i):
|
|
||||||
if not ('model' in bd and
|
|
||||||
'size' in bd or
|
|
||||||
'name' in bd):
|
|
||||||
raise Exception('Wrong lsblk json format. ' +
|
|
||||||
'No model, size or name in blockdevice')
|
|
||||||
|
|
||||||
model = bd['model'] if bd['model'] is not None else ""
|
|
||||||
size = bd['size'] if bd['size'] is not None else ""
|
|
||||||
self.screen.addstr(2 + i, 2, bd['name'] + " " + model + " " + size)
|
|
||||||
|
|
||||||
def _select_print(self, x):
|
|
||||||
self.screen.clear()
|
|
||||||
self.screen.border(0)
|
|
||||||
self.screen.addstr(1, 2, self.help_message[0])
|
|
||||||
self.screen.addstr(2, 2, self.help_message[1])
|
|
||||||
|
|
||||||
partn = 0
|
|
||||||
i = 0
|
|
||||||
if 'blockdevices' not in self.blkinfo:
|
|
||||||
raise Exception('Wrong lsblk json format. No field "blockdevices"')
|
|
||||||
for bd in self.blkinfo['blockdevices']:
|
|
||||||
i += 1
|
|
||||||
bd_selected = False
|
|
||||||
bd_i = i
|
|
||||||
self._select_print_block_device(bd, bd_i)
|
|
||||||
if 'children' not in bd:
|
|
||||||
continue
|
|
||||||
for part in bd['children']:
|
|
||||||
i += 1
|
|
||||||
partn += 1
|
|
||||||
is_selected = 0 if self.selected_partn != partn else 1
|
|
||||||
if is_selected:
|
|
||||||
bd_selected = True
|
|
||||||
self._select_print_part(part, is_selected, i)
|
|
||||||
if bd_selected:
|
|
||||||
self.screen.addstr(2 + bd_i, 1, ">")
|
|
||||||
self.screen.addstr(2 + i + 2, 4, self.message)
|
|
||||||
|
|
||||||
def _eject_all(self):
|
|
||||||
blk = None
|
|
||||||
partn = 0
|
|
||||||
for bd in self.blkinfo['blockdevices']:
|
|
||||||
if 'children' not in bd:
|
|
||||||
continue
|
|
||||||
for part in bd['children']:
|
|
||||||
partn += 1
|
|
||||||
if self.selected_partn == partn:
|
|
||||||
blk = bd
|
|
||||||
if blk is None:
|
|
||||||
return
|
|
||||||
for part in blk['children']:
|
|
||||||
self.unmount(part)
|
|
||||||
|
|
||||||
def select(self):
|
|
||||||
sel = None
|
|
||||||
x = 0
|
|
||||||
# quit when pressed `q` or `Esc` or `Ctrl+g`
|
|
||||||
while x not in (ord('q'), curses.ascii.ESC,
|
|
||||||
curses.ascii.BEL, curses.ascii.NL):
|
|
||||||
self._select_print(x)
|
|
||||||
x = self.screen.getch()
|
|
||||||
if x in (ord('j'), curses.ascii.SO, curses.KEY_DOWN):
|
|
||||||
# down
|
|
||||||
self.selected_partn += 1
|
|
||||||
if self.selected_partn > self.partn:
|
|
||||||
self.selected_partn = self.partn
|
|
||||||
elif x in (ord('k'), curses.ascii.DLE, curses.KEY_UP):
|
|
||||||
# up
|
|
||||||
self.selected_partn -= 1
|
|
||||||
if self.selected_partn <= 0:
|
|
||||||
self.selected_partn = 1
|
|
||||||
elif x == ord('e'):
|
|
||||||
sel = self._eject_all()
|
|
||||||
elif x == ord('m'):
|
|
||||||
sel = self._get_part_by_partn()
|
|
||||||
if sel is not None:
|
|
||||||
self.mount(sel)
|
|
||||||
elif x == ord('u'):
|
|
||||||
sel = self._get_part_by_partn()
|
|
||||||
if sel is not None:
|
|
||||||
self.unmount(sel)
|
|
||||||
elif x == ord('p'):
|
|
||||||
sel_drive = self._get_drive_by_partn()
|
|
||||||
if sel_drive is not None:
|
|
||||||
self.poweroff(sel_drive)
|
|
||||||
elif x == ord('g') or x == ord('r'):
|
|
||||||
self._read_partitions()
|
|
||||||
curses.endwin()
|
|
||||||
if self.selected_mountpoint is not None and x == curses.ascii.NL:
|
|
||||||
return self.selected_mountpoint
|
|
||||||
return ""
|
|
||||||
|
|
||||||
def _udisk_mount_unmount(self, cmd, dev):
|
|
||||||
r = ""
|
|
||||||
try:
|
|
||||||
r = subprocess.run(
|
|
||||||
['udisksctl', cmd, '-b', dev], capture_output=True)
|
|
||||||
r = (r.stdout.decode(encoding="utf-8") +
|
|
||||||
r.stderr.decode(encoding="utf-8"))
|
|
||||||
self.message = r
|
|
||||||
except Exception as e:
|
|
||||||
self.message = cmd + " error: " + r + str(e)
|
|
||||||
self._read_partitions()
|
|
||||||
|
|
||||||
def get_drive_path(self, drive):
|
|
||||||
if 'path' not in drive:
|
|
||||||
drive['path'] = '/dev/' + drive['kname']
|
|
||||||
return drive['path']
|
|
||||||
|
|
||||||
def unmount(self, dev):
|
|
||||||
p = self.get_drive_path(dev)
|
|
||||||
self._udisk_mount_unmount("unmount", p)
|
|
||||||
|
|
||||||
def poweroff(self, dev):
|
|
||||||
p = self.get_drive_path(dev)
|
|
||||||
self._udisk_mount_unmount("power-off", p)
|
|
||||||
|
|
||||||
def mount(self, dev):
|
|
||||||
p = self.get_drive_path(dev)
|
|
||||||
self._udisk_mount_unmount("mount", p)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
cp = ChoosePartition()
|
|
||||||
sel = cp.select()
|
|
||||||
# print(sel)
|
|
||||||
# print(len(sys.argv))
|
|
||||||
if len(sys.argv) >= 2:
|
|
||||||
# print(sys.argv[1])
|
|
||||||
with open(sys.argv[1], 'w') as f:
|
|
||||||
f.write(sel)
|
|
|
@ -1,29 +0,0 @@
|
||||||
#!/usr/bin/python3
|
|
||||||
# coding: utf-8
|
|
||||||
# License: The MIT License
|
|
||||||
# Author: Alexander Lutsai <sl_ru@live.com>
|
|
||||||
# Year: 2021
|
|
||||||
# Description: This launches script that draws menu to choose, mount and unmount drives from ranger file manager
|
|
||||||
|
|
||||||
from ranger.api.commands import Command
|
|
||||||
import tempfile
|
|
||||||
import os
|
|
||||||
|
|
||||||
|
|
||||||
class mount(Command):
|
|
||||||
""":mount
|
|
||||||
|
|
||||||
Show menu to mount and unmount
|
|
||||||
"""
|
|
||||||
def execute(self):
|
|
||||||
""" Show menu to mount and unmount """
|
|
||||||
(f, p) = tempfile.mkstemp()
|
|
||||||
os.close(f)
|
|
||||||
self.fm.execute_console(
|
|
||||||
f"shell python3 {os.path.dirname(os.path.realpath(__file__))}/menu.py {p}"
|
|
||||||
)
|
|
||||||
with open(p, 'r') as f:
|
|
||||||
d = f.readline()
|
|
||||||
if os.path.exists(d):
|
|
||||||
self.fm.cd(d)
|
|
||||||
os.remove(p)
|
|
|
@ -1,4 +0,0 @@
|
||||||
set preview_images true
|
|
||||||
set preview_images_method iterm2
|
|
||||||
set column_ratios 3,4
|
|
||||||
set viewmode miller
|
|
|
@ -1,284 +0,0 @@
|
||||||
# vim: ft=cfg
|
|
||||||
#
|
|
||||||
# This is the configuration file of "rifle", ranger's file executor/opener.
|
|
||||||
# Each line consists of conditions and a command. For each line the conditions
|
|
||||||
# are checked and if they are met, the respective command is run.
|
|
||||||
#
|
|
||||||
# Syntax:
|
|
||||||
# <condition1> , <condition2> , ... = command
|
|
||||||
#
|
|
||||||
# The command can contain these environment variables:
|
|
||||||
# $1-$9 | The n-th selected file
|
|
||||||
# $@ | All selected files
|
|
||||||
#
|
|
||||||
# If you use the special command "ask", rifle will ask you what program to run.
|
|
||||||
#
|
|
||||||
# Prefixing a condition with "!" will negate its result.
|
|
||||||
# These conditions are currently supported:
|
|
||||||
# match <regexp> | The regexp matches $1
|
|
||||||
# ext <regexp> | The regexp matches the extension of $1
|
|
||||||
# mime <regexp> | The regexp matches the mime type of $1
|
|
||||||
# name <regexp> | The regexp matches the basename of $1
|
|
||||||
# path <regexp> | The regexp matches the absolute path of $1
|
|
||||||
# has <program> | The program is installed (i.e. located in $PATH)
|
|
||||||
# env <variable> | The environment variable "variable" is non-empty
|
|
||||||
# file | $1 is a file
|
|
||||||
# directory | $1 is a directory
|
|
||||||
# number <n> | change the number of this command to n
|
|
||||||
# terminal | stdin, stderr and stdout are connected to a terminal
|
|
||||||
# X | A graphical environment is available (darwin, Xorg, or Wayland)
|
|
||||||
#
|
|
||||||
# There are also pseudo-conditions which have a "side effect":
|
|
||||||
# flag <flags> | Change how the program is run. See below.
|
|
||||||
# label <label> | Assign a label or name to the command so it can
|
|
||||||
# | be started with :open_with <label> in ranger
|
|
||||||
# | or `rifle -p <label>` in the standalone executable.
|
|
||||||
# else | Always true.
|
|
||||||
#
|
|
||||||
# Flags are single characters which slightly transform the command:
|
|
||||||
# f | Fork the program, make it run in the background.
|
|
||||||
# | New command = setsid $command >& /dev/null &
|
|
||||||
# r | Execute the command with root permissions
|
|
||||||
# | New command = sudo $command
|
|
||||||
# t | Run the program in a new terminal. If $TERMCMD is not defined,
|
|
||||||
# | rifle will attempt to extract it from $TERM.
|
|
||||||
# | New command = $TERMCMD -e $command
|
|
||||||
# Note: The "New command" serves only as an illustration, the exact
|
|
||||||
# implementation may differ.
|
|
||||||
# Note: When using rifle in ranger, there is an additional flag "c" for
|
|
||||||
# only running the current file even if you have marked multiple files.
|
|
||||||
|
|
||||||
#-------------------------------------------
|
|
||||||
# Websites
|
|
||||||
#-------------------------------------------
|
|
||||||
# Rarely installed browsers get higher priority; It is assumed that if you
|
|
||||||
# install a rare browser, you probably use it. Firefox/konqueror/w3m on the
|
|
||||||
# other hand are often only installed as fallback browsers.
|
|
||||||
ext x?html?, has surf, X, flag f = surf -- file://"$1"
|
|
||||||
ext x?html?, has vimprobable, X, flag f = vimprobable -- "$@"
|
|
||||||
ext x?html?, has vimprobable2, X, flag f = vimprobable2 -- "$@"
|
|
||||||
ext x?html?, has qutebrowser, X, flag f = qutebrowser -- "$@"
|
|
||||||
ext x?html?, has dwb, X, flag f = dwb -- "$@"
|
|
||||||
ext x?html?, has jumanji, X, flag f = jumanji -- "$@"
|
|
||||||
ext x?html?, has luakit, X, flag f = luakit -- "$@"
|
|
||||||
ext x?html?, has uzbl, X, flag f = uzbl -- "$@"
|
|
||||||
ext x?html?, has uzbl-tabbed, X, flag f = uzbl-tabbed -- "$@"
|
|
||||||
ext x?html?, has uzbl-browser, X, flag f = uzbl-browser -- "$@"
|
|
||||||
ext x?html?, has uzbl-core, X, flag f = uzbl-core -- "$@"
|
|
||||||
ext x?html?, has midori, X, flag f = midori -- "$@"
|
|
||||||
ext x?html?, has opera, X, flag f = opera -- "$@"
|
|
||||||
ext x?html?, has firefox, X, flag f = firefox -- "$@"
|
|
||||||
ext x?html?, has seamonkey, X, flag f = seamonkey -- "$@"
|
|
||||||
ext x?html?, has iceweasel, X, flag f = iceweasel -- "$@"
|
|
||||||
ext x?html?, has chromium-browser, X, flag f = chromium-browser -- "$@"
|
|
||||||
ext x?html?, has chromium, X, flag f = chromium -- "$@"
|
|
||||||
ext x?html?, has google-chrome, X, flag f = google-chrome -- "$@"
|
|
||||||
ext x?html?, has epiphany, X, flag f = epiphany -- "$@"
|
|
||||||
ext x?html?, has konqueror, X, flag f = konqueror -- "$@"
|
|
||||||
ext x?html?, has elinks, terminal = elinks "$@"
|
|
||||||
ext x?html?, has links2, terminal = links2 "$@"
|
|
||||||
ext x?html?, has links, terminal = links "$@"
|
|
||||||
ext x?html?, has lynx, terminal = lynx -- "$@"
|
|
||||||
ext x?html?, has w3m, terminal = w3m "$@"
|
|
||||||
|
|
||||||
#-------------------------------------------
|
|
||||||
# Misc
|
|
||||||
#-------------------------------------------
|
|
||||||
# Define the "editor" for text files as first action
|
|
||||||
mime ^text, label editor = ${VISUAL:-$EDITOR} -- "$@"
|
|
||||||
mime ^text, label pager = "$PAGER" -- "$@"
|
|
||||||
!mime ^text, label editor, ext xml|json|csv|tex|py|pl|rb|js|sh|php = ${VISUAL:-$EDITOR} -- "$@"
|
|
||||||
!mime ^text, label pager, ext xml|json|csv|tex|py|pl|rb|js|sh|php = "$PAGER" -- "$@"
|
|
||||||
|
|
||||||
ext 1 = man "$1"
|
|
||||||
ext s[wmf]c, has zsnes, X = zsnes "$1"
|
|
||||||
ext s[wmf]c, has snes9x-gtk,X = snes9x-gtk "$1"
|
|
||||||
ext nes, has fceux, X = fceux "$1"
|
|
||||||
ext exe = wine "$1"
|
|
||||||
name ^[mM]akefile$ = make
|
|
||||||
|
|
||||||
#--------------------------------------------
|
|
||||||
# Scripts
|
|
||||||
#-------------------------------------------
|
|
||||||
ext py = python -- "$1"
|
|
||||||
ext pl = perl -- "$1"
|
|
||||||
ext rb = ruby -- "$1"
|
|
||||||
ext js = node -- "$1"
|
|
||||||
ext sh = sh -- "$1"
|
|
||||||
ext php = php -- "$1"
|
|
||||||
|
|
||||||
#--------------------------------------------
|
|
||||||
# Audio without X
|
|
||||||
#-------------------------------------------
|
|
||||||
mime ^audio|ogg$, terminal, has mpv = mpv -- "$@"
|
|
||||||
mime ^audio|ogg$, terminal, has mplayer2 = mplayer2 -- "$@"
|
|
||||||
mime ^audio|ogg$, terminal, has mplayer = mplayer -- "$@"
|
|
||||||
ext midi?, terminal, has wildmidi = wildmidi -- "$@"
|
|
||||||
|
|
||||||
#--------------------------------------------
|
|
||||||
# Video/Audio with a GUI
|
|
||||||
#-------------------------------------------
|
|
||||||
mime ^video|audio, has gmplayer, X, flag f = gmplayer -- "$@"
|
|
||||||
mime ^video|audio, has smplayer, X, flag f = smplayer "$@"
|
|
||||||
mime ^video, has mpv, X, flag f = mpv -- "$@"
|
|
||||||
mime ^video, has mpv, X, flag f = mpv --fs -- "$@"
|
|
||||||
mime ^video, has mplayer2, X, flag f = mplayer2 -- "$@"
|
|
||||||
mime ^video, has mplayer2, X, flag f = mplayer2 -fs -- "$@"
|
|
||||||
mime ^video, has mplayer, X, flag f = mplayer -- "$@"
|
|
||||||
mime ^video, has mplayer, X, flag f = mplayer -fs -- "$@"
|
|
||||||
mime ^video|audio, has vlc, X, flag f = vlc -- "$@"
|
|
||||||
mime ^video|audio, has totem, X, flag f = totem -- "$@"
|
|
||||||
mime ^video|audio, has totem, X, flag f = totem --fullscreen -- "$@"
|
|
||||||
|
|
||||||
#--------------------------------------------
|
|
||||||
# Video without X
|
|
||||||
#-------------------------------------------
|
|
||||||
mime ^video, terminal, !X, has mpv = mpv -- "$@"
|
|
||||||
mime ^video, terminal, !X, has mplayer2 = mplayer2 -- "$@"
|
|
||||||
mime ^video, terminal, !X, has mplayer = mplayer -- "$@"
|
|
||||||
|
|
||||||
#-------------------------------------------
|
|
||||||
# Documents
|
|
||||||
#-------------------------------------------
|
|
||||||
ext pdf, has llpp, X, flag f = llpp "$@"
|
|
||||||
ext pdf, has zathura, X, flag f = zathura -- "$@"
|
|
||||||
ext pdf, has mupdf, X, flag f = mupdf "$@"
|
|
||||||
ext pdf, has mupdf-x11,X, flag f = mupdf-x11 "$@"
|
|
||||||
ext pdf, has apvlv, X, flag f = apvlv -- "$@"
|
|
||||||
ext pdf, has xpdf, X, flag f = xpdf -- "$@"
|
|
||||||
ext pdf, has evince, X, flag f = evince -- "$@"
|
|
||||||
ext pdf, has atril, X, flag f = atril -- "$@"
|
|
||||||
ext pdf, has okular, X, flag f = okular -- "$@"
|
|
||||||
ext pdf, has epdfview, X, flag f = epdfview -- "$@"
|
|
||||||
ext pdf, has qpdfview, X, flag f = qpdfview "$@"
|
|
||||||
ext pdf, has open, X, flag f = open "$@"
|
|
||||||
|
|
||||||
ext docx?, has catdoc, terminal = catdoc -- "$@" | "$PAGER"
|
|
||||||
|
|
||||||
ext sxc|xlsx?|xlt|xlw|gnm|gnumeric, has gnumeric, X, flag f = gnumeric -- "$@"
|
|
||||||
ext sxc|xlsx?|xlt|xlw|gnm|gnumeric, has kspread, X, flag f = kspread -- "$@"
|
|
||||||
ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has libreoffice, X, flag f = libreoffice "$@"
|
|
||||||
ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has soffice, X, flag f = soffice "$@"
|
|
||||||
ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has ooffice, X, flag f = ooffice "$@"
|
|
||||||
|
|
||||||
ext djvu, has zathura,X, flag f = zathura -- "$@"
|
|
||||||
ext djvu, has evince, X, flag f = evince -- "$@"
|
|
||||||
ext djvu, has atril, X, flag f = atril -- "$@"
|
|
||||||
ext djvu, has djview, X, flag f = djview -- "$@"
|
|
||||||
|
|
||||||
ext epub, has ebook-viewer, X, flag f = ebook-viewer -- "$@"
|
|
||||||
ext epub, has zathura, X, flag f = zathura -- "$@"
|
|
||||||
ext epub, has mupdf, X, flag f = mupdf -- "$@"
|
|
||||||
ext mobi, has ebook-viewer, X, flag f = ebook-viewer -- "$@"
|
|
||||||
|
|
||||||
ext cbr, has zathura, X, flag f = zathura -- "$@"
|
|
||||||
ext cbz, has zathura, X, flag f = zathura -- "$@"
|
|
||||||
|
|
||||||
#-------------------------------------------
|
|
||||||
# Images
|
|
||||||
#-------------------------------------------
|
|
||||||
mime ^image/svg, has inkscape, X, flag f = inkscape -- "$@"
|
|
||||||
mime ^image/svg, has display, X, flag f = display -- "$@"
|
|
||||||
|
|
||||||
mime ^image, has imv, X, flag f = imv -- "$@"
|
|
||||||
mime ^image, has pqiv, X, flag f = pqiv -- "$@"
|
|
||||||
mime ^image, has sxiv, X, flag f = sxiv -- "$@"
|
|
||||||
mime ^image, has feh, X, flag f = feh -- "$@"
|
|
||||||
mime ^image, has mirage, X, flag f = mirage -- "$@"
|
|
||||||
mime ^image, has ristretto, X, flag f = ristretto "$@"
|
|
||||||
mime ^image, has eog, X, flag f = eog -- "$@"
|
|
||||||
mime ^image, has eom, X, flag f = eom -- "$@"
|
|
||||||
mime ^image, has nomacs, X, flag f = nomacs -- "$@"
|
|
||||||
mime ^image, has geeqie, X, flag f = geeqie -- "$@"
|
|
||||||
mime ^image, has gpicview, X, flag f = gpicview -- "$@"
|
|
||||||
mime ^image, has gwenview, X, flag f = gwenview -- "$@"
|
|
||||||
mime ^image, has gimp, X, flag f = gimp -- "$@"
|
|
||||||
ext xcf, X, flag f = gimp -- "$@"
|
|
||||||
|
|
||||||
#-------------------------------------------
|
|
||||||
# Archives
|
|
||||||
#-------------------------------------------
|
|
||||||
|
|
||||||
# avoid password prompt by providing empty password
|
|
||||||
ext 7z, has 7z = 7z -p l "$@" | "$PAGER"
|
|
||||||
# This requires atool
|
|
||||||
ext ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has atool = atool --list --each -- "$@" | "$PAGER"
|
|
||||||
ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has atool = atool --list --each -- "$@" | "$PAGER"
|
|
||||||
ext 7z|ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has atool = atool --extract --each -- "$@"
|
|
||||||
ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has atool = atool --extract --each -- "$@"
|
|
||||||
|
|
||||||
# Listing and extracting archives without atool:
|
|
||||||
ext tar|gz|bz2|xz, has tar = tar vvtf "$1" | "$PAGER"
|
|
||||||
ext tar|gz|bz2|xz, has tar = for file in "$@"; do tar vvxf "$file"; done
|
|
||||||
ext bz2, has bzip2 = for file in "$@"; do bzip2 -dk "$file"; done
|
|
||||||
ext zip, has unzip = unzip -l "$1" | less
|
|
||||||
ext zip, has unzip = for file in "$@"; do unzip -d "${file%.*}" "$file"; done
|
|
||||||
ext ace, has unace = unace l "$1" | less
|
|
||||||
ext ace, has unace = for file in "$@"; do unace e "$file"; done
|
|
||||||
ext rar, has unrar = unrar l "$1" | less
|
|
||||||
ext rar, has unrar = for file in "$@"; do unrar x "$file"; done
|
|
||||||
|
|
||||||
#-------------------------------------------
|
|
||||||
# Fonts
|
|
||||||
#-------------------------------------------
|
|
||||||
mime ^font, has fontforge, X, flag f = fontforge "$@"
|
|
||||||
|
|
||||||
#-------------------------------------------
|
|
||||||
# Flag t fallback terminals
|
|
||||||
#-------------------------------------------
|
|
||||||
# Rarely installed terminal emulators get higher priority; It is assumed that
|
|
||||||
# if you install a rare terminal emulator, you probably use it.
|
|
||||||
# gnome-terminal/konsole/xterm on the other hand are often installed as part of
|
|
||||||
# a desktop environment or as fallback terminal emulators.
|
|
||||||
mime ^ranger/x-terminal-emulator, has terminology = terminology -e "$@"
|
|
||||||
mime ^ranger/x-terminal-emulator, has kitty = kitty -- "$@"
|
|
||||||
mime ^ranger/x-terminal-emulator, has alacritty = alacritty -e "$@"
|
|
||||||
mime ^ranger/x-terminal-emulator, has sakura = sakura -e "$@"
|
|
||||||
mime ^ranger/x-terminal-emulator, has lilyterm = lilyterm -e "$@"
|
|
||||||
#mime ^ranger/x-terminal-emulator, has cool-retro-term = cool-retro-term -e "$@"
|
|
||||||
mime ^ranger/x-terminal-emulator, has termite = termite -x '"$@"'
|
|
||||||
#mime ^ranger/x-terminal-emulator, has yakuake = yakuake -e "$@"
|
|
||||||
mime ^ranger/x-terminal-emulator, has guake = guake -ne "$@"
|
|
||||||
mime ^ranger/x-terminal-emulator, has tilda = tilda -c "$@"
|
|
||||||
mime ^ranger/x-terminal-emulator, has st = st -e "$@"
|
|
||||||
mime ^ranger/x-terminal-emulator, has terminator = terminator -x "$@"
|
|
||||||
mime ^ranger/x-terminal-emulator, has urxvt = urxvt -e "$@"
|
|
||||||
mime ^ranger/x-terminal-emulator, has pantheon-terminal = pantheon-terminal -e "$@"
|
|
||||||
mime ^ranger/x-terminal-emulator, has lxterminal = lxterminal -e "$@"
|
|
||||||
mime ^ranger/x-terminal-emulator, has mate-terminal = mate-terminal -x "$@"
|
|
||||||
mime ^ranger/x-terminal-emulator, has xfce4-terminal = xfce4-terminal -x "$@"
|
|
||||||
mime ^ranger/x-terminal-emulator, has konsole = konsole -e "$@"
|
|
||||||
mime ^ranger/x-terminal-emulator, has gnome-terminal = gnome-terminal -- "$@"
|
|
||||||
mime ^ranger/x-terminal-emulator, has xterm = xterm -e "$@"
|
|
||||||
|
|
||||||
#-------------------------------------------
|
|
||||||
# Misc
|
|
||||||
#-------------------------------------------
|
|
||||||
label wallpaper, number 11, mime ^image, has feh, X = feh --bg-scale "$1"
|
|
||||||
label wallpaper, number 12, mime ^image, has feh, X = feh --bg-tile "$1"
|
|
||||||
label wallpaper, number 13, mime ^image, has feh, X = feh --bg-center "$1"
|
|
||||||
label wallpaper, number 14, mime ^image, has feh, X = feh --bg-fill "$1"
|
|
||||||
|
|
||||||
#-------------------------------------------
|
|
||||||
# Generic file openers
|
|
||||||
#-------------------------------------------
|
|
||||||
label open, has xdg-open = xdg-open -- "$@"
|
|
||||||
label open, has open = open -- "$@"
|
|
||||||
|
|
||||||
# Define the editor for non-text files + pager as last action
|
|
||||||
!mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = ask
|
|
||||||
label editor, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = ${VISUAL:-$EDITOR} -- "$@"
|
|
||||||
label pager, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = "$PAGER" -- "$@"
|
|
||||||
|
|
||||||
|
|
||||||
######################################################################
|
|
||||||
# The actions below are left so low down in this file on purpose, so #
|
|
||||||
# they are never triggered accidentally. #
|
|
||||||
######################################################################
|
|
||||||
|
|
||||||
# Execute a file as program/script.
|
|
||||||
mime application/x-executable = "$1"
|
|
||||||
|
|
||||||
# Move the file to trash using trash-cli.
|
|
||||||
label trash, has trash-put = trash-put -- "$@"
|
|
||||||
label trash = mkdir -p -- ${XDG_DATA_DIR:-$HOME/.ranger}/ranger-trash; mv -- "$@" ${XDG_DATA_DIR:-$HOME/.ranger}/ranger-trash
|
|
|
@ -1,350 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
set -o noclobber -o noglob -o nounset -o pipefail
|
|
||||||
IFS=$'\n'
|
|
||||||
|
|
||||||
## If the option `use_preview_script` is set to `true`,
|
|
||||||
## then this script will be called and its output will be displayed in ranger.
|
|
||||||
## ANSI color codes are supported.
|
|
||||||
## STDIN is disabled, so interactive scripts won't work properly
|
|
||||||
|
|
||||||
## This script is considered a configuration file and must be updated manually.
|
|
||||||
## It will be left untouched if you upgrade ranger.
|
|
||||||
|
|
||||||
## Because of some automated testing we do on the script #'s for comments need
|
|
||||||
## to be doubled up. Code that is commented out, because it's an alternative for
|
|
||||||
## example, gets only one #.
|
|
||||||
|
|
||||||
## Meanings of exit codes:
|
|
||||||
## code | meaning | action of ranger
|
|
||||||
## -----+------------+-------------------------------------------
|
|
||||||
## 0 | success | Display stdout as preview
|
|
||||||
## 1 | no preview | Display no preview at all
|
|
||||||
## 2 | plain text | Display the plain content of the file
|
|
||||||
## 3 | fix width | Don't reload when width changes
|
|
||||||
## 4 | fix height | Don't reload when height changes
|
|
||||||
## 5 | fix both | Don't ever reload
|
|
||||||
## 6 | image | Display the image `$IMAGE_CACHE_PATH` points to as an image preview
|
|
||||||
## 7 | image | Display the file directly as an image
|
|
||||||
|
|
||||||
## Script arguments
|
|
||||||
FILE_PATH="${1}" # Full path of the highlighted file
|
|
||||||
PV_WIDTH="${2}" # Width of the preview pane (number of fitting characters)
|
|
||||||
## shellcheck disable=SC2034 # PV_HEIGHT is provided for convenience and unused
|
|
||||||
PV_HEIGHT="${3}" # Height of the preview pane (number of fitting characters)
|
|
||||||
IMAGE_CACHE_PATH="${4}" # Full path that should be used to cache image preview
|
|
||||||
PV_IMAGE_ENABLED="${5}" # 'True' if image previews are enabled, 'False' otherwise.
|
|
||||||
|
|
||||||
FILE_EXTENSION="${FILE_PATH##*.}"
|
|
||||||
FILE_EXTENSION_LOWER="$(printf "%s" "${FILE_EXTENSION}" | tr '[:upper:]' '[:lower:]')"
|
|
||||||
|
|
||||||
## Settings
|
|
||||||
HIGHLIGHT_SIZE_MAX=262143 # 256KiB
|
|
||||||
HIGHLIGHT_TABWIDTH=${HIGHLIGHT_TABWIDTH:-8}
|
|
||||||
HIGHLIGHT_STYLE=${HIGHLIGHT_STYLE:-pablo}
|
|
||||||
HIGHLIGHT_OPTIONS="--replace-tabs=${HIGHLIGHT_TABWIDTH} --style=${HIGHLIGHT_STYLE} ${HIGHLIGHT_OPTIONS:-}"
|
|
||||||
PYGMENTIZE_STYLE=${PYGMENTIZE_STYLE:-autumn}
|
|
||||||
OPENSCAD_IMGSIZE=${RNGR_OPENSCAD_IMGSIZE:-1000,1000}
|
|
||||||
OPENSCAD_COLORSCHEME=${RNGR_OPENSCAD_COLORSCHEME:-Tomorrow Night}
|
|
||||||
|
|
||||||
handle_extension() {
|
|
||||||
case "${FILE_EXTENSION_LOWER}" in
|
|
||||||
## Archive
|
|
||||||
a|ace|alz|arc|arj|bz|bz2|cab|cpio|deb|gz|jar|lha|lz|lzh|lzma|lzo|\
|
|
||||||
rpm|rz|t7z|tar|tbz|tbz2|tgz|tlz|txz|tZ|tzo|war|xpi|xz|Z|zip)
|
|
||||||
atool --list -- "${FILE_PATH}" && exit 5
|
|
||||||
bsdtar --list --file "${FILE_PATH}" && exit 5
|
|
||||||
exit 1;;
|
|
||||||
rar)
|
|
||||||
## Avoid password prompt by providing empty password
|
|
||||||
unrar lt -p- -- "${FILE_PATH}" && exit 5
|
|
||||||
exit 1;;
|
|
||||||
7z)
|
|
||||||
## Avoid password prompt by providing empty password
|
|
||||||
7z l -p -- "${FILE_PATH}" && exit 5
|
|
||||||
exit 1;;
|
|
||||||
|
|
||||||
## PDF
|
|
||||||
pdf)
|
|
||||||
## Preview as text conversion
|
|
||||||
pdftotext -l 10 -nopgbrk -q -- "${FILE_PATH}" - | \
|
|
||||||
fmt -w "${PV_WIDTH}" && exit 5
|
|
||||||
mutool draw -F txt -i -- "${FILE_PATH}" 1-10 | \
|
|
||||||
fmt -w "${PV_WIDTH}" && exit 5
|
|
||||||
exiftool "${FILE_PATH}" && exit 5
|
|
||||||
exit 1;;
|
|
||||||
|
|
||||||
## BitTorrent
|
|
||||||
torrent)
|
|
||||||
transmission-show -- "${FILE_PATH}" && exit 5
|
|
||||||
exit 1;;
|
|
||||||
|
|
||||||
## OpenDocument
|
|
||||||
odt|ods|odp|sxw)
|
|
||||||
## Preview as text conversion
|
|
||||||
odt2txt "${FILE_PATH}" && exit 5
|
|
||||||
## Preview as markdown conversion
|
|
||||||
pandoc -s -t markdown -- "${FILE_PATH}" && exit 5
|
|
||||||
exit 1;;
|
|
||||||
|
|
||||||
## XLSX
|
|
||||||
xlsx)
|
|
||||||
## Preview as csv conversion
|
|
||||||
## Uses: https://github.com/dilshod/xlsx2csv
|
|
||||||
xlsx2csv -- "${FILE_PATH}" && exit 5
|
|
||||||
exit 1;;
|
|
||||||
|
|
||||||
## HTML
|
|
||||||
htm|html|xhtml)
|
|
||||||
## Preview as text conversion
|
|
||||||
w3m -dump "${FILE_PATH}" && exit 5
|
|
||||||
lynx -dump -- "${FILE_PATH}" && exit 5
|
|
||||||
elinks -dump "${FILE_PATH}" && exit 5
|
|
||||||
pandoc -s -t markdown -- "${FILE_PATH}" && exit 5
|
|
||||||
;;
|
|
||||||
|
|
||||||
## JSON
|
|
||||||
json)
|
|
||||||
jq --color-output . "${FILE_PATH}" && exit 5
|
|
||||||
python -m json.tool -- "${FILE_PATH}" && exit 5
|
|
||||||
;;
|
|
||||||
|
|
||||||
## Direct Stream Digital/Transfer (DSDIFF) and wavpack aren't detected
|
|
||||||
## by file(1).
|
|
||||||
dff|dsf|wv|wvc)
|
|
||||||
mediainfo "${FILE_PATH}" && exit 5
|
|
||||||
exiftool "${FILE_PATH}" && exit 5
|
|
||||||
;; # Continue with next handler on failure
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
handle_image() {
|
|
||||||
## Size of the preview if there are multiple options or it has to be
|
|
||||||
## rendered from vector graphics. If the conversion program allows
|
|
||||||
## specifying only one dimension while keeping the aspect ratio, the width
|
|
||||||
## will be used.
|
|
||||||
local DEFAULT_SIZE="1920x1080"
|
|
||||||
|
|
||||||
local mimetype="${1}"
|
|
||||||
case "${mimetype}" in
|
|
||||||
## SVG
|
|
||||||
# image/svg+xml|image/svg)
|
|
||||||
# convert -- "${FILE_PATH}" "${IMAGE_CACHE_PATH}" && exit 6
|
|
||||||
# exit 1;;
|
|
||||||
|
|
||||||
## DjVu
|
|
||||||
# image/vnd.djvu)
|
|
||||||
# ddjvu -format=tiff -quality=90 -page=1 -size="${DEFAULT_SIZE}" \
|
|
||||||
# - "${IMAGE_CACHE_PATH}" < "${FILE_PATH}" \
|
|
||||||
# && exit 6 || exit 1;;
|
|
||||||
|
|
||||||
## Image
|
|
||||||
image/*)
|
|
||||||
local orientation
|
|
||||||
orientation="$( identify -format '%[EXIF:Orientation]\n' -- "${FILE_PATH}" )"
|
|
||||||
## If orientation data is present and the image actually
|
|
||||||
## needs rotating ("1" means no rotation)...
|
|
||||||
if [[ -n "$orientation" && "$orientation" != 1 ]]; then
|
|
||||||
## ...auto-rotate the image according to the EXIF data.
|
|
||||||
convert -- "${FILE_PATH}" -auto-orient "${IMAGE_CACHE_PATH}" && exit 6
|
|
||||||
fi
|
|
||||||
|
|
||||||
## `w3mimgdisplay` will be called for all images (unless overriden
|
|
||||||
## as above), but might fail for unsupported types.
|
|
||||||
exit 7;;
|
|
||||||
|
|
||||||
## Video
|
|
||||||
video/*)
|
|
||||||
# Thumbnail
|
|
||||||
ffmpegthumbnailer -i "${FILE_PATH}" -o "${IMAGE_CACHE_PATH}" -s 0 && exit 6
|
|
||||||
exit 1;;
|
|
||||||
|
|
||||||
## PDF
|
|
||||||
application/pdf)
|
|
||||||
pdftoppm -f 1 -l 1 \
|
|
||||||
-scale-to-x "${DEFAULT_SIZE%x*}" \
|
|
||||||
-scale-to-y -1 \
|
|
||||||
-singlefile \
|
|
||||||
-jpeg -tiffcompression jpeg \
|
|
||||||
-- "${FILE_PATH}" "${IMAGE_CACHE_PATH%.*}" \
|
|
||||||
&& exit 6 || exit 1;;
|
|
||||||
|
|
||||||
|
|
||||||
## ePub, MOBI, FB2 (using Calibre)
|
|
||||||
# application/epub+zip|application/x-mobipocket-ebook|\
|
|
||||||
# application/x-fictionbook+xml)
|
|
||||||
# # ePub (using https://github.com/marianosimone/epub-thumbnailer)
|
|
||||||
# epub-thumbnailer "${FILE_PATH}" "${IMAGE_CACHE_PATH}" \
|
|
||||||
# "${DEFAULT_SIZE%x*}" && exit 6
|
|
||||||
# ebook-meta --get-cover="${IMAGE_CACHE_PATH}" -- "${FILE_PATH}" \
|
|
||||||
# >/dev/null && exit 6
|
|
||||||
# exit 1;;
|
|
||||||
|
|
||||||
## Font
|
|
||||||
application/font*|application/*opentype)
|
|
||||||
preview_png="/tmp/$(basename "${IMAGE_CACHE_PATH%.*}").png"
|
|
||||||
if fontimage -o "${preview_png}" \
|
|
||||||
--pixelsize "120" \
|
|
||||||
--fontname \
|
|
||||||
--pixelsize "80" \
|
|
||||||
--text " ABCDEFGHIJKLMNOPQRSTUVWXYZ " \
|
|
||||||
--text " abcdefghijklmnopqrstuvwxyz " \
|
|
||||||
--text " 0123456789.:,;(*!?') ff fl fi ffi ffl " \
|
|
||||||
--text " The quick brown fox jumps over the lazy dog. " \
|
|
||||||
"${FILE_PATH}";
|
|
||||||
then
|
|
||||||
convert -- "${preview_png}" "${IMAGE_CACHE_PATH}" \
|
|
||||||
&& rm "${preview_png}" \
|
|
||||||
&& exit 6
|
|
||||||
else
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
|
|
||||||
## Preview archives using the first image inside.
|
|
||||||
## (Very useful for comic book collections for example.)
|
|
||||||
# application/zip|application/x-rar|application/x-7z-compressed|\
|
|
||||||
# application/x-xz|application/x-bzip2|application/x-gzip|application/x-tar)
|
|
||||||
# local fn=""; local fe=""
|
|
||||||
# local zip=""; local rar=""; local tar=""; local bsd=""
|
|
||||||
# case "${mimetype}" in
|
|
||||||
# application/zip) zip=1 ;;
|
|
||||||
# application/x-rar) rar=1 ;;
|
|
||||||
# application/x-7z-compressed) ;;
|
|
||||||
# *) tar=1 ;;
|
|
||||||
# esac
|
|
||||||
# { [ "$tar" ] && fn=$(tar --list --file "${FILE_PATH}"); } || \
|
|
||||||
# { fn=$(bsdtar --list --file "${FILE_PATH}") && bsd=1 && tar=""; } || \
|
|
||||||
# { [ "$rar" ] && fn=$(unrar lb -p- -- "${FILE_PATH}"); } || \
|
|
||||||
# { [ "$zip" ] && fn=$(zipinfo -1 -- "${FILE_PATH}"); } || return
|
|
||||||
#
|
|
||||||
# fn=$(echo "$fn" | python -c "import sys; import mimetypes as m; \
|
|
||||||
# [ print(l, end='') for l in sys.stdin if \
|
|
||||||
# (m.guess_type(l[:-1])[0] or '').startswith('image/') ]" |\
|
|
||||||
# sort -V | head -n 1)
|
|
||||||
# [ "$fn" = "" ] && return
|
|
||||||
# [ "$bsd" ] && fn=$(printf '%b' "$fn")
|
|
||||||
#
|
|
||||||
# [ "$tar" ] && tar --extract --to-stdout \
|
|
||||||
# --file "${FILE_PATH}" -- "$fn" > "${IMAGE_CACHE_PATH}" && exit 6
|
|
||||||
# fe=$(echo -n "$fn" | sed 's/[][*?\]/\\\0/g')
|
|
||||||
# [ "$bsd" ] && bsdtar --extract --to-stdout \
|
|
||||||
# --file "${FILE_PATH}" -- "$fe" > "${IMAGE_CACHE_PATH}" && exit 6
|
|
||||||
# [ "$bsd" ] || [ "$tar" ] && rm -- "${IMAGE_CACHE_PATH}"
|
|
||||||
# [ "$rar" ] && unrar p -p- -inul -- "${FILE_PATH}" "$fn" > \
|
|
||||||
# "${IMAGE_CACHE_PATH}" && exit 6
|
|
||||||
# [ "$zip" ] && unzip -pP "" -- "${FILE_PATH}" "$fe" > \
|
|
||||||
# "${IMAGE_CACHE_PATH}" && exit 6
|
|
||||||
# [ "$rar" ] || [ "$zip" ] && rm -- "${IMAGE_CACHE_PATH}"
|
|
||||||
# ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# openscad_image() {
|
|
||||||
# TMPPNG="$(mktemp -t XXXXXX.png)"
|
|
||||||
# openscad --colorscheme="${OPENSCAD_COLORSCHEME}" \
|
|
||||||
# --imgsize="${OPENSCAD_IMGSIZE/x/,}" \
|
|
||||||
# -o "${TMPPNG}" "${1}"
|
|
||||||
# mv "${TMPPNG}" "${IMAGE_CACHE_PATH}"
|
|
||||||
# }
|
|
||||||
|
|
||||||
# case "${FILE_EXTENSION_LOWER}" in
|
|
||||||
# ## 3D models
|
|
||||||
# ## OpenSCAD only supports png image output, and ${IMAGE_CACHE_PATH}
|
|
||||||
# ## is hardcoded as jpeg. So we make a tempfile.png and just
|
|
||||||
# ## move/rename it to jpg. This works because image libraries are
|
|
||||||
# ## smart enough to handle it.
|
|
||||||
# csg|scad)
|
|
||||||
# openscad_image "${FILE_PATH}" && exit 6
|
|
||||||
# ;;
|
|
||||||
# 3mf|amf|dxf|off|stl)
|
|
||||||
# openscad_image <(echo "import(\"${FILE_PATH}\");") && exit 6
|
|
||||||
# ;;
|
|
||||||
# esac
|
|
||||||
}
|
|
||||||
|
|
||||||
handle_mime() {
|
|
||||||
local mimetype="${1}"
|
|
||||||
case "${mimetype}" in
|
|
||||||
## RTF and DOC
|
|
||||||
text/rtf|*msword)
|
|
||||||
## Preview as text conversion
|
|
||||||
## note: catdoc does not always work for .doc files
|
|
||||||
## catdoc: http://www.wagner.pp.ru/~vitus/software/catdoc/
|
|
||||||
catdoc -- "${FILE_PATH}" && exit 5
|
|
||||||
exit 1;;
|
|
||||||
|
|
||||||
## DOCX, ePub, FB2 (using markdown)
|
|
||||||
## You might want to remove "|epub" and/or "|fb2" below if you have
|
|
||||||
## uncommented other methods to preview those formats
|
|
||||||
*wordprocessingml.document|*/epub+zip|*/x-fictionbook+xml)
|
|
||||||
## Preview as markdown conversion
|
|
||||||
pandoc -s -t markdown -- "${FILE_PATH}" && exit 5
|
|
||||||
exit 1;;
|
|
||||||
|
|
||||||
## XLS
|
|
||||||
*ms-excel)
|
|
||||||
## Preview as csv conversion
|
|
||||||
## xls2csv comes with catdoc:
|
|
||||||
## http://www.wagner.pp.ru/~vitus/software/catdoc/
|
|
||||||
xls2csv -- "${FILE_PATH}" && exit 5
|
|
||||||
exit 1;;
|
|
||||||
|
|
||||||
## Text
|
|
||||||
text/* | */xml)
|
|
||||||
## Syntax highlight
|
|
||||||
if [[ "$( stat --printf='%s' -- "${FILE_PATH}" )" -gt "${HIGHLIGHT_SIZE_MAX}" ]]; then
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
if [[ "$( tput colors )" -ge 256 ]]; then
|
|
||||||
local pygmentize_format='terminal256'
|
|
||||||
local highlight_format='xterm256'
|
|
||||||
else
|
|
||||||
local pygmentize_format='terminal'
|
|
||||||
local highlight_format='ansi'
|
|
||||||
fi
|
|
||||||
env HIGHLIGHT_OPTIONS="${HIGHLIGHT_OPTIONS}" highlight \
|
|
||||||
--out-format="${highlight_format}" \
|
|
||||||
--force -- "${FILE_PATH}" && exit 5
|
|
||||||
env COLORTERM=8bit bat --color=always --style="plain" \
|
|
||||||
-- "${FILE_PATH}" && exit 5
|
|
||||||
pygmentize -f "${pygmentize_format}" -O "style=${PYGMENTIZE_STYLE}"\
|
|
||||||
-- "${FILE_PATH}" && exit 5
|
|
||||||
exit 2;;
|
|
||||||
|
|
||||||
## DjVu
|
|
||||||
image/vnd.djvu)
|
|
||||||
## Preview as text conversion (requires djvulibre)
|
|
||||||
djvutxt "${FILE_PATH}" | fmt -w "${PV_WIDTH}" && exit 5
|
|
||||||
exiftool "${FILE_PATH}" && exit 5
|
|
||||||
exit 1;;
|
|
||||||
|
|
||||||
## Image
|
|
||||||
image/*)
|
|
||||||
## Preview as text conversion
|
|
||||||
# img2txt --gamma=0.6 --width="${PV_WIDTH}" -- "${FILE_PATH}" && exit 4
|
|
||||||
exiftool "${FILE_PATH}" && exit 5
|
|
||||||
exit 1;;
|
|
||||||
|
|
||||||
## Video and audio
|
|
||||||
video/* | audio/*)
|
|
||||||
mediainfo "${FILE_PATH}" && exit 5
|
|
||||||
exiftool "${FILE_PATH}" && exit 5
|
|
||||||
exit 1;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
handle_fallback() {
|
|
||||||
echo '----- File Type Classification -----' && file --dereference --brief -- "${FILE_PATH}" && exit 5
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
MIMETYPE="$( file --dereference --brief --mime-type -- "${FILE_PATH}" )"
|
|
||||||
if [[ "${PV_IMAGE_ENABLED}" == 'True' ]]; then
|
|
||||||
handle_image "${MIMETYPE}"
|
|
||||||
fi
|
|
||||||
handle_extension
|
|
||||||
handle_mime "${MIMETYPE}"
|
|
||||||
handle_fallback
|
|
||||||
|
|
||||||
exit 1
|
|
33
user/.config/starship.toml
Normal file
33
user/.config/starship.toml
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
## ____ __
|
||||||
|
## / __ \_________ _/ /_____
|
||||||
|
## / / / / ___/ __ `/ //_/ _ \
|
||||||
|
## / /_/ / / / /_/ / ,< / __/ Clay Gomera (Drake)
|
||||||
|
## /_____/_/ \__,_/_/|_|\___/ My custom starship prompt config
|
||||||
|
##
|
||||||
|
|
||||||
|
add_newline = false
|
||||||
|
|
||||||
|
[line_break]
|
||||||
|
disabled = true
|
||||||
|
|
||||||
|
[character]
|
||||||
|
error_symbol = "[](bold red) "
|
||||||
|
success_symbol = "[](bold green)"
|
||||||
|
|
||||||
|
[directory]
|
||||||
|
truncation_length = 5
|
||||||
|
home_symbol = " "
|
||||||
|
format = "[$path](bold italic yellow) "
|
||||||
|
|
||||||
|
[hostname]
|
||||||
|
ssh_only = false
|
||||||
|
disabled = false
|
||||||
|
style = "italic #87A752"
|
||||||
|
|
||||||
|
[package]
|
||||||
|
disabled = true
|
||||||
|
|
||||||
|
[username]
|
||||||
|
show_always = true
|
||||||
|
style_user = "bold red"
|
||||||
|
format = "[$user]($style)[ in ](white)"
|
|
@ -2,10 +2,7 @@ exec {
|
||||||
/usr/libexec/polkit-gnome-authentication-agent-1
|
/usr/libexec/polkit-gnome-authentication-agent-1
|
||||||
echo 25 > $SWAYSOCK.wob
|
echo 25 > $SWAYSOCK.wob
|
||||||
hash dbus-update-activation-environment 2>/dev/null && dbus-update-activation-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK
|
hash dbus-update-activation-environment 2>/dev/null && dbus-update-activation-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK
|
||||||
bash -c ~/.config/sway/initpipe
|
bash -c ~/.config/sway/pipeinit
|
||||||
xdg-desktop-portal
|
|
||||||
xdg-desktop-portal-wlr
|
|
||||||
xdg-desktop-portal-gtk
|
|
||||||
mako -c ~/.config/mako/config
|
mako -c ~/.config/mako/config
|
||||||
swayidle -w \
|
swayidle -w \
|
||||||
timeout 300 'swaylock -f -c 000000' \
|
timeout 300 'swaylock -f -c 000000' \
|
||||||
|
|
|
@ -11,7 +11,8 @@ set $right l
|
||||||
set $term wezterm
|
set $term wezterm
|
||||||
set $chat signal-desktop
|
set $chat signal-desktop
|
||||||
set $browser qutebrowser
|
set $browser qutebrowser
|
||||||
set $file wezterm start --class file_manager ranger
|
set $file wezterm start --class file_manager vifm
|
||||||
|
set $editor $HOME/.local/bin/neovide
|
||||||
set $music wezterm start --class music_player cmus
|
set $music wezterm start --class music_player cmus
|
||||||
set $ani-cli wezterm start --class ani-cli ani-cli
|
set $ani-cli wezterm start --class ani-cli ani-cli
|
||||||
set $ytfzf wezterm start --class ytfzf ytfzf -flstT chafa
|
set $ytfzf wezterm start --class ytfzf ytfzf -flstT chafa
|
||||||
|
@ -30,7 +31,7 @@ set $menu-emoji ~/.local/bin/rs_emoji | xargs swaymsg exec --
|
||||||
set $menu-wall ~/.local/bin/rs_wall | xargs swaymsg exec --
|
set $menu-wall ~/.local/bin/rs_wall | xargs swaymsg exec --
|
||||||
set $menu-scrot ~/.local/bin/rs_scrot | xargs swaymsg exec --
|
set $menu-scrot ~/.local/bin/rs_scrot | xargs swaymsg exec --
|
||||||
set $menu-blue ~/.local/bin/rs_blue | xargs swaymsg exec --
|
set $menu-blue ~/.local/bin/rs_blue | xargs swaymsg exec --
|
||||||
set $menu-clip cliphist list | wofi --dmenu -L 10 -p " Clipboard" | cliphist decode | wl-copy | xargs swaymsg exec --
|
set $menu-clip cliphist list | $RUNNER -l 10 -p "[ Clipboard] " | cliphist decode | wl-copy | xargs swaymsg exec --
|
||||||
|
|
||||||
# Start a terminal
|
# Start a terminal
|
||||||
bindsym $mod+Return exec $term
|
bindsym $mod+Return exec $term
|
||||||
|
@ -48,17 +49,20 @@ bindsym $mod+Shift+b exec $menu-blue
|
||||||
bindsym $mod+Shift+c exec $menu-clip
|
bindsym $mod+Shift+c exec $menu-clip
|
||||||
bindsym $mod+Shift+i exec $menu-wifi
|
bindsym $mod+Shift+i exec $menu-wifi
|
||||||
|
|
||||||
# Start apps
|
# XF86 Keys
|
||||||
bindsym $mod+Mod1+v exec $file
|
bindsym XF86AudioRaiseVolume exec pamixer -i 5
|
||||||
bindsym $mod+Mod1+w exec $browser
|
bindsym XF86AudioLowerVolume exec pamixer -d 5
|
||||||
bindsym $mod+Mod1+c exec $chat
|
bindsym XF86AudioMute exec pamixer -t
|
||||||
bindsym $mod+Mod1+m exec $music
|
bindsym XF86AudioMicMute exec pamixer --default-source -t
|
||||||
bindsym $mod+Mod1+b exec $monitor
|
bindsym XF86AudioPause exec playerctl play-pause
|
||||||
bindsym $mod+Mod1+p exec $audiomixer
|
bindsym XF86AudioPlay exec playerctl play-pause
|
||||||
bindsym $mod+Mod1+n exec $ytfzf-music
|
bindsym XF86AudioNext exec playerctl next
|
||||||
bindsym $mod+Mod1+a exec $ani-cli
|
bindsym XF86AudioPrev exec playerctl previous
|
||||||
bindsym $mod+Mod1+y exec $ytfzf
|
bindsym XF86AudioStop exec playerctl stop
|
||||||
bindsym $mod+Mod1+f exec $flix-cli
|
bindsym XF86News exec wezterm start --class newsboat newsboat
|
||||||
|
bindsym XF86MonBrightnessUp exec brightnessctl s 5%+
|
||||||
|
bindsym XF86MonBrightnessDown exec brightnessctl s 5%-
|
||||||
|
bindsym XF86Display exec wdisplays
|
||||||
|
|
||||||
# Drag floating windows by holding down $mod and left mouse button.
|
# Drag floating windows by holding down $mod and left mouse button.
|
||||||
# Resize them with right mouse button + $mod.
|
# Resize them with right mouse button + $mod.
|
||||||
|
@ -144,7 +148,7 @@ bindsym $mod+Ctrl+space floating toggle
|
||||||
bindsym $mod+space focus mode_toggle
|
bindsym $mod+space focus mode_toggle
|
||||||
|
|
||||||
# Move focus to the parent container
|
# Move focus to the parent container
|
||||||
bindsym $mod+a focus parent
|
bindsym $mod+Shift+Return focus parent
|
||||||
|
|
||||||
### Scratchpad:
|
### Scratchpad:
|
||||||
# Sway has a "scratchpad", which is a bag of holding for windows.
|
# Sway has a "scratchpad", which is a bag of holding for windows.
|
||||||
|
@ -179,3 +183,22 @@ mode "resize" {
|
||||||
bindsym Escape mode "default"
|
bindsym Escape mode "default"
|
||||||
}
|
}
|
||||||
bindsym $mod+r mode "resize"
|
bindsym $mod+r mode "resize"
|
||||||
|
|
||||||
|
### Mode for launching apps
|
||||||
|
mode "apps" {
|
||||||
|
# Start apps
|
||||||
|
bindsym v exec $file; mode "default"
|
||||||
|
bindsym e exec $editor; mode "default"
|
||||||
|
bindsym w exec $browser; mode "default"
|
||||||
|
bindsym c exec $chat; mode "default"
|
||||||
|
bindsym m exec $music; mode "default"
|
||||||
|
bindsym b exec $monitor; mode "default"
|
||||||
|
bindsym p exec $audiomixer; mode "default"
|
||||||
|
bindsym n exec $ytfzf-music; mode "default"
|
||||||
|
bindsym a exec $ani-cli; mode "default"
|
||||||
|
bindsym y exec $ytfzf; mode "default"
|
||||||
|
bindsym f exec $flix-cli; mode "default"
|
||||||
|
bindsym Return mode "default"
|
||||||
|
bindsym Escape mode "default"
|
||||||
|
}
|
||||||
|
bindsym $mod+a mode "apps"
|
||||||
|
|
|
@ -12,6 +12,11 @@ input {
|
||||||
dwtp disabled
|
dwtp disabled
|
||||||
pointer_accel 0.5
|
pointer_accel 0.5
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type:keyboard {
|
||||||
|
xkb_layout us,es
|
||||||
|
xkb_options grp:shift_caps_toggle
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Cursor settings
|
# Cursor settings
|
||||||
|
|
|
@ -19,8 +19,8 @@ client.urgent $color_bright_yellow $color_bright_yellow $color_n
|
||||||
client.placeholder $color_unused $color_unused $color_unused $color_unused $color_unused
|
client.placeholder $color_unused $color_unused $color_unused $color_unused $color_unused
|
||||||
|
|
||||||
# Window borders
|
# Window borders
|
||||||
default_border normal 2
|
default_border pixel 2
|
||||||
default_floating_border normal 2
|
default_floating_border pixel 2
|
||||||
|
|
||||||
# gsettings
|
# gsettings
|
||||||
exec gsettings set org.gnome.desktop.interface {
|
exec gsettings set org.gnome.desktop.interface {
|
||||||
|
|
9
user/.config/sway/pipeinit
Executable file
9
user/.config/sway/pipeinit
Executable file
|
@ -0,0 +1,9 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
pkill pipewire
|
||||||
|
pkill pipewire-pulse
|
||||||
|
pkill wireplumber
|
||||||
|
|
||||||
|
pipewire &
|
||||||
|
pipewire-pulse &
|
||||||
|
wireplumber &
|
Binary file not shown.
Before Width: | Height: | Size: 934 KiB |
BIN
user/.config/sway/wallpaper/background.png
Normal file
BIN
user/.config/sway/wallpaper/background.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.6 MiB |
Binary file not shown.
Before Width: | Height: | Size: 934 KiB |
BIN
user/.config/sway/wallpaper/locked.png
Normal file
BIN
user/.config/sway/wallpaper/locked.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.6 MiB |
30
user/.config/vifm/colors/gruvbox-dark.vifm
Normal file
30
user/.config/vifm/colors/gruvbox-dark.vifm
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
" gruvbox color scheme approximation for vifm
|
||||||
|
|
||||||
|
" Reset all styles first
|
||||||
|
highlight clear
|
||||||
|
|
||||||
|
highlight Border cterm=none ctermfg=235 ctermbg=default
|
||||||
|
|
||||||
|
highlight TopLine cterm=none ctermfg=214 ctermbg=235
|
||||||
|
highlight TopLineSel cterm=bold ctermfg=214 ctermbg=237
|
||||||
|
|
||||||
|
highlight Win cterm=none ctermfg=223 ctermbg=none
|
||||||
|
highlight OtherWin cterm=none ctermfg=223 ctermbg=none
|
||||||
|
highlight Directory cterm=bold ctermfg=109 ctermbg=default
|
||||||
|
highlight CurrLine cterm=bold,inverse ctermfg=default ctermbg=default
|
||||||
|
highlight OtherLine cterm=bold ctermfg=default ctermbg=235
|
||||||
|
highlight Selected cterm=none ctermfg=223 ctermbg=237
|
||||||
|
|
||||||
|
highlight JobLine cterm=bold ctermfg=116 ctermbg=238
|
||||||
|
highlight StatusLine cterm=bold ctermfg=144 ctermbg=236
|
||||||
|
highlight ErrorMsg cterm=bold ctermfg=167 ctermbg=default
|
||||||
|
highlight WildMenu cterm=bold ctermfg=235 ctermbg=144
|
||||||
|
highlight CmdLine cterm=none ctermfg=223 ctermbg=default
|
||||||
|
|
||||||
|
highlight Executable cterm=bold ctermfg=142 ctermbg=default
|
||||||
|
highlight Link cterm=none ctermfg=132 ctermbg=default
|
||||||
|
highlight BrokenLink cterm=bold ctermfg=167 ctermbg=default
|
||||||
|
highlight Device cterm=none,standout ctermfg=214 ctermbg=default
|
||||||
|
highlight Fifo cterm=none ctermfg=172 ctermbg=default
|
||||||
|
highlight Socket cterm=bold ctermfg=223 ctermbg=default
|
||||||
|
|
6568
user/.config/vifm/vifm-help.txt
Normal file
6568
user/.config/vifm/vifm-help.txt
Normal file
File diff suppressed because it is too large
Load diff
487
user/.config/vifm/vifmrc
Normal file
487
user/.config/vifm/vifmrc
Normal file
|
@ -0,0 +1,487 @@
|
||||||
|
" ____ __
|
||||||
|
" / __ \_________ _/ /_____
|
||||||
|
" / / / / ___/ __ `/ //_/ _ \
|
||||||
|
" / /_/ / / / /_/ / ,< / __/ Clay Gomera (Drake)
|
||||||
|
" /_____/_/ \__,_/_/|_|\___/ My custom vifm config
|
||||||
|
|
||||||
|
" vim: filetype=vifm :
|
||||||
|
" My config file for the vifm terminal file manager.
|
||||||
|
" ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
" This is the actual command used to start vi. The default is vim.
|
||||||
|
" If you would like to use emacs or emacsclient, you can use them.
|
||||||
|
" Since emacs is a GUI app and not a terminal app like vim, append the command
|
||||||
|
" with an ampersand (&).
|
||||||
|
|
||||||
|
set vicmd=~/.local/bin/lvim
|
||||||
|
|
||||||
|
" 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
|
||||||
|
|
||||||
|
" With this option turned on you can run partially entered commands with
|
||||||
|
" unambiguous beginning using :! (e.g. :!Te instead of :!Terminal or :!Te<tab>).
|
||||||
|
|
||||||
|
" set fastrun
|
||||||
|
|
||||||
|
" 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
|
||||||
|
" The following line will cause issues if using vifm.vim with regular vim.
|
||||||
|
" Either use neovim or comment out the following line.
|
||||||
|
colorscheme gruvbox-dark
|
||||||
|
|
||||||
|
" 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\ %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
|
||||||
|
|
||||||
|
" Don't do too many requests to slow file systems
|
||||||
|
|
||||||
|
if !has('win')
|
||||||
|
set slowfs=curlftpfs
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Set custom status line look
|
||||||
|
|
||||||
|
set statusline=" Hint: %z%= %A %10u:%-7g %15s %20d "
|
||||||
|
|
||||||
|
" Set line numbers to show
|
||||||
|
|
||||||
|
" ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
" :mark mark /full/directory/path [filename]
|
||||||
|
|
||||||
|
mark h ~/
|
||||||
|
|
||||||
|
" ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
" :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 vim -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 vim "+grep %a"
|
||||||
|
command! reload :write | restart
|
||||||
|
|
||||||
|
" ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
" 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.
|
||||||
|
|
||||||
|
" Pdf and cbz
|
||||||
|
filextype *.cbz,*.pdf zathura %c %i &, apvlv %c, xpdf %c
|
||||||
|
fileviewer *.pdf
|
||||||
|
\ pdftotext -nopgbrk %c -
|
||||||
|
|
||||||
|
" PostScript
|
||||||
|
filextype *.ps,*.eps,*.ps.gz
|
||||||
|
\ {View in zathura}
|
||||||
|
\ zathura %f,
|
||||||
|
\ {View in gv}
|
||||||
|
\ gv %c %i &,
|
||||||
|
|
||||||
|
" Djvu
|
||||||
|
filextype *.djvu
|
||||||
|
\ {View in zathura}
|
||||||
|
\ zathura %f,
|
||||||
|
\ {View in apvlv}
|
||||||
|
\ apvlv %f,
|
||||||
|
|
||||||
|
" Audio
|
||||||
|
filetype *.wav,*.mp3,*.flac,*.m4a,*.wma,*.ape,*.ac3,*.og[agx],*.spx,*.opus
|
||||||
|
\ {Play using mpv}
|
||||||
|
\ mpv %f,
|
||||||
|
fileviewer *.mp3 mp3info
|
||||||
|
fileviewer *.flac soxi
|
||||||
|
|
||||||
|
" Video
|
||||||
|
filextype *.avi,*.mp4,*.wmv,*.dat,*.3gp,*.ogv,*.mkv,*.mpg,*.mpeg,*.vob,
|
||||||
|
\*.fl[icv],*.m2v,*.mov,*.webm,*.ts,*.mts,*.m4v,*.r[am],*.qt,*.divx,
|
||||||
|
\*.as[fx]
|
||||||
|
\ {View using mplayer}
|
||||||
|
\ mpv %f,
|
||||||
|
fileviewer *.avi,*.mp4,*.wmv,*.dat,*.3gp,*.ogv,*.mkv,*.mpg,*.mpeg,*.vob,
|
||||||
|
\*.fl[icv],*.m2v,*.mov,*.webm,*.ts,*.mts,*.m4v,*.r[am],*.qt,*.divx,
|
||||||
|
\*.as[fx]
|
||||||
|
\ ffprobe -pretty %c 2>&1
|
||||||
|
|
||||||
|
" Web
|
||||||
|
filextype *.html,*.htm
|
||||||
|
\ {Open with emacs}
|
||||||
|
\ emacsclient -c %c &,
|
||||||
|
\ {Open with vim}
|
||||||
|
\ vim %c &,
|
||||||
|
\ {Open with dwb}
|
||||||
|
\ dwb %f %i &,
|
||||||
|
\ {Open with firefox}
|
||||||
|
\ firefox %f &,
|
||||||
|
\ {Open with uzbl}
|
||||||
|
\ uzbl-browser %f %i &,
|
||||||
|
filetype *.html,*.htm links, lynx
|
||||||
|
|
||||||
|
" Object
|
||||||
|
filetype *.o nm %f | less
|
||||||
|
|
||||||
|
" Man page
|
||||||
|
filetype *.[1-8] man ./%c
|
||||||
|
fileviewer *.[1-8] man ./%c | col -b
|
||||||
|
|
||||||
|
" Images
|
||||||
|
filextype *.bmp,*.jpg,*.jpeg,*.png,*.gif,*.xpm
|
||||||
|
\ {View in imv}
|
||||||
|
\ imv %f &,
|
||||||
|
fileviewer *.bmp,*.jpg,*.jpeg,*.png,*.xpm,*.gif
|
||||||
|
\ wezterm imgcat --width %pw --height %ph %c:p %pd
|
||||||
|
|
||||||
|
" OpenRaster
|
||||||
|
filextype *.ora
|
||||||
|
\ {Edit in MyPaint}
|
||||||
|
\ mypaint %f,
|
||||||
|
|
||||||
|
" Mindmap
|
||||||
|
filextype *.vym
|
||||||
|
\ {Open with VYM}
|
||||||
|
\ vym %f &,
|
||||||
|
|
||||||
|
" 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,
|
||||||
|
|
||||||
|
" Torrent
|
||||||
|
filetype *.torrent ktorrent %f &
|
||||||
|
fileviewer *.torrent dumptorrent -v %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,
|
||||||
|
fileviewer *.zip,*.jar,*.war,*.ear,*.oxt zip -sf %c
|
||||||
|
|
||||||
|
" ArchiveMount
|
||||||
|
filetype *.tar,*.tar.bz2,*.tbz2,*.tgz,*.tar.gz,*.tar.xz,*.txz
|
||||||
|
\ {Mount with archivemount}
|
||||||
|
\ FUSE_MOUNT|archivemount %SOURCE_FILE %DESTINATION_DIR,
|
||||||
|
fileviewer *.tgz,*.tar.gz tar -tzf %c
|
||||||
|
fileviewer *.tar.bz2,*.tbz2 tar -tjf %c
|
||||||
|
fileviewer *.tar.txz,*.txz xz --list %c
|
||||||
|
fileviewer *.tar tar -tf %c
|
||||||
|
|
||||||
|
" Rar2FsMount and rar archives
|
||||||
|
filetype *.rar
|
||||||
|
\ {Mount with rar2fs}
|
||||||
|
\ FUSE_MOUNT|rar2fs %SOURCE_FILE %DESTINATION_DIR,
|
||||||
|
fileviewer *.rar unrar v %c
|
||||||
|
|
||||||
|
" IsoMount
|
||||||
|
filetype *.iso
|
||||||
|
\ {Mount with fuseiso}
|
||||||
|
\ FUSE_MOUNT|fuseiso %SOURCE_FILE %DESTINATION_DIR,
|
||||||
|
|
||||||
|
" SshMount
|
||||||
|
filetype *.ssh
|
||||||
|
\ {Mount with sshfs}
|
||||||
|
\ FUSE_MOUNT2|sshfs %PARAM %DESTINATION_DIR %FOREGROUND,
|
||||||
|
|
||||||
|
" FtpMount
|
||||||
|
filetype *.ftp
|
||||||
|
\ {Mount with curlftpfs}
|
||||||
|
\ FUSE_MOUNT2|curlftpfs -o ftp_port=-,,disable_eprt %PARAM %DESTINATION_DIR %FOREGROUND,
|
||||||
|
|
||||||
|
" Fuse7z and 7z archives
|
||||||
|
filetype *.7z
|
||||||
|
\ {Mount with fuse-7z}
|
||||||
|
\ FUSE_MOUNT|fuse-7z %SOURCE_FILE %DESTINATION_DIR,
|
||||||
|
fileviewer *.7z 7z l %c
|
||||||
|
|
||||||
|
" Office files
|
||||||
|
filextype *.odt,*.doc,*.docx,*.xls,*.xlsx,*.odp,*.pptx libreoffice %f &
|
||||||
|
fileviewer *.doc catdoc %c
|
||||||
|
fileviewer *.docx docx2txt.pl %f -
|
||||||
|
|
||||||
|
" TuDu files
|
||||||
|
filetype *.tudu tudu -f %c
|
||||||
|
|
||||||
|
" Qt projects
|
||||||
|
filextype *.pro qtcreator %f &
|
||||||
|
|
||||||
|
" Directories
|
||||||
|
filextype */
|
||||||
|
\ {View in thunar}
|
||||||
|
\ Thunar %f &,
|
||||||
|
|
||||||
|
" Syntax highlighting in preview
|
||||||
|
"
|
||||||
|
" Explicitly set highlight type for some extensions
|
||||||
|
"
|
||||||
|
" 256-color terminal
|
||||||
|
" fileviewer *.[ch],*.[ch]pp highlight -O xterm256 -s dante --syntax c %c
|
||||||
|
" fileviewer Makefile,Makefile.* highlight -O xterm256 -s dante --syntax make %c
|
||||||
|
"
|
||||||
|
" 16-color terminal
|
||||||
|
" fileviewer *.c,*.h highlight -O ansi -s dante %c
|
||||||
|
"
|
||||||
|
" Or leave it for automatic detection
|
||||||
|
"
|
||||||
|
" fileviewer *[^/] pygmentize -O style=monokai -f console256 -g
|
||||||
|
|
||||||
|
" Displaying pictures in terminal
|
||||||
|
"
|
||||||
|
" fileviewer *.jpg,*.png shellpic %c
|
||||||
|
|
||||||
|
" Open all other files with default system programs (you can also remove all
|
||||||
|
" :file[x]type commands above to ensure they don't interfere with system-wide
|
||||||
|
" settings). By default all unknown files are opened with 'vi[x]cmd'
|
||||||
|
" uncommenting one of lines below will result in ignoring 'vi[x]cmd' option
|
||||||
|
" for unknown file types.
|
||||||
|
" For *nix:
|
||||||
|
" filetype * xdg-open
|
||||||
|
" For OS X:
|
||||||
|
" filetype * open
|
||||||
|
" For Windows:
|
||||||
|
" filetype * start, explorer
|
||||||
|
|
||||||
|
" GETTING ICONS TO DISPLAY IN VIFM
|
||||||
|
" You need the next 14 lines!
|
||||||
|
|
||||||
|
" file types
|
||||||
|
set classify=' :dir:/, :exe:, :reg:, :link:'
|
||||||
|
" various file names
|
||||||
|
set classify+=' ::../::, ::*.sh::, ::*.[hc]pp::, ::*.[hc]::, ::/^copying|license$/::, ::.git/,,*.git/::, ::*.epub,,*.fb2,,*.djvu::, ::*.pdf::, ::*.htm,,*.html,,**.[sx]html,,*.xml::'
|
||||||
|
" archives
|
||||||
|
set classify+=' ::*.7z,,*.ace,,*.arj,,*.bz2,,*.cpio,,*.deb,,*.dz,,*.gz,,*.jar,,*.lzh,,*.lzma,,*.rar,,*.rpm,,*.rz,,*.tar,,*.taz,,*.tb2,,*.tbz,,*.tbz2,,*.tgz,,*.tlz,,*.trz,,*.txz,,*.tz,,*.tz2,,*.xz,,*.z,,*.zip,,*.zoo::'
|
||||||
|
" images
|
||||||
|
set classify+=' ::*.bmp,,*.gif,,*.jpeg,,*.jpg,,*.ico,,*.png,,*.ppm,,*.svg,,*.svgz,,*.tga,,*.tif,,*.tiff,,*.xbm,,*.xcf,,*.xpm,,*.xspf,,*.xwd::'
|
||||||
|
" audio
|
||||||
|
set classify+=' ::*.aac,,*.anx,,*.asf,,*.au,,*.axa,,*.flac,,*.m2a,,*.m4a,,*.mid,,*.midi,,*.mp3,,*.mpc,,*.oga,,*.ogg,,*.ogx,,*.ra,,*.ram,,*.rm,,*.spx,,*.wav,,*.wma,,*.ac3::'
|
||||||
|
" media
|
||||||
|
set classify+=' ::*.avi,,*.ts,,*.axv,,*.divx,,*.m2v,,*.m4p,,*.m4v,,.mka,,*.mkv,,*.mov,,*.mp4,,*.flv,,*.mp4v,,*.mpeg,,*.mpg,,*.nuv,,*.ogv,,*.pbm,,*.pgm,,*.qt,,*.vob,,*.wmv,,*.xvid::'
|
||||||
|
" office files
|
||||||
|
set classify+=' ::*.doc,,*.docx::, ::*.xls,,*.xls[mx]::, ::*.pptx,,*.ppt::'
|
||||||
|
|
||||||
|
" ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
" 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
|
||||||
|
|
||||||
|
"Open all images in current directory in sxiv thumbnail mode
|
||||||
|
nnoremap sx :!sxiv -t %d & <cr>
|
||||||
|
|
||||||
|
"Open selected images in gimp
|
||||||
|
nnoremap gp :!gimp %f & <cr>
|
||||||
|
|
||||||
|
" Start shell in current directory
|
||||||
|
nnoremap s :shell<cr>
|
||||||
|
|
||||||
|
" Display sorting dialog
|
||||||
|
nnoremap S :sort<cr>
|
||||||
|
|
||||||
|
" Toggle visibility of preview window
|
||||||
|
nnoremap w :view<cr>
|
||||||
|
vnoremap w :view<cr>gv
|
||||||
|
|
||||||
|
" Open file in the background using its default program
|
||||||
|
nnoremap gb :file &<cr>l
|
||||||
|
|
||||||
|
" Yank current directory path into the clipboard
|
||||||
|
nnoremap yd :!echo %d | xclip %i<cr>
|
||||||
|
|
||||||
|
" Yank current file path into the clipboard
|
||||||
|
nnoremap yf :!echo %c:p | xclip %i<cr>
|
||||||
|
|
||||||
|
" Mappings for faster renaming
|
||||||
|
nnoremap I cw<c-a>
|
||||||
|
nnoremap cc cw<c-u>
|
||||||
|
nnoremap A cw
|
||||||
|
|
||||||
|
" Open console in current directory
|
||||||
|
nnoremap ,t :!xterm &<cr>
|
||||||
|
|
||||||
|
" Open editor to edit vifmrc and apply settings after returning to vifm
|
||||||
|
nnoremap ,c :write | edit $MYVIFMRC | restart<cr>
|
||||||
|
" Open gvim to edit vifmrc
|
||||||
|
nnoremap ,C :!gvim --remote-tab-silent $MYVIFMRC &<cr>
|
||||||
|
|
||||||
|
" Toggle wrap setting on ,w key
|
||||||
|
nnoremap ,w :set wrap!<cr>
|
||||||
|
|
||||||
|
" Example of standard two-panel file managers mappings
|
||||||
|
nnoremap <f3> :!less %f<cr>
|
||||||
|
nnoremap <f4> :edit<cr>
|
||||||
|
nnoremap <f5> :copy<cr>
|
||||||
|
nnoremap <f6> :move<cr>
|
||||||
|
nnoremap <f7> :mkdir<space>
|
||||||
|
nnoremap <f8> :delete<cr>
|
||||||
|
|
||||||
|
" ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
" 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 <left> <nop>
|
||||||
|
|
||||||
|
" 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
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"position": "top",
|
"position": "top",
|
||||||
"height": 30,
|
"height": 44,
|
||||||
"spacing": 3,
|
"spacing": 3,
|
||||||
"layer": "top",
|
"layer": "top",
|
||||||
|
|
||||||
|
@ -28,8 +28,6 @@
|
||||||
|
|
||||||
"sway/language": {
|
"sway/language": {
|
||||||
"format": "{} \udb80\udf0c",
|
"format": "{} \udb80\udf0c",
|
||||||
"format-us": "US",
|
|
||||||
"format-es": "ES",
|
|
||||||
},
|
},
|
||||||
|
|
||||||
"sway/mode": {
|
"sway/mode": {
|
||||||
|
@ -39,7 +37,7 @@
|
||||||
"sway/scratchpad": {
|
"sway/scratchpad": {
|
||||||
"format": "{icon} {count}",
|
"format": "{icon} {count}",
|
||||||
"show-empty": false,
|
"show-empty": false,
|
||||||
"format-icons": ["", ""],
|
"format-icons": ["", "\uf2d2"],
|
||||||
"tooltip": true,
|
"tooltip": true,
|
||||||
"tooltip-format": "{app}: {title}"
|
"tooltip-format": "{app}: {title}"
|
||||||
},
|
},
|
||||||
|
@ -66,13 +64,15 @@
|
||||||
"format-alt": "{time} {icon}",
|
"format-alt": "{time} {icon}",
|
||||||
"format-critical": "{capacity}% {icon}\udb84\ude38",
|
"format-critical": "{capacity}% {icon}\udb84\ude38",
|
||||||
"format-warning": "{capacity}% {icon}\udb84\ude38",
|
"format-warning": "{capacity}% {icon}\udb84\ude38",
|
||||||
"format-icons": ["\udb80\udc7a", "\udb80\udc7c", "\udb80\udc7e", "\udb80\udc80", "\udb80\udc79"]
|
"format-icons": ["\udb80\udc7a", "\udb80\udc7c", "\udb80\udc7e", "\udb80\udc80", "\udb80\udc79"],
|
||||||
|
"on-click": "$HOME/.local/bin/rs_power"
|
||||||
},
|
},
|
||||||
|
|
||||||
"custom/powerprofiles": {
|
"custom/powerprofiles": {
|
||||||
"exec": "bash $HOME/.config/waybar/power-profiles",
|
"exec": "bash $HOME/.config/waybar/power-profiles",
|
||||||
"restart-interval": 5,
|
"restart-interval": 5,
|
||||||
"format": "{}",
|
"format": "{}",
|
||||||
|
"on-click": "$HOME/.local/bin/rs_power"
|
||||||
},
|
},
|
||||||
|
|
||||||
"pulseaudio": {
|
"pulseaudio": {
|
||||||
|
@ -100,6 +100,7 @@
|
||||||
"format-wifi": "{essid} \udb81\udda9",
|
"format-wifi": "{essid} \udb81\udda9",
|
||||||
"format-ethernet": "{ipaddr}/{cidr} \udb80\ude00",
|
"format-ethernet": "{ipaddr}/{cidr} \udb80\ude00",
|
||||||
"format-disconnected": "Disconnected \udb81\uddaa",
|
"format-disconnected": "Disconnected \udb81\uddaa",
|
||||||
"format-alt": "{ifname}: {ipaddr}/{cidr}"
|
"format-alt": "{ifname}: {ipaddr}/{cidr}",
|
||||||
|
"on-click": "$HOME/.local/bin/rs_wifi"
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ button:hover {
|
||||||
|
|
||||||
#workspaces {
|
#workspaces {
|
||||||
font-family: Symbols Nerd Font Mono;
|
font-family: Symbols Nerd Font Mono;
|
||||||
font-size: 14px;
|
font-size: 18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#workspaces button {
|
#workspaces button {
|
||||||
|
@ -78,7 +78,7 @@ button:hover {
|
||||||
#language,
|
#language,
|
||||||
#mode {
|
#mode {
|
||||||
font-family: Symbols Nerd Font Mono, mononoki Nerd Font;
|
font-family: Symbols Nerd Font Mono, mononoki Nerd Font;
|
||||||
font-size: 14px;
|
font-size: 16px;
|
||||||
padding: 0 8px;
|
padding: 0 8px;
|
||||||
color: #ebdbb2;
|
color: #ebdbb2;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,9 @@ return {
|
||||||
weight = 'Medium'
|
weight = 'Medium'
|
||||||
},
|
},
|
||||||
color_scheme = 'Gruvbox dark, hard (base16)',
|
color_scheme = 'Gruvbox dark, hard (base16)',
|
||||||
default_prog = { '/usr/bin/bash' },
|
default_prog = { '/usr/bin/fish' },
|
||||||
default_cursor_style = "BlinkingUnderline",
|
default_cursor_style = "BlinkingUnderline",
|
||||||
font_size = 12,
|
font_size = 14,
|
||||||
check_for_updates = false,
|
check_for_updates = false,
|
||||||
use_dead_keys = false,
|
use_dead_keys = false,
|
||||||
warn_about_missing_glyphs = false,
|
warn_about_missing_glyphs = false,
|
||||||
|
@ -29,5 +29,5 @@ return {
|
||||||
exit_behavior = "Close",
|
exit_behavior = "Close",
|
||||||
window_close_confirmation = 'NeverPrompt',
|
window_close_confirmation = 'NeverPrompt',
|
||||||
tab_bar_at_bottom = false,
|
tab_bar_at_bottom = false,
|
||||||
window_background_opacity = 0.9,
|
window_background_opacity = 0.98,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue