diff options
| author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-02-02 02:13:40 +0100 | 
|---|---|---|
| committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-02-02 02:13:40 +0100 | 
| commit | e9752056b6eb824b85854e20dadac31c197cd235 (patch) | |
| tree | f60f7ba21b8bdfcfadb7f504679a9b13daa343e0 /config | |
| parent | ca0cec60dacc4e8c6f8f37e0605b72bac54c9ea6 (diff) | |
| parent | 541d9fa7014c5c197f7c8a09fa159ac84bd9a6a8 (diff) | |
Merge branch 'main' of debuc.com:dotfiles
Diffstat (limited to 'config')
25 files changed, 658 insertions, 342 deletions
diff --git a/config/X/x11/xinitrc b/config/X/x11/xinitrc index e5c07cc..3f18e40 100755 --- a/config/X/x11/xinitrc +++ b/config/X/x11/xinitrc @@ -25,6 +25,7 @@ feh --no-fehbg --bg-scale ~/pics/wallpaper  setxkbmap us -option ctrl:swapcaps,altwin:menu_win -variant colemak  # xautolock -locker slock &  gammastep -m randr & +dunst &  slstatus &  emacs --daemon &  eval "$(keychain --dir "$XDG_CONFIG_HOME/keychain" --eval --quiet --agents gpg,ssh)" diff --git a/config/common/mpd/.gitignore b/config/common/mpd/.gitignore new file mode 100644 index 0000000..6f196ac --- /dev/null +++ b/config/common/mpd/.gitignore @@ -0,0 +1,2 @@ +pid +database
\ No newline at end of file diff --git a/config/common/mpv/.gitignore b/config/common/mpv/.gitignore new file mode 100644 index 0000000..36aafa7 --- /dev/null +++ b/config/common/mpv/.gitignore @@ -0,0 +1,3 @@ +.gitignore +watch_later +playfile.txt
\ No newline at end of file diff --git a/config/common/mpv/input.conf b/config/common/mpv/input.conf index 7e8c13c..7fc1c12 100644 --- a/config/common/mpv/input.conf +++ b/config/common/mpv/input.conf @@ -183,22 +183,33 @@ q quit-watch-later  Alt+l cycle-values loop-file "inf" "no"    # toggle infinite looping -# seeking +# Seeking  H add chapter -1  L add chapter 1  h seek -5  l seek 5  - seek -60  = seek 60 +RIGHT seek 2 exact +LEFT seek -2 exact +UP seek 2 keyframes +DOWN seek -2 keyframes + +# Speed +] add speed 0.5 +[ add speed -0.5 +} add speed 0.25 +{ add speed -0.25 +\ set speed 1 +  # Add/Decrease volume  j add volume -5   k add volume 5   # Subtitles -c cycle sub                             # switch subtitle track up-order -C cycle sub down                        # switch subtitle track down-order -Alt+c cycle sub-visibility              # Toggle subtitles +S cycle sub                             # switch subtitle track up-order +ctrl+s cycle sub-visibility              # Toggle subtitles  # Cycle audio tracks  v cycle audio                           # switch audio track @@ -208,4 +219,6 @@ ctrl+l cycle-values loop-file "inf" "no"    # toggle infinite looping  # Keep open after exit  P cycle keep-open up -K script-message osc-chapterlist
\ No newline at end of file +# OSC +K script-message osc-chapterlist +BS script-binding osc/visibility
\ No newline at end of file diff --git a/config/common/mpv/mpv.conf b/config/common/mpv/mpv.conf index 25f4cd2..1fd96da 100755 --- a/config/common/mpv/mpv.conf +++ b/config/common/mpv/mpv.conf @@ -1,5 +1,4 @@  profile=gpu-hq -  # Set OSD font  osd-font='monospace'  # Set OSD font size @@ -13,6 +12,8 @@ volume-max=100  # Set max streaming quality as 1080p.  ytdl-format=bestvideo[height<=?1080]+bestaudio/best  +# get vp9 out +ytdl-raw-options=extractor-args="youtube:player-client=android"  # Default demuxer is 150/75 MB, note that this uses RAM so set a reasonable amount.  # 150MB, Max pre-load for network streams (1 MiB = 1048576 Bytes). @@ -29,4 +30,5 @@ stop-screensaver=yes  slang=eng, en, english  alang=jpn -screenshot-directory=~/pics/screenshots +screenshot-directory=~/pics/screenshots/mpv +screenshot-template="%F - [%P]v%#01n" diff --git a/config/common/mpv/scripts/mpv-cut/README.org b/config/common/mpv/scripts/mpv-cut/README.org new file mode 100644 index 0000000..02540b0 --- /dev/null +++ b/config/common/mpv/scripts/mpv-cut/README.org @@ -0,0 +1,20 @@ +[[https://github.com/familyfriendlymikey/mpv-cut][mpv-cut]] + +* Files +|------------+---------------| +| file       | what          | +|------------+---------------| +| ~config.lua~ | configuration | +| ~.book~      | bookmarks     | +| ~.list~      | backup        | +|------------+---------------| + +* Actions +|---+--------------------------------------------| +| ~c~ | START/END cut                              | +| ~C~ | cancel cut                                 | +| ~a~ | cycle actions                              | +| ~i~ | bookmark timestamp to ~.list~ (+add chapter) | +| ~-~ | decrement channel +| ~=~ | increment channel                          | + diff --git a/config/common/mpv/scripts/mpv-cut/config.lua b/config/common/mpv/scripts/mpv-cut/config.lua new file mode 100644 index 0000000..4639cb7 --- /dev/null +++ b/config/common/mpv/scripts/mpv-cut/config.lua @@ -0,0 +1,19 @@ +-- Key config +KEY_CUT = "c" +KEY_CANCEL_CUT = "C" +KEY_CYCLE_ACTION = "a" +KEY_BOOKMARK_ADD = "i" +KEY_CHANNEL_INC = "=" +KEY_CHANNEL_DEC = "-" + +-- The list of channel names, you can choose whatever you want. +CHANNEL_NAMES[1] = "FUNNY" + +-- The default channel +CHANNEL = 1 + +-- The default action +ACTION = "COPY" + +-- Delete a default action +ACTIONS.LIST = nil
\ No newline at end of file diff --git a/config/common/mpv/scripts/mpv-cut/main.lua b/config/common/mpv/scripts/mpv-cut/main.lua new file mode 100644 index 0000000..7db65aa --- /dev/null +++ b/config/common/mpv/scripts/mpv-cut/main.lua @@ -0,0 +1,278 @@ +mp.msg.info("MPV-CUT LOADED") + +utils = require "mp.utils" + +local function print(s) +	mp.msg.info(s) +	mp.osd_message(s) +end + +local function table_to_str(o) +	if type(o) == 'table' then +		local s = '' +		for k,v in pairs(o) do +			if type(k) ~= 'number' then k = '"'..k..'"' end +			s = s .. '['..k..'] = ' .. table_to_str(v) .. '\n' +		end +		return s +	else +		return tostring(o) +	end +end + +local function to_hms(seconds) +	local ms = math.floor((seconds - math.floor(seconds)) * 1000) +	local secs = math.floor(seconds) +	local mins = math.floor(secs / 60) +	secs = secs % 60 +	local hours = math.floor(mins / 60) +	mins = mins % 60 +	return string.format("%02d-%02d-%02d-%03d", hours, mins, secs, ms) +end + +local function next_table_key(t, current) +	local keys = {} +	for k in pairs(t) do +		keys[#keys + 1] = k +	end +	table.sort(keys) +	for i = 1, #keys do +		if keys[i] == current then +			return keys[(i % #keys) + 1] +		end +	end +	return keys[1] +end + +ACTIONS = {} + +ACTIONS.COPY = function(d) +	local args = { +		"ffmpeg", +		"-nostdin", "-y", +		"-loglevel", "error", +		"-ss", d.start_time, +		"-t", d.duration, +		"-i", d.inpath, +		"-c", "copy", +		"-map", "0", +		"-dn", +		"-avoid_negative_ts", "make_zero", +		utils.join_path(d.indir, "COPY_" .. d.channel .. "_" .. d.infile_noext .. "_FROM_" .. d.start_time_hms .. "_TO_" .. d.end_time_hms .. d.ext) +	} +	mp.command_native_async({ +		name = "subprocess", +		args = args, +		playback_only = false, +	}, function() print("Done") end) +end + +ACTIONS.ENCODE = function(d) +	local args = { +		"ffmpeg", +		"-nostdin", "-y", +		"-loglevel", "error", +		"-ss", d.start_time, +		"-t", d.duration, +		"-i", d.inpath, +		"-pix_fmt", "yuv420p", +		"-crf", "16", +		"-preset", "superfast", +		utils.join_path(d.indir, "ENCODE_" .. d.channel .. "_" .. d.infile_noext .. "_FROM_" .. d.start_time_hms .. "_TO_" .. d.end_time_hms .. d.ext) +	} +	mp.command_native_async({ +		name = "subprocess", +		args = args, +		playback_only = false, +	}, function() print("Done") end) +end + +ACTIONS.LIST = function(d) +	local inpath = mp.get_property("path") +	local outpath = inpath .. ".list" +	local file = io.open(outpath, "a") +	if not file then print("Error writing to cut list") return end +	local filesize = file:seek("end") +	local s = "\n" .. d.channel +		.. ":" .. d.start_time +		.. ":" .. d.end_time +	file:write(s) +	local delta = file:seek("end") - filesize +	io.close(file) +	print("Δ " .. delta) +end + +ACTION = "COPY" + +CHANNEL = 1 + +CHANNEL_NAMES = {} + +KEY_CUT = "c" +KEY_CANCEL_CUT = "C" +KEY_CYCLE_ACTION = "a" +KEY_BOOKMARK_ADD = "i" +KEY_CHANNEL_INC = "=" +KEY_CHANNEL_DEC = "-" + +home_config = mp.command_native({"expand-path", "~/.config/mpv-cut/config.lua"}) +if pcall(require, "config") then +    mp.msg.info("Loaded config file from script dir") +elseif pcall(dofile, home_config) then +    mp.msg.info("Loaded config file from " .. home_config) +else +    mp.msg.info("No config loaded") +end + +for i, v in ipairs(CHANNEL_NAMES) do +    CHANNEL_NAMES[i] = string.gsub(v, ":", "-") +end + +if not ACTIONS[ACTION] then ACTION = next_table_key(ACTIONS, nil) end + +START_TIME = nil + +local function get_current_channel_name() +	return CHANNEL_NAMES[CHANNEL] or tostring(CHANNEL) +end + +local function get_data() +	local d = {} +	d.inpath = mp.get_property("path") +	d.indir = utils.split_path(d.inpath) +	d.infile = mp.get_property("filename") +	d.infile_noext = mp.get_property("filename/no-ext") +	d.ext = mp.get_property("filename"):match("^.+(%..+)$") or ".mp4" +	d.channel = get_current_channel_name() +	return d +end + +local function get_times(start_time, end_time) +	local d = {} +	d.start_time = tostring(start_time) +	d.end_time = tostring(end_time) +	d.duration = tostring(end_time - start_time) +	d.start_time_hms = tostring(to_hms(start_time)) +	d.end_time_hms = tostring(to_hms(end_time)) +	d.duration_hms = tostring(to_hms(end_time - start_time)) +	return d +end + +text_overlay = mp.create_osd_overlay("ass-events") +text_overlay.hidden = true +text_overlay:update() + +local function text_overlay_off() +	-- https://github.com/mpv-player/mpv/issues/10227 +	text_overlay:update() +	text_overlay.hidden = true +	text_overlay:update() +end + +local function text_overlay_on() +	local channel = get_current_channel_name() +	text_overlay.data = string.format("%s in %s from %s", ACTION, channel, START_TIME) +	text_overlay.hidden = false +	text_overlay:update() +end + +local function print_or_update_text_overlay(content) +	if START_TIME then text_overlay_on() else print(content) end +end + +local function cycle_action() +	ACTION = next_table_key(ACTIONS, ACTION) +	print_or_update_text_overlay("ACTION: " .. ACTION) +end + +local function cut(start_time, end_time) +	local d = get_data() +	local t = get_times(start_time, end_time) +	for k, v in pairs(t) do d[k] = v end +	mp.msg.info(ACTION) +	mp.msg.info(table_to_str(d)) +	ACTIONS[ACTION](d) +end + +local function put_time() +	local time = mp.get_property_number("time-pos") +	if not START_TIME then +		START_TIME = time +		text_overlay_on() +		return +	end +	text_overlay_off() +	if time > START_TIME then +		cut(START_TIME, time) +		START_TIME = nil +	else +		print("INVALID") +		START_TIME = nil +	end +end + +local function cancel_cut() +	text_overlay_off() +	START_TIME = nil +	print("CANCELLED CUT") +end + +local function get_bookmark_file_path() +	local d = get_data() +	mp.msg.info(table_to_str(d)) +	local outfile = string.format("%s_%s.book", d.channel, d.infile) +	return utils.join_path(d.indir, outfile) +end + +local function bookmarks_load() +	local inpath = get_bookmark_file_path() +	local file = io.open(inpath, "r") +	if not file then return end +	local arr = {} +	for line in file:lines() do +		if tonumber(line) then +			table.insert(arr, { +				time = tonumber(line), +				title = "chapter_" .. line +			}) +		end +	end +	file:close() +	table.sort(arr, function(a, b) return a.time < b.time end) +	mp.set_property_native("chapter-list", arr) +end + +local function bookmark_add() +	local d = get_data() +	local outpath = get_bookmark_file_path() +	local file = io.open(outpath, "a") +	if not file then print("Failed to open bookmark file for writing") return end +	local out_string = mp.get_property_number("time-pos") .. "\n" +	local filesize = file:seek("end") +	file:write(out_string) +	local delta = file:seek("end") - filesize +	io.close(file) +	bookmarks_load() +	print(string.format("Δ %s, %s", delta, d.channel)) +end + +local function channel_inc() +	CHANNEL = CHANNEL + 1 +	bookmarks_load() +	print_or_update_text_overlay(get_current_channel_name()) +end + +local function channel_dec() +	if CHANNEL >= 2 then CHANNEL = CHANNEL - 1 end +	bookmarks_load() +	print_or_update_text_overlay(get_current_channel_name()) +end + +mp.add_key_binding(KEY_CUT, "cut", put_time) +mp.add_key_binding(KEY_CANCEL_CUT, "cancel_cut", cancel_cut) +mp.add_key_binding(KEY_BOOKMARK_ADD, "bookmark_add", bookmark_add) +mp.add_key_binding(KEY_CHANNEL_INC, "channel_inc", channel_inc) +mp.add_key_binding(KEY_CHANNEL_DEC, "channel_dec", channel_dec) +mp.add_key_binding(KEY_CYCLE_ACTION, "cycle_action", cycle_action) + +mp.register_event('file-loaded', bookmarks_load) diff --git a/config/common/mpv/scripts/mpv-cut/utils b/config/common/mpv/scripts/mpv-cut/utils new file mode 100644 index 0000000..b64ca8e --- /dev/null +++ b/config/common/mpv/scripts/mpv-cut/utils @@ -0,0 +1,44 @@ +#! /usr/bin/env bash + +mcc() { +	local list=( *.list ) +	if [[ ${#list[@]} -ne 1 ]]; then +		echo "Number of .list files in cwd must be exactly 1, exiting." +		return 1 +	fi +	make_cuts "$list" "$@" +	concat CUT -c copy "CONCAT_${list%.*}" +} + +concat() { +	local prefix="$1" +	shift +	ffmpeg -f concat -safe 0 -i <(printf 'file %q\n' "$PWD"/"$prefix"*) "$@" +} + +make_cuts() { +	local list="$1" +	local vid="${list%.*}" +	local ext="${vid##*.}" +	local vid_noext="${vid%.*}" +	local start_ts_hms +	local end_ts_hms +	shift +	while IFS=: read -r channel_name start_ts end_ts || [[ -n "$channel_name" ]]; do +		if [[ -z "$end_ts" ]]; then continue; fi +		start_ts_hms="$(_mpv_cut_to_hms "$start_ts")" +		end_ts_hms="$(_mpv_cut_to_hms "$end_ts")" +		echo "$channel_name" "$start_ts" "$end_ts" +		ffmpeg -nostdin -ss "$start_ts" -to "$end_ts" -i "$vid" "$@" "CUT_${channel_name}_${vid_noext}_${start_ts_hms}_${end_ts_hms}.${ext}" +	done < "$list" +} + +_mpv_cut_to_hms() { +	local total_seconds="$1" +	local hours=$(( ${total_seconds%.*} / 3600 )) +	local minutes=$(( (${total_seconds%.*} % 3600) / 60 )) +	local seconds=$(( ${total_seconds%.*} % 60 )) +	local ms +	ms=$(printf "%.0f" "$(echo "($total_seconds - ${total_seconds%.*}) * 1000" | bc)") +	printf "%02d-%02d-%02d-%03d\n" $hours $minutes $seconds "$ms" +} diff --git a/config/essentials/shell/aliases.sh b/config/essentials/shell/aliases.sh index 99c49d8..950cea7 100644 --- a/config/essentials/shell/aliases.sh +++ b/config/essentials/shell/aliases.sh @@ -2,7 +2,7 @@  # s/alias \([^-]\)/alias -g \1  # The most important one -alias vi='emacsclient -nw' +alias vi='nvim'  # Zsh specific aliases  if [ $SHELL = "/bin/zsh" ] @@ -77,7 +77,7 @@ alias lst2='ls --tree -L2'  alias lst3='ls --tree -L3'  alias ls.='ls -dl .*'  which exa >/dev/null 2>&1 && -	alias ls='exa --sort extension --group-directories-first' || +	alias ls='exa --sort extension --group-directories-first --no-time --git' ||  	alias ls='ls --color --group-directories-first --sort=extension'  # pacman aliases @@ -126,6 +126,7 @@ alias nvn='nvim "+Telekasten panel"'  alias xrandr-rpgmaker='xrandr --auto --output VGA-1 --mode 1024x768 --left-of HDMI-1 && ~/.fehbg'  alias xrandr-default='xrandr --auto --output VGA-1 --mode 1920x1080 --left-of HDMI-1 --output HDMI-1 --mode 1920x1080 && ~/.fehbg' +alias xrhdmi='xrandr --auto --output HDMI-4 --left-of DP-1-2'  alias d='du -d 0 -h'  alias dud='du .* * -d 0 -h 2>/dev/null | sort -h' @@ -310,192 +311,9 @@ alias dbadd='ssh db dladd "'\''$(clipo)'\''"'  alias dbcons='ssh -t db dlcons'  alias dbinf='ssh db dlinfo'  alias sshdb='ssh -t db "tmux a || tmux"' -alias dbsmu='rsync -aPz db:/media/basilisk/music/ /media/kilimanjaro/music' +alias dbsmu='rsync -rlpP db:/media/basilisk/music/ /media/kilimanjaro/music'  # oh-my-zsh git aliases  alias config='GIT_WORK_TREE=~/src/dotfiles/ GIT_DIR=~/src/dotfiles/.git'  alias cfg='vi ~/src/dotfiles/"$(config git ls-files | fzf || exit)"'  alias gmod='git status --short | sed '\''/^\s*M/!d;s/^\s*M\s*//'\'' | fzf | xargs vi' -alias g='git' -alias ga='git add' -alias gaa='git add --all' -alias gapa='git add --patch' -alias gau='git add --update' -alias gav='git add --verbose' -alias gap='git apply' -alias gapt='git apply --3way' -alias gb='git branch' -alias gba='git branch --all' -alias gbd='git branch --delete' -alias gbda='git branch --no-color --merged | command grep -vE "^([+*]|\s*($(git_main_branch)|$(git_develop_branch))\s*$)" | command xargs git branch --delete 2>/dev/null' -alias gbD='git branch --delete --force' -alias gbg='git branch -vv | grep ": gone\]"' -alias gbgd='local res=$(gbg | awk '"'"'{print $1}'"'"') && [[ $res ]] && echo $res | xargs git branch -d' -alias gbgD='local res=$(gbg | awk '"'"'{print $1}'"'"') && [[ $res ]] && echo $res | xargs git branch -D' -alias gbl='git blame -b -w' -alias gbnm='git branch --no-merged' -alias gbr='git branch --remote' -alias gbs='git bisect' -alias gbsb='git bisect bad' -alias gbsg='git bisect good' -alias gbsr='git bisect reset' -alias gbss='git bisect start' -alias gc='git commit --verbose' -alias gc!='git commit --verbose --amend' -alias gcn!='git commit --verbose --no-edit --amend' -alias gca='git commit --verbose --all' -alias gca!='git commit --verbose --all --amend' -alias gcan!='git commit --verbose --all --no-edit --amend' -alias gcans!='git commit --verbose --all --signoff --no-edit --amend' -alias gcam='git commit --all --message' -alias gcsm='git commit --signoff --message' -alias gcas='git commit --all --signoff' -alias gcasm='git commit --all --signoff --message' -alias gcb='git checkout -b' -alias gcf='git config --list' -alias gcl='git clone' -alias gclc='git clone "$(clipo)"' -alias gclr='git clone --recurse-submodules' -alias gc1='git clone --depth 1' -alias gclean='git clean --interactive -d' -alias gpristine='git reset --hard && git clean --force -dfx' -alias grsf='git reset --soft HEAD~' -alias gcm='git checkout $(git_main_branch)' -alias gcd='git checkout $(git_develop_branch)' -alias gcmsg='git commit --message' -alias gco='git checkout' -alias gcor='git checkout --recurse-submodules' -alias gcount='git shortlog --summary --numbered' -alias gcp='git cherry-pick' -alias gcpa='git cherry-pick --abort' -alias gcpc='git cherry-pick --continue' -alias gcs='git commit --gpg-sign' -alias gcss='git commit --gpg-sign --signoff' -alias gcssm='git commit --gpg-sign --signoff --message' -alias gd='git diff' -alias gdca='git diff --cached' -alias gdcw='git diff --cached --word-diff' -alias gdct='git describe --tags $(git rev-list --tags --max-count=1)' -alias gds='git diff --staged' -alias gdt='git diff-tree --no-commit-id --name-only -r' -alias gdup='git diff @{upstream}' -alias gdw='git diff --word-diff' -alias gdl='git diff HEAD^ HEAD' -alias gf='git fetch' -alias gfo='git fetch origin' -alias gfg='git ls-files | grep' -alias gg='git gui citool' -alias gga='git gui citool --amend' -alias ggpur='ggu' -alias ggpull='git pull origin "$(git_current_branch)"' -alias ggpush='git push origin "$(git_current_branch)"' -alias ggsup='git branch --set-upstream-to=origin/$(git_current_branch)' -alias gpsup='git push --set-upstream origin $(git_current_branch)' -alias ghh='git help' -alias gignore='git update-index --assume-unchanged' -alias gignored='git ls-files -v | grep "^[[:lower:]]"' -alias git-svn-dcommit-push='git svn dcommit && git push github $(git_main_branch):svntrunk' -alias gk='\gitk --all --branches &!' -alias gke='\gitk --all $(git log --walk-reflogs --pretty=%h) &!' -alias gl='git pull' -alias glg='git log --stat' -alias glgp='git log --stat --patch' -alias glgg='git log --graph' -alias glgga='git log --graph --decorate --all' -alias glgm='git log --graph --max-count=10' -alias glo='git log --oneline --decorate' -alias glol="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset'" -alias glols="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset' --stat" -alias glod="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset'" -alias glods="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --date=short" -alias glola="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset' --all" -alias glog='git log --oneline --decorate --graph' -alias gloga='git log --oneline --decorate --graph --all' -alias glp="_git_log_prettily" -alias gm='git merge' -alias gmom='git merge origin/$(git_main_branch)' -alias gmtl='git mergetool --no-prompt' -alias gmtlvim='git mergetool --no-prompt --tool=vimdiff' -alias gmum='git merge upstream/$(git_main_branch)' -alias gma='git merge --abort' -alias gp='git push' -alias gpd='git push --dry-run' -alias gpf!='git push --force' -alias gpoat='git push origin --all && git push origin --tags' -alias gpod='git push origin --delete' -alias gpr='git pull --rebase' -alias gpu='git push upstream' -alias gpv='git push --verbose' -alias gr='git remote' -alias gra='git remote add' -alias grb='git rebase' -alias grba='git rebase --abort' -alias grbc='git rebase --continue' -alias grbd='git rebase $(git_develop_branch)' -alias grbi='git rebase --interactive' -alias grbm='git rebase $(git_main_branch)' -alias grbom='git rebase origin/$(git_main_branch)' -alias grbo='git rebase --onto' -alias grbs='git rebase --skip' -alias grev='git revert' -alias grh='git reset' -alias grhh='git reset --hard' -alias groh='git reset origin/$(git_current_branch) --hard' -alias grm='git rm' -alias grmc='git rm --cached' -alias grmv='git remote rename' -alias grrm='git remote remove' -alias grs='git restore' -alias grset='git remote set-url' -alias grss='git restore --source' -alias grst='git restore --staged' -alias grt='cd "$(git rev-parse --show-toplevel || echo .)"' -alias gru='git reset --' -alias grup='git remote update' -alias grv='git remote --verbose' -alias gsb='git status --short --branch' -alias gsd='git svn dcommit' -alias gsh='git show' -alias gsi='git submodule init' -alias gsps='git show --pretty=short --show-signature' -alias gsr='git svn rebase' -alias gss='git status --short' -alias gst='git status' -alias gstaa='git stash apply' -alias gstc='git stash clear' -alias gstd='git stash drop' -alias gstl='git stash list' -alias gstp='git stash pop' -alias gsts='git stash show --text' -alias gstu='gsta --include-untracked' -alias gstall='git stash --all' -alias gsu='git submodule update' -alias gsw='git switch' -alias gswc='git switch --create' -alias gswm='git switch $(git_main_branch)' -alias gswd='git switch $(git_develop_branch)' -alias gts='git tag --sign' -alias gtv='git tag | sort -V' -alias gtl='gtl(){ git tag --sort=-v:refname -n --list "${1}*" }; noglob gtl' -alias gunignore='git update-index --no-assume-unchanged' -alias gunwip='git log --max-count=1 | grep -q -c "\--wip--" && git reset HEAD~1' -alias gup='git pull --rebase' -alias gupv='git pull --rebase --verbose' -alias gupa='git pull --rebase --autostash' -alias gupav='git pull --rebase --autostash --verbose' -alias gupom='git pull --rebase origin $(git_main_branch)' -alias gupomi='git pull --rebase=interactive origin $(git_main_branch)' -alias glum='git pull upstream $(git_main_branch)' -alias gluc='git pull upstream $(git_current_branch)' -alias gwch='git whatchanged -p --abbrev-commit --pretty=medium' -alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign --message "--wip-- [skip ci]"' -alias gwt='git worktree' -alias gwta='git worktree add' -alias gwtls='git worktree list' -alias gwtmv='git worktree move' -alias gwtrm='git worktree remove' -alias gam='git am' -alias gamc='git am --continue' -alias gams='git am --skip' -alias gama='git am --abort' -alias gamscp='git am --show-current-patch' diff --git a/config/essentials/shell/functions.sh b/config/essentials/shell/functions.sh index b699a86..d303fb8 100644 --- a/config/essentials/shell/functions.sh +++ b/config/essentials/shell/functions.sh @@ -63,6 +63,7 @@ dgo() { cd "$(goo d ~ | fzf --filter "$@" | head -n 1)"; }  open() { $EDITOR "$(goo f ~ | fzf --filter "$@" | head -n 1)"; }  pkbs() { doas pacman -Sy "$(pkgfile -b "$1" | tee /dev/stderr)"; }  oclip() { printf "\033]52;c;$(printf '%s' "$@" | base64)\a"; } +oclipp() { printf "]52;c$(cat | base64)"; }  sms() { ssh -t phone sendmsg "$1" "'$2'"; }  trcp() { scp "$1" db:/media/basilisk/downloads/transmission/torrents/; }  rln() { ln -s "$(readlink -f "$1")" "$2"; } diff --git a/config/essentials/starship.toml b/config/essentials/starship.toml new file mode 100644 index 0000000..5934cca --- /dev/null +++ b/config/essentials/starship.toml @@ -0,0 +1,30 @@ +'$schema' = "https://starship.rs/config-schema.json" + +# Inserts a blank line between shell prompts +add_newline = false +format = '\[$username[@](bold blue)$hostname\] $all' + + +[character] +success_symbol = "[❯](green)" +error_symbol = "[❮](red)" +vimcmd_symbol = "[❮](green)" + +[username] +style_root = "bold red" +style_user = "bold blue" +format = "[$user]($style)" +show_always = true +disabled = false + +[hostname] +ssh_only = false +style = "bold teal" +format = "[$hostname]($style)" + +[directory] +truncation_length = 4 +style = "bold lavender" + +[cmd_duration] +min_time = 500 diff --git a/config/essentials/zsh/.gitignore b/config/essentials/zsh/.gitignore new file mode 100644 index 0000000..b717a37 --- /dev/null +++ b/config/essentials/zsh/.gitignore @@ -0,0 +1,2 @@ +histfile +zcompcache
\ No newline at end of file diff --git a/config/essentials/zsh/.zshrc b/config/essentials/zsh/.zshrc index 99c65d7..f9ca5c3 100644 --- a/config/essentials/zsh/.zshrc +++ b/config/essentials/zsh/.zshrc @@ -4,8 +4,8 @@ if [ "$(id -u)" -ne 0 ]  then  	[ "${TTY%%tty*}" = '/dev/' ] && clear  	case "${TTY#/dev/tty}" in -		1) exec startdwl > /dev/null 2>&1 ;; -		2) exec startx > /dev/null 2>&1 ;; +		1) exec startx > /dev/null 2>&1 ;; +		2) exec startdwl > /dev/null 2>&1 ;;  		3) exec startw > /dev/null 2>&1 ;;  		*) false ;;  	esac && exit @@ -14,73 +14,69 @@ fi  autoload -U select-word-style  autoload -z edit-command-line  zle -N edit-command-line -zstyle ':compinstall' filename '/home/aluc/.zshrc' - -### Completion -# cache -zstyle ':completion:*' use-cache on -zstyle ':completion:*' cache-path "$ZDOTDIR/zcompcache" - -# completers -zstyle ':completion:*' completer _extensions _complete - -# format -zstyle ':completion:*:*:*:*:descriptions' format '%F{blue}-- %D%d --%f' -zstyle ':completion:*:*:*:*:messages' format '%F{purple}-- %d --%f' -zstyle ':completion:*:*:*:*:warnings' format '%F{red}-- no matches found --%f' -zstyle ':completion:*:default' list-prompt '%S%M matches%s' -# show a 'ls -a' like outptut when listing files -zstyle ':completion:*:*:*:*:default' list-colors ${(s.:.)LS_COLORS} - -# Group completions by categories -zstyle ':completion:*' group-name '' -zstyle ':completion:*:*:-command-:*:*' group-order aliases builtins functions commands - -zstyle ':completion:*' squeeze-slashes true - -# Prefer completing for an option (think cd -) -zstyle ':completion:*' complete-options true - -# keep prefix when completing -zstyle ':completion:*' keep-prefix true - -# ui -zstyle ':completion:*' menu select -# Move around using h j k l in completion menu -zmodload zsh/complist -bindkey -M menuselect 'h' vi-backward-char -bindkey -M menuselect 'k' vi-up-line-or-history -bindkey -M menuselect 'j' vi-down-line-or-history -bindkey -M menuselect 'l' vi-forward-char -bindkey -M menuselect '^xg' clear-screen -# interactive mode -bindkey -M menuselect '^xi' vi-insert -bindkey -M menuselect '^xh' accept-and-hold                # Hold -bindkey -M menuselect '^xn' accept-and-infer-next-history  # Next -bindkey -M menuselect '^xu' undo                           # Undo - -autoload -Uz compinit; compinit -  autoload -Uz surround  zle -N delete-surround surround  zle -N add-surround surround  zle -N change-surround surround -# Source files +### Source files  . $XDG_CONFIG_HOME/shell/functions.sh  . $XDG_CONFIG_HOME/shell/aliases.sh +# . $XDG_CONFIG_HOME/zsh/prompt.zsh +# . $XDG_CONFIG_HOME/zsh/comp.zsh +# . $XDG_CONFIG_HOME/zsh/plugins.zsh + +### Programs +eval "$(starship init zsh)" +eval "$(zoxide init zsh)" + +### Plugins +[ -f "$HOME/.local/share/zap/zap.zsh" ] && source "$HOME/.local/share/zap/zap.zsh" +plug "kutsan/zsh-system-clipboard" +plug "xPMo/zsh-toggle-command-prefix" +plug "zap-zsh/completions" +plug "zap-zsh/vim" +plug "zsh-users/zsh-autosuggestions" +plug "zsh-users/zsh-completions" +plug "chivalryq/git-alias" +plug "zap-zsh/fzf" +plug "zdharma-continuum/fast-syntax-highlighting" +plug "zsh-users/zsh-history-substring-search" +plug "MichaelAquilina/zsh-you-should-use" + +# Substring search settings +export HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND="bg=blue,fg=black,bold" +export HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND='bg=red,fg=black,bold' +bindkey -M vicmd 'k' history-substring-search-up +bindkey -M vicmd 'j' history-substring-search-down + +# Zsh System keyboard settings +if [ -n "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ]; then +    ZSH_SYSTEM_CLIPBOARD_METHOD="xsc" +else +    ZSH_SYSTEM_CLIPBOARD_METHOD="wlc" +fi -for file in /{etc,usr/lib}/os-release -do [ -f "$file" ] && . "$file" && break -done -case "${ID:=unknown}" in -	debian|ubuntu) PLUGPATH=/usr/share/ ;; -	unknown) PLUGPATH=$ZDOTDIR/plugins ;; -	*) PLUGPATH=/usr/share/zsh/plugins ;; -esac -. $PLUGPATH/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh -. $PLUGPATH/zsh-autosuggestions/zsh-autosuggestions.zsh +# Add nnn shell level to prompt +[ -n "$NNNLVL" ] && PS1="N$NNNLVL $PS1" + +# cd on nnn quiting +nnn_cd () +{ +    if ! [ -z "$NNN_PIPE" ]; then +        printf "%s\0" "0c${PWD}" > "${NNN_PIPE}" !& +    fi +} + +trap nnn_cd EXIT + +# Check if in tmux and if a venv directory exists activate the python environment +if [ ! -z "$TMUX" ] && [ -d "./env" ]; then +    . ./env/bin/activate +fi + +### Keybinds  bindkey -v  bindkey -a cs change-surround  bindkey -a ds delete-surround @@ -98,20 +94,21 @@ bindkey "^Xa" _expand_alias  bindkey "^Xe" edit-command-line  bindkey "^[." insert-last-word  bindkey "^['" quote-line +## Move around using h j k l in completion menu +zmodload zsh/complist +bindkey -M menuselect 'h' vi-backward-char +bindkey -M menuselect 'k' vi-up-line-or-history +bindkey -M menuselect 'j' vi-down-line-or-history +bindkey -M menuselect 'l' vi-forward-char +bindkey -M menuselect '^xg' clear-screen +## interactive mode +bindkey -M menuselect '^xi' vi-insert +bindkey -M menuselect '^xh' accept-and-hold                # Hold +bindkey -M menuselect '^xn' accept-and-infer-next-history  # Next +bindkey -M menuselect '^xu' undo                           # Undo -isTextFile() -{ -	[ -f "$1" ] && -		# will execute the file, I'd rather not have an error message -		[ ${1::2} != "./" ] && -		[ ${1::1} != "/" ] && -		! type "$1" > /dev/null && -		# is text file? -		file -b --mime-type "$1" | grep -q "^text/" || -		return 1 -} - -# rehash hook +### Hooks +## rehash hook  zshcache_time="$(date +%s%N)"  autoload -Uz add-zsh-hook  rehash_precmd() { @@ -123,7 +120,7 @@ rehash_precmd() {      fi    fi  } -# window title hooks +## window title hooks  add-zsh-hook -Uz precmd rehash_precmd  set_wt_action () {  	print -n "\e]0;$1\a\033[0m" @@ -133,66 +130,16 @@ set_wt () {  	print -Pn "\e]0;%n@%m on %~\a"  }  add-zsh-hook -Uz precmd set_wt -function osc7 { -    local LC_ALL=C -    export LC_ALL - -    setopt localoptions extendedglob -    input=( ${(s::)PWD} ) -    uri=${(j::)input/(#b)([^A-Za-z0-9_.\!~*\'\(\)-\/])/%${(l:2::0:)$(([##16]#match))}} -    print -n "\e]7;file://${HOSTNAME}${uri}\e\\" -} -add-zsh-hook -Uz chpwd osc7 -command_not_found_handler () { -	if [[ -o interactive ]] && isTextFile "$1" -	then -		"$EDITOR" "$1" -	else -		echo "zsh: command not found: $1" >&2 -	fi -} - -# prompt -PS1=' %K{16}%B%(#.%F{1}.%F{13})%n%b%f@%B%F{6}%m%b%f %3~%k ' -RPROMPT='%F{blue}$(parse_git_remote)%f%F{red}$(parse_git_status)%f%F{green}$(parse_git_branch)%f%(?.. %?)' - -setopt prompt_subst -parse_git_remote() { -	git branch -v 2> /dev/null | -		awk -F '[][]' '/^\*/ {print $2}' | -		sed 's/ahead/↑ /;s/behind/↓ /;s/[^↓↑]*/ /g' -} -parse_git_branch() { -    git symbolic-ref --short HEAD 2> /dev/null || git rev-parse --short HEAD 2> /dev/null -} -parse_git_status() { -	git status --short 2> /dev/null | head -n1 | awk '{print $1 " "}' -} - -# Completion -_dotnet_zsh_complete() -{ -  local completions=("$(dotnet complete "$words")") - -  # If the completion list is empty, just continue with filename selection -  if [ -z "$completions" ] -  then -    _arguments '*::arguments: _normal' -    return -  fi - -  # This is not a variable assignment, don't remove spaces! -  _values = "${(ps:\n:)completions}" -} -compdef _dotnet_zsh_complete dotnet +## automatic ls after cd +add-zsh-hook -Uz chpwd (){[ "$PWD" != "$HOME" ] && ls -a; } -export REPORTTIME=2 -export TIMEFMT="-> %*E" -# override built-in time command -alias time='/usr/bin/time' +### Variables +## Run menuscripts with fzf  export MENUCMD='fzf' +## vi mode escape fix +export KEYTIMEOUT=1 -# Options +### Options  setopt correct   setopt nonomatch   setopt autocd diff --git a/config/essentials/zsh/comp.zsh b/config/essentials/zsh/comp.zsh new file mode 100644 index 0000000..94d76b1 --- /dev/null +++ b/config/essentials/zsh/comp.zsh @@ -0,0 +1,49 @@ +# ### Completion + +# autoload -Uz compinit; compinit +# zstyle ':compinstall' filename '/home/aluc/.zshrc' +# # cache +# zstyle ':completion:*' use-cache on +# zstyle ':completion:*' cache-path "$ZDOTDIR/zcompcache" + +# # completers +# zstyle ':completion:*' completer _extensions _complete + +# # format +# zstyle ':completion:*:*:*:*:descriptions' format '%F{blue}-- %D%d --%f' +# zstyle ':completion:*:*:*:*:messages' format '%F{purple}-- %d --%f' +# zstyle ':completion:*:*:*:*:warnings' format '%F{red}-- no matches found --%f' +# zstyle ':completion:*:default' list-prompt '%S%M matches%s' +# # show a 'ls -a' like outptut when listing files +# zstyle ':completion:*:*:*:*:default' list-colors ${(s.:.)LS_COLORS} + +# # Group completions by categories +# zstyle ':completion:*' group-name '' +# zstyle ':completion:*:*:-command-:*:*' group-order aliases builtins functions commands + +# zstyle ':completion:*' squeeze-slashes true + +# # Prefer completing for an option (think cd -) +# zstyle ':completion:*' complete-options true + +# # keep prefix when completing +# zstyle ':completion:*' keep-prefix true + +# # ui +# zstyle ':completion:*' menu select + +# _dotnet_zsh_complete() +# { +#   local completions=("$(dotnet complete "$words")") + +#   # If the completion list is empty, just continue with filename selection +#   if [ -z "$completions" ] +#   then +#     _arguments '*::arguments: _normal' +#     return +#   fi + +#   # This is not a variable assignment, don't remove spaces! +#   _values = "${(ps:\n:)completions}" +# } +# compdef _dotnet_zsh_complete dotnet
\ No newline at end of file diff --git a/config/essentials/zsh/plugins.zsh b/config/essentials/zsh/plugins.zsh new file mode 100644 index 0000000..d8de390 --- /dev/null +++ b/config/essentials/zsh/plugins.zsh @@ -0,0 +1,10 @@ +for file in /{etc,usr/lib}/os-release +do [ -f "$file" ] && . "$file" && break +done +case "${ID:=unknown}" in +	debian|ubuntu) PLUGPATH=/usr/share/ ;; +	unknown) PLUGPATH=$ZDOTDIR/plugins ;; +	*) PLUGPATH=/usr/share/zsh/plugins ;; +esac +. $PLUGPATH/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh +. $PLUGPATH/zsh-autosuggestions/zsh-autosuggestions.zsh diff --git a/config/essentials/zsh/prompt.zsh b/config/essentials/zsh/prompt.zsh new file mode 100644 index 0000000..5364401 --- /dev/null +++ b/config/essentials/zsh/prompt.zsh @@ -0,0 +1,16 @@ +# prompt +# PS1=' %K{16}%B%(#.%F{1}.%F{13})%n%b%f@%B%F{6}%m%b%f %3~%k ' +# RPROMPT='%F{blue}$(parse_git_remote)%f%F{red}$(parse_git_status)%f%F{green}$(parse_git_branch)%f%(?.. %?)' + +setopt prompt_subst +parse_git_remote() { +	git branch -v 2> /dev/null | +		awk -F '[][]' '/^\*/ {print $2}' | +		sed 's/ahead/↑ /;s/behind/↓ /;s/[^↓↑]*/ /g' +} +parse_git_branch() { +    git symbolic-ref --short HEAD 2> /dev/null || git rev-parse --short HEAD 2> /dev/null +} +parse_git_status() { +	git status --short 2> /dev/null | head -n1 | awk '{print $1 " "}' +}
\ No newline at end of file diff --git a/config/extra/jftui/.gitignore b/config/extra/jftui/.gitignore new file mode 100644 index 0000000..9ba875b --- /dev/null +++ b/config/extra/jftui/.gitignore @@ -0,0 +1,2 @@ +watch_later +settings
\ No newline at end of file diff --git a/config/extra/mutt/configs/billy@spacehb.net.muttrc b/config/extra/mutt/configs/billy@spacehb.net.muttrc new file mode 100644 index 0000000..0bf375c --- /dev/null +++ b/config/extra/mutt/configs/billy@spacehb.net.muttrc @@ -0,0 +1,18 @@ +# vim: filetype=neomuttrc +# muttrc file for account billy@spacehb.net +set realname = "billy" +set from = "billy@spacehb.net" +set sendmail = "msmtp -a billy@spacehb.net" +alias me billy <billy@spacehb.net> +set folder = "/home/aluc/.local/share/mail/billy@spacehb.net" +set header_cache = "/home/aluc/.cache/mutt-wizard/billy_spacehb.net/headers" +set message_cachedir = "/home/aluc/.cache/mutt-wizard/billy_spacehb.net/bodies" +set mbox_type = Maildir +set hostname = "spacehb.net" +set spoolfile = "+INBOX" +set postponed = "+Drafts" +set trash = "+Trash" +set record = "+Sent" + +macro index o "<shell-escape>mailsync billy@spacehb.net<enter>" "sync billy@spacehb.net" +mailboxes "=Drafts" "=Sent" "=Junk" "=INBOX" diff --git a/config/extra/mutt/configs/luca@spacehb.net.muttrc b/config/extra/mutt/configs/luca@spacehb.net.muttrc new file mode 100644 index 0000000..85b65d3 --- /dev/null +++ b/config/extra/mutt/configs/luca@spacehb.net.muttrc @@ -0,0 +1,18 @@ +# vim: filetype=neomuttrc +# muttrc file for account luca@spacehb.net +set realname = "Luca" +set from = "luca@spacehb.net" +set sendmail = "msmtp -a luca@spacehb.net" +alias me luca <luca@spacehb.net> +set folder = "/home/aluc/.local/share/mail/luca@spacehb.net" +set header_cache = "/home/aluc/.cache/mutt-wizard/luca_spacehb.net/headers" +set message_cachedir = "/home/aluc/.cache/mutt-wizard/luca_spacehb.net/bodies" +set mbox_type = Maildir +set hostname = "spacehb.net" +set spoolfile = "+INBOX" +set postponed = "+Drafts" +set trash = "+Trash" +set record = "+Sent" + +macro index o "<shell-escape>mailsync luca@spacehb.net<enter>" "sync luca@spacehb.net" +mailboxes "=Drafts" "=Sent" "=Junk" "=INBOX" diff --git a/config/extra/mutt/configs/raymaekers.luca@gmail.com b/config/extra/mutt/configs/raymaekers.luca@gmail.com index ffb7003..f3bbd75 100644 --- a/config/extra/mutt/configs/raymaekers.luca@gmail.com +++ b/config/extra/mutt/configs/raymaekers.luca@gmail.com @@ -16,3 +16,38 @@ set spoolfile = "+INBOX"  set postponed = "+[Gmail]/Drafts"  set record = "+[Gmail]/Sent Mail"  set trash = "+[Gmail]/Trash" + +set header_cache = "~/.config/mutt/cache/headers" +set message_cachedir = "~/.config/mutt/cache/bodies" +set certificate_file = "~/.config/mutt/certificates" +set mbox_type = maildir + +# Default color definitions +color normal     white         default +color hdrdefault green         default +color quoted     green         default +color quoted1    yellow        default +color quoted2    red           default +color signature  cyan          default +color indicator  brightyellow  red  +color error      brightred     default +color status     brightwhite   blue +color tree       brightmagenta default +color tilde      brightblue    default +color attachment brightyellow  magenta +color markers    brightred     default +color message    white         default +color search     brightwhite   magenta +color bold       brightyellow  green + +# Color definitions when on a mono screen +mono bold      bold +mono underline underline +mono indicator reverse +mono error     bold + +# Colors for items in the reader +color header brightyellow default "^(From|Subject):" +color header brightcyan   default ^To: +color header brightcyan   default ^Cc: +mono  header bold                 "^(From|Subject):" diff --git a/config/home/.zshenv b/config/home/.zshenv index e8021ec..cfaef9c 100644 --- a/config/home/.zshenv +++ b/config/home/.zshenv @@ -1,6 +1,6 @@  #!/bin/zsh -export EDITOR="emacsclient -nw -q" -export VISUAL="emacsclient -nw -q" +export EDITOR="nvim" +export VISUAL="nvim"  export BROWSER="librewolf"  export VIEWER="zathura" diff --git a/config/old/vim/.gitignore b/config/old/vim/.gitignore new file mode 100644 index 0000000..df9ee8d --- /dev/null +++ b/config/old/vim/.gitignore @@ -0,0 +1,2 @@ +plugged +viminfo*
\ No newline at end of file diff --git a/config/wayland/waybar/colors.css b/config/wayland/waybar/colors.css new file mode 120000 index 0000000..38b29a4 --- /dev/null +++ b/config/wayland/waybar/colors.css @@ -0,0 +1 @@ +/home/aluc/.config/waybar/colors/colors-nord
\ No newline at end of file diff --git a/config/wayland/waybar/config.jsonc b/config/wayland/waybar/config.jsonc index aa93297..24065d3 100644..120000 --- a/config/wayland/waybar/config.jsonc +++ b/config/wayland/waybar/config.jsonc @@ -1,16 +1 @@ -{ -	"modules-left": ["hyprland/workspaces", "custom/layout", "hyprland/window"], -	"modules-right": ["custom/status"], -	"hyprland/window": { -		"format": " {} " -	}, -	"custom/layout": {  -		"format": " []= ", -		"interval": "once", -	}, -	"custom/status": {  -		"exec": "~/.config/waybar/status.sh", -		"format": " {} ", -		"interval": 1 -	} -} +hyprland.jsonc
\ No newline at end of file  | 
