Added scripts
This commit is contained in:
parent
6e570be6af
commit
f8b6378c3f
2 changed files with 41 additions and 0 deletions
26
scripts/cleandependencies.sh
Executable file
26
scripts/cleandependencies.sh
Executable file
|
@ -0,0 +1,26 @@
|
|||
#!/usr/bin/env bash
|
||||
# Remove unused dependencies that are not explicitly installed
|
||||
# Usage: [sudo] cleandependencies
|
||||
|
||||
# Retrieve a list of all packages that are not explicitly installed and are not needed by anything else.
|
||||
# Note that optional dependencies also do not get removed.
|
||||
# function getList () {
|
||||
# grep "Name\|Required By\|Optional For\|Install Reason" <<< $(pacman -Qi) |
|
||||
# tr '\n' ';' | sed "s/$/\n/" |
|
||||
# sed "s/ */ /g" |
|
||||
# sed "s/Name/\nName/g" |
|
||||
# sed "s/\(Name\|Required By\|Optional For\|Install Reason\) : //g" |
|
||||
# grep "Installed as a dependency for another package" |
|
||||
# grep "^[^;]*;None;None" |
|
||||
# cut -f 1 -d ';'
|
||||
# } ; export -f getList
|
||||
|
||||
current_amount=$(pacman -Qdtq | wc -l)
|
||||
# Keep looping while there are unusded dependencies.
|
||||
# Stop when the next amount is the same, probably because the action was canceled.
|
||||
while [[ ${current_amount} -ne 0 && ${current_amount} -ne ${previous_amount:=0} ]] ; do
|
||||
previous_amount=${current_amount}
|
||||
pacman -R $(pacman -Qdtq)
|
||||
current_amount=$(pacman -Qdtq | wc -l)
|
||||
done
|
||||
|
15
scripts/wlsunset.sh
Executable file
15
scripts/wlsunset.sh
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env bash
|
||||
# Script to disable for an hour or immediately continue wlsunset. 'Toggle'
|
||||
|
||||
# Check if wlsunset is still running
|
||||
pid=$(pgrep wlsunset)
|
||||
|
||||
if [[ -z ${pid} ]] ; then
|
||||
# Start wlsunset right away.
|
||||
wlsunset -l 50 -L 4 -t 2500 &
|
||||
else
|
||||
# Currently stop wlsunset but restart in an hour.
|
||||
kill ${pid}
|
||||
notify-send 'Stopping sunset, restarting in an hour'
|
||||
at now +1 hours -f ~/.scripts/wlsunset.sh
|
||||
fi
|
Loading…
Reference in a new issue