312 current 2025-02-09 03:05:47 25.05.20241217.d3c42f1 6.6.66 *
This commit is contained in:
@@ -37,6 +37,11 @@ in {
|
||||
home.packages = with pkgs;
|
||||
[
|
||||
# any other packages go here
|
||||
# xrandr
|
||||
xorg.xrandr
|
||||
bspwm
|
||||
yt-dlp
|
||||
beets
|
||||
]
|
||||
++ (
|
||||
with lib; let
|
||||
|
||||
@@ -14,6 +14,8 @@ if git --git-dir /home/synchronous/nix-cfg/.git diff-index --quiet HEAD; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
nix flake check /home/synchronous/nix-cfg/
|
||||
|
||||
# Autoformat your nix files
|
||||
alejandra . &>/dev/null \
|
||||
|| ( alejandra . ; echo "formatting failed!" && exit 1)
|
||||
|
||||
@@ -161,7 +161,7 @@ alias polybar-restart='pkill polybar; setsid polybar mybar > /dev/null 2> /dev/n
|
||||
# alias ytdl='alias ytdl="youtube-dl --extract-audio --audio-format mp3 --output "downloads/%(title)s.%(ext)s"'
|
||||
# alias ytdl="yt-dlp --extract-audio --audio-format mp3 --output "
|
||||
# alias ytdl="yt-dlp --extract-audio --audio-format mp3 --output '/home/synchronous/.music-not-tagged/%(title)s.%(ext)s'"
|
||||
alias ytdl="sh /home/synchronous/.scripts/music/ytdl.sh"
|
||||
# alias ytdl="sh /home/synchronous/.scripts/music/ytdl.sh"
|
||||
alias ytdl-mp3="yt-dlp -x --audio-format mp3 --audio-quality 0 -o '/home/synchronous/music/%(title)s.%(ext)s' "
|
||||
|
||||
alias phone-mount="sh /home/synchronous/.scripts/phone-mount/mount.sh"
|
||||
@@ -169,16 +169,16 @@ alias phone-unmount="sh /home/synchronous/.scripts/phone-mount/unmount.sh"
|
||||
alias music-move="sh /home/synchronous/.scripts/music/music-move.sh"
|
||||
|
||||
alias ntpsync="sudo ntpdate pool.ntp.org"
|
||||
alias fb="cd /home/synchronous/code/tob/fb"
|
||||
# alias fb="cd /home/synchronous/code/tob/fb"
|
||||
alias nuid="echo 002141542"
|
||||
alias gb="sh /home/synchronous/.scripts/bluetooth/gb.sh"
|
||||
# alias gb="sh /home/synchronous/.scripts/bluetooth/gb.sh"
|
||||
alias gbdc="bluetoothctl disconnect"
|
||||
# alias sxhkdrc="vim /home/synchronous/.config/sxhkd/sxhkdrc"
|
||||
# alias bspwmrc="vim /home/synchronous/.config/bspwm/bspwmrc"
|
||||
|
||||
# monitor stuff
|
||||
alias dupe-display="sh /home/synchronous/.scripts/bspwm/dupe-display.sh"
|
||||
alias undo-dupe="sh /home/synchronous/.scripts/bspwm/reset-duplicate.sh"
|
||||
# alias dupe-display="sh /home/synchronous/.scripts/bspwm/dupe-display.sh"
|
||||
# alias undo-dupe="sh /home/synchronous/.scripts/bspwm/reset-duplicate.sh"
|
||||
|
||||
# termbin
|
||||
# alias termbin="sh /home/synchronous/.scripts/termbin/tb.sh"
|
||||
|
||||
15
home/scripts/bluetooth/gb.sh
Normal file
15
home/scripts/bluetooth/gb.sh
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [[ $(bluetoothctl devices) == "No default controller available" ]]; then
|
||||
echo "click the bluetooth button lol"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# if we are not connected to gb, try to connect
|
||||
if bluetoothctl info | grep -q "Missing device address argument"; then
|
||||
bluetoothctl connect F8:8F:07:E1:FA:A7 > /dev/null
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "already connected to:"
|
||||
bluetoothctl info | grep "Name" | cut -d ' ' -f 2-
|
||||
5
home/scripts/bspwm/dupe-display.sh
Normal file
5
home/scripts/bspwm/dupe-display.sh
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
xrandr --output HDMI-2 --mode 1920x1080 --same-as eDP-1 --scale 1x1
|
||||
bspc desktop Desktop --remove
|
||||
bspc wm -r
|
||||
bspc desktop Desktop --remove
|
||||
40
home/scripts/bspwm/fast-shift.sh
Normal file
40
home/scripts/bspwm/fast-shift.sh
Normal file
@@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
shift="$1"
|
||||
current=$(bspc query -D -d --names)
|
||||
#echo "$(($current + 1))"
|
||||
if [[ "$shift" == "left" ]]; then
|
||||
iter=$(expr $current - 1)
|
||||
if [[ "$iter" == 0 ]]; then
|
||||
iter="20"
|
||||
fi
|
||||
while [[ "$iter" != "$current" ]]
|
||||
do
|
||||
if [[ "$(bspc query -N -d $iter)" != "" ]]; then
|
||||
bspc desktop -f "$iter"
|
||||
exit 0
|
||||
fi
|
||||
iter=$(expr $iter - 1)
|
||||
if [[ "$iter" == 0 ]]; then
|
||||
iter="20"
|
||||
fi
|
||||
done
|
||||
|
||||
elif [[ "$shift" == "right" ]]; then
|
||||
iter=$(expr $current + 1)
|
||||
if [[ "$iter" == 21 ]]; then
|
||||
iter="1"
|
||||
fi
|
||||
while [[ "$iter" != "$current" ]]
|
||||
do
|
||||
if [[ "$(bspc query -N -d $iter)" != "" ]]; then
|
||||
bspc desktop -f "$iter"
|
||||
exit 0
|
||||
fi
|
||||
iter=$(expr $iter + 1)
|
||||
if [[ "$iter" == 21 ]]; then
|
||||
iter="1"
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo "incorrect arguments. sorry!"
|
||||
fi
|
||||
8
home/scripts/bspwm/reset-duplicate.sh
Normal file
8
home/scripts/bspwm/reset-duplicate.sh
Normal file
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
xrandr --output HDMI-1 --off
|
||||
xrandr --output HDMI-2 --off
|
||||
xrandr --output eDP-1 --mode 1920x1080 --primary
|
||||
bspc desktop Desktop --remove
|
||||
bspc monitor HDMI-1 -r
|
||||
bspc monitor HDMI-2 -r
|
||||
bspc wm -r
|
||||
12
home/scripts/bspwm/swap-desktop.sh
Normal file
12
home/scripts/bspwm/swap-desktop.sh
Normal file
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
# swaps the current desktop with selected
|
||||
shift="$1"
|
||||
current=$(bspc query -D -d --names)
|
||||
|
||||
# if same, exit
|
||||
[[ $shift == $current ]] && exit 1
|
||||
|
||||
bspc desktop $shift -n t
|
||||
bspc desktop $current -s t
|
||||
bspc desktop $current -n $shift
|
||||
bspc desktop t -n $current
|
||||
98
home/scripts/music/ytdl.sh
Normal file
98
home/scripts/music/ytdl.sh
Normal file
@@ -0,0 +1,98 @@
|
||||
#!/bin/sh
|
||||
|
||||
usage() {
|
||||
echo "Usage: ./ytdl [URL] [options]"
|
||||
echo "Download an mp3 from a given URL, process it, and optionally move it to the music directory."
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " -h, --help Show this help message and exit."
|
||||
echo " -na --no-auto Does not automatically click thru."
|
||||
}
|
||||
|
||||
# Check if '-h' or '--help' flags are passed
|
||||
if [ "$1" = "-h" ] || [ "$1" = "--help" ] || [ "$2" = "-h" ] || [ "$2" = "--help" ]; then
|
||||
usage
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Ensure a URL is provided
|
||||
if [ -z "$1" ]; then
|
||||
echo "Error: No URL provided."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm /home/synchronous/.music-not-tagged/tmp.mp3
|
||||
|
||||
url="$1"
|
||||
|
||||
# Download and extract audio
|
||||
if ! yt-dlp --extract-audio --audio-format mp3 --output '/home/synchronous/.music-not-tagged/tmp.mp3' "$url"; then
|
||||
echo "Error downloading or extracting audio."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Import into beets
|
||||
|
||||
if [ "$2" = "-na" ] || [ "$2" = "--no-auto" ]; then
|
||||
if ! /usr/bin/beet import -s /home/synchronous/.music-not-tagged/tmp.mp3; then
|
||||
echo "Error importing into beets."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
if ! /usr/bin/beet import -s /home/synchronous/.music-not-tagged/tmp.mp3 <<< "A"; then
|
||||
echo "Error importing into beets."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# Remove all entries from beets
|
||||
if ! /usr/bin/beet ls | /usr/bin/beet remove -f; then
|
||||
echo "Error removing entries from beets."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Extract title and artist
|
||||
title=$(ffprobe -show_format -v error /home/synchronous/.music-not-tagged/tmp.mp3 | grep -m 1 'TAG:title' | cut -d= -f2)
|
||||
artist=$(ffprobe -show_format -v error /home/synchronous/.music-not-tagged/tmp.mp3 | grep -m 1 'TAG:artist' | cut -d= -f2)
|
||||
|
||||
# Ensure title and artist were extracted successfully
|
||||
if [ -z "$title" ] || [ -z "$artist" ]; then
|
||||
echo "Error extracting title or artist."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "\n"
|
||||
|
||||
# Echo title and artist
|
||||
echo "$artist"
|
||||
echo "$title"
|
||||
|
||||
|
||||
# ...
|
||||
|
||||
# Construct new filename
|
||||
t="$artist - $title"
|
||||
destination="/home/synchronous/music/$t.mp3"
|
||||
|
||||
# Check if file already exists
|
||||
if [ -f "$destination" ]; then
|
||||
echo "Error: A file with the same name already exists."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Ask user for confirmation
|
||||
echo "Would you like to continue and move the file into the music directory? (y/n)"
|
||||
read -r confirmation
|
||||
|
||||
# Exit if user doesn't confirm
|
||||
if [ "$confirmation" != "y" ]; then
|
||||
echo "Operation aborted by the user."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Move the file
|
||||
if ! mv /home/synchronous/.music-not-tagged/tmp.mp3 "$destination"; then
|
||||
echo "Error moving the file."
|
||||
exit 1
|
||||
fi
|
||||
@@ -1,2 +0,0 @@
|
||||
file=$1
|
||||
cat "$1" | nc termbin.com 9999
|
||||
@@ -1 +0,0 @@
|
||||
XD
|
||||
@@ -1,2 +0,0 @@
|
||||
file=$1
|
||||
cat "$1" | nc termbin.com 9999
|
||||
Reference in New Issue
Block a user