dotfiles

Configuration for the software I use.
git clone https://git.sr.ht/~jbauer/dotfiles
Log | Files | Refs | README | LICENSE

commit ebec777b5061f975f7309c0cc2f16d1895828449
parent 908502fb567860a7af9d18167e77beac9713550f
Author: Jake Bauer <jbauer@paritybit.ca>
Date:   Thu, 20 May 2021 22:35:08 -0400

Remove unneeded scripts

Diffstat:
D.local/bin/change-brightness | 18------------------
D.local/bin/change-kb-layout | 15---------------
D.local/bin/mount_device | 45---------------------------------------------
D.local/bin/mute-microphone | 22----------------------
D.local/bin/record | 37-------------------------------------
D.local/bin/statusbar/now-playing | 41-----------------------------------------
D.local/bin/statusbar/utcp2time | 1-
D.local/bin/toggle-touchpad | 15---------------
D.local/bin/unmount_device | 36------------------------------------
9 files changed, 0 insertions(+), 230 deletions(-)

diff --git a/.local/bin/change-brightness b/.local/bin/change-brightness @@ -1,18 +0,0 @@ -#!/bin/sh -# Thank you Arch Wiki: https://wiki.archlinux.org/index.php/Dunst#Dunstify - -# Arbitrary but unique message id -msgId="392070" - -# Set the volume based on args given -brightnessctl set "$@" > /dev/null - -# Query brightnessctl for the current brightness level -sleep 0.1 -brightness="$(brightnessctl -m | cut -d, -f4)" - -# Show the brightness notification -dunstify -a "changeBrightness" -u low -i display-brightness-medium-symbolic -r \ -"$msgId" "Brightness: $brightness" - -exit 0 diff --git a/.local/bin/change-kb-layout b/.local/bin/change-kb-layout @@ -1,15 +0,0 @@ -#!/bin/sh - -currentlayout=$(cat /tmp/current_layout) -if [ ! -f "/tmp/current_layout" ]; then - echo "us" > /tmp/current_layout -fi - -# Cycle through keyboard layouts -if [ "$currentlayout" = "us" ]; then - setxkbmap -layout ru -variant phonetic - echo "ru" > /tmp/current_layout -elif [ "$currentlayout" = "ru" ]; then - setxkbmap -layout us - echo "us" > /tmp/current_layout -fi diff --git a/.local/bin/mount_device b/.local/bin/mount_device @@ -1,45 +0,0 @@ -#!/bin/sh - -# Present the user with a dmenu prompt of devices (partitions and ROMs) to mount -# and mount the selected device to ~/.mnt/<label> or ~/.mnt/<uuid> if the device -# does not have a label. - -mount() { - choice="$(echo "$devices" | dmenu -i -p "Mount:")" || exit 1 - choice="$(echo "$choice" | awk '{print $1}')" - deviceLabel="$(lsblk -r -o "NAME,LABEL" | grep "$choice" | awk '{print $2}')" - deviceUUID="$(lsblk -r -o "NAME,UUID" | grep "$choice" | awk '{print $2}')" - - # Will require "permit nopass <username> cmd mount" in doas.conf - if [ -z "$deviceLabel" ]; then - mkdir -p ~/.mnt/"$deviceUUID" - doas mount /dev/"$choice" ~/.mnt/"$deviceUUID"/ && \ - notify-send "Mounted Drive" \ - "$choice mounted to ~/.mnt/$deviceUUID" && mounted=1 - else - mkdir -p ~/.mnt/"$deviceLabel" - doas mount /dev/"$choice" ~/.mnt/"$deviceLabel"/ && \ - notify-send "Mounted Drive" \ - "$choice mounted to ~/.mnt/$deviceLabel" && mounted=1 - fi - - # Clean up if unsuccessful mount - if [ -z "$mounted" ]; then - rmdir ~/.mnt/"$deviceUUID" || rmdir ~/.mnt/"$deviceLabel" - exit 1 - fi - - exit 0 -} - -# Display options in the form device (size) (e.g. sdc1 (256G)) -# Is there a simple OS-agnostic (i.e. not Linux-only) way of doing this? -devices="$(lsblk -r -o "NAME,TYPE,SIZE,MOUNTPOINT" | grep 'part\|rom' | \ - awk '$4=="" {printf "%s (%s)\n", $1, $3}')" - -if [ -z "$devices" ]; then - echo "No mountable devices detected" - exit 1 -fi - -mount diff --git a/.local/bin/mute-microphone b/.local/bin/mute-microphone @@ -1,22 +0,0 @@ -#!/bin/sh -# Thank you Arch Wiki: https://wiki.archlinux.org/index.php/Dunst#Dunstify - -# Arbitrary but unique message id -msgId="557843" - -# Set the volume based on args given -amixer sset Capture toggle > /dev/null - -# Query amixer for the current volume and whether or not the speaker is muted -online="$(amixer get Capture | tail -1 | awk '{print $NF}' | sed 's/[^a-z]*//g')" - -if [ "$online" = "off" ]; then - # Show the sound muted notification - dunstify -a "muteMic" -u low -i audio-input-microphone-muted-symbolic \ - -r "$msgId" "Microphone muted" -else - # Show the volume notification - dunstify -a "muteMic" -u low -i audio-input-microphone-high-symbolic \ - -r "$msgId" "Microphone unmuted" -fi -exit 0 diff --git a/.local/bin/record b/.local/bin/record @@ -1,37 +0,0 @@ -#!/bin/sh - -# Prompt the user to record audio, video, a combination, or to end the currently -# running recordings. - -choice=$(printf "audio+video\\nvideo\\naudio\\nend" | dmenu -i -p "Record:") || exit 1 -case "$choice" in - audio+video) - ffmpeg -y \ - -f x11grab \ - -framerate 60 \ - -s "1920x1080" \ - -i "$DISPLAY" \ - -f alsa -i default \ - -c:v h264 -crf 0 -preset ultrafast -c:a aac \ - "$HOME/av-$(date '+%Y%m%d-%H%M').mkv" & - ;; - video) - ffmpeg -y \ - -f x11grab \ - -framerate 60 \ - -s "1920x1080" \ - -i "$DISPLAY" \ - -c:v libx264 -qp 0 \ - "$HOME/v-$(date '+%Y%m%d-%H%M').mkv" & - ;; - audio) - ffmpeg -y \ - -f alsa -i default \ - -c:a flac \ - "$HOME/a-$(date '+%Y%m%d-%H%M').flac" & - ;; - end) - pkill ffmpeg - ;; -esac -exit 0 diff --git a/.local/bin/statusbar/now-playing b/.local/bin/statusbar/now-playing @@ -1,41 +0,0 @@ -#!/bin/sh - -nowPlaying=$(cmus-remote -Q 2>/dev/null) -title=$(echo "$nowPlaying" | grep 'tag title' | cut -d' ' -f3-) -artist=$(echo "$nowPlaying" | grep 'tag artist' | cut -d' ' -f3-) -repeat=$(echo "$nowPlaying" | grep 'set repeat ' | cut -d' ' -f3-) -shuffle=$(echo "$nowPlaying" | grep 'set shuffle' | cut -d' ' -f3-) -duration=$(echo "$nowPlaying" | grep 'duration' | cut -d' ' -f2-) -position=$(echo "$nowPlaying" | grep 'position' | cut -d' ' -f2-) -curStatus=$(echo "$nowPlaying" | head -1 | cut -d' ' -f2) - -if [ "$curStatus" != "playing" ] && [ "$curStatus" != "paused" ]; then - printf "Nothing Playing" - exit 0 -fi - -# Truncate long title (e.g. "Burned Down Cigarettes" -> "Burned Down C...") -if [ "$(echo "$title" | wc -m)" -gt 16 ]; then - title=$( printf "%.16s" "$title" | sed 's/...$/.../') -fi - -# Truncate long artist name (e.g. "Midnight Ambassador" -> "Midnight Am.") -if [ "$(echo "$artist" | wc -m)" -gt 12 ]; then - artist=$( printf "%.12s" "$artist" | sed 's/.$/./') -fi - -((durationMinutes=$duration/60)) -((durationSeconds=$duration%60)) -((positionMinutes=$position/60)) -((positionSeconds=$position%60)) - -if [ "$shuffle" = "true" ]; then - icons=" " -fi -if [ "$repeat" = "true" ]; then - icons="$icons " -fi - -printf "\"%s\" by %s — %02d:%02d/%02d:%02d%s" "$title" "$artist" \ - "$positionMinutes" "$positionSeconds" "$durationMinutes" \ - "$durationSeconds" "$icons" diff --git a/.local/bin/statusbar/utcp2time b/.local/bin/statusbar/utcp2time @@ -1 +0,0 @@ -TZ=Europe/Vienna date +"%H:%M" diff --git a/.local/bin/toggle-touchpad b/.local/bin/toggle-touchpad @@ -1,15 +0,0 @@ -#!/bin/sh - -# Arbitrary but unique message id -msgId="901230" - -id=$(xinput list | grep TouchPad | cut -d'=' -f2 | awk '{print $1}') -state=$(xinput list-props "$id" | grep 'Device Enabled' | awk '{print $4}') - -if [ "$state" -eq 1 ]; then - xinput disable $id - dunstify -u low -i touchpad-disabled-symbolic -r "$msgId" "Touchpad Disabled" -else - xinput enable $id - dunstify -u low -i touchpad-enabled-symbolic -r "$msgId" "Touchpad Enabled" -fi diff --git a/.local/bin/unmount_device b/.local/bin/unmount_device @@ -1,36 +0,0 @@ -#!/bin/sh - -# Present the user with a dmenu prompt of mounted devices to unmount. -# Will not list /, /boot, /home, /usr*, /var* locations. -# Will auto-remove the folder that the device used to be mounted to. - -unmount() { - choice="$(echo "$devices" | dmenu -i -p "Unmount:")" || exit 1 - choice="$(echo "$choice" | awk '{print $1}')" - deviceLabel="$(lsblk -r -o "NAME,LABEL" | grep "$choice" | awk '{print $2}')" - deviceUUID="$(lsblk -r -o "NAME,UUID" | grep "$choice" | awk '{print $2}')" - - # Will require "permit nopass <username> cmd umount" in doas.conf - if [ -z "$deviceLabel" ]; then - doas umount ~/.mnt/"$deviceUUID"/ && \ - notify-send "Unmounted Drive" \ - "$choice unmounted from ~/.mnt/$deviceUUID" - rmdir ~/.mnt/"$deviceUUID" - else - doas umount /dev/"$choice" ~/.mnt/"$deviceLabel"/ && \ - notify-send "Unmounted Drive" \ - "$choice unmounted from ~/.mnt/$deviceLabel" - rmdir ~/.mnt/"$deviceLabel" - fi - exit 0 -} - -devices=$(lsblk -n -r -o "NAME,TYPE,SIZE,MOUNTPOINT" | \ - awk '$4!~/\/boot|\/home$|\/usr|\/var/&&length($4)>1 {printf "%s (%s)\n", $1, $4}') - -if [ -z "$devices" ]; then - echo "No unmountable devices detected" - exit 1 -fi - -unmount