├── .config
├── sxiv
├── yt-dlp
│ └── config
├── wget
│ └── wgetrc
├── python
│ └── pythonrc
├── pinentry
│ └── preexec
├── pulse
│ └── daemon.conf
├── lf
│ ├── cleaner
│ ├── icons
│ └── scope
├── latexmk
│ └── latexmkrc
├── pipewire
│ └── pipewire.conf.d
│ │ └── user-session.conf
├── locale.conf
├── youtube-dl
│ └── config
├── shell
│ ├── inputrc
│ ├── bm-dirs
│ ├── bm-files
│ ├── aliasrc
│ └── profile
├── gtk-3.0
│ └── settings.ini
├── user-dirs.dirs
├── gtk-2.0
│ └── gtkrc-2.0
├── fontconfig
│ └── conf.d
│ │ ├── 10-no-sub-pixel.conf
│ │ ├── 30-metric-aliases.conf
│ │ ├── 40-fonts.conf
│ │ ├── 20-symbols.conf
│ │ └── 10-powerline-symbols.conf
├── nvim
│ └── auto_fcitx.vim
├── x11
│ ├── keyboard_layouts
│ ├── xinitrc
│ ├── xprofile
│ └── xresources
├── nsxiv
│ └── exec
│ │ ├── image-info
│ │ └── key-handler
├── i3
│ ├── nadeshiko.conf
│ └── ws10.json
├── mpd
│ └── mpd.conf
├── ncmpcpp
│ ├── bindings
│ └── config
├── mpv
│ └── input.conf
├── zathura
│ └── zathurarc
├── i3blocks
│ └── config
├── git
│ └── config
├── firefox
│ └── larbs.js
├── redshift.conf
├── newsboat
│ └── config
├── rofi
│ └── config.rasi
├── alacritty
│ └── alacritty.toml
└── mimeapps.list
├── .local
├── bin
│ ├── sxiv
│ ├── dmenu
│ ├── xdg-terminal-exec
│ ├── trympv
│ ├── i3cmds
│ │ ├── dropdowncalc
│ │ ├── winresize
│ │ ├── toggletouchpad
│ │ ├── ducksearch
│ │ ├── somesearch
│ │ ├── ddspawn
│ │ └── hover
│ ├── pulsemixer-default-source
│ ├── tsp_onfinish
│ ├── statusbar
│ │ ├── sb-cpu_freq
│ │ ├── sb-headphone-plug
│ │ ├── sb-mpdup
│ │ ├── sb-load_average
│ │ ├── sb-brightness
│ │ ├── sb-tasks
│ │ ├── sb-mailbox
│ │ ├── sb-pacpackages
│ │ ├── sb-calendar
│ │ ├── sb-chip_temp
│ │ ├── sb-torrent
│ │ ├── sb-moonphase
│ │ ├── sb-popupgrade
│ │ ├── sb-music
│ │ ├── sb-cpubars
│ │ ├── sb-disk
│ │ ├── sb-internet
│ │ ├── sb-pulsevol
│ │ ├── sb-nettraf
│ │ ├── sb-memory
│ │ ├── sb-battery
│ │ ├── sb-ticker
│ │ ├── sb-cpu_usage
│ │ ├── sb-price
│ │ └── sb-local_ipaddr
│ ├── remapd
│ ├── getkeys
│ ├── podentr
│ ├── showclip
│ ├── dmenupass
│ ├── fingerbox
│ ├── curlwttr
│ ├── getcomproot
│ ├── camtoggle
│ ├── queueandnotify
│ ├── pauseallmpv
│ ├── ifinstalled
│ ├── opout
│ ├── qndl
│ ├── td-toggle
│ ├── lmc
│ ├── fftemp
│ ├── rssadd
│ ├── listmarks
│ ├── dmenuunicode
│ ├── lfub
│ ├── archnews
│ ├── lf-select
│ ├── dmenumountcifs
│ ├── setbg
│ ├── sd
│ ├── unmounter
│ ├── remaps
│ ├── lf-file-op
│ ├── qolibri-mpv
│ ├── weath
│ ├── rotdir
│ ├── tag
│ ├── termcolors
│ ├── dmenuhandler
│ ├── bookmarkctl
│ ├── booksplit
│ ├── otp
│ ├── sysact
│ ├── getbib
│ ├── linkhandler
│ ├── noisereduce
│ ├── compiler
│ ├── rankspellings
│ ├── shortcuts
│ ├── maimocr
│ ├── rank-nitter-instances
│ ├── rank-invidious-instances
│ ├── rssget
│ ├── mounter
│ ├── slider
│ └── local-pronunciations
└── share
│ ├── larbs
│ ├── ttymaps.kmap
│ └── getkeys
│ │ ├── calcurse
│ │ ├── nsxiv
│ │ ├── zathura
│ │ ├── ncmpcpp
│ │ ├── newsboat
│ │ └── mutt
│ ├── icons
│ └── fingerbox.png
│ └── applications
│ ├── dmenuunicode.desktop
│ ├── newsboat-rss-add.desktop
│ ├── neomutt.desktop
│ ├── vwebp.desktop
│ ├── syncthing.desktop
│ ├── displayselect.desktop
│ ├── tv_asahi.desktop
│ ├── tv_tokyo.desktop
│ ├── tv_news24.desktop
│ ├── tv_tokyomx.desktop
│ ├── linkhandler.desktop
│ ├── lf.desktop
│ ├── tv_utako.desktop
│ ├── anki.desktop
│ ├── mozc-config.desktop
│ ├── nvim.desktop
│ ├── firefox-temp.desktop
│ └── firefox.desktop
├── .zprofile
├── .gtkrc-2.0
├── .github
└── FUNDING.yml
├── .gitignore
├── .gitmodules
└── README.md
/.config/sxiv:
--------------------------------------------------------------------------------
1 | nsxiv
--------------------------------------------------------------------------------
/.local/bin/sxiv:
--------------------------------------------------------------------------------
1 | /usr/bin/nsxiv
--------------------------------------------------------------------------------
/.zprofile:
--------------------------------------------------------------------------------
1 | .config/shell/profile
--------------------------------------------------------------------------------
/.gtkrc-2.0:
--------------------------------------------------------------------------------
1 | .config/gtk-2.0/gtkrc-2.0
--------------------------------------------------------------------------------
/.config/yt-dlp/config:
--------------------------------------------------------------------------------
1 | ../youtube-dl/config
--------------------------------------------------------------------------------
/.config/wget/wgetrc:
--------------------------------------------------------------------------------
1 | hsts-file=~/.cache/wget-hsts
2 |
--------------------------------------------------------------------------------
/.local/bin/dmenu:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | rofi -dmenu -i "$@"
3 |
--------------------------------------------------------------------------------
/.local/bin/xdg-terminal-exec:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | "$TERMINAL" -e "$@"
4 |
--------------------------------------------------------------------------------
/.local/share/larbs/ttymaps.kmap:
--------------------------------------------------------------------------------
1 | keycode 1 = Caps_Lock
2 | keycode 58 = Escape
3 |
--------------------------------------------------------------------------------
/.local/bin/trympv:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | mpv -quiet -- "$@" || "${BROWSER:-firefox}" -- "$@"
4 |
--------------------------------------------------------------------------------
/.config/python/pythonrc:
--------------------------------------------------------------------------------
1 | import readline
2 | readline.write_history_file = lambda *args: None
3 |
--------------------------------------------------------------------------------
/.local/bin/i3cmds/dropdowncalc:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | ifinstalled bc && echo "Welcome to the Calculator." && bc -lq
4 |
--------------------------------------------------------------------------------
/.local/share/icons/fingerbox.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tatsumoto-ren/dotfiles/HEAD/.local/share/icons/fingerbox.png
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | custom: https://tatsumoto.neocities.org/blog/donating-to-tatsumoto.html
4 |
--------------------------------------------------------------------------------
/.local/share/applications/dmenuunicode.desktop:
--------------------------------------------------------------------------------
1 | [Desktop Entry]
2 | Type=Application
3 | Name=dmenu unicode
4 | Exec=dmenuunicode
5 | Icon=face-sad
6 |
--------------------------------------------------------------------------------
/.local/share/applications/newsboat-rss-add.desktop:
--------------------------------------------------------------------------------
1 | [Desktop Entry]
2 | Type=Application
3 | Name=RSS feed addition
4 | Exec=/usr/bin/env rssadd %U
5 |
--------------------------------------------------------------------------------
/.local/bin/i3cmds/winresize:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 | echo "📐" | dmenu -p "Give width and height:" | xargs xdotool windowsize "$(xdotool getwindowfocus)"
3 |
--------------------------------------------------------------------------------
/.local/bin/pulsemixer-default-source:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | pulsemixer --list-sources |
4 | awk -F':|,' '/, Default$/ { print $3; exit; }' |
5 | sed 's/^\s*//g; s/\s*$//g'
6 |
--------------------------------------------------------------------------------
/.local/bin/tsp_onfinish:
--------------------------------------------------------------------------------
1 | #!/usr/bin/sh
2 |
3 | # The arguments passed are: jobid errorlevel output_filename command
4 |
5 | notify-send "Job $1 finished with status $2" "$4"
6 |
--------------------------------------------------------------------------------
/.local/share/applications/neomutt.desktop:
--------------------------------------------------------------------------------
1 | [Desktop Entry]
2 | Type=Application
3 | Name=Neomutt
4 | GenericName=Mail Client
5 | Exec=i3-sensible-terminal -e neomutt %u
6 | Icon=evolution
7 |
--------------------------------------------------------------------------------
/.local/share/applications/vwebp.desktop:
--------------------------------------------------------------------------------
1 | [Desktop Entry]
2 | Encoding=UTF-8
3 | Version=1.0
4 | Type=Application
5 | NoDisplay=true
6 | Exec=vwebp -info -mt -- %f
7 | Name=vwebp
8 | Comment=vwebp
9 |
--------------------------------------------------------------------------------
/.local/bin/statusbar/sb-cpu_freq:
--------------------------------------------------------------------------------
1 | #!/usr/bin/sh -e
2 |
3 | grep -F MHz /proc/cpuinfo | cut -d: -f2 | awk '
4 | {
5 | sum+=$0
6 | }
7 | END {
8 | printf "GHz %.2f\n", sum / FNR / 1000
9 | }'
10 |
--------------------------------------------------------------------------------
/.local/share/applications/syncthing.desktop:
--------------------------------------------------------------------------------
1 | [Desktop Entry]
2 | Name=Syncthing
3 | GenericName=Syncthing
4 | Comment=Syncthing
5 | Exec=syncthing
6 | Type=Application
7 | Icon=syncthing-gtk
8 | Categories=Network;
9 |
--------------------------------------------------------------------------------
/.local/bin/remapd:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Rerun the remaps script whenever a new input device is added.
4 |
5 | while :; do
6 | remaps
7 | grep -qP -m1 '[^un]bind.+\/[^:]+\(usb\)' <(udevadm monitor -u -t seat -s input -s usb)
8 | done
9 |
--------------------------------------------------------------------------------
/.config/pinentry/preexec:
--------------------------------------------------------------------------------
1 | #!/hint/sh
2 |
3 | # Define additional functionality for pinentry. For example
4 | test -e /usr/lib/libgcr-base-3.so.1 && exec /usr/bin/pinentry-gnome3 "$@"
5 | #test -e /usr/lib/libQt5Widgets.so.5 && exec /usr/bin/pinentry-qt "$@"
6 |
--------------------------------------------------------------------------------
/.config/pulse/daemon.conf:
--------------------------------------------------------------------------------
1 | # Never exit pulseaudio if idle. This is to deal with an issue of Chromium
2 | # browsers not properly starting Pulseaudio by themselves. When the underlying
3 | # issue is solved, this file/directory should be removed.
4 | exit-idle-time = -1
5 |
--------------------------------------------------------------------------------
/.local/bin/getkeys:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | cat "${XDG_DATA_HOME:-$HOME/.local/share}"/larbs/getkeys/"$1" 2>/dev/null && exit
4 | echo "Run command with one of the following arguments for info about that program:"
5 | ls "${XDG_DATA_HOME:-$HOME/.local/share}"/larbs/getkeys
6 |
--------------------------------------------------------------------------------
/.local/bin/i3cmds/toggletouchpad:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 | # Toggle touchpad. Requires xf86-input-synaptics.
3 | (synclient | grep "TouchpadOff.*1" && synclient TouchpadOff=0)>/dev/null && echo "TouchPad reactivated." && exit
4 | synclient TouchpadOff=1 && echo "TouchPad deactivated."
5 |
--------------------------------------------------------------------------------
/.local/bin/podentr:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # entr command to run `queueandnotify` when newsboat queue is changed
4 |
5 | [ "$(pgrep -x "$(basename "$0")" | wc -l)" -gt 2 ] && exit
6 |
7 | echo "${XDG_DATA_HOME:-$HOME/.local/share}"/newsboat/queue | entr -p queueandnotify 2>/dev/null
8 |
--------------------------------------------------------------------------------
/.local/share/applications/displayselect.desktop:
--------------------------------------------------------------------------------
1 | [Desktop Entry]
2 | Type=Application
3 | Name=Display Select
4 | Comment=Select Display
5 | GenericName=Settings
6 | Icon=utilities-terminal
7 | Exec=displayselect
8 | Categories=ConsoleOnly;System;
9 | MimeType=inode/directory;
10 |
--------------------------------------------------------------------------------
/.config/lf/cleaner:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # https://github.com/jstkdng/ueberzugpp/blob/master/scripts/lf/cleaner
4 | #ueberzugpp cmd -s "$UB_SOCKET" -a remove -i PREVIEW
5 |
6 | if [ -n "$FIFO_UEBERZUG" ]; then
7 | printf '{"action": "remove", "identifier": "PREVIEW"}\n' > "$FIFO_UEBERZUG"
8 | fi
9 |
--------------------------------------------------------------------------------
/.config/latexmk/latexmkrc:
--------------------------------------------------------------------------------
1 | $bibtex_use = 1.5;
2 | $cleanup_includes_cusdep_generated = 1;
3 | $cleanup_includes_generated = 1;
4 | $out_dir = "out";
5 | $pdf_mode = 5;
6 | $silent = 1;
7 |
8 | # SyncTeX
9 | push(@generated_exts, ("synctex.*"));
10 | push(@extra_xelatex_options, '-synctex=1') ;
11 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Local or machine-specific shell aliases
2 | /.config/shell/localrc
3 | # Machine-specific icc profiles
4 | /.local/share/icc
5 | # Various firefox profiles
6 | /.local/share/applications/firefox-*
7 | # Everyone has their own bookmarks
8 | /.config/newsboat/urls
9 |
10 | # Cache
11 | mimeinfo.cache
12 |
--------------------------------------------------------------------------------
/.local/share/applications/tv_asahi.desktop:
--------------------------------------------------------------------------------
1 | [Desktop Entry]
2 | Version=1.0
3 | Type=Application
4 | Exec=mpv "https://mov3.co/ja/tvasahi/"
5 | Name=テレビ朝日
6 | GenericName=TV Asahi
7 | Comment=Watch TV
8 | Icon=mpv
9 | Terminal=false
10 | StartupNotify=true
11 | Categories=Video;Player;TV;
12 | StartupWMClass=mpv
13 |
--------------------------------------------------------------------------------
/.local/share/applications/tv_tokyo.desktop:
--------------------------------------------------------------------------------
1 | [Desktop Entry]
2 | Version=1.0
3 | Type=Application
4 | Exec=mpv "https://mov3.co/en/tvtokyo/"
5 | Name=テレビ東京
6 | GenericName=TV Tokyo
7 | Comment=Watch TV
8 | Icon=mpv
9 | Terminal=false
10 | StartupNotify=true
11 | Categories=Video;Player;TV;
12 | StartupWMClass=mpv
13 |
--------------------------------------------------------------------------------
/.local/share/applications/tv_news24.desktop:
--------------------------------------------------------------------------------
1 | [Desktop Entry]
2 | Version=1.0
3 | Type=Application
4 | Exec=mpv "https://www.news24.jp/"
5 | Name=日テレNEWS24
6 | GenericName=NEWS24
7 | Comment=Watch the news
8 | Icon=mpv
9 | Terminal=false
10 | StartupNotify=true
11 | Categories=Video;Player;TV;
12 | StartupWMClass=mpv
13 |
--------------------------------------------------------------------------------
/.local/share/applications/tv_tokyomx.desktop:
--------------------------------------------------------------------------------
1 | [Desktop Entry]
2 | Version=1.0
3 | Type=Application
4 | Exec=mpv "https://mov3.co/en/tokyomx/"
5 | Name=TOKYO MX
6 | GenericName=Tokyo MX
7 | Comment=Watch TV
8 | Icon=mpv
9 | Terminal=false
10 | StartupNotify=true
11 | Categories=Video;Player;TV;
12 | StartupWMClass=mpv
13 |
--------------------------------------------------------------------------------
/.local/bin/showclip:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # Display contents of selection via dunst if running.
4 | # Separate script for i3.
5 |
6 | clip=$(xclip -o -selection clipboard)
7 | prim=$(xclip -o -selection primary)
8 |
9 | [ -n "$clip" ] && notify-send "Clipboard:" "$clip"
10 | [ -n "$prim" ] && notify-send "Primary:" "$prim"
11 |
--------------------------------------------------------------------------------
/.local/bin/dmenupass:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # This script is the SUDO_ASKPASS variable, meaning that it will be used as a
4 | # password prompt if needed.
5 |
6 | if pacman -Qq "rofi" >/dev/null; then
7 | rofi -dmenu -password -p "$1"
8 | else
9 | dmenu -sb "#d79921" -sf "#1d2021" -nf "#000000" -nb "#000000" -p "$1" <&- && echo
10 | fi
11 |
--------------------------------------------------------------------------------
/.config/pipewire/pipewire.conf.d/user-session.conf:
--------------------------------------------------------------------------------
1 | context.exec = [
2 | { path = "/usr/bin/wireplumber" args = "" condition = [ { exec.session-manager = null } { exec.session-manager = true } ] }
3 | { path = "/usr/bin/pipewire" args = "-c pipewire-pulse.conf" condition = [ { exec.pipewire-pulse = null } { exec.pipewire-pulse = true } ] }
4 | ]
5 |
--------------------------------------------------------------------------------
/.local/share/applications/linkhandler.desktop:
--------------------------------------------------------------------------------
1 | [Desktop Entry]
2 | Version=1.0
3 | Type=Application
4 | Name=Link Handler
5 | Exec=linkhandler %u
6 | Comment=Feed script a url or file location
7 | Icon=browser
8 | Terminal=false
9 | MimeType=x-scheme-handler/unknown;x-scheme-handler/about;x-scheme-handler/https;x-scheme-handler/http;text/html;
10 |
--------------------------------------------------------------------------------
/.local/bin/fingerbox:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # Fingerbox is a simple browser launcher initially meant to run Firefox with a fake TZ.
4 |
5 | export TZ=UTC
6 |
7 | for browser in "$BROWSER" librewolf icecat firefox chromium; do
8 | if command -v "$browser" && [ "$browser" != "$(basename -- "$0")" ]; then
9 | exec "$browser" "$@"
10 | fi
11 | done
12 |
--------------------------------------------------------------------------------
/.local/share/applications/lf.desktop:
--------------------------------------------------------------------------------
1 | [Desktop Entry]
2 | Type=Application
3 | Name=LF File Manager
4 | Comment=Browse the filesystem with the file manager
5 | GenericName=File Manager
6 | Icon=system-file-manager
7 | Exec=i3-sensible-terminal --title lf -e lf %f
8 | Categories=ConsoleOnly;System;FileTools;FileManager
9 | MimeType=inode/directory;
10 |
--------------------------------------------------------------------------------
/.local/share/applications/tv_utako.desktop:
--------------------------------------------------------------------------------
1 | [Desktop Entry]
2 | Version=1.0
3 | Type=Application
4 | Exec=mpv "https://gitflic.ru/project/utako/utako/blob/raw?file=jp.m3u"
5 | Name=IPTV-JP
6 | GenericName=IPTV-JP
7 | Comment=Watch TV
8 | Icon=mpv
9 | Terminal=false
10 | StartupNotify=true
11 | Categories=Video;Player;TV;
12 | StartupWMClass=mpv
13 |
--------------------------------------------------------------------------------
/.local/bin/curlwttr:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -euo pipefail
4 |
5 | readonly result=$(curl -s \
6 | --max-time 10 \
7 | --compressed \
8 | -H "Accept-Language: ${LANG%_*}" \
9 | "https://wttr.in/$*" 2>/dev/null
10 | )
11 |
12 | if [[ -n $result ]] && ! [[ ${result,,} =~ sorry|unknow|error|time-out ]]; then
13 | echo "$result"
14 | else
15 | exit 1
16 | fi
17 |
--------------------------------------------------------------------------------
/.config/locale.conf:
--------------------------------------------------------------------------------
1 | LANG=en_US.UTF-8
2 | LC_CTYPE=en_US.UTF-8
3 | LC_NUMERIC=en_US.UTF-8
4 | LC_TIME=en_US.UTF-8
5 | LC_COLLATE=en_US.UTF-8
6 | LC_MONETARY=en_US.UTF-8
7 | LC_MESSAGES=en_US.UTF-8
8 | LC_PAPER=en_US.UTF-8
9 | LC_NAME=en_US.UTF-8
10 | LC_ADDRESS=en_US.UTF-8
11 | LC_TELEPHONE=en_US.UTF-8
12 | LC_MEASUREMENT=en_US.UTF-8
13 | LC_IDENTIFICATION=en_US.UTF-8
14 |
--------------------------------------------------------------------------------
/.local/share/applications/anki.desktop:
--------------------------------------------------------------------------------
1 | [Desktop Entry]
2 | Name=Anki
3 | Comment=An intelligent spaced-repetition memory training program
4 | GenericName=Flashcards
5 | Exec=anki %f
6 | TryExec=anki
7 | Icon=anki
8 | Categories=Education;Languages;KDE;Qt;
9 | Terminal=false
10 | Type=Application
11 | Version=1.0
12 | MimeType=application/x-apkg;application/x-anki;application/x-ankiaddon;
13 |
--------------------------------------------------------------------------------
/.local/bin/statusbar/sb-headphone-plug:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # This loop will update the volume statusbar module whenever headphones
4 | # are connected or disconnected.
5 | # https://linux.die.net/man/8/acpid
6 | # https://unix.stackexchange.com/a/128007
7 |
8 | acpi_listen | grep --line-buffered -F 'jack/headphone HEADPHONE' | while read -r line; do
9 | pkill -RTMIN+10 "${STATUSBAR:-i3blocks}"
10 | done
11 |
--------------------------------------------------------------------------------
/.local/share/larbs/getkeys/calcurse:
--------------------------------------------------------------------------------
1 | _
2 | ___ __ _| | ___ _ _ _ __ ___ ___
3 | / __/ _` | |/ __| | | | '__/ __|/ _ \
4 | | (_| (_| | | (__| |_| | | \__ \ __/
5 | \___\__,_|_|\___|\__,_|_| |___/\___|
6 |
7 | calcurse is the calendar and schedule manager.
8 | tab - Switch from calendar to todo to appointments
9 | h/j/k/l - Move left/down/up/right
10 | Most other bindings are listed in the program.
11 |
--------------------------------------------------------------------------------
/.local/bin/getcomproot:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # A helper script for LaTeX/groff files used by `compiler` and `opout`.
4 | # The user can add the root file of a larger project as a comment as below:
5 | # % root = mainfile.tex
6 | # And the compiler script will run on that instead of the opened file.
7 |
8 | texroot="$(sed -n 's/^\s*%.*root\s*=\s*\(\S\+\).*/\1/p' "${1}")"
9 | [ -f "${texroot}" ] && readlink -f "${texroot}" || exit "1"
10 |
--------------------------------------------------------------------------------
/.local/bin/statusbar/sb-mpdup:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | pgrep -x mpd || mpd # Start mpd
4 | command -v mpc || exit # Exit if no mpc
5 |
6 | # This loop will update the mpd statusbar module whenever a command changes the
7 | # music player's status. mpd must be running on X's start for this to work.
8 |
9 | while :; do
10 | if mpc idle; then
11 | pkill -RTMIN+11 "${STATUSBAR:-i3blocks}"
12 | else
13 | break
14 | fi
15 | done
16 |
--------------------------------------------------------------------------------
/.local/bin/camtoggle:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | if ! pkill -f /dev/video; then
4 | setsid -f mpv \
5 | --no-osc \
6 | --no-input-default-bindings \
7 | --input-conf=/dev/null \
8 | --geometry=-0-0 \
9 | --autofit=30% \
10 | --title="mpvfloat" \
11 | --profile=low-latency \
12 | --untimed \
13 | --no-cache \
14 | "$(ls /dev/video* | head -n 1)"
15 | notify-send "Camtoggle" "Launched."
16 | else
17 | notify-send "Camtoggle" "Killed."
18 | fi
19 |
--------------------------------------------------------------------------------
/.local/bin/queueandnotify:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # Podboat sucks. This script replaces it.
4 | # It reads the newsboat queue, queuing downloads with taskspooler.
5 | # It also removes the junk from extensions.
6 | queuefile="${XDG_DATA_HOME:-$HOME/.local/share}/newsboat/queue"
7 |
8 | while read -r line; do
9 | [ -z "$line" ] && continue
10 | url="${line%%[ ]*}"
11 | qndl "$url" "curl -LO"
12 | done < "$queuefile"
13 |
14 | echo > "$queuefile"
15 |
--------------------------------------------------------------------------------
/.config/youtube-dl/config:
--------------------------------------------------------------------------------
1 | --sub-lang 'en,en-US,en-GB,ja,ru'
2 | --write-subs
3 | --convert-subs ass
4 | --no-mtime
5 | --ignore-errors
6 | --continue
7 | --add-metadata
8 | -f 'bestvideo[height<=1080]+bestaudio,best'
9 | -o '/mnt/archive/video/ytdl/%(upload_date)s - %(title).64s.%(ext)s'
10 | --merge-output-format mp4
11 | --user-agent "Mozilla/5.0 (Windows NT 10.0; rv:94.0) Gecko/20100101 Firefox/94.0"
12 | --geo-bypass
13 | --proxy socks5://127.0.0.1:10801/
14 |
--------------------------------------------------------------------------------
/.local/share/applications/mozc-config.desktop:
--------------------------------------------------------------------------------
1 | [Desktop Entry]
2 | Version=1.0
3 | Name=Mozc Configuration
4 | GenericName=Input Method Editor Configuration
5 | Comment=Configure Mozc
6 | Exec=/usr/lib/mozc/mozc_tool --mode=config_dialog
7 | Icon=/usr/share/fcitx/mozc/icon/mozc.png
8 | Terminal=false
9 | Type=Application
10 | StartupNotify=false
11 | Categories=Settings;
12 | Keywords=web;browser;internet;
13 | Actions=new-window;new-private-window;banking;profile-manager;
14 |
--------------------------------------------------------------------------------
/.local/share/applications/nvim.desktop:
--------------------------------------------------------------------------------
1 | [Desktop Entry]
2 | Type=Application
3 | Name=Neovim text editor
4 | GenericName=Text Editor
5 | TryExec=nvim
6 | Exec=i3-sensible-terminal -e nvim %F
7 | Keywords=Text;editor;
8 | Icon=nvim
9 | Categories=Utility;TextEditor;
10 | StartupNotify=false
11 | MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;
12 |
--------------------------------------------------------------------------------
/.local/share/larbs/getkeys/nsxiv:
--------------------------------------------------------------------------------
1 | _ __ _____ _(_)_ __
2 | | '_ \/ __\ \/ / \ \ / /
3 | | | | \__ \> <| |\ V /
4 | |_| |_|___/_/\_\_| \_/
5 | nsxiv is the image viewer.
6 | h/j/k/l - Pan image
7 | -/+ - Zoom out/in
8 | Enter - Toggle thumbnail mode
9 | f - Fullscreen
10 | n/p - Previous/next image in list/directory
11 | r - Reload image if changed
12 | m - Mark/unmark image
13 | w - Zoom to fit window
14 | ctrl-x - Run external command (see ~/.config/nsxiv/exec/key-handler for options)
15 |
--------------------------------------------------------------------------------
/.config/shell/inputrc:
--------------------------------------------------------------------------------
1 | $include /etc/inputrc
2 | set editing-mode vi
3 | set completion-ignore-case on
4 | $if mode=vi
5 |
6 | set show-mode-in-prompt on
7 | set vi-ins-mode-string \1\e[6 q\2
8 | set vi-cmd-mode-string \1\e[2 q\2
9 |
10 | set keymap vi-command
11 | # these are for vi-command mode
12 | Control-l: clear-screen
13 | Control-a: beginning-of-line
14 |
15 | set keymap vi-insert
16 | # these are for vi-insert mode
17 | Control-l: clear-screen
18 | Control-a: beginning-of-line
19 |
20 | $endif
21 |
--------------------------------------------------------------------------------
/.local/bin/pauseallmpv:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # You might notice all mpv commands are aliased to have this input-ipc-server
4 | # thing. That's just for this particular command, which allows us to pause
5 | # every single one of them with one command! This is bound to super + shift + p
6 | # (with other things) by default and is used in some other places.
7 |
8 | [[ -d /tmp/mpvSockets ]] && for i in /tmp/mpvSockets/*; do
9 | echo '{ "command": ["set_property", "pause", true] }' | socat - "$i";
10 | done
11 | true
12 |
--------------------------------------------------------------------------------
/.local/share/applications/firefox-temp.desktop:
--------------------------------------------------------------------------------
1 | [Desktop Entry]
2 | Version=1.0
3 | Name=Fingerbox / Temp
4 | GenericName=Temporary Web Browser profile
5 | Comment=Browse the Web
6 | Exec=fftemp %u
7 | Icon=fingerbox
8 | Terminal=false
9 | Type=Application
10 | MimeType=text/html;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;text/mml;x-scheme-handler/http;x-scheme-handler/https;
11 | StartupNotify=true
12 | Categories=Network;WebBrowser;
13 | Keywords=web;browser;internet;
14 | StartupWMClass=Firefox
15 |
--------------------------------------------------------------------------------
/.local/bin/ifinstalled:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # Some scripts require programs not installed by default.
4 | # I use this little script to check to see if a command exists and if it doesn't
5 | # it informs the user that they need that command to continue.
6 |
7 | for x in "$@"; do
8 | if ! which "$x" >/dev/null 2>&1 && ! pacman -Qq "$x" >/dev/null 2>&1; then
9 | echo "Error: $x must be installed for this function." >&2
10 | notify-send -u critical "📦 $x" "$x must be installed for this function."
11 | exit 1
12 | fi
13 | done
14 |
--------------------------------------------------------------------------------
/.local/bin/statusbar/sb-load_average:
--------------------------------------------------------------------------------
1 | #!/usr/bin/bash
2 |
3 | list_cpu_hogs() {
4 | ps axch -o cmd,%cpu |
5 | awk '{cmd[$1]+=$2} END {for (i in cmd) print i, cmd[i]}' |
6 | sort -nrk2 |
7 | head
8 | }
9 |
10 | notify_hogs() {
11 | notify-send "CPU hogs" "$(list_cpu_hogs)\\n(100% per core)"
12 | }
13 |
14 | if [[ $BLOCK_BUTTON == 1 ]]; then
15 | notify_hogs
16 | fi
17 |
18 | readonly load=$(cut -f1 -d' ' /proc/loadavg)
19 |
20 | echo "AVG $load"
21 | echo " $load"
22 | awk "-vl=$load" "-vn=$(nproc)" 'BEGIN{if(l>n){exit(33);}}'
23 |
--------------------------------------------------------------------------------
/.local/bin/opout:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # opout: "open output": A general handler for opening a file's intended output,
4 | # usually the pdf of a compiled document. I find this useful especially
5 | # running from vim.
6 |
7 | basename="${1%.*}"
8 |
9 | case "${*}" in
10 | *.typ|*.tex|*.sil|*.m[dse]|*.[rR]md|*.mom|*.[0-9]) target="$(getcomproot "$1" || echo "$1")" ; setsid -f xdg-open "${target%.*}".pdf >/dev/null 2>&1 ;;
11 | *.html) setsid -f "$BROWSER" "$basename".html >/dev/null 2>&1 ;;
12 | *.sent) setsid -f sent "$1" >/dev/null 2>&1 ;;
13 | esac
14 |
--------------------------------------------------------------------------------
/.local/bin/qndl:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # $1 is a url; $2 is a command
4 |
5 | if [ -z "$1" ]; then
6 | exit 1
7 | fi
8 |
9 | base="$(basename -- "$1")"
10 | cmd="$2"
11 |
12 | notify-send "qndl" "⏳ Queuing $base..."
13 |
14 | if [ -z "$cmd" ]; then
15 | cmd="yt-dlp --embed-metadata -ic"
16 | fi
17 |
18 | idnum="$(tsp $cmd "$1")"
19 | realname="$(echo "$base" | sed "s/?\(source\|dest\).*//;s/%20/ /g")"
20 |
21 | if [ "$base" != "$realname" ]; then
22 | tsp -D "$idnum" mv "$base" "$realname"
23 | fi
24 | tsp -D "$idnum" notify-send "👍 $realname done."
25 |
--------------------------------------------------------------------------------
/.config/gtk-3.0/settings.ini:
--------------------------------------------------------------------------------
1 | [Settings]
2 | gtk-application-prefer-dark-theme=0
3 | gtk-theme-name=Arc-Darker
4 | gtk-icon-theme-name=Papirus
5 | gtk-font-name=Noto Sans CJK JP 9
6 | gtk-cursor-theme-size=18
7 | gtk-toolbar-style=GTK_TOOLBAR_BOTH_HORIZ
8 | gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
9 | gtk-button-images=1
10 | gtk-menu-images=1
11 | gtk-enable-event-sounds=1
12 | gtk-enable-input-feedback-sounds=1
13 | gtk-xft-antialias=1
14 | gtk-xft-hinting=1
15 | gtk-xft-hintstyle=hintslight
16 | gtk-xft-rgba=none
17 | gtk-modules=canberra-gtk-module
18 | gtk-cursor-theme-name=Adwaita
19 |
--------------------------------------------------------------------------------
/.local/bin/td-toggle:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # If transmission-daemon is running, will ask to kill, else will ask to start.
4 |
5 | if pidof transmission-daemon >/dev/null ;
6 | then
7 | [ "$(printf "No\\nYes" | dmenu -i -p "Turn off transmission-daemon?")" = "Yes" ] && killall transmission-daemon && notify-send "transmission-daemon disabled."
8 | else
9 | ifinstalled transmission-cli || exit
10 | [ "$(printf "No\\nYes" | dmenu -i -p "Turn on transmission daemon?")" = "Yes" ] && transmission-daemon && notify-send "transmission-daemon enabled."
11 | fi
12 | sleep 3 && pkill -RTMIN+7 "${STATUSBAR:-i3blocks}"
13 |
--------------------------------------------------------------------------------
/.local/share/larbs/getkeys/zathura:
--------------------------------------------------------------------------------
1 | _ _
2 | ______ _| |_| |__ _ _ _ __ __ _
3 | |_ / _` | __| '_ \| | | | '__/ _` |
4 | / / (_| | |_| | | | |_| | | | (_| |
5 | /___\__,_|\__|_| |_|\__,_|_| \__,_|
6 |
7 | zathura is the pdf/djvu reader.
8 | h/j/k/l - Move left/down/up/right in document
9 | d/u - Down/up a half page
10 | gg - Top of document
11 | G - Bottom of document
12 | f - Highlight URLS to follow
13 | J/K - Zoom out/in
14 | s - Zoom to fit width
15 | a - Zoom to fit height
16 | r - Reload document if changed
17 | R - Rotate document
18 | D - Toggle dual-page mode
19 | p - Print document
20 |
--------------------------------------------------------------------------------
/.local/bin/lmc:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | STEP="${2:-5}"
4 |
5 | case "$1" in
6 | toggle-mic)
7 | pamixer --default-source --toggle-mute ;;
8 | toggle*)
9 | pamixer --toggle-mute ;;
10 | mute)
11 | pamixer --mute ;;
12 | mute-mic)
13 | pamixer --default-source --mute ;;
14 | unmute)
15 | pamixer --unmute ;;
16 | up)
17 | pamixer --increase "$STEP" ;;
18 | down)
19 | pamixer --decrease "$STEP" ;;
20 | control)
21 | pulsemixer ;;
22 | *)
23 | notify-send -u critical "$(basename -- "$0")" "Unsupported operation: ${1:-empty string}." ;;
24 | esac >/dev/null
25 |
26 | pkill -RTMIN+10 "${STATUSBAR:-i3blocks}" &
27 |
--------------------------------------------------------------------------------
/.local/bin/statusbar/sb-brightness:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # current brightness
4 | curr_brightness=$(cat /sys/class/backlight/*/brightness)
5 |
6 | # max_brightness
7 | max_brightness=$(cat /sys/class/backlight/*/max_brightness)
8 |
9 | # brightness percentage
10 | brightness_per=$((100 * curr_brightness / max_brightness))
11 |
12 | case $BLOCK_BUTTON in
13 | 1)
14 | ;;
15 | 3)
16 | notify-send "💡 Brightness module" "\- Shows current brightness level ☀️."
17 | ;;
18 | 6)
19 | setsid -f "$TERMINAL" -e "$EDITOR" "$0"
20 | ;;
21 | esac
22 |
23 | echo "💡 ${brightness_per}%"
24 |
--------------------------------------------------------------------------------
/.local/bin/fftemp:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | readonly TZ=UTC
4 | readonly BROWSER=$(command -v librewolf icecat iceweasel firefox | head -1)
5 | readonly fftmpdir=/tmp/firefox-temp
6 |
7 | export TZ BROWSER
8 |
9 | mkdir -p "$fftmpdir" && chmod 700 "$fftmpdir" &&
10 | echo "Created $fftmpdir directory." || exit 1
11 |
12 | if command -v firejail; then
13 | firejail --seccomp --profile=firefox --private="$fftmpdir" \
14 | "$BROWSER" --new-instance --no-remote "$@"
15 | else
16 | echo "Firejail is not installed.">&2 &&
17 | "$BROWSER" --new-instance --profile "$fftmpdir" --no-remote "$@"
18 | fi
19 | rm -rf "$fftmpdir" && echo "Bye-bye!"
20 |
--------------------------------------------------------------------------------
/.local/bin/rssadd:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | if echo "$1" | grep -q "https*://\S\+\.[A-Za-z]\+\S*" ; then
4 | url="$1"
5 | else
6 | url="$(grep -Eom1 '<[^>]+(rel="self"|application/[a-z]+\+xml)[^>]+>' "$1" |
7 | grep -o "https?://[^\" ]")"
8 |
9 | echo "$url" | grep -q "https*://\S\+\.[A-Za-z]\+\S*" ||
10 | notify-send "That doesn't look like a full URL." && exit 1
11 | fi
12 |
13 | RSSFILE="${XDG_CONFIG_HOME:-$HOME/.config}/newsboat/urls"
14 | if awk '{print $1}' "$RSSFILE" | grep "^$url$" >/dev/null; then
15 | notify-send "You already have this RSS feed."
16 | else
17 | echo "$url" >> "$RSSFILE" && notify-send "RSS feed added."
18 | fi
19 |
--------------------------------------------------------------------------------
/.local/share/larbs/getkeys/ncmpcpp:
--------------------------------------------------------------------------------
1 |
2 | _ __ ___ _ __ ___ _ __ ___ _ __ _ __
3 | | '_ \ / __| '_ ` _ \| '_ \ / __| '_ \| '_ \
4 | | | | | (__| | | | | | |_) | (__| |_) | |_) |
5 | |_| |_|\___|_| |_| |_| .__/ \___| .__/| .__/
6 | |_| |_| |_|
7 |
8 | ncmpcpp is the music player.
9 | h/j/k/l - Move left/down/up/right
10 | d/u - Down/up page
11 | a - Add song(s) to playlist
12 | c - Clear playlist
13 | g - Go to top
14 | G - Go to bottom
15 | p - Pause
16 | m - Media library
17 | f - Music sorted by directory structure
18 | t - Tag editor
19 | s - Search
20 | v - Visualizer
21 | P - Playlist
22 |
--------------------------------------------------------------------------------
/.local/bin/listmarks:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -euo pipefail
4 |
5 | urldecode() {
6 | local url
7 | url=$(cut -f1 -d' ')
8 | url=${url//file:\/\//}
9 | url=${url//+/ }
10 | url=${url//%/\\x}
11 | printf -- '%b\n' "$url"
12 | }
13 |
14 | if [[ $* =~ ^(dirs|files)$ ]]; then
15 | sed \
16 | -e 's/\s*#.*$//' \
17 | -e '/^\s*$/d' \
18 | -e 's/^\S*\s*//' \
19 | -e 's|~|$HOME|' \
20 | "${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-$*" |
21 | while read -r line; do
22 | eval "echo $line"
23 | done
24 | if [[ $* == dirs ]]; then
25 | urldecode < "${XDG_CONFIG_HOME:-$HOME/.config}/gtk-3.0/bookmarks"
26 | fi
27 | fi | sort -u
28 |
--------------------------------------------------------------------------------
/.local/bin/dmenuunicode:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # The famous "get a menu of emojis to copy" script.
4 |
5 | # Get user selection via dmenu from emoji file.
6 | chosen=$(cut -d ';' -f1 ~/.local/share/larbs/chars/* | dmenu -i -l 30 -p 'Select emoji' | sed "s/ .*//")
7 |
8 | # Exit if none chosen.
9 | [ -z "$chosen" ] && exit
10 |
11 | # If you run this command with an argument, it will automatically insert the
12 | # character. Otherwise, show a message that the emoji has been copied.
13 | if [ -n "$1" ]; then
14 | xdotool type "$chosen"
15 | else
16 | printf "%s" "$chosen" | xclip -selection clipboard
17 | notify-send "'$chosen' copied to clipboard." &
18 | fi
19 |
--------------------------------------------------------------------------------
/.local/bin/i3cmds/ducksearch:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 | # Gives a dmenu prompt to search DuckDuckGo.
3 | # Without input, will open DuckDuckGo.com.
4 | # URLs will be directly handed to the browser.
5 | # Anything else, it search it.
6 |
7 | browser=${BROWSER:-firefox}
8 |
9 | pgrep -x dmenu && exit
10 |
11 | choice=$(echo "🦆" | dmenu -i -p "Search DuckDuckGo:") || exit 1
12 |
13 | if [ "$choice" = "🦆" ]; then
14 | "$browser" "https://duckduckgo.com"
15 | else
16 | if echo "$choice" | grep "^(http:\/\/|https:\/\/)?[a-zA-Z0-9]+\.[a-zA-Z]+(/)?.*$"; then
17 | "$browser" "$choice"
18 | else
19 | "$browser" "https://duckduckgo.com/?q=$choice&t=ffab&atb=v1-1"
20 | fi
21 | fi
22 |
--------------------------------------------------------------------------------
/.config/user-dirs.dirs:
--------------------------------------------------------------------------------
1 | # This file is written by xdg-user-dirs-update
2 | # If you want to change or add directories, just edit the line you're
3 | # interested in. All local changes will be retained on the next run.
4 | # Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped
5 | # homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
6 | # absolute path. No other format is supported.
7 | #
8 | XDG_DESKTOP_DIR="$HOME/Desktop"
9 | XDG_DOWNLOAD_DIR="$HOME/Downloads"
10 | XDG_TEMPLATES_DIR="$HOME/Templates"
11 | XDG_PUBLICSHARE_DIR="$HOME/Public"
12 | XDG_DOCUMENTS_DIR="$HOME/Documents"
13 | XDG_MUSIC_DIR="$HOME/Music"
14 | XDG_PICTURES_DIR="$HOME/Pictures"
15 | XDG_VIDEOS_DIR="$HOME/Videos"
16 |
--------------------------------------------------------------------------------
/.config/gtk-2.0/gtkrc-2.0:
--------------------------------------------------------------------------------
1 | # DO NOT EDIT! This file will be overwritten by LXAppearance.
2 | # Any customization should be done in ~/.gtkrc-2.0.mine instead.
3 |
4 | include "~/.gtkrc-2.0.mine"
5 | gtk-theme-name="Arc-Darker"
6 | gtk-icon-theme-name="Papirus"
7 | gtk-font-name="Noto Sans CJK JP 9"
8 | gtk-cursor-theme-name="Adwaita"
9 | gtk-cursor-theme-size=18
10 | gtk-toolbar-style=GTK_TOOLBAR_BOTH_HORIZ
11 | gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
12 | gtk-button-images=1
13 | gtk-menu-images=1
14 | gtk-enable-event-sounds=1
15 | gtk-enable-input-feedback-sounds=1
16 | gtk-xft-antialias=1
17 | gtk-xft-hinting=1
18 | gtk-xft-hintstyle="hintslight"
19 | gtk-xft-rgba="none"
20 | gtk-modules="canberra-gtk-module"
21 |
--------------------------------------------------------------------------------
/.config/shell/bm-dirs:
--------------------------------------------------------------------------------
1 | # You can add comments to these files with #
2 |
3 | # Home
4 | downloads ~/Downloads
5 | pictures ~/Pictures
6 | documents ~/Documents
7 | syncthing ~/Documents/syncthing
8 | proj ~/Documents/Projects
9 | blog ~/Documents/Projects/bashblog/site/blog
10 | addons ~/Documents/anki_addons
11 |
12 | # Dotfiles
13 | cf ~/.config
14 | cac ~/.cache
15 | sc ~/.local/bin
16 | sr ~/.local/share
17 | rr ~/.local/src
18 |
19 | # External drives
20 | mnt /mnt
21 | avideo /mnt/archive/video
22 | audio /mnt/archive/audio
23 | ongoing /mnt/d/ongoing
24 | dvideo /mnt/d/video
25 | ytdl /mnt/archive/video/ytdl
26 | books /mnt/archive/books
27 | subs /mnt/archive/japanese/kitsunekko-mirror/subtitles
28 | japanese /mnt/archive/japanese/
29 |
--------------------------------------------------------------------------------
/.config/fontconfig/conf.d/10-no-sub-pixel.conf:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Disable sub-pixel rendering
5 |
6 |
7 |
13 | none
14 |
15 |
16 |
--------------------------------------------------------------------------------
/.config/nvim/auto_fcitx.vim:
--------------------------------------------------------------------------------
1 | " Auto Fcitx
2 | " https://wiki.archlinux.org/title/Fcitx#Vim
3 | let g:input_toggle = 1
4 | function! FcitxDisable()
5 | let s:input_status = system("fcitx-remote")
6 | if s:input_status == 2
7 | let g:input_toggle = 1
8 | let l:a = system("fcitx-remote -c")
9 | endif
10 | endfunction
11 |
12 | function! FcitxEnable()
13 | let s:input_status = system("fcitx-remote")
14 | if s:input_status != 2 && g:input_toggle == 1
15 | let l:a = system("fcitx-remote -o")
16 | let g:input_toggle = 0
17 | endif
18 | endfunction
19 |
20 | set ttimeoutlen=150
21 | "Exit insert mode
22 | autocmd InsertLeave * call FcitxDisable()
23 | "Enter insert mode
24 | autocmd InsertEnter * call FcitxEnable()
25 |
--------------------------------------------------------------------------------
/.local/bin/statusbar/sb-tasks:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # Originally by Andr3as07
4 | # Some changes by Luke
5 | # Rebuild by Tenyun
6 |
7 | # This block displays the number running background tasks. Requires tsp.
8 |
9 | num=$(tsp -l | awk -v numr=0 -v numq=0 '{if (/running/)numr++; if (/queued/)numq++} END{print numr+numq"("numq")"}')
10 |
11 | # Handle mouse clicks
12 | case $BLOCK_BUTTON in
13 | 1) setsid -f "$TERMINAL" -e tsp -l ;;
14 | 3) notify-send "Tasks module" "🤖: number of running/queued background tasks
15 | - Left click opens tsp" ;; # Right click
16 | 2) $EDITOR "$0" ;; # Middle click
17 | 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
18 | esac
19 |
20 | [ "$num" != "0(0)" ] &&
21 | echo "🤖$num"
22 |
--------------------------------------------------------------------------------
/.local/share/larbs/getkeys/newsboat:
--------------------------------------------------------------------------------
1 | _ _
2 | _ __ _____ _____| |__ ___ __ _| |_
3 | | '_ \ / _ \ \ /\ / / __| '_ \ / _ \ / _` | __|
4 | | | | | __/\ V V /\__ \ |_) | (_) | (_| | |_
5 | |_| |_|\___| \_/\_/ |___/_.__/ \___/ \__,_|\__|
6 |
7 | newsboat is the RSS reader.
8 | j/k - Move down/up
9 | l - Open entry
10 | h/q - Back/quit
11 | Q - Quit immediately
12 | J/K - Previous/next feed
13 | n - Next unread
14 | N - Previous unread
15 | a - Toggle article read/unread
16 | A - Mark all as read
17 | U - Show all URLs
18 | ,, - Open main link with linkhandler
19 | ,p - Pick which program to open link with
20 | ,v - Open video link in mpv
21 | ,w - Open link in w3m
22 | ,c - Copy link to clipboard
23 |
--------------------------------------------------------------------------------
/.local/bin/statusbar/sb-mailbox:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # Displays number of unread mail and an loading icon if updating.
4 | # When clicked, brings up `neomutt`.
5 |
6 | case $BLOCK_BUTTON in
7 | 1) setsid -w -f "$TERMINAL" -e neomutt; pkill -RTMIN+12 "${STATUSBAR:-i3blocks}" ;;
8 | 2) setsid -f mw -Y >/dev/null ;;
9 | 3) notify-send "📬 Mail module" "\- Shows unread mail
10 | - Shows 🔃 if syncing mail
11 | - Left click opens neomutt
12 | - Middle click syncs mail" ;;
13 | 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
14 | esac
15 |
16 | unread="$(find "${XDG_DATA_HOME:-$HOME/.local/share}"/mail/*/[Ii][Nn][Bb][Oo][Xx]/new/* -type f | wc -l 2>/dev/null)"
17 |
18 | pidof mbsync >/dev/null 2>&1 && icon="🔃"
19 |
20 | [ "$unread" = "0" ] && [ "$icon" = "" ] || echo "📬$unread$icon"
21 |
--------------------------------------------------------------------------------
/.config/x11/keyboard_layouts:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # Fcitx
4 | # https://wiki.archlinux.org/index.php/Fcitx
5 | find_fcitx() {
6 | for cmd in fcitx5 fcitx; do
7 | command -v "$cmd" && return
8 | done
9 | }
10 |
11 | if [ -n "${fcitx:=$(find_fcitx)}" ]; then
12 | # Define the environment variables to register the input method modules.
13 | export GTK_IM_MODULE=fcitx
14 | export QT_IM_MODULE=fcitx
15 | export XMODIFIERS=@im=fcitx
16 | setxkbmap -model pc104 \
17 | -layout us \
18 | -variant altgr-intl \
19 | -option terminate:ctrl_alt_bksp,caps:escape
20 | "$fcitx" -dr 2>/dev/null &
21 | else
22 | setxkbmap -model pc104 \
23 | -layout us,ru \
24 | -variant altgr-intl,winkeys \
25 | -option terminate:ctrl_alt_bksp,caps:escape,grp:win_space_toggle
26 | fi
27 |
--------------------------------------------------------------------------------
/.local/bin/statusbar/sb-pacpackages:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Displays number of upgradeable packages.
4 | # When clicked, it will run an upgrade via pacman.
5 | # Requires checkupdates. checkupdates is owned by pacman-contrib.
6 |
7 | readonly cache_file=~/.cache/checkupdates
8 |
9 | print_cache() {
10 | if [ -s "$cache_file" ]; then
11 | cat "$cache_file"
12 | else
13 | echo "None."
14 | fi
15 | }
16 |
17 | case $BLOCK_BUTTON in
18 | 1) notify-send "Upgradeable packages" "$(print_cache)" &;;
19 | 3) setsid -f "$TERMINAL" -e sb-popupgrade ;;
20 | 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
21 | esac
22 |
23 | printf -- "UPD "
24 |
25 | if [[ -n $BLOCK_BUTTON ]]; then
26 | wc -l <"$cache_file"
27 | else
28 | checkupdates | tee "$cache_file" | wc -l || echo "?"
29 | fi
30 |
--------------------------------------------------------------------------------
/.local/bin/statusbar/sb-calendar:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | date '+%b %d (%a)'
4 | date '+%d.%m'
5 |
6 | mark_weekend() {
7 | sed \
8 | -e 's|Su|&|' \
9 | -e 's|Sa|&|'
10 | }
11 |
12 | mark_day() {
13 | sed \
14 | -e "s/..7m//;" \
15 | -e "s/..0m/<\/span><\/b>/;"
16 | }
17 |
18 | show_cal() {
19 | cal -m -c1 -3 --color=always | mark_weekend | mark_day
20 | }
21 |
22 | case $BLOCK_BUTTON in
23 | 1)
24 | notify-send Calendar "$(show_cal)"
25 | command -v calcurse && notify-send "Appointments" "$(calcurse -D ~/.config/calcurse -d3)" ;;
26 | 2)
27 | setsid -f i3-sensible-terminal -e 'calcurse -D ~/.config/calcurse' & ;;
28 | 6)
29 | setsid -f i3-sensible-terminal -e "$EDITOR" "$0" ;;
30 | esac
31 |
--------------------------------------------------------------------------------
/.local/bin/statusbar/sb-chip_temp:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | case $BLOCK_BUTTON in
4 | 1) notify-send "🖥 CPU hogs" "$(ps axch -o cmd:15,%cpu --sort=-%cpu | head)\\n(100% per core)" ;;
5 | 3) i3-msg -q exec "$TERMINAL -e htop" ;;
6 | 6) i3-msg -q exec "$TERMINAL -e $EDITOR $0" ;;
7 | esac
8 |
9 | readonly temp="$(eval "${query:?}" | tr -cd '[:digit:].')"
10 | readonly label="${chip_label:-CPU}"
11 | [ -z "$temp" ] && exit 1
12 |
13 | awk -v temp="$temp" -v label="$label" '
14 | BEGIN {
15 | print label" "temp"°C"
16 | if (temp < 60) {
17 | print
18 | exit
19 | }
20 |
21 | # if above 60
22 | print label" "temp"°C"
23 |
24 | # color
25 | if (temp > 90) {
26 | print("#FF0000")
27 | } else if (temp > 80) {
28 | print("#FFAE00")
29 | } else if (temp > 70) {
30 | print("#FFF600")
31 | }
32 | }'
33 |
--------------------------------------------------------------------------------
/.config/nsxiv/exec/image-info:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # Example for $XDG_CONFIG_HOME/sxiv/exec/image-info
4 | # Called by sxiv(1) whenever an image gets loaded.
5 | # The output is displayed in sxiv's status bar.
6 | # Arguments:
7 | # $1: path to image file
8 | # $2: image width
9 | # $3: image height
10 |
11 | s=" | " # field separator
12 |
13 | exec 2>/dev/null
14 |
15 | filename=$(basename -- "$1")
16 | filesize=$(du -Hh -- "$1" | cut -f 1)
17 | mimetype=$(file -b --mime-type -- "$1")
18 |
19 | geometry="${2}x${3}"
20 | tags=$(identify -format '%[IPTC:2:25]' ":$1" | tr ';' ',')
21 |
22 | echo "${filesize}${s}${geometry}${tags:+$s}${tags}${s}${mimetype}${s}${filename}"
23 |
24 | # If running as a child of lf, select the current file.
25 | if [ -n "$id" ]; then
26 | lf -remote "send $id select \"$filename\" "
27 | fi
28 |
--------------------------------------------------------------------------------
/.local/bin/statusbar/sb-torrent:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | transmission-remote -l | grep % |
4 | sed " # The letters are for sorting and will not appear.
5 | s/.*Stopped.*/A 🛑/;
6 | s/.*Seeding.*/Z 🌱/;
7 | s/.*100%.*/N ✅/;
8 | s/.*Idle.*/B 🕰️/;
9 | s/.*Uploading.*/L ⬆️/;
10 | s/.*%.*/M ⬇️/" |
11 | sort -h | uniq -c | awk '{print $3 $1}' | paste -sd ' ' -
12 |
13 | case $BLOCK_BUTTON in
14 | 1) setsid -f "$TERMINAL" -e stig ;;
15 | 2) td-toggle ;;
16 | 3) notify-send "🌱 Torrent module" "\- Left click to open stig.
17 | - Middle click to toggle transmission.
18 | - Shift click to edit script.
19 | Module shows number of torrents:
20 | 🛑: paused
21 | 🕰: idle (seeds needed)
22 | 🔼: uploading (unfinished)
23 | 🔽: downloading
24 | ✅: done
25 | 🌱: done and seeding" ;;
26 | 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
27 | esac
28 |
--------------------------------------------------------------------------------
/.local/bin/lfub:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # https://github.com/jstkdng/ueberzugpp/blob/master/scripts/lf/lfub
4 |
5 | # This is a wrapper script for lf that allows it to create image previews with
6 | # ueberzug. This works in concert with the lf configuration file and the
7 | # lf-cleaner script.
8 |
9 | set -e
10 |
11 | if ! command -v ueberzug >/dev/null 2>&1; then
12 | exec lf "$@"
13 | fi
14 |
15 | cleanup() {
16 | exec 3>&-
17 | rm "$FIFO_UEBERZUG"
18 | }
19 |
20 | if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
21 | lf "$@"
22 | else
23 | [ ! -d "$HOME/.cache/lf" ] && mkdir -p "$HOME/.cache/lf"
24 | export FIFO_UEBERZUG="$HOME/.cache/lf/ueberzug-$$"
25 | mkfifo "$FIFO_UEBERZUG"
26 | ueberzug layer -s <"$FIFO_UEBERZUG" -p json &
27 | exec 3>"$FIFO_UEBERZUG"
28 | trap cleanup HUP INT QUIT TERM PWR EXIT
29 | lf "$@" 3>&-
30 | fi
31 |
--------------------------------------------------------------------------------
/.config/fontconfig/conf.d/30-metric-aliases.conf:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
12 |
13 |
14 |
15 | Helvetica
16 | Arial
17 |
18 |
19 | Times
20 | Times New Roman
21 |
22 |
23 | Courier
24 | Courier New
25 |
26 |
27 |
--------------------------------------------------------------------------------
/.local/bin/archnews:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | archnews() {
4 | local -r cached_page=$HOME/.cache/archnews
5 | local -r current_page=/tmp/archnews
6 |
7 | curl --max-time 20 -s "https://archlinux.org/feeds/news/" -o "$current_page"
8 |
9 | if ! [[ -s $current_page ]]; then
10 | echo "Couldn't connect to archlinux.org."
11 | return 1
12 | fi
13 |
14 | if ! cmp -s "$current_page" "$cached_page"; then
15 | echo "*** MANUAL INTERVENTION NEEDED ***"
16 | tee "$cached_page" < "$current_page" |
17 | xmllint --xpath '//item/title | //item/pubDate' /dev/stdin |
18 | paste - - -d '' |
19 | sed -r -e 's:([^<]*?)([^<]*?):\2\t\1:g' |
20 | sed '3q' | sed 's/>/>/g; s/\s[0-9][0-9]:[0-9][0-9]:[0-9][0-9]\s+0000\s/ - /g'
21 |
22 | xdg-open 'https://www.archlinux.org/news/'
23 | fi
24 |
25 | rm -- "$current_page"
26 | }
27 |
28 | archnews
29 |
--------------------------------------------------------------------------------
/.local/share/applications/firefox.desktop:
--------------------------------------------------------------------------------
1 | [Desktop Entry]
2 | Version=1.0
3 | Name=Fingerbox / Main profile
4 | GenericName=Web Browser
5 | Comment=Browse the Web
6 | Exec=fingerbox -P Main %u
7 | Icon=fingerbox
8 | Terminal=false
9 | Type=Application
10 | MimeType=text/html;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;text/mml;x-scheme-handler/http;x-scheme-handler/https;
11 | StartupNotify=true
12 | Categories=Network;WebBrowser;
13 | Keywords=web;browser;internet;
14 | Actions=new-window;new-private-window;profile-manager;
15 | StartupWMClass=Firefox
16 |
17 | [Desktop Action new-window]
18 | Name=New Window
19 | Exec=fingerbox --new-window %u
20 |
21 | [Desktop Action new-private-window]
22 | Name=New Private Window
23 | Exec=fingerbox --private-window %u
24 |
25 | [Desktop Action profile-manager]
26 | Name=Profile manager
27 | Exec=fingerbox -p -no-remote %u
28 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule ".config/mpv/scripts/mpvSockets"]
2 | path = .config/mpv/scripts/mpvSockets
3 | url = https://github.com/wis/mpvSockets.git
4 | [submodule ".config/mpv/scripts/subs2srs"]
5 | path = .config/mpv/scripts/subs2srs
6 | url = https://github.com/Ajatt-Tools/mpvacious.git
7 | [submodule ".config/mpv/scripts/videoclip"]
8 | path = .config/mpv/scripts/videoclip
9 | url = https://github.com/Ajatt-Tools/videoclip.git
10 | [submodule ".config/mpv/scripts/autosubsync"]
11 | path = .config/mpv/scripts/autosubsync
12 | url = https://github.com/Ajatt-Tools/autosubsync-mpv.git
13 | [submodule ".config/mpv/scripts/sub-transition"]
14 | path = .config/mpv/scripts/sub-transition
15 | url = https://github.com/Ajatt-Tools/sub-transition.git
16 | [submodule ".config/alacritty/alacritty-theme"]
17 | path = .config/alacritty/themes
18 | url = https://github.com/alacritty/alacritty-theme.git
19 |
--------------------------------------------------------------------------------
/.config/i3/nadeshiko.conf:
--------------------------------------------------------------------------------
1 | # Monitors
2 | # You can get the names of your outputs by running: xrandr -q
3 | set $monitor1 "HDMI3"
4 | set $monitor2 "DP1"
5 |
6 | # Workspace Monitors
7 | workspace $ws1 output $monitor1
8 | workspace $ws2 output $monitor1
9 | workspace $ws3 output $monitor1
10 | workspace $ws4 output $monitor1
11 | workspace $ws5 output $monitor1
12 | workspace $ws6 output $monitor1
13 | workspace $ws7 output $monitor1
14 | workspace $ws8 output $monitor1
15 | #
16 | workspace $ws9 output $monitor2
17 | workspace $ws10 output $monitor2
18 |
19 | # Load ICC profile
20 | #exec --no-startup-id xcalib -v -o $monitor1 ~/.local/share/icc/main_monitor.icc
21 |
22 | # Autostart
23 | exec --no-startup-id qbittorrent --no-splash
24 | exec --no-startup-id throne --no-splash
25 | exec --no-startup-id xrandr --output $monitor1 --primary
26 | exec --no-startup-id transformers_ocr listen
27 | #exec goldendict
28 |
--------------------------------------------------------------------------------
/.local/bin/lf-select:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # View files with nsxiv and and select them in lf.
4 |
5 | readonly first_file="$1"
6 | exe=$(basename -- "$0")
7 | readonly exe
8 |
9 | where_is_sxiv() {
10 | for cmd in nsxiv sxiv; do
11 | if command -v "$cmd" >/dev/null 2>&1; then
12 | echo "$cmd"
13 | return
14 | fi
15 | done
16 | echo "sxiv is not found in this system." >&2
17 | exit 1
18 | }
19 |
20 | if ! [ -f "$first_file" ]; then
21 | notify-send "$exe" "first arg is not a file!"
22 | exit 1
23 | fi
24 |
25 | if [ -z "$id" ]; then
26 | notify-send "$exe" "lf id is not set!"
27 | exit 1
28 | fi
29 |
30 | rotdir "$first_file" |
31 | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\|avif\|tif\|ico\)\(_large\)*$" |
32 | "$(where_is_sxiv)" -aio 2>/dev/null |
33 | while read -r file; do
34 | if [ -n "$file" ]; then
35 | lf -remote "send $id select \"$file\" "
36 | lf -remote "send $id toggle"
37 | fi
38 | done
39 |
--------------------------------------------------------------------------------
/.config/i3/ws10.json:
--------------------------------------------------------------------------------
1 | {
2 | "layout": "splitv",
3 | "percent": 0.5,
4 | "type": "con",
5 | "nodes": [
6 | {
7 | "name": "htop",
8 | "percent": 0.5,
9 | "type": "con",
10 | "swallows": [
11 | {
12 | "title": "htop$"
13 | }
14 | ]
15 | },
16 | {
17 | "name": "journalctl",
18 | "percent": 0.5,
19 | "type": "con",
20 | "swallows": [
21 | {
22 | "title": "journalctl"
23 | }
24 | ]
25 | },
26 | {
27 | "name": "terminal",
28 | "percent": 0.5,
29 | "type": "con",
30 | "swallows": [
31 | {
32 | "title": "terminal"
33 | }
34 | ]
35 | }
36 | ]
37 | }
38 |
--------------------------------------------------------------------------------
/.local/bin/dmenumountcifs:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # Gives a dmenu prompt to mount unmounted local NAS shares for read/write.
3 | # Requirements - "%wheel ALL=(ALL) NOPASSWD: ALL"
4 | #
5 | # Browse for mDNS/DNS-SD services using the Avahi daemon...
6 | srvname=$(avahi-browse _smb._tcp -t | awk '{print $4}' | dmenu -i -p "Which NAS?") || exit 1
7 | notify-send "Searching for network shares..." "Please wait..."
8 | # Choose share disk...
9 | share=$(smbclient -L "$srvname" -N | grep Disk | awk '{print $1}' | dmenu -i -p "Mount which share?") || exit 1
10 | # Format URL...
11 | share2mnt=//"$srvname".local/"$share"
12 |
13 | sharemount() {
14 | mounted=$(mount -v | grep "$share2mnt") || ([ ! -d /mnt/"$share" ] && sudo mkdir /mnt/"$share")
15 | [ -z "$mounted" ] && sudo mount -t cifs "$share2mnt" -o user=nobody,password="",noperm /mnt/"$share" && notify-send "Netshare $share mounted" && exit 0
16 | notify-send "Netshare $share already mounted"; exit 1
17 | }
18 |
19 | sharemount
20 |
--------------------------------------------------------------------------------
/.local/bin/i3cmds/somesearch:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -euo pipefail
4 |
5 | pgrep -x dmenu && exit
6 |
7 | readonly prompts=$(cat <<-EOF
8 | ZEal
9 | DUckduckgo
10 | SEarx
11 | SAkuraparis
12 | MANual
13 | EOF
14 | )
15 |
16 | readonly choice=$(echo "$prompts" | dmenu -i -p "Search:") || exit 1
17 | readonly s=${choice#* }
18 | readonly cmd=${choice%% *}
19 |
20 | browse() {
21 | setsid -f "${BROWSER:-firefox}" "$@"
22 | }
23 |
24 | case $cmd in
25 | 'ze')
26 | setsid -f zeal "$s"
27 | ;;
28 | 'du')
29 | browse "https://duckduckgo.com/?q=${s}&t=ffab&atb=v1-1"
30 | ;;
31 | 'se')
32 | browse "https://searx.work/search?q=${s}&language=auto&safesearch=0&categories=general"
33 | ;;
34 | 'sa')
35 | browse "https://sakura-paris.org/dict/明鏡国語辞典/exact/${s}"
36 | ;;
37 | 'man')
38 | if man -k "^$s$" >/dev/null; then
39 | man -Tpdf "${s}" | zathura -;
40 | else
41 | notify-send "manual" "nothing appropriate" &
42 | fi
43 | ;;
44 | *)
45 | exit 1
46 | ;;
47 | esac
48 |
--------------------------------------------------------------------------------
/.local/bin/setbg:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # This script does the following:
4 | # Run by itself, set the wallpaper (at X start).
5 | # If given a file, set that as the new wallpaper.
6 | # If given a directory, choose random file in it.
7 |
8 | readonly linkpath="${XDG_DATA_HOME:-$HOME/.local/share}/bg"
9 |
10 | setwallpaper() {
11 | hsetroot -solid '#242934'
12 | xwallpaper --zoom "$*"
13 | }
14 |
15 | die() {
16 | echo "Error: Couldn't set wallpaper." >&2
17 | notify-send -u critical "Error" "Couldn't set wallpaper."
18 | exit 1
19 | }
20 |
21 | if [ -d "$1" ]; then
22 | readonly givenpath="$(find "$1" -type f -iregex '.*\.\(jpg\|jpeg\|png\|gif\)' | shuf -n 1)"
23 | else
24 | readonly givenpath="$1"
25 | fi
26 |
27 | if [ -f "$givenpath" ]; then
28 | if setwallpaper "$givenpath" && ln -srf -- "$givenpath" "$linkpath"; then
29 | notify-send -i "$linkpath" "Wallpaper changed."
30 | else
31 | setwallpaper "$linkpath"
32 | die
33 | fi
34 | else
35 | setwallpaper "$linkpath" || die
36 | fi
37 |
--------------------------------------------------------------------------------
/.local/bin/i3cmds/ddspawn:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # Toggle floating dropdown terminal in i3, or start if non-existing.
4 | # $1 is the script run in the terminal.
5 | # All other args are terminal settings.
6 | # Terminal names are in dropdown_* to allow easily setting i3 settings.
7 |
8 | ifinstalled xwininfo || exit
9 |
10 | [ -z "$1" ] && exit
11 |
12 | case $TERMINAL in
13 | st)
14 | nameopt='-n ';;
15 | *rxvt*)
16 | nameopt='-name ';;
17 | termite)
18 | nameopt='--name=';;
19 | alacritty)
20 | nameopt='--class=';;
21 | *)
22 | echo "Could not recognize your TERMINAL \"$TERMINAL\". Please add it to $0.">&2
23 | exit 1
24 | esac
25 |
26 | script=$1
27 | shift
28 | if xwininfo -tree -root | grep "(\"dropdown_$script\" ";
29 | then
30 | echo "Window detected."
31 | i3 "[instance=\"dropdown_$script\"] scratchpad show; [instance=\"dropdown_$script\"] move position center"
32 | else
33 | echo "Window not detected... spawning."
34 | i3 "exec --no-startup-id $TERMINAL ${nameopt}dropdown_$script $* -e $script"
35 | fi
36 |
--------------------------------------------------------------------------------
/.local/bin/statusbar/sb-moonphase:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # Shows the current moon phase.
4 |
5 | moonfile="${XDG_DATA_HOME:-$HOME/.local/share}/moonphase"
6 |
7 | [ -s "$moonfile" ] && [ "$(stat -c %y "$moonfile" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] ||
8 | { curl -sf "wttr.in/?format=%m" > "$moonfile" || exit 1 ;}
9 |
10 | icon="$(cat "$moonfile")"
11 |
12 | case "$icon" in
13 | 🌑) name="New" ;;
14 | 🌒) name="Waxing Crescent" ;;
15 | 🌓) name="First Quarter" ;;
16 | 🌔) name="Waxing Gibbous" ;;
17 | 🌕) name="Full" ;;
18 | 🌖) name="Waning Gibbous" ;;
19 | 🌗) name="Last Quarter" ;;
20 | 🌘) name="Waning Crescent" ;;
21 | *) exit 1 ;;
22 | esac
23 |
24 | echo "${icon-?}"
25 |
26 | case $BLOCK_BUTTON in
27 | 3) notify-send "🌜 Moon phase module" "Displays current moon phase.
28 | - 🌑: New
29 | - 🌒: Waxing Crescent
30 | - 🌓: First Quarter
31 | - 🌔: Waxing Gibbous
32 | - 🌕: Full
33 | - 🌖: Waning Gibbous
34 | - 🌗: Last Quarter
35 | - 🌘: Waning Crescent" ;;
36 | 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
37 | esac
38 |
--------------------------------------------------------------------------------
/.config/lf/icons:
--------------------------------------------------------------------------------
1 | di 📁
2 | fi 📃
3 | tw 🤝
4 | ow 📂
5 | ln ⛓
6 | or ❌
7 | ex 🎯
8 | *.txt ✍
9 | *.mom ✍
10 | *.me ✍
11 | *.ms ✍
12 | *.avif 🖼
13 | *.png 🖼
14 | *.webp 🖼
15 | *.ico 🖼
16 | *.jpg 📸
17 | *.jpe 📸
18 | *.jpeg 📸
19 | *.gif 🖼
20 | *.svg 🗺
21 | *.tif 🖼
22 | *.tiff 🖼
23 | *.xcf 🖌
24 | *.html 🌎
25 | *.xml 📰
26 | *.gpg 🔒
27 | *.css 🎨
28 | *.pdf 📚
29 | *.djvu 📚
30 | *.epub 📚
31 | *.csv 📓
32 | *.xlsx 📓
33 | *.tex 📜
34 | *.md 📘
35 | *.r 📊
36 | *.R 📊
37 | *.rmd 📊
38 | *.Rmd 📊
39 | *.m 📊
40 | *.mp3 🎵
41 | *.opus 🎵
42 | *.ogg 🎵
43 | *.m4a 🎵
44 | *.flac 🎼
45 | *.wav 🎼
46 | *.mkv 🎥
47 | *.mp4 🎥
48 | *.webm 🎥
49 | *.mpeg 🎥
50 | *.avi 🎥
51 | *.mov 🎥
52 | *.mpg 🎥
53 | *.wmv 🎥
54 | *.m4b 🎥
55 | *.flv 🎥
56 | *.zip 📦
57 | *.rar 📦
58 | *.7z 📦
59 | *.tar 📦
60 | *.z64 🎮
61 | *.v64 🎮
62 | *.n64 🎮
63 | *.gba 🎮
64 | *.nes 🎮
65 | *.gdi 🎮
66 | *.1 ℹ
67 | *.nfo ℹ
68 | *.info ℹ
69 | *.log 📙
70 | *.iso 📀
71 | *.img 📀
72 | *.bib 🎓
73 | *.ged 👪
74 | *.part 💔
75 | *.torrent 🔽
76 | *.jar ♨
77 | *.java ♨
78 |
--------------------------------------------------------------------------------
/.local/share/larbs/getkeys/mutt:
--------------------------------------------------------------------------------
1 | _ _
2 | _ __ ___ _ _| |_| |_
3 | | '_ ` _ \| | | | __| __|
4 | | | | | | | |_| | |_| |_
5 | |_| |_| |_|\__,_|\__|\__|
6 |
7 | mutt is the email client.
8 | j/k - Move down/up
9 | d/u - Move down/up half page
10 | gg - Move to top
11 | v - View/download attachments
12 | G - Move to last message
13 | r - Reply
14 | R - Reply all
15 | S - Sync/save mailbox changes
16 | D - Mark message for deletion
17 | U - Unmark message for deletion
18 | ctrl-u - Seek urls
19 | ,, - Seek urls
20 | ctrl-f - Search mail indexed with notmuch
21 | ctrl-r - Mark all as read
22 | l - Limit mail
23 | o - Run quick sync with offlineimap
24 | O - Run full sync with offlineimap
25 | C - Copy a message to another mailbox
26 | M - Move a message to another mailbox
27 | B - Hide/reveal sidebar
28 | ctrl-j/k - Move down/up on sidebar
29 | ctrl-o - Open box selected in sidebar
30 | gi - Go to inbox
31 | gs - Go to sent mail
32 | gd - Go to drafts
33 | gS - Go to spam
34 | i# - Go to a different account (# is the number of the account)
35 |
--------------------------------------------------------------------------------
/.local/bin/i3cmds/hover:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # This script moves the selected window to the bottom left/right of the screen.
4 | command -v xdotool || exit 1
5 | # If $1 is left, hovers in the bottom left, if right, the bottom right
6 | [ -z "$1" ] && exit 1
7 |
8 | padding=10
9 | current=$(xdotool getwindowfocus)
10 | newwidth=$(($(xdotool getdisplaygeometry | awk '{print $2}') / 3))
11 | newheight=$(($(xdotool getdisplaygeometry | awk '{print $1}') / 3))
12 | xdotool windowsize "$current" $newheight $newwidth
13 | newsize=$(xdotool getwindowgeometry "$current" | grep Geometry | sed -e 's/x/ /g' | awk '{print $3}')
14 | newwidth=$(xdotool getwindowgeometry "$current" | grep Geometry | grep -o " [0-9]*")
15 |
16 | case "$1" in
17 | left) horizontal=$padding; vertical=$(($(xdotool getdisplaygeometry | awk '{print $2}') - newsize - padding)) ;;
18 | right) horizontal=$(($(xdotool getdisplaygeometry | awk '{print $1}') - newwidth - padding)) ; vertical=$(($(xdotool getdisplaygeometry | awk '{print $2}') - newsize - padding)) ;;
19 | esac
20 | xdotool windowmove "$current" $horizontal $vertical
21 |
--------------------------------------------------------------------------------
/.local/bin/sd:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # Open a terminal window in the same directory as the currently active window.
4 |
5 | windowPID=$(xprop -id "$(xprop -root | sed -n "/_NET_ACTIVE_WINDOW/ s/^.*# // p")" | sed -n "/PID/ s/^.*= // p")
6 | PIDlist=$(pstree -lpATna "$windowPID" | sed -En 's/.*,([0-9]+).*/\1/p' | tac)
7 | for PID in $PIDlist; do
8 | cmdline=$(ps -o args= -p "$PID")
9 | process_group_leader=$(ps -o comm= -p "$(ps -o pgid= -p "$PID" | tr -d ' ')")
10 | cwd=$(readlink /proc/"$PID"/cwd)
11 | # zsh and lf won't be ignored even if it shows ~ or /
12 | case "$cmdline" in
13 | 'lf -server') continue ;;
14 | "${SHELL##*/}"|'lf'|'lf '*) break ;;
15 | esac
16 | # git (and its sub-processes) will show the root of a repository instead of the actual cwd, so they're ignored
17 | [ "$process_group_leader" = 'git' ] || [ ! -d "$cwd" ] && continue
18 | # This is to ignore programs that show ~ or / instead of the actual working directory
19 | [ "$cwd" != "$HOME" ] && [ "$cwd" != '/' ] && break
20 | done
21 | [ "$PWD" != "$cwd" ] && [ -d "$cwd" ] && { cd "$cwd" || exit 1; }
22 | "$TERMINAL"
23 |
--------------------------------------------------------------------------------
/.local/bin/statusbar/sb-popupgrade:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -euo pipefail
4 |
5 | notify_pacman_i3_block() {
6 | pkill -RTMIN+8 "${STATUSBAR:-i3blocks}"
7 | }
8 |
9 | pac_upgrade() {
10 | if command -v pacapt >/dev/null 2>&1; then
11 | # On Ubuntu, pacapt can be used to upgrade system packages.
12 | # Snap is heavily utilized on Ubuntu. Upgrade snap packages as well.
13 | sudo pacapt -Syu
14 | sudo snap refresh
15 | elif pacman -Qq trizen >/dev/null; then
16 | trizen -Syu
17 | elif pacman -Qq paru >/dev/null; then
18 | paru -Syu
19 | else
20 | sudo pacman -Syu
21 | fi
22 | }
23 |
24 | pipx_upgrade() {
25 | if command -v pipx >/dev/null 2>&1; then
26 | pipx upgrade-all
27 | fi
28 | }
29 |
30 | main() {
31 | if ! command -v pacapt >/dev/null 2>&1; then
32 | archnews || exit 1
33 | fi
34 |
35 | echo "Beginning upgrade."
36 | pac_upgrade
37 | notify_pacman_i3_block
38 | remaps
39 | pipx_upgrade
40 | echo "Upgrade complete."
41 |
42 | if [ "$1" != "--no-wait" ]; then
43 | echo "Press to exit window."
44 | read -r _
45 | fi
46 | }
47 |
48 | main "$@"
49 |
--------------------------------------------------------------------------------
/.config/fontconfig/conf.d/40-fonts.conf:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | serif
6 |
7 | Libertinus Serif
8 | Joy Pixels
9 | Noto Color Emoji
10 | FontAwesome
11 |
12 |
13 |
14 | sans-serif
15 |
16 | Libertinus Sans
17 | Joy Pixels
18 | Noto Color Emoji
19 | FontAwesome
20 |
21 |
22 |
23 | sans
24 |
25 | Libertinus Sans
26 | Joy Pixels
27 | Noto Color Emoji
28 | FontAwesome
29 |
30 |
31 |
32 | monospace
33 |
34 | Noto Sans Mono
35 | Libertinus Mono
36 | FontAwesome
37 | Braille
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/.config/x11/xinitrc:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # xinitrc runs automatically when you run startx.
4 | # https://wiki.archlinux.org/index.php/Xinit#xinitrc
5 | export GDK_BACKEND=x11
6 | export XDG_SESSION_TYPE=x11
7 |
8 | # https://forum.manjaro.org/t/how-to-theme-gtk4-apps-in-manjaro-xfce/100189/7
9 | # https://forum.manjaro.org/t/setting-theme-for-gtk4-applications/165845
10 | export GTK_THEME='Arc-Darker'
11 |
12 | # Start some nice programs
13 | if [ -d /etc/X11/xinit/xinitrc.d ]; then
14 | for f in /etc/X11/xinit/xinitrc.d/?*.sh; do
15 | # shellcheck source=/dev/null
16 | [ -x "$f" ] && . "$f"
17 | done
18 | unset f
19 | fi
20 |
21 | # There are some small but important commands that need to be run
22 | # when we start the graphical environment.
23 | # shellcheck source=/dev/null
24 | . "${XDG_CONFIG_HOME:-$HOME/.config}/x11/xprofile"
25 |
26 | # Activate dbus variables
27 | dbus-update-activation-environment --all
28 |
29 | # Your default WM is determined in your `~/.profile` on login.
30 | # Here we run the proper command to run when the graphical environment starts.
31 | dbus-launch ssh-agent "${WM:-i3}"
32 |
--------------------------------------------------------------------------------
/.local/bin/unmounter:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # Unmount USB drives or Android phones. Replaces the older `dmenuumount`. Fewer
4 | # prompt and also de-decrypts LUKS drives that are unmounted.
5 |
6 | set -e
7 |
8 | mounteddroids="$(grep simple-mtpfs /etc/mtab | awk '{print "📱" $2}')"
9 | lsblkoutput="$(lsblk -nrpo "name,type,size,mountpoint")"
10 | mounteddrives="$(echo "$lsblkoutput" | awk '($2=="part"||$2="crypt")&&$4!~/\/boot|\/home$|SWAP/&&length($4)>1{printf "💾%s (%s)\n",$4,$3}')"
11 |
12 | allunmountable="$(echo "$mounteddroids
13 | $mounteddrives" | sed "/^$/d;s/ *$//")"
14 | test -n "$allunmountable"
15 |
16 | chosen="$(echo "$allunmountable" | dmenu -i -p "Unmount which drive?")"
17 | chosen="${chosen%% *}"
18 | test -n "$chosen"
19 |
20 | sudo -A umount -l "/${chosen#*/}"
21 | notify-send "Device unmounted." "$chosen has been unmounted."
22 |
23 | # Close the chosen drive if decrypted.
24 | cryptid="$(echo "$lsblkoutput" | grep "/${chosen#*/}$")"
25 | cryptid="${cryptid%% *}"
26 | test -b /dev/mapper/"${cryptid##*/}"
27 | sudo -A cryptsetup close "$cryptid"
28 | notify-send "🔒Device dencryption closed." "Drive is now securely locked again."
29 |
--------------------------------------------------------------------------------
/.local/bin/remaps:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # This script is called on startup to remap keys.
4 |
5 | # 1. Power saving behaviour of monitors when the computer is not in use
6 | # Disable screen saver blanking and set all the DPMS timeouts to zero.
7 | # https://wiki.archlinux.org/index.php/Display_Power_Management_Signaling
8 | #
9 | # 2. Override LXDE keyboard/mouse settings
10 | # Decrease key repeat delay to 300ms and increase key repeat rate to 50 per second.
11 | #
12 | # Mouse: xset m accel_mult[/accel_div] [threshold]
13 | # Autorepeat: xset r rate delay [rate]
14 | # TIP: The q option gives you information on the current settings.
15 | xset \
16 | s off \
17 | dpms 0 0 0 \
18 | m 0 0 \
19 | r rate 300 50 \
20 | b off
21 |
22 | # Map the caps lock key to super, and map the menu key to right super.
23 | setxkbmap -option terminate:ctrl_alt_bksp,caps:super,altwin:menu_win
24 |
25 | # When caps lock is pressed only once, treat it as escape.
26 | killall xcape || true
27 | xcape -e 'Super_L=Escape'
28 |
29 | # Turn off caps lock if on since there is no longer a key for it.
30 | if xset -q | grep -q "Caps Lock:\s*on"; then
31 | xdotool key Caps_Lock
32 | fi
33 |
--------------------------------------------------------------------------------
/.local/bin/lf-file-op:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -euo pipefail
4 |
5 | # Take file path and copy it to the clipboard in one of the three formats: uri, path, filename.
6 |
7 | rawurlencode() {
8 | # /questions/296536/how-to-urlencode-data-for-curl-command
9 | local -r string=${1}
10 | local -r strlen=${#string}
11 | local encoded=""
12 | local pos c o
13 |
14 | for (( pos=0 ; pos Options > External Program
5 | # You'll be able to play the audio in qolibri and paste it in an Anki note as an ogg/opus file.
6 | # When run from Qolibri, $1 is guaranteed to be the path to an audio file.
7 |
8 | readonly file_path=${1:?}
9 | readonly tmp_file_path=/tmp/qolibri-$RANDOM.ogg
10 | readonly bitrate=32k
11 |
12 | to_opus() {
13 | local -r in=${1:?} out=${2:?}
14 | ffmpeg \
15 | -y \
16 | -vn \
17 | -nostdin \
18 | -hide_banner \
19 | -loglevel info \
20 | -i "$in" \
21 | -acodec libopus \
22 | -map_metadata -1 \
23 | -ac 1 \
24 | -ab "$bitrate" \
25 | -vbr on \
26 | -compression_level 10 \
27 | -application voip \
28 | "$out"
29 | }
30 |
31 | # Play the file
32 | mpv --keep-open=no --force-window=no "$1" &
33 |
34 | # Convert from wav to ogg/opus
35 | to_opus "$file_path" "$tmp_file_path"
36 |
37 | # Copy the URI to clipboard.
38 | echo "file://$tmp_file_path" | xclip -in -selection clipboard -target "text/uri-list"
39 |
40 | # Clean up after 60 seconds.
41 | sleep 60s
42 | rm -- "$tmp_file_path"
43 | wait
44 |
--------------------------------------------------------------------------------
/.local/bin/statusbar/sb-music:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | filter() {
4 | input=$(
5 | cat -- - |
6 | sed \
7 | -e '/^volume:/d;' -e 's/ *$//' -e 's/&/\&/g' \
8 | -e 's/\</g' \
9 | -e 's/>/\>/g'
10 | )
11 | songname="$(echo "$input" | head -1)"
12 |
13 | if [ -z "$songname" ]; then
14 | echo " Stopped"
15 | echo ""
16 | echo "#888888"
17 | return
18 | fi
19 |
20 | if echo "$input" | tail -1 | grep -q 'playing'; then
21 | echo " $songname"
22 | echo " $songname" | colrm 30
23 | else
24 | echo " $songname"
25 | echo "$(echo " $songname" | colrm 30)"
26 | fi
27 | }
28 |
29 | { pidof -x sb-mpdup || setsid -f sb-mpdup; } >/dev/null 2>&1 &
30 |
31 | case $BLOCK_BUTTON in
32 | 1) # left click, launch ncmpcpp
33 | mpc status | filter
34 | setsid -f "$TERMINAL" -e ncmpcpp -s playlist
35 | ;;
36 |
37 | 3) # right click, pause/unpause
38 | mpc toggle | filter ;;
39 |
40 | 4) # scroll up, previous
41 | mpc prev | filter ;;
42 |
43 | 5) # scroll down, next
44 | mpc next | filter ;;
45 |
46 | 6) # edit
47 | mpc status | filter
48 | setsid -f "$TERMINAL" -e "$EDITOR" "$0"
49 | ;;
50 |
51 | *)
52 | mpc status | filter
53 | ;;
54 | esac
55 |
--------------------------------------------------------------------------------
/.config/ncmpcpp/bindings:
--------------------------------------------------------------------------------
1 | def_key "+"
2 | show_clock
3 | def_key "="
4 | volume_up
5 | def_key "j"
6 | scroll_down
7 | def_key "k"
8 | scroll_up
9 | def_key "ctrl-u"
10 | page_up
11 | def_key "ctrl-d"
12 | page_down
13 | def_key "u"
14 | page_up
15 | def_key "d"
16 | page_down
17 | def_key "h"
18 | previous_column
19 | def_key "l"
20 | next_column
21 | def_key "."
22 | show_lyrics
23 | def_key "n"
24 | next_found_item
25 | def_key "N"
26 | previous_found_item
27 | def_key "J"
28 | move_sort_order_down
29 | def_key "K"
30 | move_sort_order_up
31 | def_key "h"
32 | jump_to_parent_directory
33 | def_key "l"
34 | enter_directory
35 | def_key "l"
36 | run_action
37 | def_key "l"
38 | play_item
39 | def_key "m"
40 | show_media_library
41 | def_key "m"
42 | toggle_media_library_columns_mode
43 | def_key "t"
44 | show_tag_editor
45 | def_key "v"
46 | show_visualizer
47 | def_key "G"
48 | move_end
49 | def_key "g"
50 | move_home
51 | def_key "U"
52 | update_database
53 | def_key "s"
54 | reset_search_engine
55 | def_key "s"
56 | show_search_engine
57 | def_key "f"
58 | show_browser
59 | def_key "f"
60 | change_browse_mode
61 | def_key "x"
62 | delete_playlist_items
63 | def_key "P"
64 | show_playlist
65 |
--------------------------------------------------------------------------------
/.local/bin/statusbar/sb-cpubars:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # Module showing CPU load as a changing bars.
4 | # Just like in polybar.
5 | # Each bar represents amount of load on one core since
6 | # last run.
7 |
8 | # Cache in tmpfs to improve speed and reduce SSD load
9 | cache=/tmp/cpubarscache
10 |
11 | case $BLOCK_BUTTON in
12 | 2) setsid -f "$TERMINAL" -e htop ;;
13 | 3) notify-send "CPU load module" "Each bar represents one CPU core" &;;
14 | 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
15 | esac
16 |
17 | # id total idle
18 | stats=$(awk '/cpu[0-9]+/ {printf "%d %d %d\n", substr($1,4), ($2 + $3 + $4 + $5), $5 }' /proc/stat)
19 | [ ! -f $cache ] && echo "$stats" >"$cache"
20 | old=$(cat "$cache")
21 | [ -n "$LABEL" ] && printf "$LABEL "
22 | echo "$stats" | while read -r row; do
23 | id=${row%% *}
24 | rest=${row#* }
25 | total=${rest%% *}
26 | idle=${rest##* }
27 |
28 | case "$(echo "$old" | awk '{if ($1 == id)
29 | printf "%d\n", (1 - (idle - $3) / (total - $2))*100 /12.5}' \
30 | id="$id" total="$total" idle="$idle")" in
31 |
32 | "0") printf "▁" ;;
33 | "1") printf "▂" ;;
34 | "2") printf "▃" ;;
35 | "3") printf "▄" ;;
36 | "4") printf "▅" ;;
37 | "5") printf "▆" ;;
38 | "6") printf "▇" ;;
39 | "7") printf "█" ;;
40 | "8") printf "█" ;;
41 | esac
42 | done
43 | printf "\\n"
44 | echo "$stats" >"$cache"
45 |
--------------------------------------------------------------------------------
/.local/bin/statusbar/sb-disk:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Status bar module for disk space
4 |
5 | readonly DIR="${BLOCK_INSTANCE:-/}"
6 |
7 | notify_stats() {
8 | local -r stats=$(
9 | df -hl --output=target,used,size,pcent -x devtmpfs -x tmpfs -x efivarfs |
10 | sed 's/^\/home.*$/&<\/span><\/b>/'
11 | )
12 | local -r swap_stats=$(
13 | {
14 | printf -- "Device\tUsed\tSize\tUse%%\n"
15 | swapon -s |
16 | sed '1d' |
17 | awk '{ printf "%s\t%0.2fG\t%0.2fG\t%d%\n", $1, $4 / 1024 / 1024, $3 / 1024 / 1024, $4 / $3 * 100; }';
18 | } | column -t -s$'\t'
19 | )
20 | setsid -f notify-send -t 30000 " Disk space" "$stats\n\n$swap_stats" &
21 | }
22 |
23 | case $BLOCK_BUTTON in
24 | 1) notify_stats ;;
25 | 3) setsid -f "$TERMINAL" -e ncdu "$DIR" ;;
26 | 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
27 | esac
28 |
29 | df -h "$DIR" --output=avail,pcent,target | awk '
30 | /[0-9]/ {
31 | if ($3 ~ "/home") {
32 | dir_icon=""
33 | } else {
34 | dir_icon=""
35 | }
36 |
37 | print $3 " " $1
38 | print dir_icon " " $1
39 |
40 | # convert usage percent to integer
41 | gsub("%", "", $2)
42 | $2 = int($2)
43 |
44 | # color
45 | if ($2 > 90) {
46 | print("#FF0000")
47 | } else if ($2 > 80) {
48 | print("#FFAE00")
49 | } else if ($2 > 70) {
50 | print("#FFF600")
51 | }
52 | exit
53 | }'
54 |
--------------------------------------------------------------------------------
/.config/mpv/input.conf:
--------------------------------------------------------------------------------
1 | # mpv keybindings
2 |
3 | # Increase / decrease subtitle font size
4 | # https://www.reddit.com/r/mpv/comments/dg5yzj/trouble_decreasing_subtitles_size/
5 | / add sub-scale +0.1
6 | ? add sub-scale -0.1
7 |
8 | # AO volume controls (numpad):
9 | #+ add ao-volume 2
10 | #- add ao-volume -2
11 |
12 | # Cycle video aspect ratios; "-1" is the container aspect
13 | A cycle-values video-aspect "16:9" "16:10" "4:3" "2.35:1" "-1"
14 |
15 | # Vim-like seeking
16 | l seek 5
17 | h seek -5
18 | j seek -60
19 | k seek 60
20 |
21 | # Cycle between subtitle files
22 | K cycle sub
23 | J cycle sub down
24 |
25 | # Skip to previous/next subtitle line (disabled - use mpvacioius)
26 | #H no-osd sub-seek -1
27 | #L no-osd sub-seek 1
28 |
29 | # Search sub-text on Jisho.org
30 | # https://github.com/mpv-player/mpv/issues/4695#issuecomment-609876072
31 | #Ctrl+j run "/bin/sh" "-c" "xdg-open 'https://jisho.org/search?keyword=${sub-text}'"
32 |
33 | # skip to next/previous file
34 | > playlist-next
35 | < playlist-prev
36 |
37 | # Add/subtract 100 ms delay from subs
38 | Z add sub-delay +0.1
39 | z add sub-delay -0.1
40 |
41 | # Adjust timing to previous/next subtitle
42 | X sub-step 1
43 | x sub-step -1
44 |
45 | V script-binding visibility
46 |
47 | # Mouse wheel movements
48 | #WHEEL_UP add volume 2
49 | #WHEEL_DOWN add volume -2
50 | #WHEEL_UP seek 5
51 | #WHEEL_DOWN seek -5
52 |
--------------------------------------------------------------------------------
/.config/zathura/zathurarc:
--------------------------------------------------------------------------------
1 | # Zathura configuration file
2 | # See man `man zathurarc'
3 |
4 | # Open document in fit-width mode by default
5 |
6 | set adjust-open "best-fit"
7 |
8 | # One page per row by default
9 |
10 | set pages-per-row 1
11 |
12 | # Zoom settings
13 |
14 | set zoom-min 10
15 | set recolor-reverse-video "true"
16 | set recolor-keephue "true"
17 | set recolor "false"
18 | set render-loading "false"
19 | set scroll-step 50
20 | set guioptions "shv"
21 | set font "Hack 12"
22 | set selection-clipboard "clipboard"
23 | set window-title-basename "true"
24 | set sandbox none
25 | set statusbar-h-padding 0
26 | set statusbar-v-padding 0
27 | set page-padding 1
28 | set selection-clipboard clipboard
29 | map D toggle_page_mode
30 | map r reload
31 | map R rotate
32 | map i recolor
33 | map p print
34 | map g goto top
35 | map u scroll half-up
36 | map d scroll half-down
37 | map m toggle_page_mode
38 |
39 | # Scroll
40 |
41 | set scroll-page-aware "true"
42 | set smooth-scroll "true"
43 | set scroll-full-overlap 0.01
44 | set scroll-step 100
45 |
46 | map [fullscreen] u scroll half-up
47 | map [fullscreen] d scroll half-down
48 | map [fullscreen] D toggle_page_mode
49 | map [fullscreen] r reload
50 | map [fullscreen] R rotate
51 | map [fullscreen] K zoom in
52 | map [fullscreen] J zoom out
53 | map [fullscreen] i recolor
54 | map [fullscreen] p print
55 | map [fullscreen] g goto top
56 |
--------------------------------------------------------------------------------
/.config/fontconfig/conf.d/20-symbols.conf:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
26 |
27 |
28 |
29 | Hack
30 |
31 | Pomodoro
32 | FontAwesome
33 | Octicons
34 | Icomoon
35 | PowerlineSymbols
36 | Noto Sans Mono CJK JP
37 | Noto Color Emoji
38 | Hack Nerd Font Mono
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/.config/ncmpcpp/config:
--------------------------------------------------------------------------------
1 | # vim: filetype=conf
2 |
3 | ncmpcpp_directory = "~/.config/ncmpcpp"
4 | lyrics_directory = "~/.local/share/lyrics"
5 | mpd_music_dir = "/mnt/archive/audio"
6 | message_delay_time = "1"
7 | visualizer_type = "spectrum"
8 | song_list_format = {$4%a - }{%t}|{$8%f$9}$R{$3(%l)$9}
9 | song_status_format = $b{{$8"%t"}} $3by {$4%a{ $3in $7%b{ (%y)}} $3}|{$8%f}
10 | song_library_format = {%n - }{%t}|{%f}
11 | alternative_header_first_line_format = $b$1$aqqu$/a$9 {%t}|{%f} $1$atqq$/a$9$/b
12 | alternative_header_second_line_format = {{$4$b%a$/b$9}{ - $7%b$9}{ ($4%y$9)}}|{%D}
13 | current_item_prefix = $(cyan)$r$b
14 | current_item_suffix = $/r$(end)$/b
15 | current_item_inactive_column_prefix = $(magenta)$r
16 | current_item_inactive_column_suffix = $/r$(end)
17 | playlist_display_mode = columns
18 | browser_display_mode = columns
19 | progressbar_look = ->
20 | media_library_primary_tag = album_artist
21 | media_library_albums_split_by_date = no
22 | startup_screen = "media_library"
23 | display_volume_level = no
24 | ignore_leading_the = yes
25 | external_editor = nvim
26 | use_console_editor = yes
27 | empty_tag_color = magenta
28 | main_window_color = white
29 | progressbar_color = black:b
30 | progressbar_elapsed_color = blue:b
31 | statusbar_color = red
32 | statusbar_time_color = cyan:b
33 | execute_on_song_change="pkill -RTMIN+11 i3blocks"
34 | execute_on_player_state_change="pkill -RTMIN+11 i3blocks"
35 |
--------------------------------------------------------------------------------
/.local/bin/weath:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | #
3 | # Get the weather on the terminal. You can pass an alternative location as a parameter,
4 | # and/or use the 'cp' option to copy the forecast as plaintext to the clipboard.
5 |
6 | report="${XDG_CACHE_HOME:-$HOME/.cache}/weatherreport"
7 |
8 | if [ "$1" = 'cp' ]; then
9 | # shellcheck disable=SC2015
10 | [ -z "$2" ] && sed 's/\x1b\[[^m]*m//g' "$report" | xclip -selection clipboard &&
11 | notify-send "Weather forecast for '${LOCATION:-$(head -n 1 "$report" | cut -d' ' -f3-)}' copied to clipboard." ||
12 | { data="$(curl -sfm 5 "${WTTRURL:-wttr.in}/$2?T")" &&
13 | notify-send "Weather forecast for '$2' copied to clipboard." &&
14 | echo "$data" | xclip -selection clipboard ||
15 | notify-send 'Failed to get weather forecast!' 'Check your internet connection and the supplied location.'; }
16 | else
17 | [ -n "$2" ] &&
18 | notify-send "Invalid option '$1'! The only valid option is 'cp'." &&
19 | exit 1
20 |
21 | # shellcheck disable=SC2015
22 | [ -z "$1" ] && less -S "$report" ||
23 | data="$(curl -sfm 5 "${WTTRURL:-wttr.in}/$1")" && echo "$data" | less -S ||
24 | notify-send 'Failed to get weather forecast!' 'Check your internet connection and the supplied location.'
25 | fi
26 |
--------------------------------------------------------------------------------
/.local/bin/statusbar/sb-internet:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # Show wifi 📶 and percent strength or 📡 if none.
4 | # Show 🌐 if connected to ethernet or ❎ if none.
5 | # Show 🔒 if a vpn connection is active
6 |
7 | case $BLOCK_BUTTON in
8 | 1)
9 | "$TERMINAL" -e nmtui
10 | pkill -RTMIN+4 "${STATUSBAR:-i3blocks}"
11 | ;;
12 | 3)
13 | notify-send "🌐 Internet module" "\- Click to connect
14 | ❌: wifi disabled
15 | 📡: no wifi connection
16 | 📶: wifi connection with quality
17 | ❎: no ethernet
18 | 🌐: ethernet working
19 | 🔒: vpn is active
20 | " &
21 | ;;
22 | 6)
23 | setsid -f "$TERMINAL" -e "$EDITOR" "$0"
24 | ;;
25 | esac
26 |
27 | wifi_status() {
28 | if [ "$(cat /sys/class/net/w*/operstate 2>/dev/null)" = 'up' ] ; then
29 | awk '/^\s*w/ { printf " %d%\n", int($3 * 10 / 7) }' /proc/net/wireless
30 | elif [ "$(cat /sys/class/net/w*/operstate 2>/dev/null)" = 'down' ] ; then
31 | if [ "$(cat /sys/class/net/w*/flags 2>/dev/null)" = '0x1003' ];then
32 | echo 📡
33 | else
34 | echo ❌
35 | fi
36 | fi
37 | }
38 |
39 | ethernet_status() {
40 | if [ "$(cat /sys/class/net/e*/operstate 2>/dev/null)" = 'up' ]; then
41 | echo 🌐
42 | else
43 | echo ❎
44 | fi
45 | }
46 |
47 | vpn_status() {
48 | if [ -n "$(cat /sys/class/net/tun*/operstate 2>/dev/null)" ];then
49 | echo 🔒
50 | fi
51 | }
52 |
53 | printf -- '%s%s%s\n' \
54 | "$(wifi_status)" \
55 | "$(ethernet_status)" \
56 | "$(vpn_status)" |
57 | sed 's/^ *\| *$//g'
58 |
--------------------------------------------------------------------------------
/.local/bin/rotdir:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python3
2 |
3 | # When I open an image from the file manager in nsxiv (the image viewer), I want
4 | # to be able to press the next/previous keys to key through the rest of the
5 | # images in the same directory. This script "rotates" the content of a
6 | # directory based on the first chosen file, so that if I open the 15th image,
7 | # if I press next, it will go to the 16th etc. Autistic, I know, but this is
8 | # one of the reasons that nsxiv is great for being able to read standard input.
9 |
10 | import os
11 | import re
12 | import sys
13 |
14 | if len(sys.argv) < 2:
15 | sys.exit('usage: rotdir filename')
16 |
17 |
18 | def as_numeric(text: str) -> int | str:
19 | return int(text) if text.isdigit() else text.lower()
20 |
21 |
22 | def alphanum_key(text: str) -> tuple[str | int, ...]:
23 | return tuple(as_numeric(c) for c in re.split('([0-9]+)', text))
24 |
25 |
26 | def natural_sort(file_list: list[str]) -> list[str]:
27 | return sorted(file_list, key=alphanum_key)
28 |
29 |
30 | def selected_file_name() -> str:
31 | return os.path.basename(''.join(sys.argv[1:]))
32 |
33 |
34 | def list_current_dir() -> list[str]:
35 | return os.listdir(os.getcwd())
36 |
37 |
38 | def main():
39 | ls = natural_sort(list_current_dir())
40 | base_index = ls.index(selected_file_name())
41 | result = ls[base_index:] + ls[:base_index]
42 | print('\n'.join(result))
43 |
44 |
45 | if __name__ == '__main__':
46 | main()
47 |
--------------------------------------------------------------------------------
/.local/bin/statusbar/sb-pulsevol:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | # Prints the current volume.
4 | #
5 | # Pamixer options:
6 | # --list-sinks list the sinks
7 | # --list-sources list the sources
8 | # "instance" field of the block should be "sink 0", "source 1", etc.
9 |
10 | { pidof -x sb-headphone-plug || setsid -f sb-headphone-plug; } >/dev/null 2>&1 &
11 |
12 | instance() {
13 | pamixer "${DEVICE[@]}" "$@"
14 | }
15 |
16 | mixer() {
17 | if command -v pavucontrol &>/dev/null; then
18 | i3-msg -q exec pavucontrol
19 | else
20 | i3-msg -q exec 'i3-sensible-terminal -e pulsemixer'
21 | fi
22 | }
23 |
24 | if [[ -n "$BLOCK_INSTANCE" ]]; then
25 | read -r -a DEVICE <<<"--$BLOCK_INSTANCE"
26 | fi
27 |
28 | if [[ $BLOCK_INSTANCE == *source* ]]; then
29 | readonly block_icon=''
30 | readonly block_icon_mute=''
31 | else
32 | readonly block_icon=''
33 | readonly block_icon_mute=''
34 | fi
35 |
36 | # Handle mouse actions
37 | case $BLOCK_BUTTON in
38 | 1) mixer ;; # left click, run pavucontrol
39 | 3) instance --toggle-mute ;; # right click, mute/unmute
40 | 4) instance --unmute -i 5 ;; # scroll up, increase
41 | 5) instance --unmute -d 5 ;; # scroll down, decrease
42 | esac
43 |
44 | # Output status
45 | case $(instance --get-mute) in
46 | "0" | "false")
47 | echo "$block_icon $(instance --get-volume | cut -d' ' -f1)%"
48 | ;;
49 | "1" | "true")
50 | echo "$block_icon_mute MUTE"
51 | echo "$block_icon_mute"
52 | echo "#aaaaaa"
53 | ;;
54 | *)
55 | echo ERROR
56 | echo E
57 | echo "#ff0000"
58 | ;;
59 | esac
60 |
--------------------------------------------------------------------------------
/.config/i3blocks/config:
--------------------------------------------------------------------------------
1 | ## i3blocks config file
2 |
3 | # Global properties
4 | command=~/.local/bin/statusbar/$BLOCK_NAME
5 | separator_block_width=10
6 | markup=none
7 | full_text=
8 | align=left
9 | color=#f3f4f5
10 | separator=true
11 | interval=5
12 |
13 | [sb-music]
14 | interval=10
15 | signal=11
16 | markup=pango
17 |
18 | [sb-memory]
19 | separator=false
20 | interval=10
21 |
22 | [sb-memory]
23 | instance=swap
24 | interval=15
25 |
26 | [sb-disk]
27 | instance=/home
28 | interval=30
29 |
30 | [sb-nettraf]
31 | interval=5
32 |
33 | [sb-cpu_usage]
34 | LABEL=CPU
35 | interval=2
36 | separator=false
37 |
38 | [sb-cpu_freq]
39 | interval=5
40 |
41 | [sb-load_average]
42 | interval=3
43 |
44 | [sb-chip_temp]
45 | chip_label=CPU
46 | query=sensors coretemp-isa-0000 | awk '/^Package/ {print $4}'
47 | interval=5
48 |
49 | #[chip_temp]
50 | #chip_label=GPU
51 | #query=sensors amdgpu-pci-0300 | awk '/^junction/ {print $2}'
52 | #interval=7
53 |
54 | [sb-pacpackages]
55 | interval=3600
56 | signal=8
57 |
58 | [sb-pulsevol]
59 | signal=10
60 | interval=10
61 | separator=false
62 |
63 | [sb-pulsevol]
64 | signal=10
65 | interval=10
66 | instance=default-source
67 |
68 | [sb-weather]
69 | interval=1800
70 | command=curlwttr "$LOCATION?format=1" || echo '±?°C'
71 |
72 | [sb-calendar]
73 | interval=30
74 | separator=false
75 |
76 | [sb-time]
77 | command=date '+%H:%M'
78 | interval=4
79 | separator=false
80 | separator_block_width=5
81 |
82 | [sb-record]
83 | command=cat /tmp/recordingicon 2>/dev/null || echo
84 | interval=once
85 | signal=9
86 | background=#6d3d39
87 |
--------------------------------------------------------------------------------
/.local/bin/statusbar/sb-nettraf:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Module showing network traffic. Shows how much data has been received (RX) or
4 | # transmitted (TX) since the previous time this script ran. So if run every
5 | # second, gives network traffic per second.
6 |
7 | readonly cache_fol="/tmp/${0##*/}"
8 | mkdir -p "$cache_fol"
9 |
10 | local_info() {
11 | sb-local_ipaddr | head -1
12 | }
13 |
14 | public_info() {
15 | curl -s 'https://ifconfig.co/json' | sed -n \
16 | -e 's/\"//g;' \
17 | -e 's/,$//g;' \
18 | -e 's/^ *//g;' \
19 | -e '2s/ip/Public/p;' \
20 | -e '4s/^c/C/p;' \
21 | -e '7s/region_name/City/p;'
22 | }
23 |
24 | update() {
25 | local sum=0 old=0
26 | local -r cache_file="${cache_fol}/${1##*/}"
27 | for arg; do
28 | read -r i <"$arg"
29 | sum=$((sum + i))
30 | done
31 | unset arg
32 | [ -f "$cache_file" ] && read -r old <"$cache_file" || old=0
33 | printf -- '%d\n' "$sum" >"$cache_file"
34 | printf -- '%d\n' "$(((sum - old) / ${interval:-1}))"
35 | }
36 |
37 | case "$BLOCK_BUTTON" in
38 | 1)
39 | notify-send " Connection info" "$(local_info)\\n$(public_info)" &
40 | ;;
41 | 2)
42 | setsid -f "$TERMINAL" -e bmon &
43 | ;;
44 | 6)
45 | setsid -f "$TERMINAL" -e "$EDITOR" "$0"
46 | ;;
47 | esac
48 |
49 | readonly rx=$(update /sys/class/net/[ew]*/statistics/rx_bytes)
50 | readonly tx=$(update /sys/class/net/[ew]*/statistics/tx_bytes)
51 | readonly in=$(numfmt --to=iec "$rx")
52 | readonly out=$(numfmt --to=iec "$tx")
53 |
54 | if [ "$rx" -ge 0 ] && [ "$tx" -ge 0 ]; then
55 | printf -- 'IN %s OUT %s\n %s %s\n' "$in" "$out" "$in" "$out"
56 | fi
57 |
--------------------------------------------------------------------------------
/.local/bin/tag:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | err() { echo "Usage:
4 | tag [OPTIONS] file
5 | Options:
6 | -a: artist/author
7 | -t: song/chapter title
8 | -A: album/book title
9 | -n: track/chapter number
10 | -N: total number of tracks/chapters
11 | -d: year of publication
12 | -g: genre
13 | -c: comment
14 | You will be prompted for title, artist, album and track if not given." && exit 1 ;}
15 |
16 | while getopts "a:t:A:n:N:d:g:c:" o; do case "${o}" in
17 | a) artist="${OPTARG}" ;;
18 | t) title="${OPTARG}" ;;
19 | A) album="${OPTARG}" ;;
20 | n) track="${OPTARG}" ;;
21 | N) total="${OPTARG}" ;;
22 | d) date="${OPTARG}" ;;
23 | g) genre="${OPTARG}" ;;
24 | c) comment="${OPTARG}" ;;
25 | *) printf "Invalid option: -%s\\n" "$OPTARG" && err ;;
26 | esac done
27 |
28 | shift $((OPTIND - 1))
29 |
30 | file="$1"
31 |
32 | temp="$(mktemp -p "$(dirname "$file")")"
33 | trap 'rm -f $temp' HUP INT QUIT TERM PWR EXIT
34 |
35 | [ ! -f "$file" ] && echo 'Provide file to tag.' && err
36 |
37 | [ -z "$title" ] && echo 'Enter a title.' && read -r title
38 | [ -z "$artist" ] && echo 'Enter an artist.' && read -r artist
39 | [ -z "$album" ] && echo 'Enter an album.' && read -r album
40 | [ -z "$track" ] && echo 'Enter a track number.' && read -r track
41 |
42 | cp -f "$file" "$temp" && ffmpeg -i "$temp" -map 0 -y -codec copy \
43 | -metadata title="$title" \
44 | -metadata album="$album" \
45 | -metadata artist="$artist" \
46 | -metadata track="${track}${total:+/"$total"}" \
47 | ${date:+-metadata date="$date"} \
48 | ${genre:+-metadata genre="$genre"} \
49 | ${comment:+-metadata comment="$comment"} "$file"
50 |
--------------------------------------------------------------------------------
/.local/bin/termcolors:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | #
3 | # ANSI color scheme script for testing terminal colors
4 | #
5 | # Original: http://crunchbang.org/forums/viewtopic.php?pid=126921%23p126921#p126921
6 | # Modified by lolilolicon
7 | #
8 | # shellcheck disable=SC2154
9 | # shellcheck disable=SC2034
10 |
11 | f=3 b=4
12 | for j in f b; do
13 | for i in {0..7}; do
14 | printf -v $j$i %b "\e[${!j}${i}m"
15 | done
16 | done
17 | bld=$'\e[1m'
18 | rst=$'\e[0m'
19 |
20 | cat << EOF
21 |
22 | $f1 ▀▄ ▄▀ $f2 ▄▄▄████▄▄▄ $f3 ▄██▄ $f4 ▀▄ ▄▀ $f5 ▄▄▄████▄▄▄ $f6 ▄██▄ $rst
23 | $f1 ▄█▀███▀█▄ $f2███▀▀██▀▀███ $f3▄█▀██▀█▄ $f4 ▄█▀███▀█▄ $f5███▀▀██▀▀███ $f6▄█▀██▀█▄$rst
24 | $f1█▀███████▀█ $f2▀▀███▀▀███▀▀ $f3▀█▀██▀█▀ $f4█▀███████▀█ $f5▀▀███▀▀███▀▀ $f6▀█▀██▀█▀$rst
25 | $f1▀ ▀▄▄ ▄▄▀ ▀ $f2 ▀█▄ ▀▀ ▄█▀ $f3▀▄ ▄▀ $f4▀ ▀▄▄ ▄▄▀ ▀ $f5 ▀█▄ ▀▀ ▄█▀ $f6▀▄ ▄▀$rst
26 |
27 | $bld$f1▄ ▀▄ ▄▀ ▄ $f2 ▄▄▄████▄▄▄ $f3 ▄██▄ $f4▄ ▀▄ ▄▀ ▄ $f5 ▄▄▄████▄▄▄ $f6 ▄██▄ $rst
28 | $bld$f1█▄█▀███▀█▄█ $f2███▀▀██▀▀███ $f3▄█▀██▀█▄ $f4█▄█▀███▀█▄█ $f5███▀▀██▀▀███ $f6▄█▀██▀█▄$rst
29 | $bld$f1▀█████████▀ $f2▀▀▀██▀▀██▀▀▀ $f3▀▀█▀▀█▀▀ $f4▀█████████▀ $f5▀▀▀██▀▀██▀▀▀ $f6▀▀█▀▀█▀▀$rst
30 | $bld$f1 ▄▀ ▀▄ $f2▄▄▀▀ ▀▀ ▀▀▄▄ $f3▄▀▄▀▀▄▀▄ $f4 ▄▀ ▀▄ $f5▄▄▀▀ ▀▀ ▀▀▄▄ $f6▄▀▄▀▀▄▀▄$rst
31 |
32 |
33 | $f7▌$rst
34 |
35 | $f7▌$rst
36 |
37 | $f7 ▄█▄ $rst
38 | $f7▄█████████▄$rst
39 | $f7▀▀▀▀▀▀▀▀▀▀▀$rst
40 |
41 | EOF
42 |
--------------------------------------------------------------------------------
/.local/bin/dmenuhandler:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # Feed this script a link and it will give dmenu
4 | # some choice programs to use to open it.
5 | feed="${1:-$(true | dmenu -p 'Paste URL or file path')}"
6 |
7 | case "$(printf "copy url\\nnsxiv\\nsetbg\\nPDF\\nbrowser\\nlynx\\nvim\\nmpv\\nmpv loop\\nmpv float\\nqueue download\\nqueue yt-dlp\\nqueue yt-dlp audio" | dmenu -i -p "Open it with?")" in
8 | "copy url") echo "$feed" | xclip -selection clipboard ;;
9 | mpv) setsid -f mpv -quiet "$feed" >/dev/null 2>&1 ;;
10 | "mpv loop") setsid -f mpv -quiet --loop "$feed" >/dev/null 2>&1 ;;
11 | "mpv float") setsid -f "$TERMINAL" -e mpv --geometry=+0-0 --autofit=30% --title="mpvfloat" "$feed" >/dev/null 2>&1 ;;
12 | "queue yt-dlp") qndl "$feed" >/dev/null 2>&1 ;;
13 | "queue yt-dlp audio") qndl "$feed" 'yt-dlp -o "%(title)s.%(ext)s" -f bestaudio --embed-metadata --restrict-filenames' ;;
14 | "queue download") qndl "$feed" 'curl -LO' >/dev/null 2>&1 ;;
15 | PDF) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && zathura "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" >/dev/null 2>&1 ;;
16 | nsxiv) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && nsxiv -a "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" >/dev/null 2>&1 ;;
17 | vim) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && setsid -f "$TERMINAL" -e "$EDITOR" "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" >/dev/null 2>&1 ;;
18 | setbg) curl -L "$feed" > $XDG_CACHE_HOME/pic ; xwallpaper --zoom $XDG_CACHE_HOME/pic >/dev/null 2>&1 ;;
19 | browser) setsid -f "$BROWSER" "$feed" >/dev/null 2>&1 ;;
20 | lynx) lynx "$feed" >/dev/null 2>&1 ;;
21 | esac
22 |
--------------------------------------------------------------------------------
/.local/bin/statusbar/sb-memory:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | list_memory_hogs() {
4 | ps axch -o cmd,%mem |
5 | awk '{cmd[$1]+=$2} END {for (i in cmd) print i, cmd[i]}' |
6 | sort -nrk2 |
7 | head
8 | }
9 |
10 | case $BLOCK_BUTTON in
11 | 1) notify-send "Memory hogs" "$(list_memory_hogs)" ;;
12 | 2) notify-send "Memory module" "\- Shows Memory Used/Total.
13 | - Click to show memory hogs.
14 | - Middle click to open htop." &;;
15 | 3) setsid -f "$TERMINAL" -e htop ;;
16 | 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
17 | esac
18 |
19 | TYPE="${BLOCK_INSTANCE:-mem}"
20 |
21 | awk -v type="$TYPE" '
22 | /^MemTotal:/ {
23 | mem_total=$2
24 | }
25 | /^MemFree:/ {
26 | mem_free=$2
27 | }
28 | /^Buffers:/ {
29 | mem_free+=$2
30 | }
31 | /^Cached:/ {
32 | mem_free+=$2
33 | }
34 | /^SwapTotal:/ {
35 | swap_total=$2
36 | }
37 | /^SwapFree:/ {
38 | swap_free=$2
39 | }
40 | END {
41 | if (type == "swap") {
42 | free=swap_free/1024/1024
43 | used=(swap_total-swap_free)/1024/1024
44 | total=swap_total/1024/1024
45 | } else {
46 | free=mem_free/1024/1024
47 | used=(mem_total-mem_free)/1024/1024
48 | total=mem_total/1024/1024
49 | }
50 | pct=0
51 | if (total > 0) {
52 | pct=used/total*100
53 | }
54 | if (pct < 50) {
55 | printf("%s %.f%%\n",toupper(type), pct)
56 | printf("\n")
57 | exit
58 | }
59 | # full text
60 | printf("%s %.1fG/%.1fG (%.f%%)\n", toupper(type), used, total, pct)
61 | # short text
62 | printf("%s%.f%%\n", substr(toupper(type),1,1), pct)
63 | # color
64 | if (pct > 90) {
65 | print("#FF0000")
66 | } else if (pct > 80) {
67 | print("#FFAE00")
68 | } else if (pct > 70) {
69 | print("#FFF600")
70 | }
71 | }
72 | ' /proc/meminfo
73 |
--------------------------------------------------------------------------------
/.config/x11/xprofile:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # This file runs when a DM logs you into a graphical session.
4 | # If you use startx/xinit like a Chad, this file will also be sourced.
5 |
6 | # Keyboard layouts
7 | # If fcitx is installed, it will be used.
8 | . "${XDG_CONFIG_HOME:-$HOME/.config}/x11/keyboard_layouts"
9 |
10 | # Fix Gnome Apps Slow Start due to failing services
11 | # Add this when you include flatpak in your system
12 | dbus-update-activation-environment --systemd DBUS_SESSION_BUS_ADDRESS DISPLAY XAUTHORITY
13 | # Set DPI. User may want to use a larger number for larger screens.
14 | xrandr --dpi 96
15 | # Set the background with the `setbg` script
16 | setbg &
17 | # File synchronization
18 | syncthing serve --no-browser &
19 | # Backups. Install deja-dup.
20 | /usr/lib/deja-dup/deja-dup-monitor &
21 | # Podboat automatic queue and download. Requires entr.
22 | podentr &
23 | # Run mailsync periodically
24 | { command -v mailsync && while :; do mailsync; sleep 15m; done; } &
25 | # Use Xresources colors/settings on startup
26 | xrdb -merge "${XDG_CONFIG_HOME:-$HOME/.config}/x11/xresources"
27 | # Start a polkit agent to run software like gparted.
28 | lxqt-policykit-agent &
29 | # Map right Super key to Menu
30 | xmodmap -e "keysym Super_R = Menu"
31 |
32 | # Autostart
33 | for program in mpd xcompmgr dunst unclutter pipewire remapd; do
34 | if ! pidof -sx "$program" && command -v "$program"; then
35 | "$program" &
36 | fi
37 | done
38 |
39 | if command -v gnome-keyring-daemon; then
40 | gnome-keyring-daemon --start --components=ssh
41 | fi
42 |
43 | # Ensure that xrdb has finished running before moving on to start the WM/DE.
44 | [ -n "$xrdbpid" ] && wait "$xrdbpid"
45 |
--------------------------------------------------------------------------------
/.config/x11/xresources:
--------------------------------------------------------------------------------
1 | ! vim: ft=xdefaults
2 | ! To make changes take effect run xrdb -load $xresouces_path
3 | ! Type xrdb -q to make sure the settings are loaded properly.
4 | ! It is possible to import colors using #include "/path/to/file"
5 | ! * If using gdm, edit the /etc/gdm/Xsession file and remove the -nocpp option
6 | ! from the command that loads .Xresources ($userresources section)
7 | ! * If using gnome on wayland, uncomment the WaylandEnable=false in
8 | ! /etc/gdm/custom.conf and then the resources will be loaded.
9 |
10 | ! Colors
11 | ! Clone https://github.com/chriskempson/base16-xresources.git to get more schemes
12 | ! *background: #222d32
13 | *background: #2f343f
14 | *foreground: #ebdbb2
15 | *cursorColor: #f1fcf9
16 |
17 | ! Black + DarkGrey
18 | *color0: #2f343f
19 | *color8: #928374
20 | ! DarkRed + Red
21 | *color1: #cc241d
22 | *color9: #fb4934
23 | ! DarkGreen + Green
24 | *color2: #98971a
25 | *color10: #b8bb26
26 | ! DarkYellow + Yellow
27 | *color3: #d79921
28 | *color11: #fabd2f
29 | ! DarkBlue + Blue
30 | *color4: #458588
31 | *color12: #83a598
32 | ! DarkMagenta + Magenta
33 | *color5: #b16286
34 | *color13: #d3869b
35 | ! DarkCyan + Cyan
36 | *color6: #689d6a
37 | *color14: #8ec07c
38 | ! LightGrey + White
39 | *color7: #a89984
40 | *color15: #ebdbb2
41 |
42 | Xcursor.theme: Adwaita
43 | Xcursor.size: 24
44 |
45 | ! https://wiki.archlinux.org/index.php/Font_configuration
46 | ! Some applications like URxvt ignore fontconfig settings.
47 | ! You can work around this by using ~/.Xresources.
48 | Xft.antialias: 1
49 | Xft.autohint: 0
50 | Xft.dpi: 96
51 | Xft.hinting: 1
52 | Xft.hintstyle: hintslight
53 | Xft.lcdfilter: lcddefault
54 | Xft.rgba: none
55 |
--------------------------------------------------------------------------------
/.config/git/config:
--------------------------------------------------------------------------------
1 | # Git configuration file
2 |
3 | [user]
4 | # User name and email
5 | name =
6 | email =
7 |
8 | [alias]
9 | co = checkout
10 | sw = switch
11 | ci = commit
12 | st = status
13 | s = status -s
14 | br = branch
15 | dfs = diff --staged
16 | dwc = diff --word-diff=color
17 | type = cat-file -t
18 | dump = cat-file -p
19 | last = log -1 HEAD
20 | hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short
21 | lg = log --graph \
22 | --pretty='%Cred%h%Creset \
23 | -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' \
24 | --abbrev-commit
25 | contributors = shortlog -n -s
26 | remotes = remote -v
27 |
28 | [core]
29 | editor = nvim
30 | autocrlf = false
31 | quotePath = false
32 |
33 | [push]
34 | default = simple
35 |
36 | [color]
37 | ui = always
38 |
39 | [color "diff"]
40 | meta = yellow bold
41 | commit = cyan bold
42 | frag = magenta bold
43 | old = red bold
44 | new = green bold
45 | whitespace = red reverse
46 |
47 | [color "diff-highlight"]
48 | oldNormal = red bold
49 | oldHighlight = red bold 52
50 | newNormal = green bold
51 | newHighlight = green bold 22
52 |
53 | [color "branch"]
54 | current = yellow reverse
55 | local = yellow
56 | remote = green
57 |
58 | [color "status"]
59 | added = green
60 | changed = yellow
61 | untracked = red
62 | [rerere]
63 | enabled = 1
64 | [pull]
65 | rebase = false
66 | [diff]
67 | submodule = log
68 | tool = vimdiff
69 | [status]
70 | submodulesummary = 1
71 | [init]
72 | defaultBranch = main
73 | [commit]
74 | gpgsign = false
75 | [pager]
76 | status = true
77 | [tag]
78 | gpgSign = true
79 |
--------------------------------------------------------------------------------
/.local/bin/statusbar/sb-battery:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Prints all batteries, their percentage remaining and an emoji corresponding
4 | # to charge status (🔌 for plugged up, 🔋 for discharging on battery, etc.).
5 |
6 | get_discharging_status() {
7 | local -r battery=$1
8 | local -r capacity=$(cat -- "$battery/capacity" 2>&1)
9 | if ((capacity >= 90)); then
10 | echo
11 | elif ((capacity >= 60)); then
12 | echo
13 | elif ((capacity >= 40)); then
14 | echo
15 | elif ((capacity >= 10)); then
16 | echo
17 | elif ((capacity >= 0)); then
18 | echo
19 | else
20 | echo ERR
21 | fi
22 | }
23 |
24 | get_status() {
25 | local -r battery=$1
26 | case $(cat -- "$battery/status" 2>&1) in
27 | "Full") echo ;;
28 | "Charging") echo ;;
29 | "Not charging") echo ;;
30 | "Unknown") echo ♻️ ;;
31 | "Discharging") get_discharging_status "$battery" ;;
32 | *) echo ERR ;;
33 | esac
34 | }
35 |
36 | screen_brightness() {
37 | xbacklight -get | awk '{printf "%.1f",$0}'
38 | }
39 |
40 | case $BLOCK_BUTTON in
41 | 1) notify-send "Screen brightness" "$(screen_brightness)%" &;;
42 | 3) notify-send "Battery module" "🔋: discharging
43 | 🛑: not charging
44 | ♻: stagnant charge
45 | 🔌: charging
46 | ⚡: charged
47 | ❗: battery very low!
48 | - Scroll to change adjust xbacklight." &;;
49 | 4) xbacklight -inc 10 ;;
50 | 5) xbacklight -dec 10 ;;
51 | 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
52 | esac
53 |
54 | # Loop through all attached batteries and format the info
55 | for battery in /sys/class/power_supply/BAT?*; do
56 | if [[ -d $battery ]]; then
57 | printf -- '%s %d%% ' \
58 | "$(get_status "$battery")" \
59 | "$(cat -- "$battery/capacity" 2>&1)"
60 | fi
61 | done | sed 's/ *$/\n/'
62 |
--------------------------------------------------------------------------------
/.local/bin/bookmarkctl:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # bookmark ctl - add, remove and select bookmarks.
3 |
4 | set -euo pipefail
5 |
6 | # symlink the actual bookmark file to this location.
7 | bookmark_file=$(readlink -f -- "${BOOKMARK_FILE:-$HOME/.local/share/larbs/snippets}")
8 | readonly bookmark_file
9 |
10 | new_bookmark() {
11 | if ! grep -Fqsx "$*" -- "$bookmark_file"; then
12 | echo "${*//$'\n'/
}" >>"$bookmark_file"
13 | notify-send "${0##*/} - ${FUNCNAME[0]//_/ }" "✅ Bookmark added." &
14 | else
15 | notify-send "${0##*/} - ${FUNCNAME[0]//_/ }" "❌ Bookmark already exists." &
16 | fi
17 | }
18 |
19 | consume_bookmark() {
20 | local -r text=${*//
/$'\n'}
21 |
22 | if [[ $text == http?://* ]]; then
23 | "${BROWSER:-xdg-open}" "$text"
24 | else
25 | echo -n "$text" | xclip -sel c
26 | fi
27 | }
28 |
29 | select_bookmark() {
30 | grep -v '^#' -- "$bookmark_file" |
31 | tac |
32 | dmenu -i -l 50 -p "${1:-Select} bookmark"
33 | }
34 |
35 | remove_line() {
36 | local -r file=$1 line=$2
37 | local -r tmpstr=$(awk "-vLINE=$line" '{
38 | if ($0 != LINE && length($0) > 0 && match($0, "^[[:space:]]*$") == 0) {
39 | print $0
40 | }
41 | }' "$file")
42 | echo "$tmpstr" >"$bookmark_file"
43 | }
44 |
45 | pop_bookmark() {
46 | if [[ -n ${bookmark:=$(select_bookmark Pop)} ]]; then
47 | echo "$bookmark"
48 | remove_line "$bookmark_file" "$bookmark"
49 | notify-send "${0##*/} - ${FUNCNAME[0]//_/ }" "✅ Bookmark removed." &
50 | fi
51 | }
52 |
53 | main() {
54 | case $1 in
55 | new | add)
56 | new_bookmark "${@:2}"
57 | ;;
58 | pull | pop)
59 | consume_bookmark "$(pop_bookmark)"
60 | ;;
61 | select | type)
62 | consume_bookmark "$(select_bookmark Select)"
63 | ;;
64 | esac
65 | }
66 |
67 | main "$@"
68 |
--------------------------------------------------------------------------------
/.config/firefox/larbs.js:
--------------------------------------------------------------------------------
1 | // These are changes made on top of the Arkenfox JS file to tweak it as
2 | // desired. Any of these settings can be overridden by the user.
3 |
4 | // Disable the Twitter/R*ddit/Faceberg ads in the URL bar:
5 | user_pref("browser.urlbar.quicksuggest.enabled", false);
6 | user_pref("browser.urlbar.suggest.topsites", false); // [FF78+]
7 |
8 | // Do not suggest web history in the URL bar:
9 | user_pref("browser.urlbar.suggest.history", false);
10 |
11 | // Do not prefil forms:
12 | user_pref("signon.prefillForms", false);
13 |
14 | // Do not autocomplete in the URL bar:
15 | user_pref("browser.urlbar.autoFill", false);
16 |
17 | // Enable the addition of search keywords:
18 | user_pref("keyword.enabled", true);
19 |
20 | // Allow access to http (i.e. not https) sites:
21 | user_pref("dom.security.https_only_mode", false);
22 |
23 | // Keep cookies until expiration or user deletion:
24 | user_pref("network.cookie.lifetimePolicy", 0);
25 |
26 | user_pref("dom.webnotifications.serviceworker.enabled", false);
27 |
28 | // Disable push notifications:
29 | user_pref("dom.push.enabled", false);
30 |
31 | // Disable the pocket antifeature:
32 | user_pref("extensions.pocket.enabled", false);
33 |
34 | // Don't autodelete cookies on shutdown:
35 | user_pref("privacy.clearOnShutdown.cookies", false);
36 |
37 | // Enable custom userChrome.js:
38 | user_pref("toolkit.legacyUserProfileCustomizations.stylesheets", true);
39 |
40 | // This could otherwise cause some issues on bank logins and other annoying sites:
41 | user_pref("network.http.referer.XOriginPolicy", 0);
42 |
43 | // Disable Firefox sync and its menu entries
44 | user_pref("identity.fxaccounts.enabled", false);
45 |
46 | // Fix the issue where right mouse button instantly clicks
47 | user_pref("ui.context_menus.after_mouseup", true);
48 |
--------------------------------------------------------------------------------
/.local/bin/statusbar/sb-ticker:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Usage
4 | # sb-ticker
5 | # Sample output
6 | # ^DJI: 0.09%
7 | # CL=F: -1.88%
8 | # Description
9 | # displays/retrieves the latest percent-change in stock market quotes listed in $XDG_CONFIG_HOME/tickers.
10 | # defaults to S&P 500, Dow Jones Industrial, and the Nasdaq
11 | #
12 | # intended to be used in the statusbar, which will display the first quote price in the output
13 |
14 | url="terminal-stocks.dev"
15 | pricefile="${XDG_CACHE_HOME:-$HOME/.cache}/stock-prices"
16 | tickerfile="${XDG_CONFIG_HOME:-$HOME/.config}/tickers"
17 |
18 | [ -f "$tickerfile" ] && tickers="$(cat "$tickerfile")" || tickers="^GSPC,^DJI,^IXIC";
19 |
20 | checkprice() {
21 | [ -s "$pricefile" ] && [ "$(stat -c %y "$pricefile" 2>/dev/null |
22 | cut -d':' -f1)" != "$(date '+%Y-%m-%d %H')" ]
23 | }
24 |
25 | getchange() {
26 | mapfile -t changes < <(sed -e 's/ / /g' "$pricefile" | grep -oe '[m-]\+[0-9]\+\.[0-9]\+' | sed 's/[m ]/;/g')
27 | IFS=',' read -ra TICKER <<< "$tickers"
28 | for idx in "${!TICKER[@]}"; do
29 | printf "%s: %s%%\n" "${TICKER[$idx]}" "${changes[$idx]//;/}"
30 | done
31 | }
32 |
33 | updateprice() { curl -sfm 10 "$url/$tickers" --output "$pricefile" || rm -f "$pricefile" ; }
34 |
35 | case $BLOCK_BUTTON in
36 | 1) setsid "$TERMINAL" -e less -Srf "$pricefile" ;;
37 | 2) notify-send -u low "Updating..." "Updating prices" ; updateme="1" ;;
38 | 3) notify-send "Current prices:" "Current stock prices:\n$(getchange)
39 |
40 | LEFT MOUSE BUTTON: show price file
41 | MIDDLE MOUSE BUTTON: update stock prices
42 | RIGHT MOUSE BUTTON: Get stock overview" ;;
43 | 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
44 | esac
45 |
46 | [ -n "$updateme" ] && updateprice
47 |
48 | [ -f "$pricefile" ] && getchange
49 |
50 | checkprice && updateprice
51 |
--------------------------------------------------------------------------------
/.config/redshift.conf:
--------------------------------------------------------------------------------
1 | ; Global settings for redshift
2 | ; http://jonls.dk/redshift/
3 | ; https://wiki.archlinux.org/index.php/Redshift
4 | [redshift]
5 | ; Set the day and night screen temperatures (Neutral is 6500K)
6 | temp-day=5700
7 | temp-night=3500
8 |
9 | ; Enable/Disable a smooth transition between day and night
10 | ; 0 will cause a direct change from day to night screen temperature.
11 | ; 1 will gradually increase or decrease the screen temperature.
12 | transition=1
13 |
14 | ; Set the screen brightness. Default is 1.0.
15 | ;brightness=0.9
16 | ; It is also possible to use different settings for day and night
17 | ; since version 1.8.
18 | ;brightness-day=0.7
19 | ;brightness-night=0.4
20 | ; Set the screen gamma (for all colors, or each color channel
21 | ; individually)
22 | gamma=1.0
23 | ;gamma=0.8:0.7:0.8
24 | ; This can also be set individually for day and night since
25 | ; version 1.10.
26 | gamma-day=1.0
27 | gamma-night=0.8
28 |
29 | ; Set the location-provider: 'geoclue2' or 'manual'
30 | ; type 'redshift -l list' to see possible values.
31 | ; The location provider settings are in a different section.
32 | location-provider=manual
33 |
34 | ; Set the adjustment-method: 'randr', 'vidmode'
35 | ; type 'redshift -m list' to see all possible values.
36 | ; 'randr' is the preferred method, 'vidmode' is an older API.
37 | ; but works in some cases when 'randr' does not.
38 | ; The adjustment method settings are in a different section.
39 | adjustment-method=randr
40 |
41 | ; Configuration of the adjustment-method
42 | ; type 'redshift -m METHOD:help' to see the settings.
43 | ; ex: 'redshift -m randr:help'
44 | ; In this example, randr is configured to adjust screen 1.
45 | ; Note that the numbering starts from 0, so this is actually the
46 | ; second screen. If this option is not specified, Redshift will try
47 | ; to adjust _all_ screens.
48 | [randr]
49 | screen=0
50 |
--------------------------------------------------------------------------------
/.local/bin/booksplit:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # Requires ffmpeg
4 |
5 | [ ! -f "$2" ] && printf "The first file should be the audio, the second should be the timecodes.\\n" && exit
6 |
7 | echo "Enter the album/book title:"; read -r booktitle
8 | echo "Enter the artist/author:"; read -r author
9 | echo "Enter the publication year:"; read -r year
10 |
11 | inputaudio="$1"
12 | ext="${1##*.}"
13 |
14 | # Get a safe file name from the book.
15 | escbook="$(echo "$booktitle" | iconv -c -f UTF-8 -t ASCII//TRANSLIT | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | sed "s/-\+/-/g;s/\(^-\|-\$\)//g")"
16 |
17 | ! mkdir -p "$escbook" &&
18 | echo "Do you have write access in this directory?" &&
19 | exit 1
20 |
21 | # Get the total number of tracks from the number of lines.
22 | total="$(wc -l < "$2")"
23 |
24 | cmd="ffmpeg -i \"$inputaudio\" -nostdin -y"
25 |
26 | while read -r x;
27 | do
28 | end="$(echo "$x" | cut -d' ' -f1)"
29 | file="$escbook/$(printf "%.2d" "$track")-$esctitle.$ext"
30 | if [ -n "$start" ]; then
31 | cmd="$cmd -metadata artist=\"$author\" -metadata title=\"$title\" -metadata album=\"$booktitle\" -metadata year=\"$year\" -metadata track=\"$track\" -metadata total=\"$total\" -ss \"$start\" -to \"$end\" -vn -c:a copy \"$file\" "
32 | fi
33 | title="$(echo "$x" | cut -d' ' -f2-)"
34 | esctitle="$(echo "$title" | iconv -c -f UTF-8 -t ASCII//TRANSLIT | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | sed "s/-\+/-/g;s/\(^-\|-\$\)//g")"
35 | track="$((track+1))"
36 | start="$end"
37 | done < "$2"
38 |
39 | # Last track must be added out of the loop.
40 | file="$escbook/$(printf "%.2d" "$track")-$esctitle.$ext"
41 | cmd="$cmd -metadata artist=\"$author\" -metadata title=\"$title\" -metadata album=\"$booktitle\" -metadata year=\"$year\" -metadata track=\"$track\" -ss \"$start\" -vn -c copy \"$file\""
42 |
43 | eval "$cmd"
44 |
--------------------------------------------------------------------------------
/.local/bin/statusbar/sb-cpu_usage:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 | #
3 | # Copyright 2014 Pierre Mavro
4 | # Copyright 2014 Vivien Didelot
5 | # Copyright 2014 Andreas Guldstrand
6 | #
7 | # Licensed under the terms of the GNU GPL v3, or any later version.
8 |
9 | use strict;
10 | use warnings;
11 | use utf8;
12 | use Getopt::Long;
13 |
14 | # default values
15 | my $t_warn = $ENV{T_WARN} // 50;
16 | my $t_crit = $ENV{T_CRIT} // 80;
17 | my $cpu_usage = -1;
18 | my $decimals = $ENV{DECIMALS} // 2;
19 | my $label = $ENV{LABEL} // "";
20 |
21 | sub help {
22 | print "Usage: cpu_usage [-w ] [-c ] [-d ]\n";
23 | print "-w : warning threshold to become yellow\n";
24 | print "-c : critical threshold to become red\n";
25 | print "-d : Use decimals for percentage (default is $decimals) \n";
26 | exit 0;
27 | }
28 |
29 | GetOptions("help|h" => \&help,
30 | "w=i" => \$t_warn,
31 | "c=i" => \$t_crit,
32 | "d=i" => \$decimals,
33 | );
34 |
35 | # Get CPU usage
36 | $ENV{LC_ALL}="en_US"; # if mpstat is not run under en_US locale, things may break, so make sure it is
37 | open (MPSTAT, 'mpstat 1 1 |') or die;
38 | while () {
39 | if (/^.*\s+(\d+\.\d+)[\s\x00]?$/) {
40 | $cpu_usage = 100 - $1; # 100% - %idle
41 | last;
42 | }
43 | }
44 | close(MPSTAT);
45 |
46 | $cpu_usage eq -1 and die 'Can\'t find CPU information';
47 |
48 | # Print short_text, full_text
49 | print "${label} ";
50 | printf "%.${decimals}f%%\n", $cpu_usage;
51 | print "${label} ";
52 | printf "%.${decimals}f%%\n", $cpu_usage;
53 |
54 | # Print color, if needed
55 | if ($cpu_usage >= $t_crit) {
56 | print "#FF0000\n";
57 | exit 33;
58 | } elsif ($cpu_usage >= $t_warn) {
59 | print "#FFFC00\n";
60 | }
61 |
62 | exit 0;
63 |
--------------------------------------------------------------------------------
/.local/bin/otp:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # Get a one-time password, or add a OTP secret to your pass-otp store.
4 |
5 | # The assumption of this script is that all otp passwords are stored with the
6 | # suffix `-otp`. This script automatically appends newly added otps as such.
7 |
8 | # For OTP passwords to be generated properly, it is important for the local
9 | # computer to have its time properly synced. This can be done with the command
10 | # below which requires the package `ntp`.
11 |
12 | ifinstalled pass pass-otp || exit 1
13 |
14 | dir="${PASSWORD_STORE_DIR}"
15 |
16 | choice="$({ echo "🆕add" ; echo "🕙sync-time" ; ls "$dir"/*-otp.gpg ;} | sed "s/.*\///;s/-otp.gpg//" | dmenu -p "Pick a 2FA:")"
17 |
18 | case $choice in
19 | 🆕add )
20 | ifinstalled maim zbar || exit 1
21 |
22 | temp=$(mktemp -p "$XDG_RUNTIME_DIR" --suffix=.png)
23 | otp="otp-test-script"
24 | trap 'rm -f $temp; pass rm -f $otp' HUP INT QUIT TERM PWR EXIT
25 |
26 | notify-send "Scan the image." "Scan the OTP QR code."
27 |
28 | maim -s "$temp" || exit 1
29 | info="$(zbarimg -q "$temp")"
30 | info="${info#QR-Code:}"
31 |
32 | if echo "$info" | pass otp insert "$otp"; then
33 | while true ; do
34 | export name="$(echo | dmenu -p "Give this One Time Password a one-word name:")"
35 | echo "$name" | grep -q -- "^[A-z0-9-]\+$" && break
36 | done
37 | pass mv "$otp" "$name-otp"
38 | notify-send "Successfully added." "$name-otp has been created."
39 | else
40 | notify-send "No OTP data found." "Try to scan the image again more precisely."
41 | fi
42 | ;;
43 | 🕙sync-time )
44 | ifinstalled ntp || exit 1
45 | notify-send -u low "🕙 Synchronizing Time..." "Synching time with remote NTP servers..."
46 | updatedata="$(sudo ntpdate pool.ntp.org)" &&
47 | notify-send -u low "🕙 Synchronizing Time..." "Done. Time changed by ${updatedata#*offset }"
48 | ;;
49 | *) pass otp -c ${choice}-otp ;;
50 | esac
51 |
--------------------------------------------------------------------------------
/.config/shell/bm-files:
--------------------------------------------------------------------------------
1 | # These files automatically update when edited/saved in vim:
2 | # key filename
3 |
4 | # This file, a list of bookmarked files
5 | bf ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-files
6 | # A list of bookmarked directories similar to this file
7 | bd ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs
8 | # Colors, themes and variables for X11
9 | cfx ${XDG_CONFIG_HOME:-$HOME/.config}/x11/xresources
10 |
11 | # These do not update automatically, but on the next new instance of a program:
12 |
13 | # vim/neovim config
14 | cfv ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/init.vim
15 | # zsh (shell) config
16 | cfz $ZDOTDIR/.zshrc
17 | # aliases used by zsh (and potentially other shells)
18 | cfa ${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc
19 | # profile file for login settings for zsh
20 | cfp ${XDG_CONFIG_HOME:-$HOME/.config}/shell/profile
21 | # mutt (email client) config
22 | cfm ${XDG_CONFIG_HOME:-$HOME/.config}/mutt/muttrc
23 | # newsboat (RSS reader)
24 | cfn ${XDG_CONFIG_HOME:-$HOME/.config}/newsboat/config
25 | # RSS urls for newsboat
26 | cfu ${XDG_CONFIG_HOME:-$HOME/.config}/newsboat/urls
27 | # ncmpcpp (music player) keybinds file
28 | cfmb ${XDG_CONFIG_HOME:-$HOME/.config}/ncmpcpp/bindings
29 | # ncmpcpp (music player) config
30 | cfmc ${XDG_CONFIG_HOME:-$HOME/.config}/ncmpcpp/config
31 | # lf (file browser) config
32 | cfl ${XDG_CONFIG_HOME:-$HOME/.config}/lf/lfrc
33 | # lf's scope/preview file
34 | cfL ${XDG_CONFIG_HOME:-$HOME/.config}/lf/scope
35 | # nsxiv (image viewer) key/script handler
36 | cfX ${XDG_CONFIG_HOME:-$HOME/.config}/nsxiv/exec/key-handler
37 |
38 | cfx ${XDG_CONFIG_HOME:-$HOME/.config}/x11/xresources
39 | cfxp ${XDG_CONFIG_HOME:-$HOME/.config}/x11/xprofile
40 | cfi ${XDG_CONFIG_HOME:-$HOME/.config}/i3/config
41 | cfb ${XDG_CONFIG_HOME:-$HOME/.config}/i3blocks/config
42 | cft ${XDG_CONFIG_HOME:-$HOME/.config}/termite/config
43 | cff ${XDG_CONFIG_HOME:-$HOME/.config}/shell/functionrc
44 | cfal ${XDG_CONFIG_HOME:-$HOME/.config}/alacritty/alacritty.yml
45 |
46 | snippets ~/.local/share/larbs/snippets
47 |
--------------------------------------------------------------------------------
/.local/bin/statusbar/sb-price:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # Usage:
4 | # price
5 | # price bat-btc "Basic Attention Token" 🦁 24
6 | # This will give the price of BAT denominated in BTC and will update on
7 | # signal 24.
8 | # When the name of the currency is multi-word, put it in quotes.
9 |
10 | [ -z "$1" ] && exit 1
11 |
12 | url="${CRYPTOURL:-rate.sx}"
13 | target="${1%%-*}"
14 | denom="${1##*-}"
15 | name="${2:-$1}"
16 | icon="${3:-💰}"
17 | case "$denom" in
18 | "$target"|usd) denom="usd"; symb="$" ;;
19 | gbp) symb="£" ;;
20 | eur) symb="€" ;;
21 | btc) symb="" ;;
22 | esac
23 | interval="@14d" # History contained in chart preceded by '@' (7d = 7 days)
24 | dir="${XDG_CACHE_HOME:-$HOME/.cache}/crypto-prices"
25 | pricefile="$dir/$target-$denom"
26 | chartfile="$dir/$target-$denom-chart"
27 | filestat="$(stat -c %x "$pricefile" 2>/dev/null)"
28 |
29 | [ -d "$dir" ] || mkdir -p "$dir"
30 |
31 | updateprice() { curl -sf \
32 | --fail-early "${denom}.${url}/1${target}" "${denom}.${url}/${target}${interval}" \
33 | --output "$pricefile" --output "$chartfile" ||
34 | rm -f "$pricefile" "$chartfile" ;}
35 |
36 | [ "${filestat%% *}" != "$(date '+%Y-%m-%d')" ] &&
37 | updateme="1"
38 |
39 | case $BLOCK_BUTTON in
40 | 1) setsid "$TERMINAL" -e less -Srf "$chartfile" ;;
41 | 2) notify-send -u low "$icon Updating..." "Updating $name price..." ; updateme="1" ; showupdate="1" ;;
42 | 3) uptime="$(date -d "$filestat" '+%D at %T' | sed "s|$(date '+%D')|Today|")"
43 | notify-send "$icon $name module" "\- Exact price: \$$(cat "$pricefile")
44 | - Left click for chart of changes.
45 | - Middle click to update.
46 | - Shows 🔃 if updating prices.
47 | - Last updated:
48 | $uptime" ;;
49 | 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
50 | esac
51 |
52 | [ -n "$updateme" ] &&
53 | updateprice "$target" &&
54 | [ -n "$showupdate" ] &&
55 | notify-send "$icon Update complete." "$name price is now
56 | \$$(cat "$pricefile")"
57 |
58 | [ -f "$pricefile" ] && printf "%s%s%0.2f" "$icon" "$symb" "$(cat "$pricefile")"
59 |
--------------------------------------------------------------------------------
/.local/bin/sysact:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # A dmenu wrapper script for system functions.
4 |
5 | ctl() {
6 | case $(readlink -f /sbin/init) in
7 | *systemd*) echo systemctl ;;
8 | *) echo loginctl ;;
9 | esac
10 | }
11 |
12 | silence_all() {
13 | mpc pause || true
14 | pauseallmpv
15 | lmc mute
16 | lmc mute-mic
17 | }
18 |
19 | ask_action() {
20 | cat <<-EOF | dmenu -l 30 -i -p "Action:"
21 | 🔒 lock screen
22 | 🚪 leave ${WM:-i3}
23 | ♻️ renew ${WM:-i3}
24 | 🔃 reboot
25 | 🖥️ shutdown
26 | 💤 sleep
27 | 🐻 hibernate
28 | 📺 display off
29 | EOF
30 | }
31 |
32 | background_color() {
33 | {
34 | xrdb -query -all | awk -F'#' '/background:|color0:/{print $2; exit;}'
35 | echo 1d2021 # fallback
36 | } | head -1
37 | }
38 |
39 | display_off() {
40 | xset dpms force off
41 | }
42 |
43 | lock_screen() {
44 | fcitx-remote -s fcitx-keyboard-us-altgr-intl
45 | silence_all
46 | i3lock -e -f -c "${1:-$(background_color)}"
47 | }
48 |
49 | cleanup() {
50 | dmenurecord kill
51 | fcitx-remote -e
52 | ibus exit
53 | local -ra apps=(
54 | qbittorrent goldendict keepassxc telegram-desktop Throne
55 | )
56 | for app in "${apps[@]}"; do
57 | killall "$app"
58 | done
59 | sleep '0.33s'
60 | }
61 |
62 | main() {
63 | sync
64 | case ${*:-$(ask_action)} in
65 | *lock*)
66 | lock_screen
67 | silence_all
68 | ;;
69 | *leave*)
70 | cleanup
71 | i3-msg -q exit || kill -TERM "$(pgrep -u "$USER" "\bdwm$")"
72 | ;;
73 | *renew*)
74 | i3-msg -q restart || kill -HUP "$(pgrep -u "$USER" "\bdwm$")"
75 | ;;
76 | *hibernate*)
77 | lock_screen ee4b2b
78 | $(ctl) hibernate
79 | ;;
80 | *sleep* | *suspend*)
81 | lock_screen ee4b2b
82 | $(ctl) suspend
83 | ;;
84 | *reboot*)
85 | cleanup
86 | $(ctl) reboot -i
87 | ;;
88 | *shutdown* | *poweroff*)
89 | cleanup
90 | $(ctl) poweroff -i
91 | ;;
92 | *'display off'*)
93 | display_off
94 | ;;
95 | *silence*)
96 | silence_all
97 | ;;
98 | *)
99 | exit 1
100 | ;;
101 | esac
102 | }
103 |
104 | main "$@"
105 |
--------------------------------------------------------------------------------
/.local/bin/getbib:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | BIB_FILE="${HOME}/latex/uni.bib"
4 | [ -f "${BIB_FILE}" ] || BIB_FILE="${2:-$(find "${HOME}" -path "${HOME}/.*" \
5 | -prune -o -type "f" -name "*.bib" -print -quit)}"
6 |
7 | { [ -f "${BIB_FILE}" ] || [ "${2}" ]; } || {
8 | printf "%s\n" "Create a .bib file or provide as \$2." && exit "1"
9 | }
10 |
11 | filter() {
12 | sed -n -E 's/.*((DOI|doi)((\.(org))?\/?|:? *))([^: ]+[^ .]).*/\6/p; T; q'
13 | }
14 |
15 | fpdf() {
16 | pdf="${1}"
17 | doi="$(pdfinfo "${pdf}" 2> "/dev/null" | filter)"
18 |
19 | [ "${doi}" ] || doi="$(pdftotext -q -l "2" "${pdf}" - 2> "/dev/null" | filter)"
20 |
21 | [ "${doi}" ] || printf "%s\n" "No DOI found for PDF: ${pdf}" >&2
22 |
23 | printf "%s\n" "${doi}"
24 | }
25 |
26 | arrange() {
27 | sed 's/\}, /\},\n /g
28 | s/, /,\n /
29 | s/ }/\n}/
30 | s/,\s*pages=/,\n\tpages=/' |
31 | sed '1s/^ *//
32 | 1s/[0-9]*\([0-9]\{2\}\)/\1/
33 | 1s/_//
34 | 1s/.*/\L&/
35 | s/.*=/\L&/
36 | s/=/ = /'
37 | }
38 |
39 | doi2bib() {
40 | doi="${1#doi:}"
41 | url="https://api.crossref.org/works/${doi}/transform/application/x-bibtex"
42 | entry="$(curl -kLsS --no-fail "${url}" | arrange)"
43 | red='\033[0;31m'
44 | reset='\033[0m'
45 |
46 | printf "${red}%s${reset}\n" "${entry}"
47 |
48 | [ "${entry%"${entry#?}"}" != "@" ] && {
49 | printf "%s\n" "Failed to fetch bibtex entry for DOI: ${doi}"
50 | return "1"
51 | }
52 |
53 | grep -iFq "doi = {${doi}}" "${BIB_FILE}" 2> "/dev/null" && {
54 | printf "%s\n" "Bibtex entry for DOI: ${doi} already exists in the file."
55 | } || {
56 | [ -s "${BIB_FILE}" ] && printf "\n" >> "${BIB_FILE}"
57 | printf "%s\n" "${entry}" >> "${BIB_FILE}"
58 | printf "%s\n" "Added bibtex entry for DOI: ${doi}"
59 | }
60 | }
61 |
62 | [ "${1}" ] || {
63 | printf "%s\n" "Give either a pdf file or a DOI or a directory path that has PDFs as an argument."
64 | exit "1"
65 | }
66 |
67 | [ -f "${1}" ] && doi="$(fpdf "${1}")" && doi2bib "${doi}" && exit "0"
68 |
69 | [ -d "${1}" ] && for i in "${1}"/*.pdf; do doi="$(fpdf "${i}")" && doi2bib "${doi}"; done && exit "0"
70 |
71 | doi="$(printf "%s\n" "${1}" | filter)" && doi2bib "${doi}"
72 |
--------------------------------------------------------------------------------
/.local/bin/linkhandler:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -euo pipefail
4 |
5 | # Feed script a url or file location.
6 | # If an image, it will view in nsxiv,
7 | # if a video or gif, it will view in mpv
8 | # if a music file or pdf, it will download,
9 | # otherwise it opens link in browser.
10 |
11 | # Add this to ~/.config/mimeapps.list
12 | # x-scheme-handler/chrome=linkhandler.desktop;
13 | # x-scheme-handler/http=linkhandler.desktop;
14 | # x-scheme-handler/https=linkhandler.desktop;
15 |
16 | if [ -z "${1-}" ]; then
17 | url="$(xclip -o)"
18 | else
19 | url="$1"
20 | fi
21 |
22 | cd -- ~/Downloads || true
23 |
24 | case "${url:?}" in
25 | "https://t.me/"*|"t.me/")
26 | domain=${url##"https://t.me/"}
27 | domain=${domain##"t.me/"}
28 | post=""
29 | if [[ $domain == */* ]]; then
30 | post="${domain##*/}"
31 | fi
32 | domain="${domain%%/*}"
33 | url="tg://resolve?domain=${domain}${post:+"&post="}${post}"
34 | echo "opening with xdg-open: $url"
35 | setsid -f xdg-open "$url"
36 | ;;
37 | #http*youtube.com* | http*youtu.be*)
38 | # ifinstalled jq || exit 1
39 | # inv=$( curl -s 'https://api.invidious.io/instances.json?sort_by=type,users' |
40 | # jq -r '.[0][1].uri' )
41 | # get_params=${url##*/}
42 | # setsid -f "$BROWSER" -- "${inv}/${get_params}" >/dev/null 2>&1 &
43 | # ;;
44 | *.mkv | *.webm | *.mp4 | \
45 | *hooktube.com* | *bitchute.com/video* | *instagram.com* | *twitter.com* | \
46 | *odysee.com* | \
47 | *videos.lukesmith.xyz* | \
48 | *tiktok.com/* | *streamable.com/* | \
49 | *worldstar.com/web/video*)
50 | setsid -f trympv "$url" >/dev/null 2>&1 &
51 | ;;
52 | *.png | *.jpg | *.jpe | *.jpeg | *.gif | \
53 | *.pdf | *.cbz | *.cbr | *.webp | \
54 | *matrix/media/*/download/*)
55 | filename=$(echo "$url" | sed 's|.*/||; s|%20| |g')
56 | dl_file_path=$HOME/Downloads/$(mktemp -- "${filename%.*}.XXXXXX")
57 | curl --max-time 180 -sL -o "$dl_file_path" -- "$url"
58 | new_file_path="${dl_file_path%.*}.$(file --mime-type --brief "$dl_file_path" | cut -d/ -f2)"
59 | mv -n -- "$dl_file_path" "$new_file_path"
60 | setsid -f xdg-open "$new_file_path" >/dev/null 2>&1 &
61 | ;;
62 | *.mp3 | *.flac | *.opus | *.mp3?source*)
63 | qndl "$1" 'curl -LO' >/dev/null 2>&1
64 | ;;
65 | *)
66 | if [ -f "$url" ]; then
67 | setsid -f "$TERMINAL" -e "$EDITOR -- $url"
68 | else
69 | setsid -f "$BROWSER" -- "$url" >/dev/null 2>&1 &
70 | fi
71 | ;;
72 | esac
73 |
--------------------------------------------------------------------------------
/.local/bin/noisereduce:
--------------------------------------------------------------------------------
1 | #!/usr/bin/sh
2 |
3 | usage ()
4 | {
5 | printf "Usage : noisereduce