diff --git a/user/.bashrc b/user/.bashrc index 7e4a9d89e..3097b224a 100644 --- a/user/.bashrc +++ b/user/.bashrc @@ -190,8 +190,8 @@ alias \ # file management alias \ - fm="ranger" \ - flm="ranger" \ + fm="vifm" \ + flm="vifm" \ rm="rm -vI" \ mv="mv -iv" \ cp="cp -iv" \ @@ -228,64 +228,5 @@ alias \ wfi-off="nmcli radio wifi off" \ blt="bluetoothctl" -# 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 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 +# starship prompt +eval "$(starship init bash)" diff --git a/user/.config/btop/btop.conf b/user/.config/btop/btop.conf index c1669d15c..81284d1f5 100644 --- a/user/.config/btop/btop.conf +++ b/user/.config/btop/btop.conf @@ -50,7 +50,7 @@ graph_symbol_proc = "default" shown_boxes = "cpu mem net proc" #* 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", #* "cpu lazy" sorts top process over time (easier to follow), "cpu direct" updates top process directly. diff --git a/user/.config/fish/config.fish b/user/.config/fish/config.fish new file mode 100644 index 000000000..247deedda --- /dev/null +++ b/user/.config/fish/config.fish @@ -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 diff --git a/user/.config/fuzzel/fuzzel.ini b/user/.config/fuzzel/fuzzel.ini index 167125819..e7a0ba070 100644 --- a/user/.config/fuzzel/fuzzel.ini +++ b/user/.config/fuzzel/fuzzel.ini @@ -5,16 +5,19 @@ icons-enabled=yes password-character=* fuzzy=yes terminal=wezterm start -lines=15 -width=45 -layer = top -exit-on-keyboard-focus-loss = yes +lines=20 +width=70 +inner-pad=12 +vertical-pad=12 +horizontal-pad=12 +layer= top +exit-on-keyboard-focus-loss=yes [colors] background=1d2021ff text=ebdbb2ff match=8ec07cff -selection-match=b8bb26ff +selection-match=1d2021ff selection=cc241dff selection-text=ebdbb2ff border=cc241dff diff --git a/user/.config/gtk-3.0/bookmarks b/user/.config/gtk-3.0/bookmarks new file mode 100644 index 000000000..e69de29bb diff --git a/user/.config/lvim/config.lua b/user/.config/lvim/config.lua index 033aa60a6..64523b530 100644 --- a/user/.config/lvim/config.lua +++ b/user/.config/lvim/config.lua @@ -1,5 +1,5 @@ -- 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_input_macos_alt_is_meta = true vim.g.neovide_hide_mouse_when_typing = false @@ -21,10 +21,10 @@ vim.g.neovide_padding_left = 0 -- Helper function for transparency formatting 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 -vim.g.neovide_transparency = 0.9 -vim.g.transparency = 0.9 +vim.g.neovide_transparency = 0.98 +vim.g.transparency = 0.98 vim.g.neovide_background_color = "#1d2021" .. alpha() -- nvim options diff --git a/user/.config/mako/config b/user/.config/mako/config index 5d8ef838b..384f51f0c 100644 --- a/user/.config/mako/config +++ b/user/.config/mako/config @@ -11,13 +11,13 @@ font=Mononoki Nerd Font 12 background-color=#282828 border-color=#cc241d text-color=#ebdbb2 -width=300 -height=100 +width=450 +height=130 margin=10 padding=15 border-size=2 icons=1 -max-icon-size=128 +max-icon-size=32 icon-location=left markup=1 actions=1 diff --git a/user/.config/ranger/commands.py b/user/.config/ranger/commands.py deleted file mode 100644 index 6d96e5d56..000000000 --- a/user/.config/ranger/commands.py +++ /dev/null @@ -1 +0,0 @@ -from ranger_udisk_menu.mounter import mount diff --git a/user/.config/ranger/ranger_udisk_menu/menu.py b/user/.config/ranger/ranger_udisk_menu/menu.py deleted file mode 100644 index d3d390e52..000000000 --- a/user/.config/ranger/ranger_udisk_menu/menu.py +++ /dev/null @@ -1,243 +0,0 @@ -#!/usr/bin/python3 -# coding: utf-8 -# License: The MIT License -# Author: Alexander Lutsai -# 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) diff --git a/user/.config/ranger/ranger_udisk_menu/mounter.py b/user/.config/ranger/ranger_udisk_menu/mounter.py deleted file mode 100644 index d7573df8d..000000000 --- a/user/.config/ranger/ranger_udisk_menu/mounter.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/python3 -# coding: utf-8 -# License: The MIT License -# Author: Alexander Lutsai -# 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) diff --git a/user/.config/ranger/rc.conf b/user/.config/ranger/rc.conf deleted file mode 100644 index b33e82b4d..000000000 --- a/user/.config/ranger/rc.conf +++ /dev/null @@ -1,4 +0,0 @@ -set preview_images true -set preview_images_method iterm2 -set column_ratios 3,4 -set viewmode miller diff --git a/user/.config/ranger/rifle.conf b/user/.config/ranger/rifle.conf deleted file mode 100644 index 86f53fd10..000000000 --- a/user/.config/ranger/rifle.conf +++ /dev/null @@ -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: -# , , ... = 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 | The regexp matches $1 -# ext | The regexp matches the extension of $1 -# mime | The regexp matches the mime type of $1 -# name | The regexp matches the basename of $1 -# path | The regexp matches the absolute path of $1 -# has | The program is installed (i.e. located in $PATH) -# env | The environment variable "variable" is non-empty -# file | $1 is a file -# directory | $1 is a directory -# number | 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 | Change how the program is run. See below. -# label