major springcleaning
This commit is contained in:
@ -1,87 +0,0 @@
|
||||
# Directory of Scripts
|
||||
|
||||
I keep all my user-created scripts here in `~/.local/bin/`. Scripts are sorted
|
||||
into sub-directories for easy management, and all are seamlessly added to
|
||||
`$PATH` with the command below in `~/.profile`:
|
||||
|
||||
```
|
||||
export PATH="$(du $HOME/.local/bin/ | cut -f2 | tr '\n' ':')$PATH"
|
||||
```
|
||||
|
||||
## `statusbar/`
|
||||
|
||||
For modules used in i3blocks.
|
||||
|
||||
- `battery` -- i3blocks module. Shows available power remaining with icon indicating battery status. Colors indicate different levels of charge.
|
||||
- `clock` -- Shows time and date. If clicked, brings up calender or coming calcuse events.
|
||||
- `cpu` -- Shows CPU temperature. If clicked, shows most processor-intensive processes.
|
||||
- `help` -- Module which appears as a question mark. Brings up readme if clicked.
|
||||
- `internet` -- Shows whether machine is connected to wifi and ethernet. If clicked, brings up `nmtui`.
|
||||
- `mailbox` -- i3blocks module for use with mutt-wizard. Shows unread mail and if `mailsync.sh` is running.
|
||||
- `mem` -- Shows memory usage. If clicked, shows most memory-intensive processes.
|
||||
- `music` -- i3blocks module. Shows current song; if paused, name will be grayed and italic.
|
||||
- `mpdupdate` -- A daemon running by default that will update the i3mpd block on mpd change.
|
||||
- `news` -- Shows unread newsboat articles. Brings up newsboat or refreshes RSS feeds.
|
||||
- `pacpackages` -- i3blocks module. Detects new installable upgrades. Only works if you use cronjobs to automatically sync repositories.
|
||||
- `popupgrade` -- Called by clicking on the update icon if there are new packages. Spawns a `yay` upgrade of the main Arch repos and AUR packages, updates the i3blocks module once complete.
|
||||
- `torrent` -- i3blocks module. Shows torrents idle (⌛️), downloading (⬇️) or finished (🌱).
|
||||
- `volume` -- i3blocks module. Shows volume percentage or mute notification.
|
||||
- `weather` -- i3blocks module. Gets weather forcast from wttr.in and returns today's precipitation chance (☔), daily low (❄️) and daily high (☀️).
|
||||
|
||||
## `cron/`
|
||||
|
||||
For scripts meant to be cronjobs. None are active by default on LARBS.
|
||||
|
||||
- `checkup` -- If connected to internet, syncs package repositories and downloads (but does not install) any potential updates. Gives `notify-send` notifications of when it is active since other `pacman` install commands cannot be run simultaneously. You may need to grant your user the ability to run `pacman -Syyuw --noconfirm` without a password (done in `/etc/sudoers`).
|
||||
- `cronbat` -- Gives a dunst notification if the battery is less than 25%.
|
||||
- `crontog` -- Not actually a cronjob, but just turns off/on all user cronjobs.
|
||||
- `getforecast` -- Updates the weather forecast. This is automatically run by `weather` if there hasn't been a new forecast today.
|
||||
- `newsup` -- Updates newsboat RSS feeds if connected to internet. Will also display a newspaper update icon on i3blocks if it has not be user disabled.
|
||||
|
||||
## `tools/`
|
||||
|
||||
Scripts intended to be run either manually by the user or linked to a shortcut
|
||||
in vim or another program.
|
||||
|
||||
- `compiler` -- Compiles a markdown, R markdown or LaTeX document with the approriate command. Will also run `make && sudo make install` if in a `config.h` file. Otherwise it will create a sent presentation. This can be thought of a general output handler. I have it bound to `<leader>c` in vim.
|
||||
- `dmenuhandler` -- Give this script a url and it will offer dmenu options for opening it. Used by `newsboat` and some other programs as a link handler.
|
||||
- `extract` -- Will detect file type of archive and run appropriate extraction command.
|
||||
- `getbib` -- Use crossref.org to automatically detect bibtex entry of a .pdf. Attempts to search for the .pdf's DOI. Returns nothing if none detected.
|
||||
- `getkeys` -- Get the LARBS documentation on what bindings exist for main programs.
|
||||
- `linkhandler` -- The automatic link handler used by `newsboat` and other programs. Urls of video sites or of video files are opened in `mpv`, images are downloaded/opened in `feh`, music files are downloaded with `wget` and all other urls are opened in the default browser.
|
||||
- `lmc` -- A music controller that simplifies music/audio management and improves the interface with i3blocks. Check inside to see what it does. This is what i3 audio/music commands run by default. If you use a difference music system or ALSA, you can change this script rather than changing all the shortcuts in different places.
|
||||
- `note` -- Give this script some text/a message as an argument. It will print it to the terminal, and if `dunst` is running, display a notification.
|
||||
- `opout` -- "Open output", opens the corresponding `.pdf` file if run on a `.md`, `.tex` or `.rmd` file, or if given an `.html` file, will open it in the browser. Bound to `<leader>p` in my vim config to reveal typical output.
|
||||
- `pauseallmpv` -- Pauses all mpv instances by sending the `,` key to each. Used by several scripts, but can be used alone as well. It will not pause an audio only mpv instance. If you know how to add a hack to do this, feel free to PR it or email me an addition.
|
||||
- `remaps` -- Remaps capslock to escape when pressed and super/mod when held. Maps the menu key to super as well. Runs the US international keyboard setup. If you want another keyboard setup, edit this fine.
|
||||
- `shortcuts` -- For updating bash and ranger shortcuts. Reads `~/.config/bmdirs` and `~/.config/bmfiles` for pairs of keypresses and directories and files, then autoproduces bash aliases and ranger shortcuts for them which output to `~/.config/shortcutrc` and `~/.config/ranger/shortcuts.conf` respectively. These are read automatically by my bash and ranger configs. You don't have to run this script manually though, as it's run by vim whenever you edit one of the `~/.bm*` files.
|
||||
- `speedvid` -- Speed up a given video file (`$1`) by a given ammount (`$2`).
|
||||
- `tpb` -- Search Pirate Bay for the certain search terms given as arguments.
|
||||
- `texclear` -- Remove all `.tex` related build files. This is run by my vim when I stop editing any `.tex` file.
|
||||
- `transadd` -- The mimeapp default script for handling torrent magnet links. Starts `transmission-daemon` if not running and adds the link.
|
||||
|
||||
## `i3cmds`
|
||||
|
||||
These are scripts linked to bindings in i3. They typically perform
|
||||
user-interface actions or involve dmenu.
|
||||
|
||||
- `bottomleft` and `bottomright` -- Makes the currently selected window float in one of the bottom corners of the screen. `bottomleft` is bound to `mod+B` by default.
|
||||
- `camtoggle` -- Starts/kills /dev/video0 webcam. Placed in bottom right by default.
|
||||
- `ddspawn` -- This is the script called to create, show and hide the dropdown tmux terminal mapped to `mod+u`, but also the dropdown calculator mapped to `mod+a`. Give the script an argument that is a script the window will run. If a window does not already exist, `ddspawn` creates it, if it does, `ddspawn` will toggle its visibility. The the script itself for usage.
|
||||
- `displayselect` -- Select which displays to use. Bound to `mod+F3`.
|
||||
- `dmenumount` -- Gives a dmenu prompt for mounting USB drives or Android devices. Bound to `mod+F9`. Will do nothing if none are available.
|
||||
- `dmenurecord` -- Gives a list of recording commands: `audio`, `video` and `screencast` (both) in dmenu for selection. Bound to `mod+PrintScreen` by default. Should be killed by `killrecording`.
|
||||
- `dmenuumount` -- Unmount a mounted non-essential partition. Bound to `mod+F10`. Will do nothing if none are mounted. It will not try to unmount essential system partitions.
|
||||
- `dmenuunicode` -- Shows a searchable dmenu prompt of emoji characters. The selected emoji is copied to the system clipboard, while its character code is copied to primary selection (middle mouse button).
|
||||
- `dropdowncalc` -- The dropdown calculator script called by `ddspawn` and bound to `mod+a` by default. Will run an R calculator if installed, otherwise python.
|
||||
- `ducksearch` -- Show a dmenu prompt and search for the inputed text in DuckDuckGo. Can take bangtags as expected, i.e. typing in `!aw Arch Linux` will search the Arch Wiki for "Arch Linux" or `!yt Luke Smith` will search YouTube for "Luke Smith", etc.
|
||||
- `i3resize` -- A script that allows intuitive resizing of windows. Mapped to `mod+Y/U/I/O`.
|
||||
- `killrecording` -- End a recording started by `dmenurecord` the proper way without file trucation or lingering background processes, mapped to `mod+Delete` by default.
|
||||
- `lockscreen` -- The screen locker. Gives a confirm prompt and if user says yes, all audio will be paused and the screen will be distorted and locked and screen will soon time out. User must insert password to unlock. Mapped to `mod+x` by default.
|
||||
- `newspod` -- A silly line that has a script all to itself due to i3's idiosyncracies. Starts `newsboat`, if `newsboat` cannot open because of another instance being open, opens `podboat`.
|
||||
- `prompt` -- Gives a Yes/No prompt to a question given as an argument. Used by numerous bindings like `mod+shift+x`, `mod+shift+backspace` and `mod+shift+escape`.
|
||||
- `samedir` -- Opens a terminal window in the same directory as the window currently selection. Bound to `mod+shift+enter`.
|
||||
- `td-toggle` -- Gives a dmenu prompt to start `transmission-daemon` if not running, or the kill it if it is. Obviously you need `transmission-cli` installed for this to work. Mapped to `mod+F7` by default.
|
||||
- `tmuxdd` -- The startup script for the dropdown terminal (toggleable with `mod+u`). Either attaches to an existing tmux session or begins a new one.
|
||||
- `toggletouchpad` -- As the name suggests, turns off TouchPad if on, and turns it on if off. Requires `xf86-input-synaptics`. If your laptop has a special button for this, it will be mapped by default.
|
||||
- `tutorialvids` -- A dmenu prompt that gives some options of tutorial videos to watch. Bound to `mod+shift+e`.
|
@ -1,49 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Requires ffmpeg (audio splitting) and my `tag` wrapper script.
|
||||
|
||||
[ ! -f "$2" ] && printf "The first file should be the audio, the second should be the timecodes.\\n" && exit
|
||||
|
||||
echo "Enter the album/book title:"; read -r booktitle
|
||||
|
||||
#echo "Enter the artist/author:"; read -r author
|
||||
|
||||
echo "Enter the publication year:"; read -r year
|
||||
|
||||
inputaudio="$1"
|
||||
|
||||
# Get a safe file name from the book.
|
||||
#iconv -cf UTF-8 -t ASCII//TRANSLIT
|
||||
escbook="$(echo "$booktitle" | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | sed "s/-\+/-/g;s/\(^-\|-\$\)//g")"
|
||||
|
||||
! mkdir -p "$escbook" && echo "Do you have write access in this directory?" && exit 1
|
||||
|
||||
# As long as the extension is in the tag script, it'll work.
|
||||
ext="opus"
|
||||
#ext="${1#*.}"
|
||||
|
||||
# Get the total number of tracks from the number of lines.
|
||||
total="$(wc -l < "$2")"
|
||||
|
||||
while read -r x;
|
||||
do
|
||||
end="$(echo "$x" | cut -f1)"
|
||||
|
||||
[ -n "$start" ] &&
|
||||
echo "From $start to $end; $track $title"
|
||||
file="$escbook/$(printf "%.2d" "$track")-$esctitle.$ext"
|
||||
[ -n "$start" ] && echo "Splitting \"$title\"..." &&
|
||||
ffmpeg -nostdin -y -i "$inputaudio" -ss "$start" -to "$end" -vn -c copy "$file" &&
|
||||
echo "Tagging \"$title\"..." && tag -a "$author" -A "$booktitle" -t "$title" -n "$track" -N "$total" -d "$year" "$file"
|
||||
title="$(echo "$x" | cut -f 2)"
|
||||
author="$(echo "$x" | cut -f 3)"
|
||||
#| iconv -cf UTF-8 -t ASCII//TRANSLIT
|
||||
esctitle="$(echo "$title" | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr ' ' '_' | sed "s/-\+/-/g;s/\(^-\|-\$\)//g")"
|
||||
track="$((track+1))"
|
||||
start="$end"
|
||||
done < "$2"
|
||||
# The last track must be done outside the loop.
|
||||
echo "From $start to the end: $title"
|
||||
file="$escbook/$(printf "%.2d" "$track")-$esctitle.$ext"
|
||||
echo "Splitting \"$title\"..." && ffmpeg -nostdin -y -loglevel -8 -i "$inputaudio" -ss "$start" -vn -c copy "$file" &&
|
||||
echo "Tagging \"$title\"..." && tag -a "$author" -A "$booktitle" -t "$title" -n "$track" -N "$total" -d "$year" "$file"
|
247
.local/bin/bt
247
.local/bin/bt
@ -1,247 +0,0 @@
|
||||
#!/bin/sh
|
||||
SCAN_PERIOD=5
|
||||
AUTOTRUST=false #trust every newly paired device
|
||||
AUTOSCAN=false #immediately start scanning when started to speed up pairing process
|
||||
#If you want to update symbols in your status bar add your details below:
|
||||
bar="dwmblocks"
|
||||
barsignal="4"
|
||||
|
||||
#locations of blacklist and hard coded list of paired devices (watch out, need to modify Makefile as well if you want to change these values and still use make install)
|
||||
BLACKLIST=${XDG_DATA_HOME:-$HOME/.local/share}/bt/blacklist
|
||||
PAIRLIST=${XDG_DATA_HOME:-$HOME/.local/share}/bt/paired
|
||||
|
||||
actions="pair
|
||||
unpair"
|
||||
|
||||
[ "$AUTOTRUST" = false ] && actions="${actions}
|
||||
trust"
|
||||
|
||||
#Checks for necessary programs to be present. Very unlikely not to be present but let's just err on the safer side.
|
||||
for prog in dmenu bluetoothctl awk cat date nl; do
|
||||
if ! hash "$prog" 2>/dev/null; then
|
||||
printf 'bthandler: %s: command not found\n' "$prog" >&2
|
||||
exit 127
|
||||
fi
|
||||
done
|
||||
|
||||
power(){
|
||||
powerstatus="$( bluetoothctl show | grep Powered | awk '{print $2}' )"
|
||||
if [ "$powerstatus" = "no" ]; then
|
||||
[ "$1" = on ] && bluetoothctl power on
|
||||
elif [ "$powerstatus" = "yes" ]; then
|
||||
[ "$1" = off ] && bluetoothctl power off
|
||||
fi
|
||||
}
|
||||
|
||||
scan(){
|
||||
scanstatus="$( bluetoothctl show | grep Discovering | awk '{print $2}' )"
|
||||
if [ "$1" = on ]; then
|
||||
#sets variable in case scanning was no already on before the start of bt
|
||||
[ -f /tmp/bt_start_scan$$ ] || start_scan="$( date +'%s' )"
|
||||
if [ "$scanstatus" = "no" ]; then
|
||||
bluetoothctl scan on &
|
||||
start_scan="$( date +'%s' )"
|
||||
fi
|
||||
echo "$start_scan" > /tmp/bt_start_scan$$
|
||||
elif [ "$1" = off ]; then
|
||||
if [ "$scanstatus" = "yes" ]; then
|
||||
bluetoothctl scan off
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
#Check bluetoothctl paired-devices for new devices to be hardcoded into pair list
|
||||
update_pair_list(){
|
||||
btctl_paired_devices="$(bluetoothctl paired-devices)"
|
||||
if [ -n "$btctl_paired_devices" ]
|
||||
then
|
||||
btctl_not_in_list="$( echo "$btctl_paired_devices" | grep -vf "$PAIRLIST")"
|
||||
[ -n "$btctl_not_in_list" ] && echo "$btctl_not_in_list" >> "$PAIRLIST"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#start scanning as early as possible to speed up pairing process
|
||||
startup(){
|
||||
#remove old tmp files
|
||||
for f in /tmp/*
|
||||
do
|
||||
case $f in
|
||||
/tmp/bt_start_scan*) rm "$f";;
|
||||
*) true;;
|
||||
esac
|
||||
done
|
||||
if $AUTOSCAN
|
||||
then
|
||||
power on
|
||||
scan on
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
if [ "$1" = "edit" ]; then
|
||||
case $2 in
|
||||
"pairlist")${EDITOR:-vim} "$PAIRLIST" && exit;;
|
||||
"blacklist")${EDITOR:-vim} "$BLACKLIST" && exit;;
|
||||
*)true;;
|
||||
esac
|
||||
fi
|
||||
#Sadly needs to be run without '&' for now, since it otherwise breaks start_scan variable
|
||||
startup &
|
||||
update_pair_list &
|
||||
|
||||
# include head command here to speed up launch if too many devices are listed (long uptime and long scanning will lead to this depending on your surroundings)
|
||||
# shellcheck disable=SC1091
|
||||
if bluetoothctl devices | head | awk '{print "bluetoothctl info "$2}' | . /dev/stdin | grep -q "Connected: yes"
|
||||
then
|
||||
actions="$(printf "disconnect\n%s" "$actions")"
|
||||
fi
|
||||
|
||||
|
||||
#Compile list of all Bluetooth IDS of paired devices (from bluetoothctl and from hardcoded list)
|
||||
bt_IDS="$( ( bluetoothctl paired-devices && cat "$PAIRLIST" ) | sort -u | awk '{print $2}' )"
|
||||
|
||||
#Compile list of all device Names of paired devices (from bluetoothctl and from hardcoded list)
|
||||
paired_devices="$( ( bluetoothctl paired-devices && cat "$PAIRLIST" ) | sort -u | awk '{for (i=3; i<NF; i++) printf $i " "; print $NF}' )"
|
||||
|
||||
disp_devices="$( echo "$paired_devices" | grep -vf "$BLACKLIST" )"
|
||||
|
||||
#detects current power mode of controller and adjusts options accordingly
|
||||
powerstatus="$( bluetoothctl show | grep Powered | awk '{print $2}' )"
|
||||
poweroption="$( echo "$powerstatus" | sed 's/yes/power off/; s/no/power on/' )"
|
||||
#Don't print empty device list, removes unnecessary empty choice in dmenu
|
||||
[ "$disp_devices" = "" ] && choice=$( printf "%s\n%s" "$actions" "$poweroption" | dmenu -i -p 'What BT action would you like to perform:' )
|
||||
[ "$disp_devices" != "" ] && choice=$( ( echo "$disp_devices" && printf "%s\n%s" "$actions" "$poweroption" ) | dmenu -i -p 'What BT action would you like to perform:' )
|
||||
|
||||
cleanup(){
|
||||
scan off
|
||||
rm /tmp/bt_start_scan$$ 2> /dev/null
|
||||
pkill -RTMIN+$barsignal $bar
|
||||
exit 0
|
||||
}
|
||||
|
||||
pair(){
|
||||
#since this function can get called indefinitely, make sure to always be scanning and controller has power in the case that it got deactived by some other process.
|
||||
power on
|
||||
scan on
|
||||
#check whether $SCAN_PERIOD seconds has already passed since starting scanning, if not, wait for the rest of that time.
|
||||
start_scan="$(cat /tmp/bt_start_scan$$)"
|
||||
if [ $(( $(date +'%s') - $start_scan )) -lt $SCAN_PERIOD ]; then
|
||||
sleep_period="$(( $SCAN_PERIOD - $( date +'%s') + $start_scan ))"
|
||||
[ "$sleep_period" -gt 1 ] && plural="s"
|
||||
notify-send "Bluetooth" "Searching for devices, please wait $sleep_period second$plural"
|
||||
sleep "$sleep_period"
|
||||
fi
|
||||
all_devices="$( bluetoothctl devices )"
|
||||
if [ "$paired_devices" = "" ]; then
|
||||
new_devices="$( echo "$all_devices" | awk '{for (i=3; i<NF; i++) printf $i " "; print $NF}' )"
|
||||
bt_IDS="$( echo "$all_devices" | awk '{print $2}' )"
|
||||
else
|
||||
#echo "$paired_devices" > /tmp/paired_devices$$
|
||||
filtered_devices="$( echo "$all_devices" | grep -v "$paired_devices")"
|
||||
bt_IDS="$( echo "$filtered_devices" | awk '{print $2}' )"
|
||||
new_devices="$( echo "$filtered_devices" | awk '{for (i=3; i<NF; i++) printf $i " "; print $NF}' )"
|
||||
#rm /tmp/paired_devices$$
|
||||
fi
|
||||
[ "$new_devices" = "" ] && options="rescan" || options=$(echo "$new_devices" && echo 'rescan')
|
||||
choice=$( echo "$options" | dmenu -l 10 -i -p 'pair with which device?' )
|
||||
if [ -n "$choice" ]; then
|
||||
if [ "$choice" = "rescan" ]; then
|
||||
start_scan="$( date +'%s')"
|
||||
echo "$start_scan" > /tmp/bt_start_scan$$
|
||||
pair
|
||||
else
|
||||
dev_no=$( echo "$new_devices" | nl | grep "$choice" | awk '{print $1}')
|
||||
dev_id=$( echo "$bt_IDS" | nl | grep -P "^.*$dev_no\t" | awk '{print $2}' )
|
||||
#only attempt to connect if pairing succeeds
|
||||
bluetoothctl pair "$dev_id" && ( pair_succesful=true && bluetoothctl connect "$dev_id" ) || pair_succesful=false
|
||||
if $AUTOTRUST; then
|
||||
bluetoothctl trust "$dev_id"
|
||||
fi
|
||||
#if device is not already hard coded as paired, add to paired devices list
|
||||
if $pair_succesful && [ "$( grep "$dev_id" "$PAIRLIST")" = "" ] || [ "$(wc -l "$PAIRLIST")" -eq 0 ]
|
||||
then
|
||||
echo to be added to "$PAIRLIST":
|
||||
echo Device "$dev_id" "$choice"
|
||||
echo Device "$dev_id" "$choice" >> "$PAIRLIST"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
case $choice in
|
||||
"power on") bluetoothctl power on;;
|
||||
"power off") bluetoothctl power off;;
|
||||
"scan on") bluetoothctl power on && echo power on && sleep 2
|
||||
([ -n "$TERMINAL" ] && $TERMINAL -e bluetoothctl scan on ) || st bluetoothctl scan on;;
|
||||
"pair") pair;;
|
||||
"unpair") choice=$( echo "$paired_devices" | dmenu -l 10 -i -p 'remove which paired device?')
|
||||
if [ -n "$choice" ]; then
|
||||
dev_no=$( echo "$paired_devices" | nl | grep -P "[0-9]+\t$choice$" | awk '{print $1}')
|
||||
dev_id=$( echo "$bt_IDS" | nl | grep -P "^.*$dev_no\t" | awk '{print $2}' )
|
||||
bluetoothctl remove "$dev_id"
|
||||
#remove device to unpair from hard coded paired devices list
|
||||
new_paired_list="$( grep -v "$dev_id" "$PAIRLIST" )"
|
||||
if [ "$new_paired_list" != "" ]
|
||||
then
|
||||
echo "$new_paired_list" > "$PAIRLIST"
|
||||
else
|
||||
rm -rf "$PAIRLIST"
|
||||
touch "$PAIRLIST"
|
||||
fi
|
||||
fi;;
|
||||
|
||||
"trust")
|
||||
#search through all devices which are connected and only list those as options
|
||||
# shellcheck disable=SC1091
|
||||
untrusted_devices="$( awk '{print "bluetoothctl info "$2}' "$PAIRLIST" | . /dev/stdin | grep -E '(Alias:|Trusted:)' | sed -e 'N;s/\n/;/;s/^.?*Alias: //' | grep "Trusted: no" | awk -F ';' '{print $1}' )"
|
||||
if [ "$( echo "$untrusted_devices" | wc -l )" -gt 0 ]
|
||||
then
|
||||
choice=$( echo "$untrusted_devices" | dmenu -l 10 -i -p 'remove which paired device?')
|
||||
else
|
||||
notify-send "Bluetooth" "No paired devices that are not trusted"
|
||||
fi
|
||||
if [ -n "$choice" ]; then
|
||||
dev_no=$( echo "$paired_devices" | nl | grep -P "[0-9]+\t$choice$" | awk '{print $1}')
|
||||
dev_id=$( echo "$bt_IDS" | nl | grep -P "^.*$dev_no\t" | awk '{print $2}' )
|
||||
bluetoothctl trust "$dev_id"
|
||||
fi;;
|
||||
"disconnect")
|
||||
#search through all devices which are connected and only list those as options
|
||||
# shellcheck disable=SC1091
|
||||
connected_devices="$( bluetoothctl devices | awk '{print "bluetoothctl info "$2}' | . /dev/stdin | grep -E '(Alias:|Connected:)' | sed -e 'N;s/\n/;/;s/^.?*Alias: //' | grep "Connected: yes" | awk -F ';' '{print $1}' )"
|
||||
echo "$connected_devices"
|
||||
#only open dmenu prompt if there is more than one connected device
|
||||
if [ "$( echo "$connected_devices" | wc -l )" -gt 1 ]
|
||||
then
|
||||
choice=$( echo "$connected_devices" | dmenu -l 10 -i -p 'remove which paired device?')
|
||||
else
|
||||
choice="$connected_devices"
|
||||
fi
|
||||
#only there was a choice (instead of canceling the dmenu)
|
||||
if [ -n "$choice" ]; then
|
||||
dev_no=$( echo "$paired_devices" | nl | grep -P "[0-9]+\t$choice$" | awk '{print $1}')
|
||||
dev_id=$( echo "$bt_IDS" | nl | grep -P "^.*$dev_no\t" | awk '{print $2}' )
|
||||
bluetoothctl disconnect "$dev_id"
|
||||
fi;;
|
||||
"blacklist")
|
||||
choice=$( echo "$paired_devices" | dmenu -l 10 -i -p 'blacklist which paired device from selection?')
|
||||
if [ -n "$choice" ]; then
|
||||
echo "$choice" >> "$BLACKLIST"
|
||||
fi;;
|
||||
*)
|
||||
dev_no=$( echo "$paired_devices" | nl | grep -P "[0-9]+\t$choice$" | awk '{print $1}')
|
||||
[ "$dev_no" != "" ] && dev_id=$( echo "$bt_IDS" | nl | grep -P "^.*$dev_no\t" | awk '{print $2}')
|
||||
if [ -n "$dev_id" ]; then
|
||||
power on
|
||||
if bluetoothctl info "$dev_id" | grep -q "Connected: yes"
|
||||
then
|
||||
bluetoothctl disconnect "$dev_id"
|
||||
else
|
||||
bluetoothctl devices | grep -q "$dev_id" || bluetoothctl pair "$dev_id"
|
||||
bluetoothctl connect "$dev_id"
|
||||
fi
|
||||
fi;;
|
||||
esac
|
||||
|
||||
cleanup
|
@ -1,26 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Dependencies are xclip and xorg-xprop.
|
||||
# qrencode required for qrcode generation.
|
||||
# groff/zathura required for man pages.
|
||||
prim="$(xclip -o -selection 'clipboard')"; [ -z "$prim" ] && exit
|
||||
|
||||
PID=$(xprop -id "$(xprop -root | awk '/_NET_ACTIVE_WINDOW\(WINDOW\)/{print $NF}')" | grep -m 1 PID | cut -d " " -f 3)
|
||||
PID=$(echo "$(pstree -lpA "$PID" | tail -n 1)" | awk -F'---' '{print $NF}' | sed -re 's/[^0-9]//g')
|
||||
cd "$(readlink /proc/"$PID"/cwd)"
|
||||
[ -f "$prim" ] && xdg-open "$prim" && exit
|
||||
[ -d "$prim" ] && "$TERMINAL" "$prim" && exit
|
||||
|
||||
websearch() { "$BROWSER" "https://duckduckgo.com/?q=$@" ;}
|
||||
wikipedia() { "$BROWSER" "https://en.wikipedia.org/wiki/$@" ;}
|
||||
wiktionary() { "$BROWSER" "https://en.wiktionary.org/wiki/$@" ;}
|
||||
maps() { "$BROWSER" "https://www.openstreetmap.org/search?query=$@" ;}
|
||||
ebay() { "$BROWSER" "https://www.ebay.com/sch/$@" ;}
|
||||
|
||||
echo "$prim" | grep "^.*\.[A-Za-z]\+.*" >/dev/null && gotourl() { "$BROWSER" "$@" ;}
|
||||
echo "$prim" | grep "^.*@.*\.[A-Za-z]\+$" >/dev/null && email() { xdg-email "$@" ;}
|
||||
command -v qrencode >/dev/null && qrcode() { qrencode "$@" -s 10 -o /tmp/qr.png && xdg-open /tmp/qr.png ;}
|
||||
man -k "^$prim$" >/dev/null && manual() { man -Tpdf "$prim" | zathura - ;}
|
||||
|
||||
func="$(declare -F | awk '{print $3}' | dmenu -p "Plumb \"$(echo "$prim" | cut -c -30)\" to?" -i -l 15)"
|
||||
|
||||
[ -z "$func" ] || "$func" "$prim"
|
@ -1,13 +0,0 @@
|
||||
#!/bin/bash
|
||||
xrandr --output eDP-1 --mode 1920x1080 --auto
|
||||
xrdb -merge ~/.config/X11/Xres_casting
|
||||
setbg
|
||||
#wal -q -i ~/.config/wall.png -b '000000'
|
||||
pkill dwm
|
||||
pgrep dwmblocks && dwmblocks & st mkchromecast --video --control --screencast -s
|
||||
xrandr --output eDP-1 --mode 3200x1800 --auto
|
||||
xrdb -merge ~/.config/X11/Xresources
|
||||
setbg
|
||||
#wal -q -i ~/.config/wall.png -b '000000'
|
||||
pkill dwm
|
||||
pgrep dwmblocks && dwmblocks & disown
|
@ -1,40 +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 -kept -T pdf > "$base".pdf ;;
|
||||
*\.mom) refer -PS -e "$file" | groff -mom -kept -T pdf > "$base".pdf ;;
|
||||
*\.[0-9]) refer -PS -e "$file" | groff -mandoc -T pdf > "$base".pdf ;;
|
||||
*\.[rR]md) Rscript -e "rmarkdown::render('$file', quiet=TRUE)" ;;
|
||||
*\.tex) textype "$file" ;;
|
||||
*\.md) pandoc "$file" -V geometry:margin=1in --pdf-engine=xelatex -o "$base".pdf ;;
|
||||
*config.h) sudo make install ;;
|
||||
*\.c) cc "$file" -o "$base" && "$base" ;;
|
||||
*\.py) python "$file" ;;
|
||||
*\.m) octave "$file" ;;
|
||||
*\.scad) openscad -o "$base".stl "$file" ;;
|
||||
*\.go) go run "$file" ;;
|
||||
*\.sent) setsid sent "$file" 2>/dev/null & ;;
|
||||
*) sed 1q "$file" | grep "^#!/" | sed "s/^#!//" | xargs -r -I % "$file" ;;
|
||||
esac
|
33
.local/bin/cookies2nsformat
Executable file
33
.local/bin/cookies2nsformat
Executable file
@ -0,0 +1,33 @@
|
||||
#!/bin/node
|
||||
/**
|
||||
* @file Convert cookies copy/pasted from Chrome's Application -> Storage -> Cookies -> [domain] table,
|
||||
* into the Netscape cookies format used by tools like `curl` or `youtube-dl`.
|
||||
*/
|
||||
const fs = require('fs');
|
||||
|
||||
const filename = process.argv[2];
|
||||
if (!filename) {
|
||||
console.error(`Usage: node convert-cookies.js <file-with-cookies-copy-pasted-from-Chrome.txt> > netscape-cookies.txt`);
|
||||
console.error();
|
||||
console.error(`Make sure to replace <file-with-cookies-copy-pasted-from-Chrome.txt> with the name of the\nfile in which you copy/pasted the cookies from Chrome's Application -> Storage -> Cookies.`);
|
||||
console.error(`\nThen, pass the 'netscape-cookies.txt' file to 'curl' or 'youtube-dl' or any other tool\nthat reads cookies in the Netscape cookies format.`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const content = fs.readFileSync(filename, 'utf8');
|
||||
const cookies = content.split('\n');
|
||||
|
||||
console.log('# Netscape HTTP Cookie File');
|
||||
|
||||
for (const cookie of cookies) {
|
||||
let [name, value, domain, path, expiration, /* size */, httpOnly] = cookie.split('\t');
|
||||
if (!name)
|
||||
continue;
|
||||
if (domain.charAt(0) !== '.')
|
||||
domain = '.' + domain;
|
||||
httpOnly = httpOnly === '✓' ? 'TRUE' : 'FALSE'
|
||||
if (expiration === 'Session')
|
||||
expiration = new Date(Date.now() + 86400 * 1000);
|
||||
expiration = Math.trunc(new Date(expiration).getTime() / 1000);
|
||||
console.log([domain, 'TRUE', path, httpOnly, expiration, name, value].join('\t'));
|
||||
}
|
@ -5,7 +5,7 @@ These cronjobs have components that require information about your current displ
|
||||
When you add them as cronjobs, I recommend you precede the command with commands as those below:
|
||||
|
||||
```
|
||||
export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus; export DISPLAY=:0; . $HOME/.zprofile; then_command_goes_here
|
||||
export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u $USER)/bus; export DISPLAY=:0; . $HOME/.zprofile; then_command_goes_here
|
||||
```
|
||||
|
||||
This ensures that notifications will display, xdotool commands will function and environmental variables will work as well.
|
@ -2,8 +2,6 @@
|
||||
|
||||
# Syncs repositories and downloads updates, meant to be run as a cronjob.
|
||||
|
||||
ping -q -c 1 1.1.1.1 > /dev/null || exit
|
||||
|
||||
notify-send "📦 Repository Sync" "Checking for package updates..."
|
||||
|
||||
sudo pacman -Syyuw --noconfirm || notify-send "Error downloading updates.
|
||||
|
@ -1,9 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Notify me with notify-send if my battery is below 25%.
|
||||
# You can set this to run via cron.
|
||||
|
||||
[ "$(cat /sys/class/power_supply/BAT0/status)" = "Charging" ] && exit
|
||||
[ "$(cat /sys/class/power_supply/BAT0/capacity)" -lt 25 ] &&
|
||||
export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1001/bus &&
|
||||
notify-send -u critical "Battery critically low."
|
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Toggles all cronjobs off/on.
|
||||
# Stores disabled crontabs in ~/.consaved until restored.
|
||||
# Stores disabled crontabs in ~/.config/cronsaved until restored.
|
||||
|
||||
([ -f ${XDG_CONFIG_HOME:-$HOME/.config}/cronsaved ] && crontab - < ${XDG_CONFIG_HOME:-$HOME/.config}/cronsaved && rm ${XDG_CONFIG_HOME:-$HOME/.config}/cronsaved && notify-send "🕓 Cronjobs re-enabled.") || ( crontab -l > ${XDG_CONFIG_HOME:-$HOME/.config}/cronsaved && crontab -r && notify-send "🕓 Cronjobs saved and disabled.")
|
||||
([ -f "${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved ] && crontab - < "${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved && rm "${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved && notify-send "🕓 Cronjobs re-enabled.") || ( crontab -l > "${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved && crontab -r && notify-send "🕓 Cronjobs saved and disabled.")
|
||||
|
@ -3,11 +3,9 @@
|
||||
# Set as a cron job to check for new RSS entries for newsboat.
|
||||
# If newsboat is open, sends it an "R" key to refresh.
|
||||
|
||||
ping -q -c 1 1.1.1.1 > /dev/null || exit
|
||||
|
||||
/usr/bin/notify-send "📰 Updating RSS feeds..."
|
||||
|
||||
ps ax | grep -q newsboat$ && /usr/bin/xdotool key --window "$(/usr/bin/xdotool search --name newsboat)" R && exit
|
||||
pgrep -f newsboat$ && /usr/bin/xdotool key --window "$(/usr/bin/xdotool search --name "^newsboat$")" R && exit
|
||||
|
||||
echo 🔃 > /tmp/newsupdate
|
||||
pkill -RTMIN+6 "${STATUSBAR:-dwmblocks}"
|
||||
|
@ -1,13 +0,0 @@
|
||||
#!/bin/sh
|
||||
source $HOME/.config/aliasrc
|
||||
alldata="/tmp/allfiles"
|
||||
videos="/tmp/videos"
|
||||
du -a ~/vids/* --time | sort -u | awk '!($1="")' | sort -bg | awk '!($1="")' | awk '!($1="")' | sed 's/^ //' | tac > $alldata
|
||||
touch $videos
|
||||
while read line; do
|
||||
[ -f "$line" ] && echo $line >> $videos
|
||||
done <$alldata
|
||||
choice=$( cat $videos | dmenu -i -l 50 -p "Choose a video to watch:" )
|
||||
[ -n "$choice" ] && st mkchromecast --video --control -i "$choice"
|
||||
rm -f "$alldata"
|
||||
rm -f "$videos"
|
@ -1,19 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Toggle floating dropdown terminal in i3, or start if non-existing.
|
||||
# $1 is the script run in the terminal.
|
||||
# All other args are terminal settings.
|
||||
# Terminal names are in dropdown_* to allow easily setting i3 settings.
|
||||
|
||||
[ -z "$1" ] && exit
|
||||
|
||||
script=$1
|
||||
shift
|
||||
if xwininfo -tree -root | grep "(\"dropdown_$script\" ";
|
||||
then
|
||||
echo "Window detected."
|
||||
i3 "[instance=\"dropdown_$script\"] scratchpad show; [instance=\"dropdown_$script\"] move position center"
|
||||
else
|
||||
echo "Window not detected... spawning."
|
||||
i3 "exec --no-startup-id $TERMINAL -n dropdown_$script $@ -e $script"
|
||||
fi
|
@ -5,7 +5,12 @@
|
||||
# selection" which opens arandr.
|
||||
|
||||
#automatically scale HD screens to better work with hidpi
|
||||
scale_factor_HD=${1:-1.6}
|
||||
scale_factor_HD=${1:-1.6666}
|
||||
scale_outputs="HDMI-3
|
||||
DP-2
|
||||
HDMI-1-3
|
||||
DP1-2"
|
||||
|
||||
|
||||
#fixes issue that script gets called twice for some reason
|
||||
[ "$(pgrep -c displayselect)" -gt 1 ] && exit
|
||||
@ -40,9 +45,9 @@ twoscreen() { # If multi-monitor is selected and there are two screens.
|
||||
primary=$(echo "$screens" | dmenu -i -p "Select primary display:")
|
||||
secondary=$(echo "$screens" | grep -v "$primary")
|
||||
direction=$(printf "left\\nright" | dmenu -i -p "What side of $primary should $secondary be on?")
|
||||
if [ "$primary" = "HDMI-1" ]; then
|
||||
if $(echo "$scale_outputs" | grep -q "$primary"); then
|
||||
xrandr --output "$primary" --auto --scale $scale_factor_HD --output "$secondary" --"$direction"-of "$primary" --auto --scale 1.0x1.0
|
||||
elif [ "$secondary" = "HDMI-1" ]; then
|
||||
elif $(echo "$scale_outputs" | grep -q "$seconday"); then
|
||||
xrandr --output "$primary" --auto --scale 1.0x1.0 --output "$secondary" --"$direction"-of "$primary" --auto --scale $scale_factor_HD
|
||||
else
|
||||
xrandr --output "$primary" --auto --scale 1.0x1.0 --output "$secondary" --"$direction"-of "$primary" --auto --scale 1.0x1.0
|
||||
@ -65,7 +70,7 @@ multimon() { # Multi-monitor handler.
|
||||
esac ;}
|
||||
|
||||
onescreen() { # If only one output available or chosen.
|
||||
xrandr --output "$1" --auto --scale 1.0x1.0 $(echo "$allposs" | grep -v "$1" | awk '{print "--output", $1, "--off"}' | tr '\n' ' ')
|
||||
xrandr --output "$1" --auto --scale 1 $(echo "$allposs" | grep -v "$1" | awk '{print "--output", $1, "--off"}' | tr '\n' ' ')
|
||||
}
|
||||
|
||||
postrun() { # Stuff to run to clean up.
|
||||
|
21
.local/bin/dmenuhandler
Executable file
21
.local/bin/dmenuhandler
Executable file
@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Feed this script a link and it will give dmenu
|
||||
# some choice programs to use to open it.
|
||||
feed="${1:-$(true | dmenu -p 'Paste URL or file path')}"
|
||||
|
||||
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
|
||||
"copy url") echo "$feed" | xclip -selection clipboard ;;
|
||||
mpv) setsid -f mpv -quiet "$feed" >/dev/null 2>&1 ;;
|
||||
"mpv loop") setsid -f mpv -quiet --loop "$feed" >/dev/null 2>&1 ;;
|
||||
"mpv float") setsid -f "$TERMINAL" -e mpv --geometry=+0-0 --autofit=30% --title="mpvfloat" "$feed" >/dev/null 2>&1 ;;
|
||||
"queue yt-dlp") qndl "$feed" >/dev/null 2>&1 ;;
|
||||
"queue yt-dlp audio") qndl "$feed" 'yt-dlp -o "%(title)s.%(ext)s" -f bestaudio --embed-metadata --restrict-filenames' ;;
|
||||
"queue download") qndl "$feed" 'curl -LO' >/dev/null 2>&1 ;;
|
||||
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 ;;
|
||||
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 ;;
|
||||
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 ;;
|
||||
setbg) curl -L "$feed" > $XDG_CACHE_HOME/pic ; xwallpaper --zoom $XDG_CACHE_HOME/pic >/dev/null 2>&1 ;;
|
||||
browser) setsid -f "$BROWSER" "$feed" >/dev/null 2>&1 ;;
|
||||
lynx) lynx "$feed" >/dev/null 2>&1 ;;
|
||||
esac
|
19
.local/bin/dmenumountcifs
Executable file
19
.local/bin/dmenumountcifs
Executable file
@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
# Gives a dmenu prompt to mount unmounted local NAS shares for read/write.
|
||||
# Requirements - "%wheel ALL=(ALL) NOPASSWD: ALL"
|
||||
#
|
||||
# Browse for mDNS/DNS-SD services using the Avahi daemon...
|
||||
srvname=$(avahi-browse _smb._tcp -t | awk '{print $4}' | dmenu -i -p "Which NAS?") || exit 1
|
||||
notify-send "Searching for network shares..." "Please wait..."
|
||||
# Choose share disk...
|
||||
share=$(smbclient -L "$srvname" -N | grep Disk | awk '{print $1}' | dmenu -i -p "Mount which share?") || exit 1
|
||||
# Format URL...
|
||||
share2mnt=//"$srvname".local/"$share"
|
||||
|
||||
sharemount() {
|
||||
mounted=$(mount -v | grep "$share2mnt") || ([ ! -d /mnt/"$share" ] && sudo mkdir /mnt/"$share")
|
||||
[ -z "$mounted" ] && sudo mount -t cifs "$share2mnt" -o user=nobody,password="",noperm /mnt/"$share" && notify-send "Netshare $share mounted" && exit 0
|
||||
notify-send "Netshare $share already mounted"; exit 1
|
||||
}
|
||||
|
||||
sharemount
|
@ -9,6 +9,8 @@
|
||||
#
|
||||
# If there is already a running instance, user will be prompted to end it.
|
||||
|
||||
getdim() { xrandr | sed -n "s/\s*\([0-9]\+x[0-9]\+\).*\*.*/\1/p" ;}
|
||||
|
||||
updateicon() { \
|
||||
echo "$1" > /tmp/recordingicon
|
||||
pkill -RTMIN+9 "${STATUSBAR:-dwmblocks}"
|
||||
@ -16,49 +18,32 @@ updateicon() { \
|
||||
|
||||
killrecording() {
|
||||
recpid="$(cat /tmp/recordingpid)"
|
||||
# kill with SIGTERM, allowing finishing touches.
|
||||
kill -15 "$recpid"
|
||||
rm -f /tmp/recordingpid
|
||||
updateicon ""
|
||||
pkill -RTMIN+9 "${STATUSBAR:-dwmblocks}"
|
||||
# even after SIGTERM, ffmpeg may still run, so SIGKILL it.
|
||||
sleep 3
|
||||
kill -9 "$recpid"
|
||||
exit
|
||||
}
|
||||
|
||||
screencast() { \
|
||||
ffmpeg -y \
|
||||
-f x11grab \
|
||||
-framerate 60 \
|
||||
-s "$(xdpyinfo | grep dimensions | awk '{print $2;}')" \
|
||||
-framerate 30 \
|
||||
-s "$(getdim)" \
|
||||
-i "$DISPLAY" \
|
||||
-r 30 \
|
||||
-c:v h264 -crf 0 -preset ultrafast -c:a aac \
|
||||
-r 24 \
|
||||
-use_wallclock_as_timestamps 1 \
|
||||
-f alsa -thread_queue_size 1024 -i default \
|
||||
-c:v h264 \
|
||||
-crf 0 -preset ultrafast -c:a aac \
|
||||
"$HOME/screencast-$(date '+%y%m%d-%H%M-%S').mp4" &
|
||||
echo $! > /tmp/recordingpid
|
||||
updateicon "⏺️🎙️"
|
||||
}
|
||||
|
||||
screencast_old() { \
|
||||
ffmpeg -y \
|
||||
-f x11grab \
|
||||
-framerate 60 \
|
||||
-s "$(xdpyinfo | grep dimensions | awk '{print $2;}')" \
|
||||
-i "$DISPLAY" \
|
||||
-f alsa -i default \
|
||||
-r 30 \
|
||||
-c:v h264 -crf 0 -preset ultrafast -c:a aac \
|
||||
"$HOME/screencast-$(date '+%y%m%d-%H%M-%S').mp4" &
|
||||
echo $! > /tmp/recordingpid
|
||||
updateicon "⏺️🎙️"
|
||||
}
|
||||
|
||||
|
||||
|
||||
video() { ffmpeg \
|
||||
-f x11grab \
|
||||
-s "$(xdpyinfo | grep dimensions | awk '{print $2;}')" \
|
||||
-framerate 30 \
|
||||
-s "$(getdim)" \
|
||||
-i "$DISPLAY" \
|
||||
-c:v libx264 -qp 0 -r 30 \
|
||||
"$HOME/video-$(date '+%y%m%d-%H%M-%S').mkv" &
|
||||
@ -95,11 +80,12 @@ audio() { \
|
||||
}
|
||||
|
||||
askrecording() { \
|
||||
choice=$(printf "screencast\\nvideo\\naudio\\nwebcam\\nwebcam (hi-def)" | dmenu -i -p "Select recording style:")
|
||||
choice=$(printf "screencast\\nvideo\\nvideo selected\\naudio\\nwebcam\\nwebcam (hi-def)" | dmenu -i -p "Select recording style:")
|
||||
case "$choice" in
|
||||
screencast) screencast;;
|
||||
audio) audio;;
|
||||
video) video;;
|
||||
*selected) videoselected;;
|
||||
webcam) webcam;;
|
||||
"webcam (hi-def)") webcamhidef;;
|
||||
esac
|
||||
@ -110,11 +96,28 @@ asktoend() { \
|
||||
[ "$response" = "Yes" ] && killrecording
|
||||
}
|
||||
|
||||
videoselected()
|
||||
{
|
||||
slop -f "%x %y %w %h" > /tmp/slop
|
||||
read -r X Y W H < /tmp/slop
|
||||
rm /tmp/slop
|
||||
|
||||
ffmpeg \
|
||||
-f x11grab \
|
||||
-framerate 30 \
|
||||
-video_size "$W"x"$H" \
|
||||
-i :0.0+"$X,$Y" \
|
||||
-c:v libx264 -qp 0 -r 30 \
|
||||
"$HOME/box-$(date '+%y%m%d-%H%M-%S').mkv" &
|
||||
echo $! > /tmp/recordingpid
|
||||
updateicon "⏺️"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
screencast) screencast;;
|
||||
audio) audio;;
|
||||
video) video;;
|
||||
*selected) videoselected;;
|
||||
kill) killrecording;;
|
||||
*) ([ -f /tmp/recordingpid ] && asktoend && exit) || askrecording;;
|
||||
esac
|
||||
|
@ -1,18 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# The famous "get a menu of emojis to copy" script.
|
||||
|
||||
# Must have xclip installed to even show menu.
|
||||
xclip -h 2>/dev/null || exit 1
|
||||
|
||||
chosen=$(cut -d ';' -f1 ${XDG_DATA_HOME:-$HOME/.local/share}/larbs/emoji | dmenu -i -l 20 | sed "s/ .*//")
|
||||
|
||||
[ "$chosen" != "" ] || exit
|
||||
|
||||
# If you run this command with an argument, it will automatically insert the character.
|
||||
if [ -n "$1" ]; then
|
||||
xdotool key Shift+Insert
|
||||
else
|
||||
echo "$chosen" | tr -d '\n' | xclip -selection clipboard
|
||||
notify-send "'$chosen' copied to clipboard." &
|
||||
fi
|
@ -8,12 +8,16 @@ choice="$(ls "${XDG_CONFIG_HOME}/openvpn/cfgs" | sed 's/\.ovpn//' | awk 'BEGIN {
|
||||
[ -z "$choice" ] && exit
|
||||
if [ "$choice" = "ETH" ]; then
|
||||
if [ $(pgrep -c openconnect) -eq 0 ]; then
|
||||
transmission-remote -u 0
|
||||
transmission-remote -d 0
|
||||
pass "$ETH_password_path" | sudo openconnect -g student-net -u "$ETH_user" --passwd-on-stdin sslvpn.ethz.ch &
|
||||
if ping -c 3 -W 3 -q webprint.ethz.ch ;then
|
||||
notify-send "ETH VPN" "ETH VPN connected"
|
||||
fi
|
||||
elif ping -c 1 -W 2 -q webprint.ethz.ch ;then
|
||||
if ping -c 3 -W 3 -q webprint.ethz.ch ;then
|
||||
notify-send "ETH VPN" "ETH VPN connected"
|
||||
fi
|
||||
elif ping -c 1 -W 2 -q webprint.ethz.ch ;then
|
||||
sudo pkill openconnect && notify-send "ETH VPN" "ETH VPN disconnected"
|
||||
transmission-remote -U
|
||||
transmission-remote -D
|
||||
fi
|
||||
else
|
||||
printf '%s\n%s\n' "$USER" "$(pass $PASS_DIR)" > /tmp/tmp_pass
|
||||
|
@ -1 +0,0 @@
|
||||
/home/alex/.local/bin/dmenuunicode
|
18
.local/bin/emoji
Executable file
18
.local/bin/emoji
Executable file
@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
# The famous "get a menu of emojis to copy" script.
|
||||
|
||||
# Get user selection via dmenu from emoji file.
|
||||
chosen=$(cut -d ';' -f1 ~/.local/share/larbs/chars/* | dmenu -i -l 30 | sed "s/ .*//")
|
||||
|
||||
# Exit if none chosen.
|
||||
[ -z "$chosen" ] && exit
|
||||
|
||||
# If you run this command with an argument, it will automatically insert the
|
||||
# character. Otherwise, show a message that the emoji has been copied.
|
||||
if [ -n "$1" ]; then
|
||||
xdotool type "$chosen"
|
||||
else
|
||||
printf "%s" "$chosen" | xclip -selection clipboard
|
||||
notify-send "'$chosen' copied to clipboard." &
|
||||
fi
|
14
.local/bin/ethupdate
Executable file
14
.local/bin/ethupdate
Executable file
@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
rclone_out="$(rclone copy --verbose OLAT: ~/eth/.olat 2>&1)"
|
||||
echo "$rclone_out" | tee -i $HOME/rclone.log
|
||||
rclone_out="$(echo "$rclone_out" | grep INFO | grep "Copied (new)" | cut -d':' -f2 | cut -d'/' -f1,3,4,5 --complement)"
|
||||
[ -n "$rclone_out" ] &&
|
||||
/usr/bin/env DISPLAY=:0 /usr/bin/notify-send 'new files (olat):' "$rclone_out"
|
||||
|
||||
cd $HOME/eth/.moodle
|
||||
pgrep moodle-dl || [ -f running.lock ] && rm running.lock
|
||||
|
||||
log="$(moodle-dl | sed -r "s/\x1B\[([0-9]{1,3}(;[0-9]{1,2})?)?[mGK]//g")"
|
||||
notifs="$(echo "$log" | grep -E '^\+' | sed 's/^+\s*/+/g')"
|
||||
[ $(printf %s "$notifs" | wc -l) -gt 0 ] &&
|
||||
/usr/bin/env DISPLAY=:0 /usr/bin/notify-send 'new files (moodle):' "$notifs"
|
@ -1,8 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from numpy.f2py.f2py2e import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
@ -1,8 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from numpy.f2py.f2py2e import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
@ -1,8 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from numpy.f2py.f2py2e import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
14
.local/bin/getbib
Executable file
14
.local/bin/getbib
Executable file
@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
[ -z "$1" ] && echo "Give either a pdf file or a DOI as an argument." && exit
|
||||
|
||||
if [ -f "$1" ]; then
|
||||
# Try to get DOI from pdfinfo or pdftotext output.
|
||||
doi=$(pdfinfo "$1" | grep -io "doi:.*") ||
|
||||
doi=$(pdftotext "$1" 2>/dev/null - | sed -n '/[dD][oO][iI]:/{s/.*[dD][oO][iI]:\s*\(\S\+[[:alnum:]]\).*/\1/p;q}') ||
|
||||
exit 1
|
||||
else
|
||||
doi="$1"
|
||||
fi
|
||||
|
||||
# Check crossref.org for the bib citation.
|
||||
curl -s "https://api.crossref.org/works/$doi/transform/application/x-bibtex" -w "\\n"
|
14
.local/bin/getbib_
Executable file
14
.local/bin/getbib_
Executable file
@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
[ -z "$1" ] && echo "Give either a pdf file or a DOI as an argument." && exit
|
||||
|
||||
if [ -f "$1" ]; then
|
||||
# Try to get DOI from pdfinfo or pdftotext output.
|
||||
doi=$(pdfinfo "$1" | grep -io "doi:.*") ||
|
||||
doi=$(pdftotext "$1" 2>/dev/null - | grep -io "doi:.*" -m 1) ||
|
||||
exit 1
|
||||
else
|
||||
doi="$1"
|
||||
fi
|
||||
|
||||
# Check crossref.org for the bib citation.
|
||||
curl -s "https://api.crossref.org/works/$doi/transform/application/x-bibtex" -w "\\n"
|
12
.local/bin/getcomproot
Executable file
12
.local/bin/getcomproot
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
# A helper script for LaTeX/groff files used by `compiler` and `opout`.
|
||||
# The user can add the root file of a larger project as a comment as below:
|
||||
# % root = mainfile.tex
|
||||
# And the compiler script will run on that instead of the opened file.
|
||||
|
||||
texroot="$(grep -i "^.\+\s*root\s*=\s*\S\+" "$1")"
|
||||
texroot="${texroot##*=}"
|
||||
texroot="${texroot//[\"\' ]}"
|
||||
|
||||
[ -f "$texroot" ] && readlink -f "$texroot" || exit 1
|
@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
cat ${XDG_DATA_HOME:-$HOME/.local/share}/larbs/getkeys/"$1" 2>/dev/null && exit
|
||||
cat "${XDG_DATA_HOME:-$HOME/.local/share}"/larbs/getkeys/"$1" 2>/dev/null && exit
|
||||
echo "Run command with one of the following arguments for info about that program:"
|
||||
ls ${XDG_DATA_HOME:-$HOME/.local/share}/larbs/getkeys
|
||||
ls "${XDG_DATA_HOME:-$HOME/.local/share}"/larbs/getkeys
|
||||
|
@ -1,8 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Some optional functions in LARBS require programs not installed by default. I
|
||||
# use this little script to check to see if a command exists and if it doesn't
|
||||
# it informs the user that they need that command to continue. This is used in
|
||||
# various other scripts for clarity's sake.
|
||||
|
||||
pacman -Qq "$1" >/dev/null || { notify-send "📦 $1" "must be installed for this function." && exit 1 ;}
|
@ -1,9 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Terminate already running bar instances
|
||||
killall -q polybar
|
||||
|
||||
# Wait until the processes have been shut down
|
||||
while pidof polybar >/dev/null; do sleep 1; done
|
||||
|
||||
for i in $(polybar -m | awk -F: '{print $1}'); do MONITOR=$i polybar default & done
|
@ -1,9 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Reads file names from stdin and selects them in lf.
|
||||
|
||||
while read -r file; do
|
||||
[ -z "$file" ] && continue
|
||||
lf -remote "send select \"$file\""
|
||||
lf -remote "send toggle"
|
||||
done
|
23
.local/bin/linkhandler
Executable file
23
.local/bin/linkhandler
Executable file
@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Feed script a url or file location.
|
||||
# If an image, it will view in sxiv,
|
||||
# if a video or gif, it will view in mpv
|
||||
# if a music file or pdf, it will download,
|
||||
# otherwise it opens link in browser.
|
||||
|
||||
# If no url given. Opens browser. For using script as $BROWSER.
|
||||
[ -z "$1" ] && { "$BROWSER"; exit; }
|
||||
|
||||
case "$1" in
|
||||
*mkv|*webm|*mp4|*youtube.com/watch*|*youtube.com/playlist*|*youtu.be*|*hooktube.com*|*bitchute.com*|*videos.lukesmith.xyz*|*odysee.com*)
|
||||
setsid -f mpv -quiet "$1" >/dev/null 2>&1 ;;
|
||||
*png|*jpg|*jpe|*jpeg|*gif)
|
||||
curl -sL "$1" > "/tmp/$(echo "$1" | sed "s/.*\///;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$1" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;;
|
||||
*pdf|*cbz|*cbr)
|
||||
curl -sL "$1" > "/tmp/$(echo "$1" | sed "s/.*\///;s/%20/ /g")" && zathura "/tmp/$(echo "$1" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;;
|
||||
*mp3|*flac|*opus|*mp3?source*)
|
||||
qndl "$1" 'curl -LO' >/dev/null 2>&1 ;;
|
||||
*)
|
||||
[ -f "$1" ] && setsid -f "$TERMINAL" -e "$EDITOR" "$1" >/dev/null 2>&1 || setsid -f "$BROWSER" "$1" >/dev/null 2>&1
|
||||
esac
|
@ -1,28 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
NUM="${2:-5}"
|
||||
|
||||
# Uncomment the following line to use Pulseaudio.
|
||||
# PULSE=true
|
||||
|
||||
if [ "$PULSE" ]; then
|
||||
toggle() { pulsemixer --toggle-mute ;}
|
||||
mute() { pulsemixer --mute ;}
|
||||
up() { pulsemixer --change-volume +"$NUM" ;}
|
||||
down() { pulsemixer --change-volume -"$NUM" ;}
|
||||
control() { pulsemixer ;}
|
||||
else
|
||||
toggle() { amixer sset Master toggle ;}
|
||||
mute() { amixer sset Master mute ;}
|
||||
up() { amixer sset Master "$NUM"%+ ;}
|
||||
down() { amixer sset Master "$NUM"%- ;}
|
||||
control() { alsamixer ;}
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
toggle) toggle ;;
|
||||
mute) mute ;;
|
||||
up) up ;;
|
||||
down) down ;;
|
||||
control) control ;;
|
||||
esac
|
@ -4,11 +4,15 @@
|
||||
# choose the kind of screenshot to take, including copying the image or even
|
||||
# highlighting an area to copy. scrotcucks on suicidewatch right now.
|
||||
|
||||
# variables
|
||||
output="$(date '+%y%m%d-%H%M-%S').png"
|
||||
xclip_cmd="xclip -sel clip -t image/png"
|
||||
|
||||
case "$(printf "a selected area\\ncurrent window\\nfull screen\\na selected area (copy)\\ncurrent window (copy)\\nfull screen (copy)" | dmenu -l 6 -i -p "Screenshot which area?")" in
|
||||
"a selected area") maim -s -u pic-selected-"$(date '+%y%m%d-%H%M-%S').png" ;;
|
||||
"current window") maim -i "$(xdotool getactivewindow)" -u pic-window-"$(date '+%y%m%d-%H%M-%S').png" ;;
|
||||
"full screen") maim -u pic-full-"$(date '+%y%m%d-%H%M-%S').png" ;;
|
||||
"a selected area (copy)") maim -s -u | xclip -selection clipboard -t image/png ;;
|
||||
"current window (copy)") maim -u -i "$(xdotool getactivewindow)" | xclip -selection clipboard -t image/png ;;
|
||||
"full screen (copy)") maim -u | xclip -selection clipboard -t image/png ;;
|
||||
"a selected area") maim -u -s pic-selected-"${output}" ;;
|
||||
"current window") maim -q -d 0.2 -i "$(xdotool getactivewindow)" pic-window-"${output}" ;;
|
||||
"full screen") maim -q -d 0.2 pic-full-"${output}" ;;
|
||||
"a selected area (copy)") maim -u -s | ${xclip_cmd} ;;
|
||||
"current window (copy)") maim -q -d 0.2 -i "$(xdotool getactivewindow)" | ${xclip_cmd} ;;
|
||||
"full screen (copy)") maim -q -d 0.2 | ${xclip_cmd} ;;
|
||||
esac
|
||||
|
@ -1,12 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
# EASY-INSTALL-ENTRY-SCRIPT: 'manga-py==1.19.7','console_scripts','manga-py'
|
||||
__requires__ = 'manga-py==1.19.7'
|
||||
import re
|
||||
import sys
|
||||
from pkg_resources import load_entry_point
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(
|
||||
load_entry_point('manga-py==1.19.7', 'console_scripts', 'manga-py')()
|
||||
)
|
@ -1,8 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from markdown.__main__ import run
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(run())
|
114
.local/bin/mounter
Executable file
114
.local/bin/mounter
Executable file
@ -0,0 +1,114 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Mounts Android Phones and USB drives (encrypted or not). This script will
|
||||
# replace the older `dmenumount` which had extra steps and couldn't handle
|
||||
# encrypted drives.
|
||||
# TODO: Try decrypt for drives in crtypttab
|
||||
# TODO: Add some support for connecting iPhones (although they are annoying).
|
||||
|
||||
IFS='
|
||||
'
|
||||
# Function for escaping cell-phone names.
|
||||
escape(){ echo "$@" | iconv -cf UTF-8 -t ASCII//TRANSLIT | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | sed "s/-\+/-/g;s/\(^-\|-\$\)//g" ;}
|
||||
|
||||
# Check for phones.
|
||||
phones="$(simple-mtpfs -l 2>/dev/null | sed "s/^/📱/")"
|
||||
mountedphones="$(grep "simple-mtpfs" /etc/mtab)"
|
||||
# If there are already mounted phones, remove them from the list of mountables.
|
||||
[ -n "$mountedphones" ] && phones="$(for phone in $phones; do
|
||||
for mounted in $mountedphones; do
|
||||
escphone="$(escape "$phone")"
|
||||
[[ "$mounted" =~ "$escphone" ]] && break 1
|
||||
done && continue 1
|
||||
echo "$phone"
|
||||
done)"
|
||||
|
||||
# Check for drives.
|
||||
lsblkoutput="$(lsblk -rpo "uuid,name,type,size,label,mountpoint,fstype")"
|
||||
# Get all LUKS drives
|
||||
allluks="$(echo "$lsblkoutput" | grep crypto_LUKS)"
|
||||
# Get a list of the LUKS drive UUIDs already decrypted.
|
||||
decrypted="$(find /dev/disk/by-id/dm-uuid-CRYPT-LUKS2-* | sed "s|.*LUKS2-||;s|-.*||")"
|
||||
# Functioning for formatting drives correctly for dmenu:
|
||||
filter() { sed "s/ /:/g" | awk -F':' '$7==""{printf "%s%s (%s) %s\n",$1,$3,$5,$6}' ; }
|
||||
|
||||
# Get only LUKS drives that are not decrypted.
|
||||
unopenedluks="$(for drive in $allluks; do
|
||||
uuid="${drive%% *}"
|
||||
uuid="${uuid//-}" # This is a bashism.
|
||||
for open in $decrypted; do
|
||||
[ "$uuid" = "$open" ] && break 1
|
||||
done && continue 1
|
||||
echo "🔒 $drive"
|
||||
done | filter)"
|
||||
|
||||
# Get all normal, non-encrypted or decrypted partitions that are not mounted.
|
||||
normalparts="$(echo "$lsblkoutput"| grep -v crypto_LUKS | grep 'part\|rom\|crypt' | sed "s/^/💾 /" | filter )"
|
||||
|
||||
# Add all to one variable. If no mountable drives found, exit.
|
||||
alldrives="$(echo "$phones
|
||||
$unopenedluks
|
||||
$normalparts" | sed "/^$/d;s/ *$//")"
|
||||
|
||||
# Quit the script if a sequential command fails.
|
||||
set -e
|
||||
|
||||
test -n "$alldrives"
|
||||
|
||||
# Feed all found drives to dmenu and get user choice.
|
||||
chosen="$(echo "$alldrives" | dmenu -p "Mount which drive?" -i)"
|
||||
|
||||
# Function for prompting user for a mountpoint.
|
||||
getmount(){
|
||||
mp="$(find /mnt /media /mount /home -maxdepth 1 -type d 2>/dev/null | dmenu -i -p "Mount this drive where?")"
|
||||
test -n "$mp"
|
||||
if [ ! -d "$mp" ]; then
|
||||
mkdiryn=$(printf "No\\nYes" | dmenu -i -p "$mp does not exist. Create it?")
|
||||
[ "$mkdiryn" = "Yes" ] && (mkdir -p "$mp" || sudo -A mkdir -p "$mp")
|
||||
fi
|
||||
}
|
||||
|
||||
attemptmount(){
|
||||
# Attempt to mount without a mountpoint, to see if drive is in fstab.
|
||||
sudo -A mount "$chosen" || return 1
|
||||
notify-send "💾Drive Mounted." "$chosen mounted."
|
||||
exit
|
||||
}
|
||||
|
||||
case "$chosen" in
|
||||
💾*)
|
||||
chosen="${chosen%% *}"
|
||||
chosen="${chosen:1}" # This is a bashism.
|
||||
attemptmount || getmount
|
||||
sudo -A mount "$chosen" "$mp" -o uid="$(id -u)",gid="$(id -g)"
|
||||
notify-send "💾Drive Mounted." "$chosen mounted to $mp."
|
||||
;;
|
||||
|
||||
🔒*)
|
||||
chosen="${chosen%% *}"
|
||||
chosen="${chosen:1}" # This is a bashism.
|
||||
# Number the drive.
|
||||
while true; do
|
||||
[ -f "/dev/mapper/usb$num" ] || break
|
||||
num="$(printf "%02d" "$((num +1))")"
|
||||
done
|
||||
|
||||
# Decrypt in a terminal window
|
||||
${TERMINAL:-st} -n floatterm -g 60x1 -e sudo cryptsetup open "$chosen" "usb$num"
|
||||
# Check if now decrypted.
|
||||
test -b "/dev/mapper/usb$num"
|
||||
|
||||
attemptmount || getmount
|
||||
sudo -A mount "/dev/mapper/usb$num" "$mp" -o uid="$(id -u)",gid="$(id -g)"
|
||||
notify-send "🔓Decrypted drive Mounted." "$chosen decrypted and mounted to $mp."
|
||||
;;
|
||||
|
||||
📱*)
|
||||
notify-send "❗Note" "Remember to allow file access on your phone now."
|
||||
getmount
|
||||
number="${chosen%%:*}"
|
||||
number="${chosen:1}" # This is a bashism.
|
||||
sudo -A simple-mtpfs -o allow_other -o fsname="simple-mtpfs-$(escape "$chosen")" --device "$number" "$mp"
|
||||
notify-send "🤖 Android Mounted." "Android device mounted to $mp."
|
||||
;;
|
||||
esac
|
@ -1,304 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -o nounset -o pipefail
|
||||
# Before doing anything, check if the required programs are installed. See
|
||||
# <https://stackoverflow.com/q/592620>. Some of these can probably be reasonably assumed
|
||||
# to be present, but err on the side of caution.
|
||||
for prog in awk cowsay figlet notify-send stty tput; do
|
||||
if ! hash "$prog" 2>/dev/null; then
|
||||
printf 'muccadoro: %s: command not found\n' "$prog" >&2
|
||||
exit 127
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
temp_loc=/tmp/pomptemptimes
|
||||
temp_timeloc=/tmp/mucc_time
|
||||
statusbar="dwmblocks"
|
||||
update_signal="3"
|
||||
|
||||
freetime=${2:-w}
|
||||
if [ "$freetime" = "f" ]; then
|
||||
temp_loc=/tmp/pomptemptimesft
|
||||
fi
|
||||
|
||||
declare -i silly=1
|
||||
|
||||
# http://mywiki.wooledge.org/BashFAQ/035#getopts
|
||||
# http://wiki.bash-hackers.org/howto/getopts_tutorial
|
||||
while getopts ':s' opt; do
|
||||
case $opt in
|
||||
s) (( ++silly ));;
|
||||
esac
|
||||
done
|
||||
shift "$((OPTIND-1))" # Shift off the options and optional --.
|
||||
|
||||
# One pomodoro lasts "$1" minutes. The default duration is 25 minutes.
|
||||
declare -i duration=$((${1:-25}*60)) num_pomodoros=4
|
||||
|
||||
(( silly %= 5 ))
|
||||
if (( silly )); then
|
||||
declare -i silliness=$((2**(4-silly)))
|
||||
# `apps` stands for appearances, of course.
|
||||
declare -a apps=('' '-b' '-d' '-g' '-p' '-s' '-t' '-w' '-e oO' '-e Oo' '-e ><' '-e -o'
|
||||
'-e o-' '-e >o' '-e o<')
|
||||
num_apps=${#apps[@]}
|
||||
cowtell() {
|
||||
app_num=$((RANDOM % (silliness * num_apps)))
|
||||
(( app_num >= num_apps )) && app_num=0
|
||||
cowsay -n ${apps[app_num]}
|
||||
}
|
||||
else
|
||||
cowtell() {
|
||||
cowsay -n
|
||||
}
|
||||
fi
|
||||
|
||||
summary=
|
||||
|
||||
# Standard output must be a terminal. See <https://unix.stackexchange.com/q/91638>. Save
|
||||
# the original stdout to file descriptor 3 (see <https://unix.stackexchange.com/q/80988>).
|
||||
exec 3>&1 &>/dev/tty
|
||||
|
||||
# Save the current terminal settings.
|
||||
initial_tty_settings=$(stty -g)
|
||||
|
||||
# Revert all changed terminal settings (FIXME: restore everything from saved settings) and
|
||||
# print a summary.
|
||||
cleanup() {
|
||||
tput rmcup
|
||||
tput cnorm
|
||||
stty "$initial_tty_settings"
|
||||
[[ $summary ]] && echo -ne "$summary" >&3
|
||||
rm -f $temp_loc
|
||||
rm -f $temp_timeloc
|
||||
pkill -RTMIN+$update_signal $statusbar
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
# Switch to the alternate screen. See <https://unix.stackexchange.com/q/27941>, xterm(1),
|
||||
# terminfo(5), and <https://stackoverflow.com/q/11023929>.
|
||||
tput smcup
|
||||
|
||||
# TODO: explain. See
|
||||
# <http://www.unix.com/shell-programming-and-scripting/176837-bash-hide-terminal-cursor.html>.
|
||||
tput civis
|
||||
|
||||
# Don't echo characters typed on the tty. See <https://unix.stackexchange.com/a/28620>.
|
||||
stty -echo
|
||||
|
||||
# Output empty lines before the message so the message is displayed at the bottom of the
|
||||
# terminal. See <https://stackoverflow.com/a/29314659>. Also, instead of `clear`ing
|
||||
# (which causes flickering), pad all lines of the message with spaces all the way to the
|
||||
# right edge of the terminal, thereby overwriting any currently displayed characters. See
|
||||
# <https://stackoverflow.com/questions/9394408>. TODO: probably just use Bash and not
|
||||
# awk.
|
||||
pad() {
|
||||
awk -v lines="$(tput lines)" -v cols="$(tput cols)" '
|
||||
NR!=1 && FNR==1 { n=lines-NR; for(; n>0; n--) printf "%-"cols"s\n", "" }
|
||||
NR==FNR { next }
|
||||
{ printf "%-"cols"s\n", $0 }' <(echo "$1"){,}
|
||||
}
|
||||
|
||||
pp() {
|
||||
tput cup 0 0 # TODO: explain.
|
||||
pad "$1"
|
||||
}
|
||||
|
||||
ppp() {
|
||||
tput cup 0 0
|
||||
# FIXME: probably just check once if we have lolcat.
|
||||
pad "$1" | { lolcat 2>/dev/null || cat; }
|
||||
}
|
||||
|
||||
declare -a lyrics
|
||||
declare -i line_index=0
|
||||
lyrics=(
|
||||
"Can't stop, addicted to the shindig;"
|
||||
"Chop Top, he says I'm gonna win big;"
|
||||
"Choose not a life of imitation;"
|
||||
"Distant cousin to the reservation;"
|
||||
"Defunct the pistol that you pay for;"
|
||||
"This punk, the feeling that you stay for;"
|
||||
"In time I want to be your best friend;"
|
||||
"East side lovers living on the west end;"
|
||||
"Knocked out but boy you better come to;"
|
||||
"Don't die, you know the truth as some do;"
|
||||
"Go write your message on the pavement;"
|
||||
"Burn so bright I wonder what the wave meant;"
|
||||
)
|
||||
|
||||
declare -i state=0
|
||||
|
||||
cant-stop() {
|
||||
(( state == 2 )) && return
|
||||
state=2
|
||||
tty_settings=$(stty -g)
|
||||
trap '' INT
|
||||
stty susp undef
|
||||
pp "$(cowsay -e '><' -W $(($(tput cols)-3)) ${lyrics[line_index]})"
|
||||
|
||||
((++line_index)); ((line_index%=${#lyrics[@]}))
|
||||
sleep 2 & wait $!
|
||||
stty "$tty_settings"
|
||||
count-state
|
||||
}
|
||||
|
||||
# SIGTSTP handler.
|
||||
on-tstp() {
|
||||
# Signal all processes in the process group $$ (the group leader) to continue. See
|
||||
# kill(1), and <https://unix.stackexchange.com/q/139222>. Pomodoros are not
|
||||
# interruptible.
|
||||
kill -CONT -- -$$
|
||||
if (( state == 1 )); then
|
||||
cant-stop
|
||||
fi
|
||||
}
|
||||
trap on-tstp TSTP
|
||||
|
||||
count-state() {
|
||||
# 130 is the exit status for termination by Ctrl-C. See
|
||||
# <http://www.tldp.org/LDP/abs/html/exitcodes.html>.
|
||||
trap 'trap on-int INT; on-int; return 130' INT
|
||||
state=1
|
||||
}
|
||||
|
||||
dead-state() {
|
||||
trap on-int INT
|
||||
state=0
|
||||
}
|
||||
|
||||
pause-state() {
|
||||
trap on-int INT
|
||||
state=0
|
||||
}
|
||||
|
||||
on-int() {
|
||||
if (( state==0 )); then
|
||||
# We are supposed to kill ourselves with SIGINT instead of using `exit`. See
|
||||
# <http://mywiki.wooledge.org/SignalTrap#Special_Note_On_SIGINT>.
|
||||
trap - INT
|
||||
kill -INT $$
|
||||
elif (( state==1 )); then
|
||||
dead-state
|
||||
elif (( state==2 )); then
|
||||
count-state
|
||||
fi
|
||||
}
|
||||
|
||||
# XXX: beware of bugs due to SIGINT (Ctrl-C) being received during the short timeframe in
|
||||
# which another function invoked by this one is executing. The `return 1` statement of
|
||||
# the SIGINT trap will be ran in the context of the inner function.
|
||||
pomodoro() {
|
||||
count-state
|
||||
while :; do
|
||||
# Handle signals immediately, not after `sleep` exits. See
|
||||
# <http://mywiki.wooledge.org/SignalTrap#When_is_the_signal_handled.3F>.
|
||||
sleep 1 &
|
||||
# See <http://mywiki.wooledge.org/BashFAQ/002>.
|
||||
planned_end_time=$(( $start_time_secs + $duration ))
|
||||
seconds=$(( $planned_end_time - $( date +'%s') ))
|
||||
the_time=$((seconds/60)):$(printf '%02d' $((seconds%60)))
|
||||
# Keep in mind that almost everything causes new values to be assigned to `$?`:
|
||||
# $ false
|
||||
# $ (( $? )) && echo $?
|
||||
# 0
|
||||
# $ false || { (( $? != 148 )) && echo $?; }
|
||||
# 0
|
||||
# In both cases, when `echo $?` is executed, `$?` is no longer 1.
|
||||
fail=$?
|
||||
if (( fail && fail != 148 )); then
|
||||
return $fail
|
||||
fi
|
||||
text=$(figlet -f small "$the_time" ) #remove | cowtell
|
||||
fail=$?
|
||||
if (( ! fail )); then
|
||||
pp "$text"
|
||||
fail=$?
|
||||
echo "$the_time" > $temp_timeloc
|
||||
pkill -RTMIN+$update_signal $statusbar
|
||||
(( fail && fail != 148 )) && return $fail
|
||||
elif (( fail != 148 )); then
|
||||
return $fail
|
||||
fi
|
||||
wait
|
||||
((--seconds <= 0)) && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
flush-stdin() {
|
||||
# See <https://superuser.com/q/276531>.
|
||||
read -r -d '' -t 0.1 -n 1000
|
||||
}
|
||||
|
||||
# FIXME: why `dummy` (http://wiki.bash-hackers.org/commands/builtin/read#press_any_key).
|
||||
pause() {
|
||||
# See <http://wiki.bash-hackers.org/syntax/pe#use_an_alternate_value>.
|
||||
read -r -n 1${1:+ -t $1}
|
||||
}
|
||||
|
||||
for (( n=1; n<=num_pomodoros; ++n )); do
|
||||
declare -i seconds=$duration
|
||||
declare -i start_time_secs=$(date +'%s')
|
||||
start_time=$(date --date "@$start_time_secs" +'%H:%M')
|
||||
pomodoro
|
||||
fail=$?
|
||||
if (( fail == 130 )); then
|
||||
end_time=$(date +'%H:%M')
|
||||
end_time_secs=$(date -d $end_time +'%s')
|
||||
day=$(date '+%Y%b%d')
|
||||
summary+="Abandoned: $start_time to $end_time ($((($end_time_secs - $start_time_secs)/ 60))) $day\n"
|
||||
#summary+="Abandoned: $start_time to $(date +'%H:%M')\n"
|
||||
# Pomodoros are atomic.
|
||||
pp "$(cowsay -d -W $(($(tput cols)-3)) 'You abandoned pomodoro '$n'. Press any' \
|
||||
'key to restart it.')"
|
||||
rm -f $temp_timeloc
|
||||
pkill -RTMIN+$update_signal $statusbar
|
||||
pause
|
||||
(( --n ))
|
||||
continue
|
||||
elif (( fail )); then
|
||||
exit $fail
|
||||
fi
|
||||
pause-state
|
||||
tty_settings=$(stty -g)
|
||||
stty susp undef
|
||||
end_time_secs=$(date +'%s')
|
||||
end_time=$(date --date "@$end_time_secs" +'%H:%M')
|
||||
#end_time_secs=$(date -d $end_time +'%s')
|
||||
#start_time_secs=$(date -d $start_time +'%s')
|
||||
day=$(date '+%Y%b%d')
|
||||
summary+="Pomodoro $n: $start_time to $end_time ($(( ($end_time_secs - $start_time_secs )/60))) $day\n"
|
||||
#summary+="Pomodoro $n: $start_time to $(date +'%H:%M') \n"
|
||||
if (( n!=num_pomodoros )); then
|
||||
start_time=$(date +'%s')
|
||||
notify-send "You completed pomodoro $n. Take a short break (3-5 minutes)."
|
||||
#
|
||||
#
|
||||
echo "($n*$duration)/60" | bc > $temp_loc
|
||||
pkill -RTMIN+$update_signal $statusbar
|
||||
# TODO: it may be nice to create this message asynchronously with `lolcat -f` since
|
||||
# lolcat is a bit slow. That's not a priority, though.
|
||||
ppp "$(cowsay -e '^^' -W $(($(tput cols)-3)) 'You completed pomodoro '$n'. Take' \
|
||||
'a short break (3-5 minutes), then press any key to continue.')"
|
||||
rm -f $temp_timeloc
|
||||
pkill -RTMIN+$update_signal $statusbar
|
||||
flush-stdin
|
||||
if ! pause 180; then
|
||||
pp "$(cowsay -w -W $(($(tput cols)-3)) 'Press any key to continue.')"
|
||||
pause 120 || {
|
||||
notify-send -u critical 'Time to start the next pomodoro.'; pause;
|
||||
}
|
||||
fi
|
||||
break_duration=$((($(date +'%s')-start_time+30)/60))
|
||||
summary+="Break: about $break_duration minute"
|
||||
(( break_duration != 1 )) && summary+=s # plural
|
||||
summary+='\n'
|
||||
fi
|
||||
stty "$tty_settings"
|
||||
done
|
||||
|
||||
notify-send "You completed all $num_pomodoros pomodoros!"
|
||||
|
||||
# vim: tw=90 sts=-1 sw=3 et
|
81
.local/bin/noisereduce
Executable file
81
.local/bin/noisereduce
Executable file
@ -0,0 +1,81 @@
|
||||
#!/usr/bin/sh
|
||||
|
||||
usage ()
|
||||
{
|
||||
printf "Usage : noisereduce <input video file> <output video file>\n"
|
||||
exit
|
||||
}
|
||||
|
||||
# Tests for requirements
|
||||
ifinstalled ffmpeg || { echo >&2 "We require 'ffmpeg' but it's not installed."; exit 1; }
|
||||
ifinstalled sox || { echo >&2 "We require 'ffmpeg' but it's not installed."; exit 1; }
|
||||
|
||||
if [ "$#" -ne 2 ]
|
||||
then
|
||||
usage
|
||||
fi
|
||||
|
||||
if [ ! -e "$1" ]
|
||||
then
|
||||
printf "File not found: %s\n" "$1"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ -e "$2" ]
|
||||
then
|
||||
printf "File %s already exists, overwrite? [y/N]\n: " "$2"
|
||||
read -r yn
|
||||
case $yn in
|
||||
[Yy]* ) ;;
|
||||
* ) exit;;
|
||||
esac
|
||||
fi
|
||||
|
||||
inBasename=$(basename "$1")
|
||||
inExt="${inBasename##*.}"
|
||||
|
||||
isVideoStr=$(ffprobe -v warning -show_streams "$1" | grep codec_type=video)
|
||||
if [ -n "$isVideoStr" ]
|
||||
then
|
||||
isVideo=1
|
||||
printf "Detected %s as a video file\n" "$inBasename"
|
||||
else
|
||||
isVideo=0
|
||||
printf "Detected %s as an audio file\n" "$inBasename"
|
||||
fi
|
||||
|
||||
printf "Sample noise start time [00:00:00]: "
|
||||
read -r sampleStart
|
||||
if [ -z "$sampleStart" ] ; then sampleStart="00:00:00"; fi
|
||||
printf "Sample noise end time [00:00:00.900]: "
|
||||
read -r sampleEnd
|
||||
if [ -z "$sampleEnd" ] ; then sampleEnd="00:00:00.900"; fi
|
||||
printf "Noise reduction amount [0.21]: "
|
||||
read -r sensitivity
|
||||
if [ -z "$sensitivity" ] ; then sensitivity="0.21"; fi
|
||||
|
||||
|
||||
tmpVidFile="/tmp/noiseclean_tmpvid.$inExt"
|
||||
tmpAudFile="/tmp/noiseclean_tmpaud.wav"
|
||||
noiseAudFile="/tmp/noiseclean_noiseaud.wav"
|
||||
noiseProfFile="/tmp/noiseclean_noise.prof"
|
||||
tmpAudCleanFile="/tmp/noiseclean_tmpaud-clean.wav"
|
||||
|
||||
printf "Cleaning noise on %s...\n" "$1"
|
||||
|
||||
if [ $isVideo -eq "1" ]; then
|
||||
ffmpeg -v warning -y -i "$1" -qscale:v 0 -vcodec copy -an "$tmpVidFile"
|
||||
ffmpeg -v warning -y -i "$1" -qscale:a 0 "$tmpAudFile"
|
||||
else
|
||||
cp "$1" "$tmpAudFile"
|
||||
fi
|
||||
ffmpeg -v warning -y -i "$1" -vn -ss "$sampleStart" -t "$sampleEnd" "$noiseAudFile"
|
||||
sox "$noiseAudFile" -n noiseprof "$noiseProfFile"
|
||||
sox "$tmpAudFile" "$tmpAudCleanFile" noisered "$noiseProfFile" "$sensitivity"
|
||||
if [ $isVideo -eq "1" ]; then
|
||||
ffmpeg -v warning -y -i "$tmpAudCleanFile" -i "$tmpVidFile" -vcodec copy -qscale:v 0 -qscale:a 0 "$2"
|
||||
else
|
||||
cp "$tmpAudCleanFile" "$2"
|
||||
fi
|
||||
|
||||
printf "Done"
|
@ -1,13 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# opout: "open output": A general handler for opening a file's intended output,
|
||||
# usually the pdf of a compiled document. I find this useful especially
|
||||
# running from vim.
|
||||
|
||||
basename="$(echo "$1" | sed 's/\.[^\/.]*$//')"
|
||||
|
||||
case "$1" in
|
||||
*.tex|*.m[dse]|*.[rR]md|*.mom|*.[0-9]) setsid xdg-open "$basename".pdf >/dev/null 2>&1 & ;;
|
||||
*.html) setsid "$BROWSER" "$basename".html >/dev/null 2>&1 & ;;
|
||||
*.sent) setsid sent "$1" >/dev/null 2>&1 & ;;
|
||||
esac
|
@ -6,5 +6,5 @@
|
||||
# (with other things) by default and is used in some other places.
|
||||
|
||||
for i in $(ls /tmp/mpvSockets/*); do
|
||||
echo '{ "command": ["set_property", "pause", true] }' | socat - $i;
|
||||
echo '{ "command": ["set_property", "pause", true] }' | socat - "$i";
|
||||
done
|
||||
|
@ -1,7 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# entr command to run `queueandnotify` when newsboat queue is changed
|
||||
|
||||
[ "$(pgrep -x $(basename $0) | wc -l)" -gt 2 ] && exit
|
||||
|
||||
echo ${XDG_DATA_HOME:-$HOME/.local/share}/newsboat/queue | entr -p queueandnotify 2>/dev/null
|
@ -1,13 +0,0 @@
|
||||
#!/bin/sh
|
||||
SAVE_DIR=~/eth/pomodoros
|
||||
case $1 in
|
||||
add) start=$2
|
||||
start_secs=$(date -d $start +'%s')
|
||||
end=$3
|
||||
end_secs=$(date -d $end +'%s')
|
||||
duration="$(( ($end_secs - $start_secs)/60 ))"
|
||||
echo "Pomodoro 1: $start to $end ($duration) $(date '+%Y%b%d')" | tee -ai $SAVE_DIR;;
|
||||
*) xdotool key super+shift+9
|
||||
muccadoro $1 | tee -ai "$SAVE_DIR";;
|
||||
esac
|
||||
pkill -RTMIN+3 dwmblocks
|
@ -1,12 +0,0 @@
|
||||
#!/bin/sh
|
||||
SAVE_DIR=~/bks/pomodoros_freetime
|
||||
case $1 in
|
||||
add) start=$2
|
||||
start_secs=$(date -d $start +'%s')
|
||||
end=$3
|
||||
end_secs=$(date -d $end +'%s')
|
||||
duration="$(( ($end_secs - $start_secs)/60 ))"
|
||||
echo "Pomodoro 1: $start to $end ($duration) $(date '+%Y%b%d')" | tee -ai $SAVE_DIR;;
|
||||
*) muccadoro ${1:-25} 'f' | tee -ai "$SAVE_DIR";;
|
||||
esac
|
||||
pkill -RTMIN+3 dwmblocks
|
@ -5,26 +5,27 @@
|
||||
VIRTUAL_PRINTER_DIR="/var/spool/cups-pdf/$USER"
|
||||
# Printer to print magazine layout on
|
||||
PRINTER="Canon-MF220"
|
||||
for file in $@; do
|
||||
lpr -P Virtual_PDF_Printer -o number-up=2 -o orientation-requested=4 -o fit-to-page -o media=a4 "$file"
|
||||
str="."
|
||||
until lpc status | grep -A 4 'Virtual_PDF_Printer:' | tail -n1 | grep 'no entries'; do
|
||||
printf "\033[s\033[uPrinting to file for two slides per a5 page"
|
||||
printf "%s" $str
|
||||
printf "\033[u"
|
||||
str=$str.
|
||||
sleep 1
|
||||
done
|
||||
echo "virtual printing done."
|
||||
last_job_id="$(ls "$VIRTUAL_PRINTER_DIR" | grep -o '[0-9]*\.pdf$' | grep '[0-9]' | cut -d'.' -f1 | sort -n | tail -n1)"
|
||||
#echo "last_job_id:$last_job_id"
|
||||
file_two_page="$(ls $VIRTUAL_PRINTER_DIR/*${last_job_id}.pdf)"
|
||||
#echo "file_two_page:$file_two_page"
|
||||
printf "Invoking a5ona4..."
|
||||
a5ona4 "$file_two_page" > /dev/null
|
||||
echo "Done."
|
||||
rm "$file_two_page"
|
||||
only_filename_two_page="$( echo "$file_two_page"| awk -F/ '{print $NS}' )"
|
||||
echo "Magazine layout of $file being sent to printer..."
|
||||
lpr -P $PRINTER -o media=A4 -o Duplex=DuplexTumble -o sides=two-sided-short-edge -o BindEdge=Bottom -o media=a4 -r a5ona4_$file*
|
||||
PRINTER=Virtual_PDF_Printer
|
||||
file="$@"
|
||||
lpr -P Virtual_PDF_Printer -o number-up=2 -o orientation-requested=4 -o fit-to-page -o media=a4 "$file"
|
||||
str="."
|
||||
until lpc status | grep -A 4 'Virtual_PDF_Printer:' | tail -n1 | grep 'no entries'; do
|
||||
printf "\033[s\033[uPrinting to file for two slides per a5 page"
|
||||
printf "%s" $str
|
||||
printf "\033[u"
|
||||
str=$str.
|
||||
sleep 1
|
||||
done
|
||||
echo "virtual printing done."
|
||||
last_job_id="$(ls "$VIRTUAL_PRINTER_DIR" | grep -o '[0-9]*\.pdf$' | grep '[0-9]' | cut -d'.' -f1 | sort -n | tail -n1)"
|
||||
#echo "last_job_id:$last_job_id"
|
||||
file_two_page="$(ls $VIRTUAL_PRINTER_DIR/*${last_job_id}.pdf)"
|
||||
#echo "file_two_page:$file_two_page"
|
||||
printf "Invoking a5ona4..."
|
||||
a5ona4 "$file_two_page" > /dev/null
|
||||
echo "Done."
|
||||
rm "$file_two_page"
|
||||
only_filename_two_page="$( echo "$file_two_page"| awk -F/ '{print $NS}' )"
|
||||
echo "Magazine layout of $file being sent to printer..."
|
||||
file_without_suffix="$(echo "$file" | sed 's/[ \(\)]/_/g; s/\.pdf$//')"
|
||||
lpr -P $PRINTER -o media=A4 -o Duplex=DuplexTumble -o sides=two-sided-short-edge -o BindEdge=Bottom -o media=a4 -r a5ona4_${file_without_suffix}*
|
||||
|
@ -5,4 +5,4 @@
|
||||
# For example:
|
||||
# `./prompt "Do you want to shutdown?" "shutdown -h now"`
|
||||
|
||||
[ "$(printf "No\\nYes" | dmenu -i -n -p "$1" -nb darkred -sb red -sf white -nf gray )" = "Yes" ] && $2
|
||||
[ "$(printf "No\\nYes" | dmenu -i -p "$1" -nb darkred -sb red -sf white -nf gray -n)" = "Yes" ] && $2
|
||||
|
@ -1,8 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from pyls.__main__ import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
@ -1,12 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# $1 is a url; $2 is a command
|
||||
[ -z "$1" ] && exit
|
||||
base="$(basename "$1")"
|
||||
notify-send "⏳ Queuing $base..."
|
||||
cmd="$2"
|
||||
[ -z "$cmd" ] && cmd="youtube-dl --add-metadata"
|
||||
idnum="$(tsp $cmd "$1")"
|
||||
realname="$(echo "$base" | sed "s/?\(source\|dest\).*//;s/%20/ /g")"
|
||||
tsp -D "$idnum" mv "$base" "$realname"
|
||||
tsp -D "$idnum" notify-send "👍 $realname done."
|
@ -1,14 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Podboat sucks. This script replaces it.
|
||||
# It reads the newsboat queue, queuing downloads with taskspooler.
|
||||
# It also removes the junk from extentions.
|
||||
queuefile="${XDG_DATA_HOME:-$HOME/.local/share}/newsboat/queue"
|
||||
|
||||
while read -r line; do
|
||||
[ -z "$line" ] && continue
|
||||
url="$(echo "$line" | awk '{print $1}')"
|
||||
qndl "$url" "curl -LO"
|
||||
done < "$queuefile"
|
||||
|
||||
echo > "$queuefile"
|
@ -1,5 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Refresh the dwmbar.
|
||||
# Send SIGTRAP signal to dwmbar script, which will handle it with a trap.
|
||||
pkill -SIGTRAP dwmbar
|
8
.local/bin/remapd
Executable file
8
.local/bin/remapd
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Rerun the remaps script whenever a new input device is added.
|
||||
|
||||
while :; do
|
||||
remaps
|
||||
grep -qP -m1 '[^un]bind.+\/[^:]+\(usb\)' <(udevadm monitor -u -t seat -s input -s usb)
|
||||
done
|
@ -9,3 +9,5 @@ setxkbmap -option caps:super -variant intl
|
||||
killall xcape 2>/dev/null ; xcape -e 'Super_L=Escape'
|
||||
# Map the menu button to right super as well.
|
||||
xmodmap -e 'keycode 135 = Super_R'
|
||||
# Turn off the caps lock if on since there is no longer a key for it.
|
||||
xset -q | grep "Caps Lock:\s*on" && xdotool key Caps_Lock
|
||||
|
@ -1,117 +0,0 @@
|
||||
#!/bin/sh
|
||||
#A script that checks multiple youtube and bitchute channels for new videos to download via youtube-dl
|
||||
#This script works considerably faster than just giving youtube-dl a channel URI.
|
||||
#The YouTube implementation now uses a YoutubeData API v3 key to work more reliably.
|
||||
#This can be quite quota taxing, as each channel search is 1% of the allotted qutoa for the day.
|
||||
#-> checking n YT channels => n% of daily quota required to run this script
|
||||
#Keep this in mind when running it as a cronjob
|
||||
#Either insert this key in plain text below at the variable "APIKEY" or do it via ENV vars or a password manager
|
||||
#Since bitchute still doesn't have an API I'm using lynx to emulate a user.
|
||||
#This can limit the number of recent videos available. For a whole download of bitchute channels consider other methods first.
|
||||
#For youtube the videos per channel are limited to the last 500 uploaded videos. For the rest you can just use youtube-dl itself
|
||||
|
||||
#needed if run as cronjob
|
||||
XDG_VIDEOS_DIR=$HOME/vids #TODO ADJUST FOR PERSONAL USE HERE!
|
||||
export XDG_VIDEOS_DIR
|
||||
DLARCHIVE="${XDG_VIDEOS_DIR:-$HOME/Videos}/.downloaded"
|
||||
DLLOC="${XDG_VIDEOS_DIR:-$HOME/Videos}"
|
||||
#FORMAT OF CHANNELSFILE:
|
||||
#Youtube: include the channel URI: https://www.youtube.com/channel/<channelId>
|
||||
#Bitchute: normal channel URI: https://www.bitchute.com/channel/<user>
|
||||
#Lines starting with '#' will be ignored in this file
|
||||
CHANNELSFILE="${XDG_VIDEOS_DIR:-$HOME/Videos}/.channels"
|
||||
BLACKLIST="${XDG_VIDEOS_DIR:-$HOME/Videos}/.blacklist"
|
||||
|
||||
# Required to display notifications if run as a cronjob:
|
||||
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus
|
||||
export DBUS_SESSION_BUS_ADDRESS
|
||||
export DISPLAY=:0.0
|
||||
export XDG_DATA_HOME=/home/alex/.local/share
|
||||
# Required to have pass work if run as cronjob
|
||||
export PASSWORD_STORE_GPG_OPTS="--homedir=$XDG_DATA_HOME/gnupg"
|
||||
export GTK2_RC_FILES="${XDG_CONFIG_HOME:-$HOME/.config}/gtk-2.0/gtkrc-2.0"
|
||||
[ -d "$HOME/.local/share/password-store" ] && export PASSWORD_STORE_DIR="$HOME/.local/share/password-store"
|
||||
|
||||
APIKEY="$(pass show API/Youtube\ Data\ API\ v3 | head -n1 )"
|
||||
LEGACYMODE=$1 #set to anything nonzero to ignore YT API
|
||||
|
||||
[ -n "$LEGACYMODE" ] && printf "Using YT Legacy fallback mode...\nThis is less reliable than the API requests.\nOnly expect to find the last 5 videos or so per channel\n"
|
||||
if [ "$(pgrep -c ripper)" -gt 1 ]; then
|
||||
echo "Ripper already running, exiting new instance..."
|
||||
exit
|
||||
fi
|
||||
|
||||
echo "Scanning for new Videos to download"
|
||||
|
||||
|
||||
##YOUTUBE
|
||||
echo "Scanning on Youtube..."
|
||||
IDs="$( grep 'youtube' "$CHANNELSFILE" | grep -v '^#' | grep 'channel' | sed 's/https:\/\/www\.youtube\.com\/channel\///')"
|
||||
not_correctly_formatted="$(grep 'youtube' "$CHANNELSFILE" | grep -v '^#' | grep -v 'https:\/\/www\.youtube\.com\/channel\/')"
|
||||
if [ -n "$not_correctly_formatted" ]; then
|
||||
echo Please fix the following channel urls to be scannable:
|
||||
echo "$not_correctly_formatted" | while read -r line; do
|
||||
printf 'Given URI:\t%s\n' "$line"
|
||||
printf 'Potentially correct channel URI:\n\thttps://www.youtube.com/channel/%s\n' "$(curl "$line" -s | grep -Eo 'externalId":"[^"]*"' | sed 's|^externalId":"||; s|"||g')"
|
||||
done
|
||||
echo "They need to be in the 'https://www.youtube.com/channel/...' format"
|
||||
fi
|
||||
for channel_id in $IDs; do
|
||||
echo "YT-ID: $channel_id"
|
||||
if [ -z "$LEGACYMODE" ]; then
|
||||
json="$(curl -s "https://www.googleapis.com/youtube/v3/search?key=$APIKEY&channelId=$channel_id&part=snippet,id&order=date&maxResults=500")"
|
||||
#Fallback to legacy mode if API quota is exceeded
|
||||
if [ "$(echo "$json" | jq '."error"."errors"[]."reason"' 2> /dev/null )" = '"quotaExceeded"' ];then
|
||||
echo "YT API Quota exceeded, using fallback"
|
||||
LEGACYMODE=1
|
||||
fi
|
||||
fi
|
||||
if [ -n "$LEGACYMODE" ];then
|
||||
curl -s "https://www.youtube.com/feeds/videos.xml?channel_id=$channel_id" > /tmp/"${channel_id}.xml"
|
||||
python -c "from lxml import etree
|
||||
file=\"/tmp/${channel_id}.xml\"
|
||||
root = etree.parse(file)
|
||||
for el in root.iter():
|
||||
if(el.tag in '{http://www.youtube.com/xml/schemas/2015}videoId'):
|
||||
print(el.text)" |
|
||||
sed 's/^/https:\/\/www\.youtube\.com\/watch\?v=/' | grep -vf "$BLACKLIST" >> /tmp/todownload$$
|
||||
rm -f "/tmp/${channel_id}.xml"
|
||||
else
|
||||
#Only try to download videos, not sheduled livestreams
|
||||
echo "$json" | jq '.items[] | select(.snippet.liveBroadcastContent != "upcoming") | .id.videoId' |
|
||||
tr -d '"' | grep -v '^null$'|
|
||||
sed 's/^/https:\/\/www\.youtube\.com\/watch\?v=/' |
|
||||
grep -vf "$BLACKLIST" >> /tmp/todownload$$
|
||||
fi
|
||||
done
|
||||
grep 'youtube' "$DLARCHIVE" | sed 's/youtube /https:\/\/www\.youtube\.com\/watch?v=/' > /tmp/alreadydownloaded$$
|
||||
|
||||
##BITCHUTE
|
||||
#This section is quite generic and could probably be easily adapted for other video hosting websites
|
||||
echo "Scanning on Bitchute..."
|
||||
BC_CHANNELS="$(grep 'bitchute' "$CHANNELSFILE" | grep -v '^#')"
|
||||
for channel in $BC_CHANNELS; do
|
||||
printf 'BC channel: %s\n' "$( echo "$channel" | sed 's|https://www.bitchute.com/channel/||; s|/||')"
|
||||
lynx --read_timeout=5 --dump --nonumbers -listonly "$channel"| grep 'bitchute\.com\/video' | sort -u | grep -vf "$BLACKLIST" >> /tmp/todownload$$
|
||||
done
|
||||
grep 'bitchute' "$DLARCHIVE" | sed 's/bitchute /https:\/\/www\.bitchute\.com\/video\//' >> /tmp/alreadydownloaded$$
|
||||
|
||||
##DOWNLOAD VIDEOS FROM ACCUMULATED LINKS
|
||||
grep -vf /tmp/alreadydownloaded$$ /tmp/todownload$$ | sort -u > /tmp/new_videos$$
|
||||
rm -f /tmp/alreadydownloaded$$ /tmp/todownload$$
|
||||
number=$(wc -l /tmp/new_videos$$ | cut -d ' ' -f 1 )
|
||||
if [ "$number" -gt 0 ]; then
|
||||
[ "$number" -gt 1 ] && plural="s"
|
||||
notify-send "Channel Ripper" "$number new video$plural available for download, downloading now."
|
||||
echo "$number new video$plural for download available, downloading now."
|
||||
if [ "$number" -lt 10 ];then
|
||||
youtube-dl --get-filename -o "'%(uploader)s' '%(title)s'" -a /tmp/new_videos$$ | xargs -L1 notify-send
|
||||
fi
|
||||
youtube-dl --hls-prefer-native -i --download-archive "$DLARCHIVE" -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best' --add-metadata -o "$DLLOC/%(uploader)s/%(upload_date)s-%(title)s.%(ext)s" -a /tmp/new_videos$$
|
||||
rm -f /tmp/new_videos$$
|
||||
notify-send "Channel Ripper" "Finished downloading"
|
||||
fi
|
||||
|
||||
if [ "$number" -eq 0 ]; then
|
||||
echo "No new videos"
|
||||
fi
|
12
.local/bin/rotdir
Executable file
12
.local/bin/rotdir
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
# When I open an image from the file manager in nsxiv (the image viewer), I want
|
||||
# to be able to press the next/previous keys to key through the rest of the
|
||||
# images in the same directory. This script "rotates" the content of a
|
||||
# directory based on the first chosen file, so that if I open the 15th image,
|
||||
# if I press next, it will go to the 16th etc. Autistic, I know, but this is
|
||||
# one of the reasons that nsxiv is great for being able to read standard input.
|
||||
|
||||
[ -z "$1" ] && echo "usage: rotdir regex 2>&1" && exit 1
|
||||
base="$(basename "$1")"
|
||||
ls "$PWD" | awk -v BASE="$base" 'BEGIN { lines = ""; m = 0; } { if ($0 == BASE) { m = 1; } } { if (!m) { if (lines) { lines = lines"\n"; } lines = lines""$0; } else { print $0; } } END { print lines; }'
|
@ -2,7 +2,9 @@
|
||||
|
||||
# Open a terminal window in the same directory as the currently active window.
|
||||
|
||||
PID=$(xprop -id "$(xprop -root | awk '/_NET_ACTIVE_WINDOW\(WINDOW\)/{print $NF}')" | grep -m 1 PID | cut -d " " -f 3)
|
||||
PID="$(pstree -lpA "$PID" | tail -n 1 | awk -F'---' '{print $NF}' | sed -re 's/[^0-9]//g')"
|
||||
PID=$(xprop -id "$(xprop -root | xprop -root | sed -n "/_NET_ACTIVE_WINDOW/ s/^.*# // p")" | sed -n "/PID/ s/^.*= // p")
|
||||
PID="$(pstree -lpA "$PID")"
|
||||
PID="${PID##*(}"
|
||||
PID="${PID%)}"
|
||||
cd "$(readlink /proc/"$PID"/cwd)" || return 1
|
||||
"$TERMINAL"
|
||||
|
33
.local/bin/setbg
Executable file
33
.local/bin/setbg
Executable file
@ -0,0 +1,33 @@
|
||||
#!/bin/sh
|
||||
|
||||
# This script does the following:
|
||||
# Run by itself, set the wallpaper (at X start).
|
||||
# If given a file, set that as the new wallpaper.
|
||||
# If given a directory, choose random file in it.
|
||||
# If wal is installed, also generates a colorscheme.
|
||||
|
||||
# Location of link to wallpaper link.
|
||||
bgloc="${XDG_DATA_HOME:-$HOME/.local/share/}/bg"
|
||||
|
||||
# Configuration files of applications that have their themes changed by pywal.
|
||||
dunstconf="${XDG_CONFIG_HOME:-$HOME/.config}/dunst/dunstrc"
|
||||
zathuraconf="${XDG_CONFIG_HOME:-$HOME/.config}/zathura/zathurarc"
|
||||
|
||||
trueloc="$(readlink -f "$1")" &&
|
||||
case "$(file --mime-type -b "$trueloc")" in
|
||||
image/* ) ln -sf "$(readlink -f "$1")" "$bgloc" && notify-send -i "$bgloc" "Changing wallpaper..." ;;
|
||||
inode/directory ) ln -sf "$(find "$trueloc" -iregex '.*.\(jpg\|jpeg\|png\|gif\)' -type f | shuf -n 1)" "$bgloc" && notify-send -i "$bgloc" "Random Wallpaper chosen." ;;
|
||||
*) notify-send "Error" "Not a valid image." ; exit 1;;
|
||||
esac
|
||||
|
||||
# If pywal is installed, use it.
|
||||
if command -v wal >/dev/null 2>&1 ; then
|
||||
wal -i "$(readlink -f $bgloc)" -o "${XDG_CONFIG_HOME:-$HOME/.config}/wal/postrun" >/dev/null 2>&1 &&
|
||||
pidof dwm >/dev/null && xdotool key super+F12
|
||||
# If pywal is removed, return config files to normal.
|
||||
else
|
||||
[ -f "$dunstconf.bak" ] && unlink "$dunstconf" && mv "$dunstconf.bak" "$dunstconf"
|
||||
[ -f "$zathuraconf.bak" ] && unlink "$zathuraconf" && mv "$zathuraconf.bak" "$zathuraconf"
|
||||
fi
|
||||
|
||||
xwallpaper --zoom "$bgloc"
|
@ -1,29 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Output locations. Unactivated progs should go to /dev/null.
|
||||
shell_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/shortcutrc"
|
||||
zsh_named_dirs="${XDG_CONFIG_HOME:-$HOME/.config}/zshnameddirrc"
|
||||
ranger_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/ranger/shortcuts.conf"
|
||||
qute_shortcuts="/dev/null"
|
||||
fish_shortcuts="/dev/null"
|
||||
vifm_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/vifm/vifmshortcuts"
|
||||
|
||||
# Remove, prepare files
|
||||
rm -f "$ranger_shortcuts" "$qute_shortcuts" "$zsh_named_dirs" 2>/dev/null
|
||||
printf "# vim: filetype=sh\\n" > "$fish_shortcuts"
|
||||
printf "# vim: filetype=sh\\nalias " > "$shell_shortcuts"
|
||||
printf "\" vim: filetype=vim\\n" > "$vifm_shortcuts"
|
||||
|
||||
# Format the `directories` file in the correct syntax and sent it to all three configs.
|
||||
sed "s/\s*#.*$//;/^\s*$/d" "${XDG_CONFIG_HOME:-$HOME/.config}/directories" | tee >(awk '{print $1"=\"cd "$2" && ls -a\" \\"}' >> "$shell_shortcuts") \
|
||||
>(awk '{print "hash -d "$1"="$2}' >> "$zsh_named_dirs") \
|
||||
>(awk '{print "abbr", $1, "\"cd " $2 "; and ls -a\""}' >> "$fish_shortcuts") \
|
||||
>(awk '{print "map g" $1, ":cd", $2 "<CR>\nmap t" $1, "<tab>:cd", $2 "<CR><tab>\nmap M" $1, "<tab>:cd", $2 "<CR><tab>:mo<CR>\nmap Y" $1, "<tab>:cd", $2 "<CR><tab>:co<CR>" }' >> "$vifm_shortcuts") \
|
||||
>(awk '{print "config.bind(\";"$1"\", \"set downloads.location.directory "$2" ;; hint links download\")"}' >> "$qute_shortcuts") \
|
||||
| awk '{print "map g"$1" cd "$2"\nmap t"$1" tab_new "$2"\nmap m"$1" shell mv -v %s "$2"\nmap Y"$1" shell cp -rv %s "$2}' >> "$ranger_shortcuts"
|
||||
|
||||
# Format the `files` file in the correct syntax and sent it to both configs.
|
||||
sed "s/\s*#.*$//;/^\s*$/d" "${XDG_CONFIG_HOME:-$HOME/.config}/files" | tee >(awk '{print $1"=\"$EDITOR "$2"\" \\"}' >> "$shell_shortcuts") \
|
||||
>(awk '{print "abbr", $1, "\"$EDITOR "$2"\""}' >> "$fish_shortcuts") \
|
||||
>(awk '{print "map", $1, ":e", $2 "<CR>" }' >> "$vifm_shortcuts") \
|
||||
| awk '{print "map "$1" shell $EDITOR "$2}' >> "$ranger_shortcuts"
|
@ -1,11 +0,0 @@
|
||||
#!/bin/bash
|
||||
( [ "$(stat -c %y ~/.cache/corona | cut -d' ' -f1)" != "$(date '+%Y-%m-%d')" ] || [ "$1" = "up" ] )&&
|
||||
curl -s https://corona-stats.online/Switzerland | sed -r "s/[[:cntrl:]]\[[0-9]{1,3}m//g" > ~/.cache/corona && notify-send "Corona" "Stats updated"; sleep 5; pkill -RTMIN+15 dwmblocks
|
||||
|
||||
increase=$( grep "Switzerland" ~/.cache/corona |
|
||||
sed "s/\s*//g; s/║//g; s/│/;/g" | awk -F';' '{print $4}' )
|
||||
[ "$increase" != "" ] && ( grep "Switzerland" ~/.cache/corona |
|
||||
sed "s/\s*//g; s/║//g; s/│/;/g" |
|
||||
awk -F';' '{print "😷"$3 " ("$4") 💀"$5 }' ) || ( grep "Switzerland" ~/.cache/corona |
|
||||
sed "s/\s*//g; s/║//g; s/│/;/g" |
|
||||
awk -F';' '{print "😷"$3 " 💀"$5 }' )
|
@ -1,53 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Shows the price for desired cryptocurrencies. Module updates automatically
|
||||
# every calendar day, but can also be updated with a middle click.
|
||||
|
||||
# Currencies should be ;-separated:
|
||||
# human-readable name;urlname;icon
|
||||
coins="Bitcoin;btc;💰
|
||||
Etherium;eth;🍸
|
||||
Basic Attention Token;bat;🦁
|
||||
LBC;lbc;📚"
|
||||
|
||||
# Directory where currency info is stored.
|
||||
dir="${XDG_DATA_HOME:-$HOME/.local/share}/crypto-prices"
|
||||
|
||||
getprices() { # The command to get the desired prices
|
||||
printf "🔃 "; printprices
|
||||
{ rm -rf "${dir:?}/*"
|
||||
echo "$coins" | while IFS=';' read -r human web icon; do
|
||||
val="$(curl -s "rate.sx/1$web")" &&
|
||||
echo "$icon;$val;$human" > "$dir/$web"
|
||||
done; [ -d "$dir" ] && touch "$dir"
|
||||
pkill -RTMIN+13 "${STATUSBAR:-dwmblocks}" ;} &
|
||||
exit
|
||||
}
|
||||
|
||||
printprices() { # Print/format all prices
|
||||
for x in "$dir"/*; do
|
||||
[ -f "$x" ] || break
|
||||
info="$(cut -d';' -f-2 --output-delimiter=' ' "$x")"
|
||||
printf "%s $%0.2f " $info
|
||||
done | sed 's/ $//'
|
||||
}
|
||||
|
||||
[ ! -d "$dir" ] && mkdir -p "$dir" && { getprices; exit ;}
|
||||
|
||||
# If currencies haven't been updated today, try to update them.
|
||||
[ "$(stat -c %x "$HOME/.local/share/crypto-prices" | cut -d' ' -f1)" != "$(date '+%Y-%m-%d')" ] &&
|
||||
{ ping -q -c 1 1.1.1.1 >/dev/null 2>&1 && getprices || exit ;}
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
1) uptime="$(date -d "$(stat -c %x "$dir")" '+%D at %T' | sed "s|$(date '+%D')|Today|")"
|
||||
notify-send "Exact prices in USD" "$(awk -F';' '{print $1, $3 ":\n\t$" $2}' "$dir"/*)
|
||||
<b>Last updated:</b>
|
||||
$uptime" ;;
|
||||
2) getprices ;;
|
||||
3) notify-send "💸 Crypto-currency module" "\- Left click for exact prices.
|
||||
- Middle click to update.
|
||||
- Shows 🔃 if updating prices.
|
||||
- Manually add/remove currencies to list in the script." ;;
|
||||
esac
|
||||
|
||||
printprices
|
@ -1,7 +0,0 @@
|
||||
#!/bin/bash
|
||||
day=$(date '+%Y%b%d')
|
||||
logged=$(grep -v Break ~/eth/pomodoros | grep $(date '+%Y%b%d') | grep -Eo "\(.*\)" | paste -sd+ | bc)
|
||||
temp=$(cat /tmp/pomptemptimes 2>/dev/null)
|
||||
min=$([ "$logged" != "" ] && ([ "$temp" != "" ] && echo "$logged + $temp" | bc || echo $logged ) || ([ "$temp" != "" ] && echo $temp))
|
||||
[ -n "$min" ] && printf '🍅%s' "$min"
|
||||
printf '\n'
|
@ -1,7 +0,0 @@
|
||||
#!/bin/bash
|
||||
day=$(date '+%Y%b%d')
|
||||
logged=$(grep -v Break ~/bks/pomodoros_freetime | grep $(date '+%Y%b%d') | grep -Eo "\(.*\)" | paste -sd+ | bc)
|
||||
temp=$(cat /tmp/pomptemptimesft 2>/dev/null)
|
||||
min=$([ "$logged" != "" ] && ([ "$temp" != "" ] && echo "$logged + $temp" | bc || echo $logged ) || ([ "$temp" != "" ] && echo $temp))
|
||||
[ -n "$min" ] && printf '📚%s'"$min"
|
||||
printf '\n'
|
@ -1,5 +0,0 @@
|
||||
#!/bin/sh
|
||||
if pactl list sinks | grep -qE 'device.icon_name = \"audio-(headset|headphones)-bluetooth\"'; then
|
||||
printf '🎧'
|
||||
fi
|
||||
printf '\n'
|
@ -1,7 +0,0 @@
|
||||
#!/bin/sh
|
||||
case $BLOCK_BUTTON in
|
||||
1) groff -mom ~/.local/share/larbs/readme.mom -Tpdf | zathura - ;;
|
||||
2) i3 restart ;;
|
||||
3) pgrep -x dunst >/dev/null && notify-send "❓ Help module" "\- Left click to open LARBS guide.
|
||||
- Middle click to refresh i3.";;
|
||||
esac; echo "❓"
|
@ -1,16 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# The clickable help menu. Middle click to restart wm.
|
||||
|
||||
# If dwm is running, use dwm's readme and restart.
|
||||
ps ax | grep -q "\sdwm$" &&
|
||||
READMEFILE=/usr/local/share/dwm/larbs.mom
|
||||
restartwm() { pkill -HUP dwm ;} ||
|
||||
restartwm() { i3 restart ;}
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
1) groff -mom "${READMEFILE:-${XDG_DATA_HOME:-$HOME/.local/share}/larbs/readme.mom}" -Tpdf | zathura - ;;
|
||||
2) restartwm ;;
|
||||
3) notify-send "❓ Help module" "\- Left click to open LARBS guide.
|
||||
- Middle click to refresh window manager.";;
|
||||
esac; echo "❓"
|
@ -1,9 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Gets your public ip address checks which country you are in and
|
||||
# displays that information in the statusbar
|
||||
#
|
||||
# https://www.maketecheasier.com/ip-address-geolocation-lookups-linux/
|
||||
ifinstalled "geoiplookup" || exit
|
||||
addr="$(curl ifconfig.me 2>/dev/null)" || exit
|
||||
grep "flag: " ~/.config/emoji | grep "$(geoiplookup $addr | sed 's/.*, //')" | sed "s/flag: //;s/;.*//"
|
@ -1,25 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Shows the current moon phase. Requires `pom-perl`.
|
||||
|
||||
mnphs=$(pom $1 | grep -o 'New\|Waxing Crescent\|First Quarter\|Waxing Gibbous\|Full\|Waning Gibbous\|Last Quarter\|Waning Crescent' | grep -m1 '.')
|
||||
prcnt=$(pom $1 | grep -o '[[:digit:]]*%' | grep -o '[[:digit:]]*' )
|
||||
case "$mnphs" in
|
||||
"New") icon="🌑" prcnt="0" ;;
|
||||
"Waxing Crescent") icon="🌒" ;;
|
||||
"First Quarter") icon="🌓" prcnt="50" ;;
|
||||
"Waxing Gibbous") icon="🌔" ;;
|
||||
"Full") icon="🌕" prcnt="100" ;;
|
||||
"Waning Gibbous") icon="🌖" ;;
|
||||
"Last Quarter") icon="🌗" prcnt="50" ;;
|
||||
"Waning Crescent") icon="🌘" ;;
|
||||
*) echo errorrrr ;;
|
||||
esac
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
1) $mnphs ;;
|
||||
2) $mnphs ;;
|
||||
3) notify-send " 🌜$(pom)" ;;
|
||||
esac
|
||||
|
||||
echo "$icon" "$prcnt"%
|
@ -1,9 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Whenever the mpd state changes, update the mpd i3 module.
|
||||
#kill -0 "$(cat /tmp/mpdupdate)" 2>/dev/null && exit || echo $$ > /tmp/mpdupdate
|
||||
|
||||
#sleep 5 && while : ; do
|
||||
#pkill -RTMIN+11 dwmblocks
|
||||
#mpc idle >/dev/null || exit
|
||||
#done
|
||||
pkill -RTMIN+11 dwmblocks
|
@ -1,12 +0,0 @@
|
||||
#!/bin/sh
|
||||
if [ "$( mpc status | grep -c '\[playing\]')" -eq 1 ]; then
|
||||
full_length="$(mpc status | sed "/^volume:/d" | tac | sed -e "s/\\[paused\\].*//g;s/\\[playing\\].*//g" | tr -d '\n' | sed -e "s/$/ /g")"
|
||||
#remove full directory structure if no title present and too long
|
||||
if [ ${#full_length} -gt 40 ]; then
|
||||
echo "${full_length##*/}"
|
||||
else
|
||||
echo "$full_length"
|
||||
fi
|
||||
else
|
||||
printf '\n'
|
||||
fi
|
@ -1,18 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
filter() {
|
||||
sed "/^volume:/d" | tac | sed -e "s/\\&/&/g;s/\\[paused\\].*/<span color=\"gray\" font_style=\"italic\">/g;s/\\[playing\\].*/<span>/g" | tr -d '\n' | sed -e "s/$/<\\/span>/g"
|
||||
}
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
1) mpc status | filter && setsid "$TERMINAL" -e ncmpcpp & ;; # right click, pause/unpause
|
||||
2) mpc toggle | filter ;; # right click, pause/unpause
|
||||
3) mpc status | filter && pgrep -x dunst >/dev/null && notify-send "🎵 Music module" "\- Shows mpd song playing.
|
||||
- Italic when paused.
|
||||
- Left click opens ncmpcpp.
|
||||
- Middle click pauses.
|
||||
- Scroll changes track.";; # right click, pause/unpause
|
||||
4) mpc prev | filter ;; # scroll up, previous
|
||||
5) mpc next | filter ;; # scroll down, next
|
||||
*) mpc status | filter ;;
|
||||
esac; exit
|
@ -1,6 +1,16 @@
|
||||
#!/bin/sh
|
||||
#Print the next appointment for the day for statusbar
|
||||
#or generate notification for upcoming appointment
|
||||
notify_mins_before=10
|
||||
|
||||
|
||||
calcurse -a | perl -pe 's/([0-9]{2}:[0-9]{2})\n/\1/' | tail -n+2 | perl -pe 's/^\s*-\s*([0-9]{2}:[0-9]{2})\s*->\s*([0-9]{2}:[0-9]{2})\s*(.*?)$/\1\t\2\t\3/' |
|
||||
while read -r appointment; do
|
||||
start=$(echo "$appointment" | cut -d'\t' -f1)
|
||||
end=$(echo "$appointment" | cut -d'\t' -f2)
|
||||
description=$(echo "$appointment" | cut -d'\t' -f3)
|
||||
done
|
||||
|
||||
diff=$(calcurse --next | sed -n 's/^\s*//; s/\[//;s/\]//p' | cut -f1 -d ' ' | perl -pe 's/0([0-9])/\1/g' )
|
||||
if [ -n "$diff" ]; then
|
||||
secs=$(( $(echo "$diff" | cut -f1 -d ':') * 3600 + $(echo "$diff" | cut -f2 -d ':') *60 ))
|
||||
@ -12,8 +22,11 @@ if [ -n "$diff" ]; then
|
||||
fi
|
||||
if [ "$1" = "notif" ]; then
|
||||
msg="$(printf '%s\n%s' "$(date --date "@$time_appointment" +'%H:%M')" "$appointment")"
|
||||
check_for_notif "$msg"
|
||||
notify-send "Appointment coming up" "$msg"
|
||||
printf "%s\n%s\n" $(date -I) $msg >> /tmp/apts_notif
|
||||
else
|
||||
#Fix this ugly thing lmao
|
||||
midnight=$(( $(date --date "$(date | sed 's/..:..:../23:59:59/; s/ PM//; s/ AM//')" +%s) + 1 ))
|
||||
if [ $midnight -gt "$time_appointment" ]; then
|
||||
#only print appointment if dunst-notifications are also shown -> "privacy screen"
|
@ -12,8 +12,13 @@ esac
|
||||
|
||||
[ "$(cat /sys/class/net/w*/operstate)" = 'down' ] && wifiicon="📡"
|
||||
|
||||
[ -z "${wifiicon+var}" ] && wifiicon="📶"
|
||||
#[ ! -n "${wifiicon+var}" ] && wifiicon=$(grep "^\s*w" /proc/net/wireless | awk '{ print "📶", int($3 * 100 / 70) "%" }')
|
||||
|
||||
|
||||
printf "%s%s\n" "$wifiicon" "$(cat /sys/class/net/w*/operstate | sed "s/down/❎/;s/up//")"
|
||||
if [ -d /sys/class/net/e* ]; then
|
||||
wifiicon=🌐
|
||||
printf "%s%s\n" "$wifiicon" "$(cat /sys/class/net/e*/operstate | sed "s/down/❎/;s/up//")"
|
||||
else
|
||||
[ -z "${wifiicon+var}" ] && wifiicon="📶"
|
||||
printf "%s%s\n" "$wifiicon" "$(cat /sys/class/net/w*/operstate | sed "s/down/❎/;s/up//")"
|
||||
fi
|
16
.local/bin/statusbar/sb-music
Executable file
16
.local/bin/statusbar/sb-music
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
if [ "$( mpc status | grep -c '\[playing\]')" -eq 1 ]; then
|
||||
if [ ! -f /tmp/nodunst ]; then
|
||||
full_length="$(mpc status | sed "/^volume:/d" | tac | sed -e "s/\\[paused\\].*//g;s/\\[playing\\].*//g" | tr -d '\n' | sed -e "s/$/ /g")"
|
||||
#remove full directory structure if no title present and too long
|
||||
if [ ${#full_length} -gt 40 ]; then
|
||||
echo "${full_length##*/}"
|
||||
else
|
||||
echo "$full_length"
|
||||
fi
|
||||
else
|
||||
printf '\n'
|
||||
fi
|
||||
else
|
||||
printf '\n'
|
||||
fi
|
52
.local/bin/statusbar/sb-volume
Executable file
52
.local/bin/statusbar/sb-volume
Executable file
@ -0,0 +1,52 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Prints the current volume or 🔇 if muted. Uses PulseAudio by default,
|
||||
# uncomment the ALSA lines if you remove PulseAudio.
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
# 1) setsid "$TERMINAL" -e alsamixer & ;;
|
||||
# 2) amixer sset Master toggle ;;
|
||||
# 4) amixer sset Master 5%+ >/dev/null 2>/dev/null ;;
|
||||
# 5) amixer sset Master 5%- >/dev/null 2>/dev/null ;;
|
||||
1) setsid "$TERMINAL" -e pulsemixer & ;;
|
||||
2) pamixer -t ;;
|
||||
4) pamixer --allow-boost -i 1 ;;
|
||||
5) pamixer --allow-boost -d 1 ;;
|
||||
3) notify-send "📢 Volume module" "\- Shows volume 🔊, 🔇 if muted.
|
||||
- Middle click to mute.
|
||||
- Scroll to change."
|
||||
esac
|
||||
|
||||
#volstat="$(pactl list sinks)"
|
||||
## volstat="$(amixer get Master)" # ALSA only equivalent.
|
||||
#
|
||||
## Uses active sink if one is running, otherwise just go for the default one (First one listed in pactl list sinks)
|
||||
#if [ -z "$(echo "$volstat" | grep -A10 'State: RUNNING' )" ]; then
|
||||
# echo "$volstat" | grep -q "Mute: yes" && printf "🔇\\n" && exit
|
||||
#else
|
||||
# echo "$volstat" | grep -A10 "State: RUNNING" | grep -q "Mute: yes" && printf "🔇\\n" && exit
|
||||
#fi
|
||||
## echo "$volstat" | grep "\[off\]" >/dev/null && printf "🔇\\n" && exit # ALSA
|
||||
#
|
||||
## Uses active sink if one is running, otherwise just go for the default one (First one listed in pactl list sinks)
|
||||
#if [ -z "$(echo "$volstat" | grep -A10 'State: RUNNING' )" ]; then
|
||||
# vol="$(echo "$volstat" | grep '[0-9]\+%' | sed "s,.* \([0-9]\+\)%.*,\1,;1q")"
|
||||
#else
|
||||
# vol="$(echo "$volstat" | grep -A10 "State: RUNNING" | grep '[0-9]\+%' | sed "s,.* \([0-9]\+\)%.*,\1,;1q")"
|
||||
#fi
|
||||
|
||||
# vol=$(echo "$volstat" | grep -o "\[[0-9]\+%\]" | sed "s/[^0-9]*//g;1q") # ALSA
|
||||
vol="$(pamixer --get-volume-human | tr -d '%')"
|
||||
if echo "$vol" | grep -q muted; then
|
||||
printf '🔇\n'
|
||||
|
||||
else
|
||||
if [ "$vol" -gt "70" ]; then
|
||||
icon="🔊"
|
||||
elif [ "$vol" -lt "30" ]; then
|
||||
icon="🔈"
|
||||
else
|
||||
icon="🔉"
|
||||
fi
|
||||
printf "%s%s%%\\n" "$icon" "$vol"
|
||||
fi
|
@ -1,32 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "
|
||||
____ _ _ _
|
||||
/ ___|| |_ __ _| |_ _ _ ___| |__ __ _ _ __
|
||||
\___ \| __/ _\` | __| | | / __| '_ \ / _\` | '__|
|
||||
___) | || (_| | |_| |_| \__ \ |_) | (_| | |
|
||||
|____/ \__\__,_|\__|\__,_|___/_.__/ \__,_|_|
|
||||
|
||||
This is a list of the statusbar modules.
|
||||
|
||||
📦5 \033[31mpacpackages\033[0m: updatable packages (must have pacman -Sy run in root cronjob to check).
|
||||
📰 41 \033[32mnews\033[0m: unread RSS entries in newsboat.
|
||||
☔ 83% ❄️ 69° 🌞 80° \033[33mweather\033[0m: ☔ for precipitation, 🌞 and ❄ for daily high and low.
|
||||
📬 20 \033[34mmailbox\033[0m: number of unread mail if mutt-wizard is active.
|
||||
🔉 62% \033[35mvolume\033[0m: master sink volume.
|
||||
🔌83% \033[36mbattery\033[0m: 🔌 for charging, 🔋 for discharging, ⚡ for full.
|
||||
📶 80% ❎ \033[37minternet\033[0m: 📶 for wifi with % (📡 if none), 🌐 for ethernet. (❎ if none).
|
||||
|
||||
Obviously the time and date are displayed as well.
|
||||
|
||||
Optional script modules:
|
||||
|
||||
Edit \033[32m~/.local/src/dwmblocks/config.h\033[0m to add these or your own if you'd like (and recompile and restart dwmblocks).
|
||||
|
||||
'memory' 🧠 559Mi/3.7Gi Current used memory/total memory.
|
||||
'cpu' 🌡 +46.0°C CPU temperature.
|
||||
'disk' 🖥 : 28G/30G Remaining disk space...
|
||||
'disk ~' 🏠: 641G/850G ...can be given directory argument.
|
||||
'moonphase' 🌕 39% Phase of the moon (requires \033[32m\`pom-perl\`\033[0m).
|
||||
'iplocate' 🇺🇸 United States Your own or VPN location (requires \033[32m\`geoiplookup\`\033[0m).
|
||||
" | less
|
@ -1,8 +0,0 @@
|
||||
#!/bin/sh
|
||||
string="$(insync get_status)"
|
||||
|
||||
case "$string" in
|
||||
SYNCED) echo '🔗' ;;
|
||||
OFFLINE) echo '🔗' ;;
|
||||
SYNCING) echo '🔄' ;;
|
||||
esac
|
@ -1,48 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Prints the current volume or 🔇 if muted. Uses PulseAudio by default,
|
||||
# uncomment the ALSA lines if you remove PulseAudio.
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
# 1) setsid "$TERMINAL" -e alsamixer & ;;
|
||||
# 2) amixer sset Master toggle ;;
|
||||
# 4) amixer sset Master 5%+ >/dev/null 2>/dev/null ;;
|
||||
# 5) amixer sset Master 5%- >/dev/null 2>/dev/null ;;
|
||||
1) setsid "$TERMINAL" -e pulsemixer & ;;
|
||||
2) pamixer -t ;;
|
||||
4) pamixer --allow-boost -i 1 ;;
|
||||
5) pamixer --allow-boost -d 1 ;;
|
||||
3) notify-send "📢 Volume module" "\- Shows volume 🔊, 🔇 if muted.
|
||||
- Middle click to mute.
|
||||
- Scroll to change."
|
||||
esac
|
||||
|
||||
volstat="$(pactl list sinks)"
|
||||
# volstat="$(amixer get Master)" # ALSA only equivalent.
|
||||
|
||||
# Uses active sink if one is running, otherwise just go for the default one (First one listed in pactl list sinks)
|
||||
if [ -z "$(echo "$volstat" | grep -A10 'State: RUNNING' )" ]; then
|
||||
echo "$volstat" | grep -q "Mute: yes" && printf "🔇\\n" && exit
|
||||
else
|
||||
echo "$volstat" | grep -A10 "State: RUNNING" | grep -q "Mute: yes" && printf "🔇\\n" && exit
|
||||
fi
|
||||
# echo "$volstat" | grep "\[off\]" >/dev/null && printf "🔇\\n" && exit # ALSA
|
||||
|
||||
# Uses active sink if one is running, otherwise just go for the default one (First one listed in pactl list sinks)
|
||||
if [ -z "$(echo "$volstat" | grep -A10 'State: RUNNING' )" ]; then
|
||||
vol="$(echo "$volstat" | grep '[0-9]\+%' | sed "s,.* \([0-9]\+\)%.*,\1,;1q")"
|
||||
else
|
||||
vol="$(echo "$volstat" | grep -A10 "State: RUNNING" | grep '[0-9]\+%' | sed "s,.* \([0-9]\+\)%.*,\1,;1q")"
|
||||
fi
|
||||
|
||||
# vol=$(echo "$volstat" | grep -o "\[[0-9]\+%\]" | sed "s/[^0-9]*//g;1q") # ALSA
|
||||
|
||||
if [ "$vol" -gt "70" ]; then
|
||||
icon="🔊"
|
||||
elif [ "$vol" -lt "30" ]; then
|
||||
icon="🔈"
|
||||
else
|
||||
icon="🔉"
|
||||
fi
|
||||
|
||||
printf "%s%s%%\\n" "$icon" "$vol"
|
@ -1,25 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
1) setsid "$TERMINAL" -e pulsemixer & ;;
|
||||
2) pulsemixer --toggle-mute ;;
|
||||
4) pulsemixer --change-volume +5 ;;
|
||||
5) pulsemixer --change-volume -5 ;;
|
||||
3) pgrep -x dunst >/dev/null && notify-send "📢 Volume module" "\- Shows volume 🔊, 🔇 if muted.
|
||||
- Middle click to mute.
|
||||
- Scroll to change."
|
||||
esac
|
||||
|
||||
[ "$(pulsemixer --get-mute)" = "1" ] && printf "🔇\\n" && exit
|
||||
|
||||
vol=$(pulsemixer --get-volume | awk '{print $1}')
|
||||
|
||||
if [ "$vol" -gt "70" ]; then
|
||||
icon="🔊"
|
||||
elif [ "$vol" -lt "30" ]; then
|
||||
icon="🔈"
|
||||
else
|
||||
icon="🔉"
|
||||
fi
|
||||
|
||||
printf "%s %s%%\\n" "$icon" "$vol"
|
@ -1,26 +0,0 @@
|
||||
#!/bin/sh
|
||||
meteobluelink="https://www.meteoblue.com/en/weather/forecast/multimodel/zurich_switzerland_2657896"
|
||||
multimodel_path="$XDG_DATA_HOME/$(date -I)_multimodel.png"
|
||||
|
||||
last_downloaded_path="$(for file in "$XDG_DATA_HOME"/*_multimodel.png; do
|
||||
echo "$file"
|
||||
done | head -n1)"
|
||||
last_downloaded="$(echo "${last_downloaded_path%_multimodel.png}" | awk 'BEGIN{FS="/"} {print $NF}')"
|
||||
if [ "$last_downloaded" = "*" ]; then
|
||||
FLAG_download=true
|
||||
else
|
||||
if [ "$(date -I)" != "$last_downloaded" ]; then
|
||||
echo "Last report is from another day, downloading for today..."
|
||||
rm "$XDG_DATA_HOME"/*_multimodel.png
|
||||
FLAG_download=true
|
||||
else
|
||||
FLAG_download=false
|
||||
fi
|
||||
fi
|
||||
if [ $FLAG_download = 'true' ]; then
|
||||
mb_imagelink="$(lynx --dump --listonly --nonumbers "$meteobluelink" | grep meteogram_multiSimple_hd)"
|
||||
curl -L "$mb_imagelink" -o "$multimodel_path"
|
||||
else
|
||||
echo "currently downloaded multimodel is from today, showing cached version"
|
||||
fi
|
||||
sxiv "$XDG_DATA_HOME"/*_multimodel.png
|
@ -1,14 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# A dmenu wrapper script for system functions.
|
||||
|
||||
cmds="\
|
||||
lock screen slock
|
||||
leave dwm kill -TERM $(pidof -s dwm)
|
||||
refresh dwm kill -HUP $(pidof -s dwm)
|
||||
reboot sudo -A reboot
|
||||
shutdown sudo -A shutdown -h now"
|
||||
|
||||
choice="$(echo "$cmds" | cut -d' ' -f 1 | dmenu)" || exit 1
|
||||
|
||||
`echo "$cmds" | grep "^$choice " | cut -d ' ' -f2-`
|
@ -1,12 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# If transmission-daemon is running, will ask to kill, else will ask to start.
|
||||
|
||||
if pidof transmission-daemon >/dev/null ;
|
||||
then
|
||||
[ "$(printf "No\\nYes" | dmenu -i -p "Turn off transmission-daemon?")" = "Yes" ] && killall transmission-da && notify-send "transmission-daemon disabled."
|
||||
else
|
||||
ifinstalled transmission-cli || exit
|
||||
[ "$(printf "No\\nYes" | dmenu -i -p "Turn on transmission daemon?")" = "Yes" ] && transmission-daemon && notify-send "tranmission-daemon enabled."
|
||||
fi
|
||||
sleep 3 && pkill -RTMIN+7 "${STATUSBAR:-dwmblocks}"
|
@ -1,3 +0,0 @@
|
||||
#!/bin/bash
|
||||
echo $1
|
||||
echo $2
|
@ -1,2 +0,0 @@
|
||||
#!/bin/bash
|
||||
[ -n "$1" ] && echo "$1" > "/home/alex/test"
|
16
.local/bin/texclear
Executable file
16
.local/bin/texclear
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Clears the build files of a LaTeX/XeLaTeX build.
|
||||
# I have vim run this file whenever I exit a .tex file.
|
||||
|
||||
case "$1" in
|
||||
*.tex)
|
||||
file=$(readlink -f "$1")
|
||||
dir=$(dirname "$file")
|
||||
base="${file%.*}"
|
||||
find "$dir" -maxdepth 1 -type f -regextype gnu-awk -regex "^$base\\.(4tc|xref|tmp|pyc|pyg|pyo|fls|vrb|fdb_latexmk|bak|swp|aux|log|synctex\\(busy\\)|lof|lot|maf|idx|mtc|mtc0|nav|out|snm|toc|bcf|run\\.xml|synctex\\.gz|blg|bbl)" -delete
|
||||
rm -rdf "$dir/_minted-$(basename -- "$base")"
|
||||
;;
|
||||
*) printf "Give .tex file as argument.\\n" ;;
|
||||
esac
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user