Added some things, fixed some things, upgrading to 0.1.6
This commit is contained in:
parent
08688e4267
commit
d621a426b6
32 changed files with 234 additions and 29 deletions
26
stow/_scripts/.scripts/cleandependencies.sh
Executable file
26
stow/_scripts/.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
|
||||
|
22
stow/_scripts/.scripts/dnd.sh
Executable file
22
stow/_scripts/.scripts/dnd.sh
Executable file
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env bash
|
||||
# Script to toggle Do not disturb mode for mako and dunst
|
||||
|
||||
# Permanent memory
|
||||
saved_state=0
|
||||
|
||||
# Toggle
|
||||
if [[ ${saved_state} -eq 0 ]] ; then
|
||||
~/.scripts/notify.sh 'Hiding notifications'
|
||||
sleep 5
|
||||
makoctl set-mode do-not-disturb
|
||||
dunstctl set-paused true
|
||||
else
|
||||
makoctl set-mode default
|
||||
dunstctl set-paused false
|
||||
~/.scripts/notify.sh 'Showing notifications'
|
||||
fi
|
||||
|
||||
# Update status in file
|
||||
new_state=$(( (${saved_state} + 1) % 2 ))
|
||||
sed -i "s/^saved_state=.*$/saved_state=${new_state}/" "${0}"
|
||||
|
16
stow/_scripts/.scripts/focus.sh
Executable file
16
stow/_scripts/.scripts/focus.sh
Executable file
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/env bash
|
||||
# Script to toggle black background to focus on sway
|
||||
|
||||
# Get instances of swaybg, except for the 'standard' one.
|
||||
list=$( pgrep swaybg | head -n -1 )
|
||||
|
||||
if [ -z "${list}" ] ; then
|
||||
swaybg --mode=solid_color --color=#000000 &
|
||||
# Give the previous command some time to execute
|
||||
sleep .1
|
||||
swaymsg reload
|
||||
else
|
||||
# Clean up if already running
|
||||
kill $( tr ' ' '\n' <<< ${list} )
|
||||
fi
|
||||
|
19
stow/_scripts/.scripts/idle.sh
Executable file
19
stow/_scripts/.scripts/idle.sh
Executable file
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/env bash
|
||||
# Configuration of swayidle
|
||||
# Just run the script
|
||||
|
||||
# Kill previous instances to avoid clashing
|
||||
pkill swayidle
|
||||
|
||||
swayidle -w \
|
||||
timeout 600 \
|
||||
'swaymsg "output * dpms off"' \
|
||||
resume 'swaymsg "output * dpms on"' \
|
||||
timeout 1200 \
|
||||
'systemctl suspend' \
|
||||
before-sleep 'swaymsg "output * dpms on"; swaylock'
|
||||
# Screen needs to be turned back on or you will get a black screen after waking up again.
|
||||
|
||||
# timeout 300 \
|
||||
# "~/.scripts/wander.sh" \
|
||||
# resume 'brightnessctl -r' \
|
71
stow/_scripts/.scripts/notify.sh
Executable file
71
stow/_scripts/.scripts/notify.sh
Executable file
|
@ -0,0 +1,71 @@
|
|||
#!/usr/bin/env bash
|
||||
# Show system status in notification, or your own message
|
||||
# Syntaxis: notify [-vb] [-t <timeout>] [-p <value>] [<title> <message>]
|
||||
|
||||
# Requirements:
|
||||
# - brightnessctl
|
||||
|
||||
panic () {
|
||||
>&2 echo "Syntaxis: notify [-vb] [-t <timeout>] [-p <value>] [<title> <message>]"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Get options
|
||||
while getopts ":bvt:p:" options; do
|
||||
case "${options}" in
|
||||
b)
|
||||
value=$( brightnessctl | grep -o "[0-9]*%" | tr -d '%' )
|
||||
title="Brightness: ${value}%"
|
||||
category='sysinfo'
|
||||
;;
|
||||
v)
|
||||
# Get volume (don't use pamixer because that is way slower)
|
||||
value=$( pactl get-sink-volume @DEFAULT_SINK@ \
|
||||
| cut -d '/' -f2 \
|
||||
| grep -o '[0-9]*%' \
|
||||
| tr -d '%' )
|
||||
title="Volume: ${value}%"
|
||||
category='sysinfo'
|
||||
|
||||
# If audio disabled, set value to zero.
|
||||
if [ "$( pactl get-sink-mute @DEFAULT_SINK@ )" == "Mute: yes" ] ; then
|
||||
title="Volume: ${value}% (Disabled)"
|
||||
value=0
|
||||
fi
|
||||
;;
|
||||
t)
|
||||
timeout="${OPTARG}"
|
||||
;;
|
||||
p)
|
||||
value="${OPTARG}"
|
||||
;;
|
||||
*)
|
||||
panic
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
shift $((OPTIND - 1))
|
||||
|
||||
# Check arguments
|
||||
if [ $# -gt 2 ] ; then
|
||||
panic
|
||||
elif [ $# -gt 0 ] ; then
|
||||
title="${1}"
|
||||
message="${2:-}"
|
||||
fi
|
||||
|
||||
# Build command string
|
||||
arguments=""
|
||||
if [[ ! -z "${category}" ]] ; then
|
||||
arguments+=" -c ${category}"
|
||||
fi
|
||||
if [[ ! -z "${timeout}" ]] ; then
|
||||
arguments+=" -t ${timeout}"
|
||||
fi
|
||||
if [[ ! -z "${value}" ]] ; then
|
||||
arguments+=" -h int:value:${value}"
|
||||
fi
|
||||
|
||||
notify-send "${title}" "${message}" ${arguments}
|
||||
|
9
stow/_scripts/.scripts/wander.sh
Executable file
9
stow/_scripts/.scripts/wander.sh
Executable file
|
@ -0,0 +1,9 @@
|
|||
#!/usr/bin/env bash
|
||||
# Toggle brightness to 'sleep' or 'awake', since brightnessctl does not support
|
||||
# percentages of current amount.
|
||||
# Just run the script
|
||||
|
||||
current=$( brightnessctl get )
|
||||
# Doesn't have to be accurate so we can use built-in calculator.
|
||||
brightnessctl -sq set $(( current / 10 * 3 ))
|
||||
|
15
stow/_scripts/.scripts/wlsunset.sh
Executable file
15
stow/_scripts/.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}
|
||||
~/.scripts/notify.sh 'Stopping sunset' 'Restarting in an hour'
|
||||
at now +1 hours -f ~/.scripts/wlsunset.sh
|
||||
fi
|
|
@ -40,7 +40,7 @@
|
|||
"clock": {
|
||||
"format": "{:%H:%M}",
|
||||
"format-alt": "{:%d/%m/%Y %H:%M}",
|
||||
"timezone": "Europe/Brussels",
|
||||
// "timezone": "Europe/Brussels",
|
||||
"tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>"
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue