From 0e2d387565cb03c41cef33b9ff01eac5a5cb9132 Mon Sep 17 00:00:00 2001 From: marcellus Date: Thu, 14 Sep 2023 22:26:17 +0200 Subject: update: general changes, read the diff --- .gitignore | 1 + crontab | 2 + dwmblocks/config | 2 +- lf/cleaner | 4 + lf/icons | 327 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ lf/lfrc | 124 +++++++++++++++++++++ lf/scope | 50 +++++++++ nvim | 1 + picom/picom.conf | 7 +- scripts/icstocal | 3 +- scripts/lfub | 23 ++++ scripts/plumber | 209 +++++++++++++++++++++++++++++++++++ scripts/rotdir | 13 +++ sx/sxrc | 10 ++ zsh/.zprofile | 2 +- zsh/.zshenv | 1 + zsh/.zshrc | 19 ++-- 17 files changed, 784 insertions(+), 14 deletions(-) create mode 100644 crontab create mode 100644 lf/cleaner create mode 100644 lf/icons create mode 100644 lf/lfrc create mode 100644 lf/scope create mode 160000 nvim create mode 100755 scripts/lfub create mode 100755 scripts/plumber create mode 100644 scripts/rotdir create mode 100755 sx/sxrc diff --git a/.gitignore b/.gitignore index f9c5df5..122c843 100644 --- a/.gitignore +++ b/.gitignore @@ -25,4 +25,5 @@ gops/ ## other stuff scummvm/ paliasrc +epitaliasrc pavucontrol.ini diff --git a/crontab b/crontab new file mode 100644 index 0000000..0197eb0 --- /dev/null +++ b/crontab @@ -0,0 +1,2 @@ +1/10 * * * * kill -52 $(pidof dwmblocks); randwp +1/30 * * * * kill -49 $(pidof dwmblocks) diff --git a/dwmblocks/config b/dwmblocks/config index 91f8f1d..dc92fe0 100644 --- a/dwmblocks/config +++ b/dwmblocks/config @@ -12,7 +12,7 @@ volume = true // 44 mic = false // 45 news = false // 46 mail = false // 47 -weather = false // 48 +weather = true// 48 daypercent = false // 49 date = true // 50 time = true // 51 diff --git a/lf/cleaner b/lf/cleaner new file mode 100644 index 0000000..a184d84 --- /dev/null +++ b/lf/cleaner @@ -0,0 +1,4 @@ +#!/bin/sh +if [ -n "$FIFO_UEBERZUG" ]; then + printf '{"action": "remove", "identifier": "PREVIEW"}\n' > "$FIFO_UEBERZUG" +fi diff --git a/lf/icons b/lf/icons new file mode 100644 index 0000000..be94780 --- /dev/null +++ b/lf/icons @@ -0,0 +1,327 @@ +# vim:ft=conf + +# file types +ln " " # LINK +or " " # ORPHAN +tw t # STICKY_OTHER_WRITABLE +ow " " # OTHER_WRITABLE +st t # STICKY +di " " # DIR +pi p # FIFO +so s # SOCK +bd b # BLK +cd c # CHR +su u # SETUID +sg g # SETGID +ex " " # EXEC +fi " " # FILE + +# file extensions +*.styl " " +*.sass " " +*.scss " " +*.htm " " +*.html " " +*.slim " " +*.haml " " +*.ejs " " +*.css " " +*.less " " +*.md " " +*.mdx " " +*.markdown " " +*.rmd " " +*.json " " +*.webmanifest " " +*.js " " +*.mjs " " +*.jsx " " +*.rb " " +*.gemspec " " +*.rake " " +*.php " " +*.py " " +*.pyc " " +*.pyo " " +*.pyd " " +*.coffee " " +*.mustache " " +*.hbs " " +*.conf " " +*.ini " " +*.yml " " +*.yaml " " +*.toml " " +*.bat " " +*.mk " " +*.twig " " +*.cpp " " +*.c++ " " +*.cxx " " +*.cc " " +*.cp " " +*.c " " +*.cs " " +*.h " " +*.hh " " +*.hpp " " +*.hxx " " +*.hs " " +*.lhs " " +*.nix " " +*.lua " " +*.java " " +*.sh " " +*.fish " " +*.bash " " +*.zsh " " +*.ksh " " +*.csh " " +*.awk " " +*.ps1 " " +*.ml "λ " +*.mli "λ " +*.diff " " +*.db " " +*.sql " " +*.dump " " +*.clj " " +*.cljc " " +*.cljs " " +*.edn " " +*.scala " " +*.go " " +*.dart " " +*.xul " " +*.sln " " +*.suo " " +*.pl " " +*.pm " " +*.t " " +*.rss " " +*.xml " " +'*.f#' " " +*.fsscript " " +*.fsx " " +*.fs " " +*.fsi " " +*.rs " " +*.rlib " " +*.d " " +*.erl " " +*.hrl " " +*.ex " " +*.exs " " +*.eex " " +*.leex " " +*.heex " " +*.vim " " +*.ai " " +*.psd " " +*.psb " " +*.ts " " +*.tsx " " +*.jl " " +*.pp " " +*.vue "﵂ " +*.elm " " +*.swift " " +*.xcplayground " " +*.tex "ﭨ " +*.r "ﳒ " +*.rproj "鉶 " +*.sol "ﲹ " +*.pem " " +*.gpg " " +*.pdf " " +*.1 " " +*.nfo " " +*.info " " +*.iso " " +*.img " " +*.part "󰋔 " +*.torrent " " +*.zig " " + +# file names +*gruntfile.coffee " " +*gruntfile.js " " +*gruntfile.ls " " +*gulpfile.coffee " " +*gulpfile.js " " +*gulpfile.ls " " +*mix.lock " " +*dropbox " " +*.ds_store " " +*.gitconfig " " +*.gitignore " " +*.gitattributes " " +*.gitlab-ci.yml " " +*.bashrc " " +*.zshrc " " +*.zshenv " " +*.zprofile " " +*.vimrc " " +*.gvimrc " " +*_vimrc " " +*_gvimrc " " +*.bashprofile " " +*favicon.ico " " +*license " " +*node_modules " " +*react.jsx " " +*procfile " " +*dockerfile " " +*docker-compose.yml " " +*rakefile " " +*config.ru " " +*gemfile " " +*makefile " " +*cmakelists.txt " " +*robots.txt "ﮧ " +*Gruntfile.coffee " " +*Gruntfile.js " " +*Gruntfile.ls " " +*Gulpfile.coffee " " +*Gulpfile.js " " +*Gulpfile.ls " " +*Dropbox " " +*.DS_Store " " +*LICENSE " " +*React.jsx " " +*Procfile " " +*Dockerfile " " +*Docker-compose.yml " " +*Rakefile " " +*Gemfile " " +*Makefile " " +*CMakeLists.txt " " +*jquery.min.js " " +*angular.min.js " " +*backbone.min.js " " +*require.min.js " " +*materialize.min.js " " +*materialize.min.css " " +*mootools.min.js " " +*vimrc " " +*calendar " " +*conf " " +*config " " + +# archives or compressed +*.tar " " +*.tgz " " +*.arc " " +*.arj " " +*.taz " " +*.lha " " +*.lz4 " " +*.lzh " " +*.lzma " " +*.tlz " " +*.txz " " +*.tzo " " +*.t7z " " +*.zip " " +*.z " " +*.dz " " +*.gz " " +*.lrz " " +*.lz " " +*.lzo " " +*.xz " " +*.zst " " +*.tzst " " +*.bz2 " " +*.bz " " +*.tbz " " +*.tbz2 " " +*.tz " " +*.deb " " +*.rpm " " +*.jar " " +*.war " " +*.ear " " +*.sar " " +*.rar " " +*.alz " " +*.ace " " +*.zoo " " +*.cpio " " +*.7z " " +*.rz " " +*.cab " " +*.wim " " +*.swm " " +*.dwm " " +*.esd " " + +# image formats +*.jpg " " +*.jpeg " " +*.mjpg " " +*.gif " " +*.ico " " +*.bmp " " +*.pbm " " +*.pgm " " +*.ppm " " +*.tga " " +*.xbm " " +*.xpm " " +*.tif " " +*.tiff " " +*.png " " +*.svg " " +*.svgz " " +*.webp " " +*.mng " " +*.pcx " " +*.flc " " +*.fli " " +*.xcf " " +*.xwd " " +*.cgm " " +*.emf " " +*.ff " " + +# video formats +*.webm " " +*.ogm " " +*.mp4 " " +*.m4v " " +*.mp4v " " +*.mkv " " +*.mpg " " +*.mpeg " " +*.avi " " +*.mov " " +*.wmv " " +*.flv " " +*.m2v " " +*.vob " " +*.qt " " +*.asf " " +*.rm " " +*.rmvb " " +*.ogv " " +*.ogx " " +*.mjpeg " " + +# audio formats +*.aac " " +*.au " " +*.flac " " +*.m4a " " +*.mid " " +*.midi " " +*.mka " " +*.mp3 " " +*.mpc " " +*.ogg " " +*.ra " " +*.wav " " +*.oga " " +*.opus " " +*.spx " " +*.xspf " " diff --git a/lf/lfrc b/lf/lfrc new file mode 100644 index 0000000..0cc85f2 --- /dev/null +++ b/lf/lfrc @@ -0,0 +1,124 @@ +# Stolen from Luke Smith config +# Note on Image Previews +# For those wanting image previews, like this system, there are four steps to +# set it up. These are done automatically for those that useed my Makefile users, +# but I will state them here for others doing it manually. +# +# 1. ueberzug must be installed. +# 2. The scope file (~/.local/etc/lf/scope for me), must have a command similar to +# mine to generate ueberzug images. +# 3. A `set cleaner` line as below is a cleaner script. +# 4. lf should be started through a wrapper script (~/.local/bin/lfub for me) +# that creates the environment for ueberzug. This command can be be aliased +# in your shellrc (`alias lf="lfub") or if set to a binding, should be +# called directly instead of normal lf. + +# Basic vars +set shellopts '-eu' +set ifs "\n" +set scrolloff 10 +set icons +set period 1 +set hiddenfiles ".*:*.aux:*.log:*.bbl:*.bcf:*.blg:*.run.xml" +set cleaner '~/.local/etc/lf/cleaner' +set previewer '~/.local/etc/lf/scope' +set autoquit true + +# cmds/functions +cmd open ${{ + case $(file --mime-type "$(readlink -f $f)" -b) in + image/vnd.djvu|application/pdf|application/octet-stream|application/postscript) setsid -f zathura $fx >/dev/null 2>&1 ;; + text/*|application/json|inode/x-empty|application/x-subrip) $EDITOR $fx;; + image/*) rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\|tif\|ico\)\(_large\)*$" | + setsid -f nsxiv -aio 2>/dev/null | while read -r file; do + [ -z "$file" ] && continue + lf -remote "send select \"$file\"" + lf -remote "send toggle" + done & ;; + audio/*|video/x-ms-asf) mpv --audio-display=no $f ;; + video/*) setsid -f mpv $f -quiet >/dev/null 2>&1 ;; + application/pdf|application/vnd.djvu|application/epub*) setsid -f zathura $fx >/dev/null 2>&1 ;; + application/pgp-encrypted) $EDITOR $fx ;; + *) for f in $fx; do setsid -f $OPENER $f >/dev/null 2>&1; done;; + esac +}} + +cmd mkdir $mkdir -p "$(echo $* | tr ' ' '\ ')" + +cmd extract ${{ + clear; tput cup $(($(tput lines)/3)); tput bold + set -f + printf "%s\n\t" "$fx" + printf "extract?[y/N]" + read ans + [ $ans = "y" ] && aunpack $fx +}} + +cmd delete ${{ + clear; tput cup $(($(tput lines)/3)); tput bold + set -f + printf "%s\n\t" "$fx" + printf "delete?[y/N]" + read ans + [ $ans = "y" ] && rm -rf -- $fx +}} + +cmd moveto ${{ + clear; tput cup $(($(tput lines)/3)); tput bold + set -f + clear; echo "Move to where?" + dest="$(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf | sed 's|~|$HOME|')" && + for x in $fx; do + eval mv -iv \"$x\" \"$dest\" + done && + notify-send "File(s) moved to $dest." +}} + +cmd copyto ${{ + clear; tput cup $(($(tput lines)/3)); tput bold + set -f + clear; echo "Copy to where?" + dest="$(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf | sed 's|~|$HOME|')" && + for x in $fx; do + eval cp -ivr \"$x\" \"$dest\" + done && + notify-send "File(s) copies to $dest." +}} + +cmd q quit + +# Bindings +map $lf -remote "send $id select \"$(fzf)\"" +map J $lf -remote "send $id cd $(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf)" +map gh +map g top +map d +map D delete +map delete +map delete +map E extract +map C copyto +map M moveto +map push :mkdir +map reload +map set hidden! +map shell +map x $$f +map X !$f +map o &mimeopen "$f" +map O $mimeopen --ask "$f" + +map A rename # at the very end +map c push A # new rename +map I push A # at the very beginning +map i push A # before extension +map a push A # after extension +map w $env IGNORE="" randwp "$f" + +map down +map up +map V push :!nvim + +map W $setsid -f $TERMINAL >/dev/null 2>&1 + +map Y $printf "%s" "$fx" | xclip -selection clipboard diff --git a/lf/scope b/lf/scope new file mode 100644 index 0000000..bcefeab --- /dev/null +++ b/lf/scope @@ -0,0 +1,50 @@ +#!/bin/sh + +# File preview handler for lf. + +set -C -f +IFS="$(printf '%b_' '\n')"; IFS="${IFS%_}" +THEME=gruvbox-dark + +image() { + if [ -f "$1" ] && [ -n "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ] && command -V ueberzug >/dev/null 2>&1; then + printf '{"action": "add", "identifier": "PREVIEW", "x": "%s", "y": "%s", "width": "%s", "height": "%s", "scaler": "contain", "path": "%s"}\n' "$4" "$5" "$(($2-1))" "$(($3-1))" "$1" > "$FIFO_UEBERZUG" + else + mediainfo "$6" + fi +} + +ifub() { + [ -n "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ] && command -V ueberzug >/dev/null 2>&1 +} + +# Note that the cache file name is a function of file information, meaning if +# an image appears in multiple places across the machine, it will not have to +# be regenerated once seen. + +case "$(file --dereference --brief --mime-type -- "$1")" in + image/*) image "$1" "$2" "$3" "$4" "$5" "$1" ;; + text/html) w3m -dump "$1" ;; # lynx -width="$4" -display_charset=utf-8 -dump "$1" ;; + text/troff) man ./ "$1" | col -b ;; + text/* | */xml | application/json) bat --theme=$THEME --terminal-width "$(($4-2))" -f "$1" ;; + audio/* | application/octet-stream) mediainfo "$1" || exit 1 ;; + video/* ) + CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)" + [ ! -f "$CACHE" ] && ffmpegthumbnailer -i "$1" -o "$CACHE" -s 0 + image "$CACHE" "$2" "$3" "$4" "$5" "$1" + ;; + */pdf) + CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)" + [ ! -f "$CACHE.jpg" ] && pdftoppm -jpeg -f 1 -singlefile "$1" "$CACHE" + image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" + ;; + */epub+zip|*/mobi*) + CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)" + [ ! -f "$CACHE.jpg" ] && gnome-epub-thumbnailer "$1" "$CACHE.jpg" + image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" + ;; + application/*zip) atool --list -- "$1" ;; + *opendocument*) odt2txt "$1" ;; + application/pgp-encrypted) gpg -d -- "$1" ;; +esac +exit 1 diff --git a/nvim b/nvim new file mode 160000 index 0000000..1a971cb --- /dev/null +++ b/nvim @@ -0,0 +1 @@ +Subproject commit 1a971cbdcffdc204e073d8142e5491e1f976a3eb diff --git a/picom/picom.conf b/picom/picom.conf index 1731c3a..a5392f6 100644 --- a/picom/picom.conf +++ b/picom/picom.conf @@ -111,10 +111,10 @@ frame-opacity = 0.9; # Let inactive opacity set by -i override the '_NET_WM_WINDOW_OPACITY' values of windows. # inactive-opacity-override = true -inactive-opacity-override = false; +inactive-opacity-override = true; # Default opacity for active windows. (0.0 - 1.0, defaults to 1.0) -# active-opacity = 1.0 +active-opacity = 0.95; # Dim inactive windows. (0.0 - 1.0, defaults to 0.0) # inactive-dim = 0.0 @@ -131,8 +131,7 @@ focus-exclude = [ "class_g = 'Cairo-clock'" ]; # Note we don't make any guarantee about possible conflicts with other # programs that set '_NET_WM_WINDOW_OPACITY' on frame or client windows. # example: -# opacity-rule = [ "80:class_g = 'URxvt'" ]; -# +opacity-rule = [ "100:class_g= 'mpv'" ]; # opacity-rule = [] diff --git a/scripts/icstocal b/scripts/icstocal index 3d086ca..9bff2be 100755 --- a/scripts/icstocal +++ b/scripts/icstocal @@ -68,7 +68,8 @@ while line != "END:VCALENDAR\n": starts.append([year, month, day, hour, min]) elif line.startswith("DTEND"): end = line.lstrip("DTEND") - while start[n] != ":": + n = 0 + while end[n] != ":": n+=1 hour = "" min = "" diff --git a/scripts/lfub b/scripts/lfub new file mode 100755 index 0000000..0d8b7fe --- /dev/null +++ b/scripts/lfub @@ -0,0 +1,23 @@ +#!/bin/sh +# This is a wrapper script for lf that allows it to create image previews with +# ueberzug. This works in concert with the lf configuration file and the +# lf-cleaner script. + +set -e + +cleanup() { + exec 3>&- + rm "$FIFO_UEBERZUG" +} + +if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then + lf "$@" +else + [ ! -d "$XDG_CACHE_HOME/lf" ] && mkdir -p "$XDG_CACHE_HOME/lf" + export FIFO_UEBERZUG="$XDG_CACHE_HOME/lf/ueberzug-$$" + mkfifo "$FIFO_UEBERZUG" + ueberzug layer -s <"$FIFO_UEBERZUG" -p json & + exec 3>"$FIFO_UEBERZUG" + trap cleanup HUP INT QUIT TERM PWR EXIT + lf "$@" 3>&- +fi diff --git a/scripts/plumber b/scripts/plumber new file mode 100755 index 0000000..b6931a1 --- /dev/null +++ b/scripts/plumber @@ -0,0 +1,209 @@ +#!/bin/sh +# Copywrong © 2023 Ratakor. Under ISC License. +# plumber 🪠 +# dependencies: +# - default programs +# - xdo +# - xclip or xsel +# - (optional) herbe and dmenusearch web +# - (optional) dmenu_path +# - (optional) st with plumber patch +# shellcheck disable=SC2086 + +# default programs +WEB="xdg-open" +TEXT="$TERMINAL -e $EDITOR" +VIDEO="mpv --ytdl-format=22 --loop" +AUDIO="music --shuffle" +PIC="nsxiv -a" +DOC="zathura" +DIR="$TERMINAL -e lfub" + +openlink() { + case "$1" in + *.mkv|*.webm|*.mp4|*.mov|*youtube.com/watch*|*youtube.com/playlist*|\ + *youtube.com/shorts*|*youtu.be*|*inv*/playlist*|*inv*/watch*) + setsid -f $VIDEO "$1" >/dev/null 2>&1 ;; + *.mp3|*.flac|*.opus|*mp3?source*|*.ogg|*.wav|*soundcloud.com*) + setsid -f $AUDIO "$1" >/dev/null 2>&1 ;; + *.png|*.jpg|*.jpeg|*.gif|*.webp) + file=$(printf '%s' "$1" | sed "s/.*\///;s/%20/ /g") + curl -sL "$1" > "/tmp/$file" && + $PIC "/tmp/$file" >/dev/null 2>&1 & ;; + *.pdf|*.ps|*.cbz|*.cbr|*.djvu|*.epub) + file=$(printf '%s' "$1" | sed "s/.*\///;s/%20/ /g") + curl -sL "$1" > "/tmp/$file" && + $DOC "/tmp/$file" >/dev/null 2>&1 & ;; + *wp.com/stonetoss.com*) + file=$(printf '%s' "${1%"?resize=150%2C150&ssl=1"}" |\ + sed "s/.*\///;s/%20/ /g") + curl -sL "${1%"?resize=150%2C150&ssl=1"}" > "/tmp/$file" && + $PIC "/tmp/$file" >/dev/null 2>&1 & ;; + git://*|git@*|*.git) + "$TERMINAL" -e git clone "$1" ;; + *) + setsid -f $WEB "$1" >/dev/null 2>&1 ;; + esac +} + +openfile() { + if [ -d "$1" ]; then + setsid -f $DIR "$1" >/dev/null 2>&1 + return + fi + + if [ ! -f "$1" ]; then + printf '\033[31mError:\033[m %s is not a valid file\n' "$1" >&2 + return 1 + fi + + case "$1" in + *.mkv|*.webm|*.mp4|*.mov) + setsid -f $VIDEO "$1" >/dev/null 2>&1 ;; + *.mp3|*.flac|*.opus|*.ogg|*.wav) + setsid -f $AUDIO "$1" >/dev/null 2>&1 ;; + *.png|*.jpg|*.jpeg|*.gif|*.webp) + setsid -f $PIC "$1" >/dev/null 2>&1 ;; + *.pdf|*.ps|*.cbz|*.cbr|*.djvu|*.epub) + setsid -f $DOC "$1" >/dev/null 2>&1 ;; + *) + setsid -f $TEXT "$1" >/dev/null 2>&1 ;; + esac +} + +checksel() { + case "$1" in + http://*|https://*|irc://*|ircs://*|git://*|git@*) + openlink "$1" ;; + /*) + opensel "$1" "$1" ;; + + *) + pid=$(pstree -lpA "$(xdo pid)" | tail -n 1 |\ + awk -F '---' '{print $NF}' | sed -re 's/[^0-9]//g') + opensel "$(readlink "/proc/$pid/cwd")/$1" "$1" ;; + esac +} + +opensel() { + if [ -d "$1" ]; then + case $1 in + "$XDG_MUSIC_DIR"/*) + setsid -f $AUDIO "$1" >/dev/null 2>&1 ;; + *) + xdo kill + $TERMINAL -e sh -c "cd $1; $SHELL" ;; + esac + return + fi + + if [ ! -f "$1" ]; then + progname=${2%\ *} + for prog in $(dmenu_path); do + case $prog in + "$progname") + $TERMINAL -e sh -c\ + "cd ${1%"$2"}; echo \$ $2; $2; $SHELL" + return ;; + esac + done + herbe "Do you want to search for '$2' ?" && dmenusearch web "$2" + return + fi + + case "$1" in + *.mkv|*.webm|*.mp4|*.mov) + setsid -f $VIDEO "$1" >/dev/null 2>&1 ;; + *.mp3|*.flac|*.opus|*.ogg|*.wav) + setsid -f $AUDIO "$1" >/dev/null 2>&1 ;; + *.png|*.jpg|*.jpeg|*.gif|*.webp) + setsid -f $PIC "$1" >/dev/null 2>&1 ;; + *.pdf|*.ps|*.cbz|*.cbr|*.djvu|*.epub) + setsid -f $DOC "$1" >/dev/null 2>&1 ;; + *) + pid=$(xdo pid) + xdo hide -p "$pid" + $TEXT "$1" >/dev/null 2>&1 + xdo show -p "$pid" ;; + esac +} + + +usage() { + cat << EOF >&2 +Usage: ${0##*/} [options] [arg] + +Options: + no option [arg] | Try to guess what to do + -l|--link [link] | Open the link + -f|--file [file] | Open the file or the folder + -s|--sel | Use the selection buffer instead, Plan9's way + -t|--term | To be used only when invoking through a patched st + -h|--help │ Print this help message + +Config: + browser = $WEB + editor = $TEXT + video = $VIDEO + audio = $AUDIO + picture = $PIC + document = $DOC + file manager = $DIR +EOF +} + +main() { + case "$1" in + -l|--link) + if [ -z "$2" ]; then + printf '\033[31mError:\033[m no argument given\n' >&2 + usage + return 1 + fi + openlink "$2" ;; + -f|--file) + if [ -z "$2" ]; then + printf '\033[31mError:\033[m no argument given\n' >&2 + usage + return 1 + fi + openfile "$2" ;; + -s|--sel|'') + sel=$(xclip -o -sel 2>/dev/null || xsel -opn 2>/dev/null) + sel=${sel#"${sel%%[![:space:]]*}"} + + # clear clipboard + true | xclip 2>/dev/null || true | xsel 2>/dev/null + + if [ -z "$sel" ]; then + printf '\033[31mError:\033[m selection buffer is empty\n' >&2 + usage + return 1 + fi + + checksel "$sel" ;; + -t|--term) + #if [ "$(ps -o comm= $PPID)" != "st" ]; then + # printf '\033[31mError:\033[m --term option used outside of st\n' >&2 + # usage + # return 1 + #fi + [ -n "$2" ] && checksel "$2" ;; + -h|--help) + usage + return 0 ;; + -*) + printf '\033[31mError:\033[m unknown option\n' >&2 + usage + return 1 ;; + *) + case "$1" in + http://*|https://*|git://*|irc://*|ircs://*) + openlink "$1" ;; + *) + openfile "$1" ;; + esac + esac +} + +main "$@" diff --git a/scripts/rotdir b/scripts/rotdir new file mode 100644 index 0000000..3b3f39d --- /dev/null +++ b/scripts/rotdir @@ -0,0 +1,13 @@ +#!/bin/sh + +# When I open an image from the file manager in sxiv (the image viewer), I want +# to be able to press the next/previous keys to key through the rest of the +# images in the same directory. This script "rotates" the content of a +# directory based on the first chosen file, so that if I open the 15th image, +# if I press next, it will go to the 16th etc. Autistic, I know, but this is +# one of the reasons that sxiv is great for being able to read standard input. +# ^ this is Luke's toughts and I approve them + +[ -z "$1" ] && echo "usage: rotdir regex 2>&1" && exit 1 +base="$(basename "$1")" +ls "$PWD" | awk -v BASE="$base" 'BEGIN { lines = ""; m = 0; } { if ($0 == BASE) { m = 1; } } { if (!m) { if (lines) { lines = lines"\n"; } lines = lines""$0; } else { print $0; } } END { print lines; }' diff --git a/sx/sxrc b/sx/sxrc new file mode 100755 index 0000000..00847b1 --- /dev/null +++ b/sx/sxrc @@ -0,0 +1,10 @@ +setxkbmap fr +curl -m 3 -s $CAL_PERSO | grep -v END:VCALENDAR >/tmp/calendar.ics +curl -m 3 -s $CAL_SCHOOL | grep -v BEGIN:VCALENDAR >> /tmp/calendar.ics +icstocal /tmp/calendar.ics /tmp/calendar >/dev/null +scron -f $XDG_CONFIG_HOME/crontab +$HOME/.config/scripts/randwp +sxhkd& +picom& +dwmblocks& +exec dwm diff --git a/zsh/.zprofile b/zsh/.zprofile index d8f183c..2a73493 100644 --- a/zsh/.zprofile +++ b/zsh/.zprofile @@ -1,2 +1,2 @@ -[ "$(tty)" = "/dev/tty1" ] && ! pidof -s Xorg >/dev/null 2>&1 && exec startx +[ "$(tty)" = "/dev/tty1" ] && ! pidof -s Xorg >/dev/null 2>&1 && exec sx diff --git a/zsh/.zshenv b/zsh/.zshenv index c80ce3a..9b82ff7 100644 --- a/zsh/.zshenv +++ b/zsh/.zshenv @@ -5,6 +5,7 @@ export BROWSER="librewolf" export BRIGHTNESS=1 export XDG_CONFIG_HOME="$HOME/.config" +export XDG_CACHE_HOME="$HOME/.cache" export XDG_DATA_HOME="$HOME/data" export XDG_PICTURES_DIR="$HOME/img" # Following line was automatically added by arttime installer diff --git a/zsh/.zshrc b/zsh/.zshrc index 6cbe074..dc2013b 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -1,10 +1,8 @@ [ -f "$ZDOTDIR/paliasrc" ] && source "$ZDOTDIR/paliasrc" # Private aliases +[ -f "$ZDOTDIR/epitaliasrc" ] && source "$ZDOTDIR/epitaliasrc" # Private aliases -curl -s $CAL_PERSO | grep -v END:VCALENDAR >/tmp/calendar.ics -curl -s $CAL_SCHOOL | grep -v BEGIN:VCALENDAR >>/tmp/calendar.ics -icstocal /tmp/calendar.ics /tmp/calendar >/dev/null -flashfetch -quand +# quand +cat ~/todo autoload -U colors && colors # Load colors PS1="%B%(?.0.%F{red}%?) %F{blue}%n %F{green}%~ %f$%b " @@ -13,27 +11,34 @@ PS1="%B%(?.0.%F{red}%?) %F{blue}%n %F{green}%~ %f$%b " alias ls="ls -a --color=auto" alias shut="sudo openrc-shutdown -p now" alias shutr="sudo openrc-shutdown -r now" +alias upd="sudo pacman -Syuu" alias ins="sudo pacman -Syu" alias uins="sudo pacman -Rns" -alias c="clear; quand" +alias c="clear; cat ~/todo" # git + +alias {clone,cloner}="git clone" alias {tirer,tir,poule}="git pull" alias {statut,sta}="git status" alias {ajouter,aj}="git add" alias {atome_de_code,ato}="git commit -m" # voir bitoduc.fr, Commit alias {pousser,pous}="git push" +alias {poussétiquettes,poussE}="git push --follow-tags" alias {difference,ference}="git diff" alias {tronc,tr}="git log" alias {resto,restau}="git restore" +alias {étiquette,etiqu}="git tag" alias bri5="xrandr --output eDP-1 --brightness 0.5" alias bri6="xrandr --output eDP-1 --brightness 0.6" alias ascii="ascii -d" +alias lf="lfub" +alias vmk="v Makefile" alias cf="$HOME/.config/" alias cspt="$HOME/.config/scripts" alias cz="$HOME/.config/zsh" -alias czr="v $ZDOTDIR/.zshrc" +alias czr="v $ZDOTDIR/.zshrc && source $ZDOTDIR/.zshrc" alias cn="$XDG_CONFIG_HOME/nvim" alias rps="echo help | nc ratakor.com 9998" alias v="nvim" -- cgit v1.2.3