diff --git a/.config/profile/local_profile b/.config/profile/local_profile new file mode 100644 index 0000000..aeb900b --- /dev/null +++ b/.config/profile/local_profile @@ -0,0 +1,20 @@ +#!/bin/sh + +# relevant for: record_replay_start, record_start +export CAPTURE_INPUT_AUDIO="easyeffects_sink.monitor" +export CAPTURE_OUTPUT_AUDIO="easyeffects_source" +export CAPTURE_DIR="$HOME/downloads" +# relevant for: monitor +export EXTERNAL_MONITOR="HDMI2" +export INTERNAL_MONITOR="LVDS1" +# relevant for: textemp +export LATEX_TEMPLATE_DIR="~/code/main/latextemplates" +# relevant for: lmc +export LOOPBACK_DEVICE="PCM2902 Audio Codec Analog Stereo" +# relevant for: disk +export STATUSBAR_DISK="/home" +# relevant for: wallpaper +export WALLPAPER_DESKTOP="${XDG_DATA_HOME:-$HOME/.local/share}/bg" +export WALLPAPER_LOCK="${XDG_DATA_HOME:-$HOME/.local/share}/lock" +# relevant for: screenshot +export SCREENSHOT_DIR="$HOME/downloads" diff --git a/.local/bin/etc/screen_capture/record_replay_start b/.local/bin/etc/screen_capture/record_replay_start index 69404a2..1d45701 100755 --- a/.local/bin/etc/screen_capture/record_replay_start +++ b/.local/bin/etc/screen_capture/record_replay_start @@ -1,14 +1,15 @@ #!/bin/sh +[ -z "$CAPTURE_INPUT_AUDIO" ] && audio_1="easyeffects_sink.monitor" || audio_1="$CAPTURE_INPUT_AUDIO" +[ -z "$CAPTURE_OUTPUT_AUDIO" ] && audio_2="easyeffects_source" || audio_2="$CAPTURE_OUTPUT_AUDIO" +[ -z "$CAPTURE_DIR" ] && output="$HOME/downloads" || output="$CAPTURE_DIR" + window=$(xdotool getwindowfocus) fps=60 -audio_1="easyeffects_sink.monitor" -audio_2="easyeffects_source" format="mp4" v_codec="h264" a_codec="opus" lenght=20 -output="$HOME/downloads" gpu-screen-recorder -w $window -f $fps -a $audio_1 -a $audio_2 -c $format -k $v_codec -ac $a_codec -r $lenght -o $output & notify-send -u low 'Screen record' 'Replay started' diff --git a/.local/bin/etc/screen_capture/record_start b/.local/bin/etc/screen_capture/record_start index 477f6fc..5dd1190 100755 --- a/.local/bin/etc/screen_capture/record_start +++ b/.local/bin/etc/screen_capture/record_start @@ -1,13 +1,15 @@ #!/bin/sh +[ -z "$CAPTURE_INPUT_AUDIO" ] && audio_1="easyeffects_sink.monitor" || audio_1="$CAPTURE_INPUT_AUDIO" +[ -z "$CAPTURE_OUTPUT_AUDIO" ] && audio_2="easyeffects_source" || audio_2="$CAPTURE_OUTPUT_AUDIO" +[ -z "$CAPTURE_DIR" ] && output_dir="$HOME/downloads" || output_dir="$CAPTURE_DIR" + window=$(xdotool getwindowfocus) fps=30 -audio_1="$(pactl get-default-sink).monitor" -audio_2="$(pactl get-default-source)" format="mp4" v_codec="h264" a_codec="opus" -output="$HOME/downloads/recording-$(date '+%Y-%m-%d_%H-%M-%S').$format" +output="$output_dir/recording-$(date '+%Y-%m-%d_%H-%M-%S').$format" gpu-screen-recorder -w $window -c $format -k $v_codec -ac $a_codec -f $fps -a $audio_1 -a $audio_2 -o $output & notify-send -u low 'Screen record' 'Recording started' diff --git a/.local/bin/etc/statusbar/disk b/.local/bin/etc/statusbar/disk index 8ab67a1..5352897 100755 --- a/.local/bin/etc/statusbar/disk +++ b/.local/bin/etc/statusbar/disk @@ -3,7 +3,8 @@ # Status bar module for disk space # $1 should be drive mountpoint -disk="/home" +[ -z "$STATUSBAR_DISK" ] && disk="/home" || disk="$STATUSBAR_DISK" + [ ! -z "$1" ] && disk="$1" icon="$disk" diff --git a/.local/bin/etc/sxhkd/audio/lmc b/.local/bin/etc/sxhkd/audio/lmc index 99ba5b2..9a6978d 100755 --- a/.local/bin/etc/sxhkd/audio/lmc +++ b/.local/bin/etc/sxhkd/audio/lmc @@ -4,10 +4,11 @@ # Based on a script by lukesmithxyz, checkout github.com/lukesmithxyz/voidrice # Heavily extended and updated to a pipewire system -Device="Audio Adapter (Unitek Y-247A) Mono" -Name=$(wpctl status | grep "$Device") -Id=$( echo $Name | cut -d '.' -f 1 | cut -c 5-) -Node=$(wpctl inspect $Id | grep node.name | cut -d '=' -f 2) +[ -z "$LOOPBACK_DEVICE" ] && device="Easy Effects Source" || device="$LOOPBACK_DEVICE" + +name=$(wpctl status | grep "$device") +id=$( echo $name | cut -d '.' -f 1 | cut -c 5-) +node=$(wpctl inspect $id | grep node.name | cut -d '=' -f 2) [ -z "$2" ] && num="5" || num="$2" @@ -59,10 +60,10 @@ case "$1" in loop) playerctl loop none sleep 1 pkill -RTMIN+9 $STATUSBAR ;; - tap) wpctl set-volume $Id 0.2 + tap) wpctl set-volume $id 1.0 touch ~/.local/state/loopback.lock - pw-loopback -C $Node & - notify-send -u low 'sxhkd' "Started loopback of $Device" ;; + pw-loopback -C $node & + notify-send -u low 'sxhkd' "Started loopback of $device" ;; untap) killall pw-loopback rm ~/.local/state/loopback.lock notify-send -u low 'sxhkd' "Stopped all loopbacks" ;; diff --git a/.local/bin/etc/sxhkd/monitor b/.local/bin/etc/sxhkd/monitor index ed5e924..d1c8dc7 100755 --- a/.local/bin/etc/sxhkd/monitor +++ b/.local/bin/etc/sxhkd/monitor @@ -3,8 +3,8 @@ # toggle external monitor # by lukesmithxyz, checkout github.com/lukesmithxyz/voidrice -intern=LVDS1 -extern=HDMI2 +[ -z "$INTERNAL_MONITOR" ] && intern="LVDS1" || intern="$EXTERNAL_MONITOR" +[ -z "$EXTERNAL_MONITOR" ] && extern="HDMI2" || extern="$INTERNAL_MONITOR" case "$1" in toggle) (xrandr | grep "$extern disconnected") diff --git a/.local/bin/etc/sxhkd/screenshot b/.local/bin/etc/sxhkd/screenshot index e818678..1500adb 100755 --- a/.local/bin/etc/sxhkd/screenshot +++ b/.local/bin/etc/sxhkd/screenshot @@ -3,7 +3,9 @@ # Requires maim. It lets you choose the kind of screenshot to take, # including copying the image or even highlighting an area to copy. -output="$HOME/downloads/screenshot-$(date '+%Y-%m-%d_%H-%M-%S').png" +[ -z "$SCREENSHOT_DIR" ] && output_dir="$HOME/downloads" || output_dir="$SCREENSHOT_DIR" + +output="$output_dir/screenshot-$(date '+%Y-%m-%d_%H-%M-%S').png" xclip_img="xclip -sel clip -t image/png" xclip_txt="xclip -sel clip -t text/plain" diff --git a/.local/bin/tools/textemp b/.local/bin/tools/textemp index 04584b3..46c0b95 100755 --- a/.local/bin/tools/textemp +++ b/.local/bin/tools/textemp @@ -2,7 +2,7 @@ # copying latex templates from my template repository # (not included in the dotfiles) -latexdir=~/code/main/latextemplates +[ -z "$LATEX_TEMPLATE_DIR" ] && latexdir="~/code/main/latextemplates" || latexdir="$LATEX_TEMPLATE_DIR" articletemp=${latexdir}/article/* beamertemp=${latexdir}/beamer/* diff --git a/.local/bin/tools/wallpaper b/.local/bin/tools/wallpaper index 9b1d585..918ccec 100755 --- a/.local/bin/tools/wallpaper +++ b/.local/bin/tools/wallpaper @@ -2,20 +2,23 @@ # Adapted from a script by lukesmithxyz, checkout github.com/lukesmithxyz/voidrice +[ -z "$WALLPAPER_DESKTOP" ] && wall_desk="${XDG_DATA_HOME:-$HOME/.local/share}/bg" || disk="$WALLPAPER_DESKTOP" +[ -z "$WALLPAPER_LOCK" ] && wall_desk="${XDG_DATA_HOME:-$HOME/.local/share}/lock" || disk="$WALLPAPER_LOCK" + case "$1" in - desktop) bgloc="${XDG_DATA_HOME:-$HOME/.local/share}/bg" + desktop) wall_desk="${XDG_DATA_HOME:-$HOME/.local/share}/bg" trueloc="$(readlink -f "$2")" && case "$(file --mime-type -b "$trueloc")" in - image/* ) ln -f "$(readlink -f "$2")" "$bgloc" && notify-send -i "$bgloc" "Desktop wallpaper has been changed." ;; - inode/directory ) ln -f "$(find "$trueloc" -iregex '.*.\(jpg\|jpeg\|png\|gif\)' -type f | shuf -n 1)" "$bgloc" && notify-send -i "$bgloc" "Random desktop wallpaper chosen." ;; + image/* ) ln -f "$(readlink -f "$2")" "$wall_desk" && notify-send -i "$wall_desk" "Desktop wallpaper has been changed." ;; + inode/directory ) ln -f "$(find "$trueloc" -iregex '.*.\(jpg\|jpeg\|png\|gif\)' -type f | shuf -n 1)" "$wall_desk" && notify-send -i "$wall_desk" "Random desktop wallpaper chosen." ;; *) notify-send "🖼️ Error" "Not a valid image or directory." ; exit 1;; esac - xwallpaper --zoom "$bgloc" ;; - lock) bgloc="${XDG_DATA_HOME:-$HOME/.local/share}/lock" + xwallpaper --zoom "$wall_desk" ;; + lock) wall_lock="${XDG_DATA_HOME:-$HOME/.local/share}/lock" trueloc="$(readlink -f "$2")" && case "$(file --mime-type -b "$trueloc")" in - image/* ) ln -f "$(readlink -f "$2")" "$bgloc" && notify-send -i "$bgloc" "Lock screen wallpaper has been changed." ;; - inode/directory ) ln -f "$(find "$trueloc" -iregex '.*.\(jpg\|jpeg\|png\|gif\)' -type f | shuf -n 1)" "$bgloc" && notify-send -i "$bgloc" "Random lock screen wallpaper chosen." ;; + image/* ) ln -f "$(readlink -f "$2")" "$wall_lock" && notify-send -i "$wall_lock" "Lock screen wallpaper has been changed." ;; + inode/directory ) ln -f "$(find "$trueloc" -iregex '.*.\(jpg\|jpeg\|png\|gif\)' -type f | shuf -n 1)" "$wall_lock" && notify-send -i "$wall_lock" "Random lock screen wallpaper chosen." ;; *) notify-send "🖼️ Error" "Not a valid image or directory." ; exit 1;; esac ;; *) cat << EOF diff --git a/.profile b/.profile index 1f0c7a8..ddac26e 100644 --- a/.profile +++ b/.profile @@ -79,5 +79,8 @@ export LESS_TERMCAP_ue="$(printf '%b' '')"; a="${a%_}" echo "$0" | grep "bash$" >/dev/null && [ -f ~/.bashrc ] && source "${HOME}/.bashrc" echo "$0" | grep "zsh$" >/dev/null && [ -f ${ZDOTDIR}/.zshrc ] && source "${ZDOTDIR}/.zshrc" +# load optional variables +[ -f ~/.config/profile/local_profile ] && source "${HOME}/.config/profile/local_profile" + # Start graphical server if not already running. [ "$(tty)" = "/dev/tty1" ] && ! pgrep -x Xorg >/dev/null && exec startx