~andreafeletto/dotfiles

bf4778f37e992b6147f94f1622c2c0d26acd0fc1 — Andrea Feletto 3 years ago 9b7ab84
update
18 files changed, 76 insertions(+), 346 deletions(-)

M README.md
M etc/pacman.conf
D gnupg/.config/gnupg/gpg.conf
D gtk/.config/gtk-3.0/settings.ini
M packages
A river/.config/river/autorun
M river/.config/river/init
D sh/.local/bin/compiler
D sh/.local/bin/dbrowse
M sh/.local/bin/dzip
A sh/.local/bin/launcher
M sh/.local/bin/menu
D sh/.local/bin/prompt
M sh/.local/bin/screenshot
D sh/.local/bin/status
R river/.local/bin/wm => usr/local/bin/compositor
A waylock/.config/waylock/waylock.toml
M xdg/.config/mimeapps.list
M README.md => README.md +1 -1
@@ 5,7 5,7 @@
| river    | wayland compositor |
| waybar   | statusbar          |
| foot     | terminal emulator  |
| fuzzer   | command launcher   |
| fuzzel   | command launcher   |
| bash     | shell              |
| vis      | text editor        |
| fff      | file manager       |

M etc/pacman.conf => etc/pacman.conf +7 -1
@@ 3,8 3,8 @@
Architecture 	= auto
NoExtract	= etc/pacman.d/mirrorlist
Color
TotalDownload
CheckSpace
ParallelDownloads = 5
SigLevel = Required DatabaseOptional
LocalFileSigLevel = Optional



@@ 14,8 14,14 @@ Include = /etc/pacman.d/mirrorlist
[extra]
Include = /etc/pacman.d/mirrorlist

[testing]
Include = /etc/pacman.d/mirrorlist

[community]
Include = /etc/pacman.d/mirrorlist

[community-testing]
Include = /etc/pacman.d/mirrorlist

[multilib]
Include = /etc/pacman.d/mirrorlist

D gnupg/.config/gnupg/gpg.conf => gnupg/.config/gnupg/gpg.conf +0 -2
@@ 1,2 0,0 @@
keyserver hkps://keys.openpgp.org
trust-model tofu

D gtk/.config/gtk-3.0/settings.ini => gtk/.config/gtk-3.0/settings.ini +0 -6
@@ 1,6 0,0 @@
[Settings]
gtk-icon-theme-name = Arc
gtk-theme-name = Arc-Dark-solid
gtk-font-name = DejaVu Sans 11
gtk-application-prefer-dark-theme = true
gtk-enable-primary-paste = false

M packages => packages +27 -68
@@ 1,20 1,26 @@

# desktop
gammastep
# login
greetd
greetd-tuigreet-bin
waybar

# file manager
fff

# crypto
signify
# desktop
river-git
waybar-git
fuzzel
amfora
firefox
1password

# desktop daemons
udiskie
gammastep
mako
blueman
network-manager-applet
twmn-git
udiskie
polkit-gnome

# crypto
signify
age

# spellcheck
nuspell


@@ 26,44 32,24 @@ ttf-jetbrains-mono
adobe-source-code-pro-fonts
gnu-free-fonts

# browsers
amfora
chromium
firefox

# gramps
gramps

# GTK themes
arc-solid-gtk-theme
arc-icon-theme

# xorg
xclip
xorg-fonts-100dpi
xorg-server
xorg-xbacklight
xorg-xev
xorg-xinit
xorg-xsetroot

# drivers
xf86-video-intel
bluez
networkmanager
openssh
pipewire
pipewire-alsa
pipewire-pulse
pulseeffects
blueman
bluez
networkmanager
xorg-xwayland

# pdf
# documents
zathura
zathura-pdf-mupdf
zathura-djvu

# utility
ffmpeg
fff
fzf
grim
htop
man-pages
pulsemixer


@@ 74,28 60,14 @@ vis
words
xdg-user-dirs
xdg-utils
xurls

# system
cronie
openssh
pacman-contrib
pacutils
yay

# network
curl
iproute2
wget
traceroute

# media
imagemagick
mpv
scrot
sxiv
imv

# vis plugins
vis-base16-git
vis-cscope-git
vis-fzf-open-git
vis-open_rej-git


@@ 110,16 82,3 @@ bash-completion
dash
git
python

# python modules
python-matplotlib
python-numpy
python-pandas
python-requests
python-scipy

# dict
dictd
dict-freedict-eng-ita-bin
dict-freedict-ita-end-bin
dict-gcide

A river/.config/river/autorun => river/.config/river/autorun +8 -0
@@ 0,0 1,8 @@
waybar
gammastep
mako
nm-applet --indicator
blueman-applet
udiskie --automount --notify --tray
/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
1password --silent

M river/.config/river/init => river/.config/river/init +14 -15
@@ 2,16 2,16 @@

mod="Mod4"

riverctl map normal $mod Q spawn 'dmenu_path | menu | $SHELL'
riverctl map normal $mod Q spawn 'launcher'
riverctl map normal $mod W spawn '$BROWSER'
riverctl map normal $mod E spawn '$TERMINAL'
riverctl map normal $mod A spawn '$TERMINAL fff'
riverctl map normal $mod G spawn '$TERMINAL amfora'
riverctl map normal $mod O spawn 'xdg-open "$(dbrowse)"'

riverctl map normal $mod BackSpace close
riverctl map normal $mod+Shift BackSpace exit
riverctl map normal $mod+Shift Delete spawn 'byebye'
riverctl map normal $mod Space spawn 'waylock'

riverctl map normal $mod J focus-view next
riverctl map normal $mod K focus-view previous


@@ 19,13 19,10 @@ riverctl map normal $mod H send-layout-cmd rivertile 'main-ratio -0.05'
riverctl map normal $mod L send-layout-cmd rivertile 'main-ratio +0.05'

riverctl map normal $mod M toggle-fullscreen
riverctl map normal $mod Space toggle-float
riverctl map normal $mod F toggle-float
riverctl map normal $mod Return zoom
riverctl map normal $mod Tab swap next

riverctl map normal $mod N spawn 'makoctl dismiss --all'
riverctl map normal $mod+Shift N spawn 'makoctl restore'

riverctl map-pointer normal $mod BTN_LEFT move-view
riverctl map-pointer normal $mod+Shift BTN_LEFT resize-view



@@ 52,6 49,10 @@ for mode in normal locked; do
		'screenshot'
	riverctl map $mode Shift Print spawn \
		'screenshot region'
	riverctl map $mode $mod N spawn \
		'makoctl dismiss --all'
	riverctl map $mode $mod+Shift N spawn \
		'makoctl restore'
done

riverctl set-repeat 50 200


@@ 60,19 61,17 @@ touchpad='2:7:SynPS/2_Synaptics_TouchPad'
riverctl input $touchpad tap enabled
riverctl input $touchpad natural-scroll enabled
riverctl input $touchpad pointer-accel 0.4
riverctl focus-follows-cursor normal

riverctl border-width 4
riverctl border-color-focused 0x93a1a1
riverctl border-color-unfocused 0x325b68

riverctl spawn 'waybar'
riverctl spawn 'gammastep'
riverctl spawn 'mako'
riverctl spawn 'nm-applet --indicator'
riverctl spawn 'blueman-applet'
riverctl spawn 'udiskie --automount --notify --tray'
riverctl spawn '/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1'
riverctl spawn '1password --silent'
while read -r cmd; do
	pgrep -f "${cmd%% *}" >/dev/null || riverctl spawn "$cmd"
done < "$XDG_CONFIG_HOME/river/autorun"

riverctl default-layout rivertile
exec rivertile -main-ratio 0.5 -view-padding 8 -outer-padding 8
if ! pgrep rivertile >/dev/null; then
	exec rivertile -main-ratio 0.5 -view-padding 8 -outer-padding 8
fi

D sh/.local/bin/compiler => sh/.local/bin/compiler +0 -41
@@ 1,41 0,0 @@
#!/bin/sh
# This script will compile or run another finishing operation on a document. I
# have this script run via vim.
#
# Compiles .tex. groff (.mom, .ms), .rmd, .md.
# Opens .sent files as sent presentations.
# Runs scripts based on extention or shebang


file=$(readlink -f "$1")
dir=$(dirname "$file")
base="${file%.*}"

cd "$dir" || exit

textype() { \
	command="pdflatex"
	( sed 5q "$file" | grep -i -q 'xelatex' ) && command="xelatex"
	$command --output-directory="$dir" "$base" &&
	grep -i addbibresource "$file" >/dev/null &&
	biber --input-directory "$dir" "$base" &&
	$command --output-directory="$dir" "$base" &&
	$command --output-directory="$dir" "$base"
	}

case "$file" in
	*\.ms) refer -PS -e "$file" | groff -me -ms -kejpt -T pdf > "$base".pdf ;;
	*\.mom) refer -PS -e "$file" | groff -mom -kejpt -T pdf > "$base".pdf ;;
	*\.rmd) echo "require(rmarkdown); render('$file')" | R -q --vanilla ;;
	*\.tex) textype "$file" ;;
	*\.md) pandoc "$file" --pdf-engine=xelatex -o "$base".pdf ;;
	*config.h) sudo make install ;;
        *\.c) cc "$file" -o "$base" && "$base" ;;
        *\.cpp) clang++ "$file" -o "$base" && "$base" ;;
	*\.py) python "$file" ;;
	*\.go) go run "$file" ;;
	*\.sent) setsid sent "$file" 2>/dev/null & ;;
    *\.hs) ghc -O2 -dynamic "$file" ;;
	src/*\.rs) cargo run ;;
	*) sed 1q "$file" | grep "^#!/" | sed "s/^#!//" | xargs -r -I % "$file" ;;
esac

D sh/.local/bin/dbrowse => sh/.local/bin/dbrowse +0 -17
@@ 1,17 0,0 @@
#!/bin/sh

target="${1:-$HOME}"

while true; do
	sel="$(ls -1a "$target" | grep -v '^\.$' | menu)"
	ec=$?
	[ "$ec" -ne 0 ] && exit $ec

	newtarget="$target/$sel"
	if [ -d "$newtarget" ]; then
		target="$newtarget"
	elif [ -r "$newtarget" ]; then
		printf '%s\n' "$newtarget"
		exit 0
	fi
done

M sh/.local/bin/dzip => sh/.local/bin/dzip +1 -1
@@ 19,7 19,7 @@ case "$1" in
esac

while true; do
	res=$(lsd | dmenu -p "$Prompt")
	res=$(lsd | menu -p "$Prompt")

	# quit
	[ -z "$res" ] && exit 1

A sh/.local/bin/launcher => sh/.local/bin/launcher +3 -0
@@ 0,0 1,3 @@
#!/usr/bin/env bash

{ IFS=:; ls -H $PATH; } | sort -u | menu | $SHELL

M sh/.local/bin/menu => sh/.local/bin/menu +5 -1
@@ 1,3 1,7 @@
#!/bin/sh

fuzzel -d -r 0 -b 000000ff -t f92672ff -m f92673ff -C f92672ff
fuzzel --dmenu \
	--background=111111ff --text-color=dcdcccff --match-color=325b68ff \
	--selection-color=eee8d5ff --selection-text-color=657b83ff \
	--border-radius=0 --border-width=4 --border-color=93a1a1ff \
	--font=monospace:size=10 --line-height=16 --lines=10

D sh/.local/bin/prompt => sh/.local/bin/prompt +0 -7
@@ 1,7 0,0 @@
#!/bin/sh
# A dmenu binary prompt script.
# Gives a dmenu prompt labeled with $1 to perform command $2.
# For example:
# `./prompt "Do you want to shutdown?" "shutdown -h now"`

[ "$(printf "no\\nyes" | dmenu -i -p "$1")" = "yes" ] && $2

M sh/.local/bin/screenshot => sh/.local/bin/screenshot +2 -1
@@ 1,9 1,10 @@
#!/bin/sh

directory="$(xdg-user-dir PICTURES)/screenshots"
mkdir -p "$directory"
filename="$directory/$(date +%F-%H-%M-%S).png"

mkdir -p "$directory"

if [ $# -eq 0 ]; then
	grim "$filename"
else

D sh/.local/bin/status => sh/.local/bin/status +0 -184
@@ 1,184 0,0 @@
#!/bin/sh

Version='0.0.1'
PrgName=${0##*/}

PrgDir="$HOME/.local/share/$PrgName"
mkdir -p "$PrgDir"
PidPath="$PrgDir/$PrgName.pid"
LogPath="$PrgDir/$PrgName.log"
#BacklightPath='/sys/class/backlight/intel_backlight'

Usage() {
	while read -r Line; do
		printf '%b\n' "$Line"
	done <<-EOF
		\rUsage: $PrgName OPTION
		\rStatusbar for dwm.

		\rOptions:
		\r  -h, --help, -?      display this help and exit
		\r  -v, --version       output version infromation
		\r  -r, --refresh       refresh
		\r  -d, --daemon        start in the background (if not already running)
		\r  -s, --stop          stop daemon if one exists

		\rGit repository: <https://github.com/andreafeletto/dotfiles>
	EOF
}

Die() {
	printf 'error: %s\n' "$1" 1>&2
	Usage
	exit 1
}

################################################################################
##																			  ##
## Status Bar Elements														  ##
##																			  ##
################################################################################

Battery() {
	CapacityPath='/sys/class/power_supply/BAT1/capacity'
	StatusPath='/sys/class/power_supply/BAT1/status'
	if [ -r "$CapacityPath" ] && [ -r "$StatusPath" ]; then
		read -r Status <"$StatusPath"
		case $Status in
		Discharging)
			Icon="🔋"
			;;
		Charging)
			Icon="🔌"
			;;
		Full)
			Icon="⚡"
			;;
		Unknown)
			Icon="❓"
			;;
		esac
		read -r Capacity <"$CapacityPath"
		printf '%s %4s%%\n' "$Icon" "$Capacity"
	else
		Die 'unable to access power supply files'
	fi
}

Volume() {
	if ! command -v pulsemixer >/dev/null; then
		Die 'missing dependency: pulsemixer'
	fi

	if [ "$(pulsemixer --get-mute)" -eq 1 ]; then
		printf '   🔇   \n'
	else
		Value=$(pulsemixer --get-volume)
		printf '🔊 %4s%%\n' "${Value%% *}"
	fi
}

Backlight() {
	if [ -n "$BacklightPath" ]; then
		read -r Brightness <"$BacklightPath/brightness"
		read -r MaxBrightness <"$BacklightPath/max_brightness"
		Value=$((100 * Brightness / MaxBrightness))
	elif xbacklight >/dev/null; then
		Value=$(xbacklight)
	fi
	printf '💡 %4d%%\n' "${Value%%.*}"
}

Clock() {
	if command -v lolclock >/dev/null; then
		lolclock
	else
		date '+%R'
	fi
}

################################################################################
##																			  ##
## Utility Functions														  ##
##																			  ##
################################################################################

Refresh() {
	printf '%s' "$$" >"$PidPath"
	xsetroot -name "| $(Backlight) | $(Volume) | $(Battery) | $(Clock)"
}

GetDaemonPid() {
	if [ -r "$PidPath" ]; then
		read -r Pid <"$PidPath"
		printf '%s' "$Pid"
	fi
}

SendRefresh() {
	kill -USR1 "$(GetDaemonPid)"
}

StartDaemon() {
	if kill -0 "$(GetDaemonPid)" 2>/dev/null; then
		Die 'daemon already running'
	fi
	${SHELL:-"/bin/sh"} -c "$0" >>"$LogPath" 2>&1 &
}

StopDaemon() {
	Pid=$(GetDaemonPid)
	if ! kill -0 "$Pid"; then
		Die 'no daemon to kill'
	fi
	kill -15 "$Pid"
}

################################################################################
##																			  ##
## Argument Parsing															  ##
##																			  ##
################################################################################

if [ $# -gt 1 ]; then
	Usage
	exit 1
fi

case $1 in
--help | -h | -\?)
	Usage
	exit 0
	;;
--version | -v)
	printf '%s\n' "$Version"
	exit 0
	;;
--refresh | -r)
	SendRefresh
	exit 0
	;;
--daemon | -d)
	StartDaemon
	exit 0
	;;
--stop | -s)
	StopDaemon
	exit 0
	;;
esac

################################################################################
##																			  ##
## Main Loop and Traps														  ##
##																			  ##
################################################################################

trap 'Refresh' USR1
trap 'rm $PidPath $LogPath; exit 0' INT TERM

while true; do
	Refresh
	sleep 10 &
	wait $!
done

R river/.local/bin/wm => usr/local/bin/compositor +0 -0
A waylock/.config/waylock/waylock.toml => waylock/.config/waylock/waylock.toml +7 -0
@@ 0,0 1,7 @@

#fail_command = "fswebcam -q $HOME/pictures/intruder.png"

[colors]
init_color  = 0x000000
input_color = 0x004354
fail_color  = 0xdc322f

M xdg/.config/mimeapps.list => xdg/.config/mimeapps.list +1 -1
@@ 8,7 8,7 @@ image/gif=imv.desktop;
image/jpeg=imv.desktop;
image/png=imv.desktop;
inode/directory=filemanager.desktop;
text/html=chromium.desktop;
text/html=firefox.desktop;
text/plain=text.desktop;
text/x-c=text.desktop;
text/x-makefile=text.desktop;