Update core script
This commit is contained in:
parent
08e8642d37
commit
6d834d5e21
|
@ -3,8 +3,8 @@
|
||||||
# This script handles the systray and other things necessary for keybinds.
|
# This script handles the systray and other things necessary for keybinds.
|
||||||
|
|
||||||
# Set binary directory if not set already.
|
# Set binary directory if not set already.
|
||||||
if [ -e "/usr/share/dwm-bindir" ]; then
|
if [ -e "/usr/share/speedwm-bindir" ]; then
|
||||||
BINDIR=$(cat /usr/share/dwm-bindir) # Set binary directory to the contents of this variable.
|
BINDIR=$(cat /usr/share/speedwm-bindir) # Set binary directory to the contents of this variable.
|
||||||
else
|
else
|
||||||
BINDIR="/usr/bin/"
|
BINDIR="/usr/bin/"
|
||||||
fi
|
fi
|
||||||
|
@ -16,12 +16,13 @@ SYSTRAY_COL=1 # When using pywal, set color to background (1) or backgroundmid (
|
||||||
USE_SRG=false # Use $SYSTRAY-srg (available in Gentoo repos and AUR as $SYSTRAY-srg-git) instead of $SYSTRAY adding more features (true/false)
|
USE_SRG=false # Use $SYSTRAY-srg (available in Gentoo repos and AUR as $SYSTRAY-srg-git) instead of $SYSTRAY adding more features (true/false)
|
||||||
USE_DEFAULT_TINT=false # Use default $TINT or use $SYSTRAY_COL
|
USE_DEFAULT_TINT=false # Use default $TINT or use $SYSTRAY_COL
|
||||||
ALPHA=0 # Opacity of the systray (0 is opaque, 255 is fully transparent)
|
ALPHA=0 # Opacity of the systray (0 is opaque, 255 is fully transparent)
|
||||||
HIDE_BAR_WHEN_SYSTRAY_SHOW=false # Hide the dwm bar when the systray is running.
|
HIDE_BAR_WHEN_SYSTRAY_SHOW=false # Hide the speedwm bar when the systray is running.
|
||||||
ALPHA_BARHIDDEN=255 # Opacity of the systray when the dwm bar is hidden (0 is opaque, 255 is fully transparent)
|
ALPHA_BARHIDDEN=255 # Opacity of the systray when the speedwm bar is hidden (0 is opaque, 255 is fully transparent)
|
||||||
TRANSPARENT=true # Transparent or not (true/false)
|
TRANSPARENT=true # Transparent or not (true/false)
|
||||||
EXPORTDIR=$HOME/.config/dwm-de/systray # Config directory
|
EXPORTDIR=$HOME/.config/speedwm-de/systray # Config directory
|
||||||
HEIGHT=18 # Height of the systray
|
HEIGHT=18 # Height of the systray
|
||||||
WIDTH=30 # Width of the systray
|
WIDTH=30 # Width of the systray
|
||||||
|
SHOW_SYSTRAY_WHEN_BARPADDING=true # Show systray if vertical barpadding is enabled
|
||||||
mkdir -p $EXPORTDIR
|
mkdir -p $EXPORTDIR
|
||||||
|
|
||||||
# Load config if available and override settings
|
# Load config if available and override settings
|
||||||
|
@ -33,11 +34,12 @@ else
|
||||||
printf "\nGET_EDGE_AUTO=$GET_EDGE_AUTO # Get edge automatically (true/false)" >> $EXPORTDIR/config
|
printf "\nGET_EDGE_AUTO=$GET_EDGE_AUTO # Get edge automatically (true/false)" >> $EXPORTDIR/config
|
||||||
printf "\nSYSTRAY_COL=$SYSTRAY_COL # When using pywal, set color to background (1) or backgroundmid (0)" >> $EXPORTDIR/config
|
printf "\nSYSTRAY_COL=$SYSTRAY_COL # When using pywal, set color to background (1) or backgroundmid (0)" >> $EXPORTDIR/config
|
||||||
printf "\nALPHA=$ALPHA # Opacity of the systray (0 is opaque, 255 is fully transparent)" >> $EXPORTDIR/config
|
printf "\nALPHA=$ALPHA # Opacity of the systray (0 is opaque, 255 is fully transparent)" >> $EXPORTDIR/config
|
||||||
printf "\nALPHA_BARHIDDEN=$ALPHA_BARHIDDEN # Opacity of the systray when the dwm bar is hidden (0 is opaque, 255 is fully transparent)" >> $EXPORTDIR/config
|
printf "\nALPHA_BARHIDDEN=$ALPHA_BARHIDDEN # Opacity of the systray when the speedwm bar is hidden (0 is opaque, 255 is fully transparent)" >> $EXPORTDIR/config
|
||||||
printf "\nTRANSPARENT=true # Transparent or not (true/false)" >> $EXPORTDIR/config
|
printf "\nTRANSPARENT=true # Transparent or not (true/false)" >> $EXPORTDIR/config
|
||||||
printf "\nHIDE_BAR_WHEN_SYSTRAY_SHOW=$HIDE_BAR_WHEN_SYSTRAY_SHOW # Hide the dwm bar when the systray is running." >> $EXPORTDIR/config
|
printf "\nHIDE_BAR_WHEN_SYSTRAY_SHOW=$HIDE_BAR_WHEN_SYSTRAY_SHOW # Hide the speedwm bar when the systray is running." >> $EXPORTDIR/config
|
||||||
printf "\nUSE_SRG=$USE_SRG # Use $SYSTRAY-srg (available in Gentoo repos and AUR as $SYSTRAY-srg-git) instead of $SYSTRAY adding more features (true/false)" >> $EXPORTDIR/config
|
printf "\nUSE_SRG=$USE_SRG # Use $SYSTRAY-srg (available in Gentoo repos and AUR as $SYSTRAY-srg-git) instead of $SYSTRAY adding more features (true/false)" >> $EXPORTDIR/config
|
||||||
printf "\nUSE_DEFAULT_TINT=$USE_DEFAULT_TINT # Use default $TINT or use $SYSTRAY_COL" >> $EXPORTDIR/config
|
printf "\nUSE_DEFAULT_TINT=$USE_DEFAULT_TINT # Use default $TINT or use $SYSTRAY_COL" >> $EXPORTDIR/config
|
||||||
|
printf "\nSHOW_SYSTRAY_WHEN_BARPADDING=$SHOW_SYSTRAY_WHEN_BARPADDING # Show systray if vertical barpadding is enabled" >> $EXPORTDIR/config
|
||||||
printf "\nHEIGHT=$HEIGHT # Height of the systray" >> $EXPORTDIR/config
|
printf "\nHEIGHT=$HEIGHT # Height of the systray" >> $EXPORTDIR/config
|
||||||
printf "\nWIDTH=$WIDTH # Width of the systray\n" >> $EXPORTDIR/config
|
printf "\nWIDTH=$WIDTH # Width of the systray\n" >> $EXPORTDIR/config
|
||||||
fi
|
fi
|
||||||
|
@ -63,7 +65,7 @@ PYWAL_TINT() {
|
||||||
# Set edge
|
# Set edge
|
||||||
SETEDGE() {
|
SETEDGE() {
|
||||||
if [ "$GET_EDGE_AUTO" = "true" ]; then
|
if [ "$GET_EDGE_AUTO" = "true" ]; then
|
||||||
if [ -e "/usr/share/dwm-topbar" ]; then
|
if [ -e "/usr/share/speedwm-topbar" ]; then
|
||||||
EDGE="top"
|
EDGE="top"
|
||||||
else
|
else
|
||||||
EDGE="bottom"
|
EDGE="bottom"
|
||||||
|
@ -102,16 +104,16 @@ USE() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Update dwm
|
# Update speedwm
|
||||||
UPDATE() {
|
UPDATE() {
|
||||||
|
|
||||||
FAIL_SOURCEDOESNOTEXIST() {
|
FAIL_SOURCEDOESNOTEXIST() {
|
||||||
echo "The dwm source code directory could not be located. This means an automatic update cannot be performed. Clone a new build (instructions on https://speedie.gq/dwm) and update manually."
|
echo "The speedwm source code directory could not be located. This means an automatic update cannot be performed. Clone a new build (instructions on https://speedie.gq/speedwm) and update manually."
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
FAIL_NOT_INSTALLED_USING_GIT() {
|
FAIL_NOT_INSTALLED_USING_GIT() {
|
||||||
echo "Your build of dwm was likely not installed through Git (maybe installed using a tarball?) so therefore the update cannot continue. Clone a new build (instructions on https://speedie.gq/dwm) and update manually."
|
echo "Your build of speedwm was likely not installed through Git (maybe installed using a tarball?) so therefore the update cannot continue. Clone a new build (instructions on https://speedie.gq/speedwm) and update manually."
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,14 +122,14 @@ USE() {
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
SOURCEDIR=$(cat /usr/share/dwm-sourcedir)
|
SOURCEDIR=$(cat /usr/share/speedwm-sourcedir)
|
||||||
test $SOURCEDIR || FAIL_SOURCEDOESNOTEXIST
|
test $SOURCEDIR || FAIL_SOURCEDOESNOTEXIST
|
||||||
|
|
||||||
# Check if Git is available
|
# Check if Git is available
|
||||||
if [ -e "${BINDIR}git" ]; then
|
if [ -e "${BINDIR}git" ]; then
|
||||||
echo "Git found!"
|
echo "Git found!"
|
||||||
else
|
else
|
||||||
echo "Git was not found, therefore the dwm update cannot continue." ; exit 1
|
echo "Git was not found, therefore the speedwm update cannot continue." ; exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd $SOURCEDIR
|
cd $SOURCEDIR
|
||||||
|
@ -135,16 +137,16 @@ USE() {
|
||||||
git pull || FAIL_NOT_INSTALLED_USING_GIT
|
git pull || FAIL_NOT_INSTALLED_USING_GIT
|
||||||
clear
|
clear
|
||||||
|
|
||||||
echo "dwm requires root permissions briefly to run the following command:\nmake clean install\nEnter your password to allow this.\n"
|
echo "speedwm requires root permissions briefly to run the following command:\nmake clean install\nEnter your password to allow this.\n"
|
||||||
su -c "make clean install" || FAIL_NO_AUTH
|
su -c "make clean install" || FAIL_NO_AUTH
|
||||||
echo 'dwm has been updated!'
|
echo 'speedwm has been updated!'
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$OPT" in
|
case "$OPT" in
|
||||||
"-toggle") TOGGLE ;;
|
"-toggle") TOGGLE ;;
|
||||||
"-update-dwm") UPDATE ;;
|
"-update-speedwm") UPDATE ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
case "$OPT" in
|
case "$OPT" in
|
||||||
|
@ -157,7 +159,7 @@ USE() {
|
||||||
if [ "$HIDE_BAR_WHEN_SYSTRAY_SHOW" = "true" ]; then
|
if [ "$HIDE_BAR_WHEN_SYSTRAY_SHOW" = "true" ]; then
|
||||||
xsetroot -name "fsignal:23"
|
xsetroot -name "fsignal:23"
|
||||||
fi ;;
|
fi ;;
|
||||||
"") echo "dwm-core\n-start | Start the systray and restart status\n-stop | Stop the systray and restart status\n-toggle | Toggle systray and restart status\n-update-dwm | Update dwm using git\n-curl-weather | Curl wttr.in in a readable format\n-curl-cheatsheet | Ask the user what cheatsheet they want and then curl it." ;;
|
"") echo "speedwm-core\n-start | Start the systray and restart status\n-stop | Stop the systray and restart status\n-toggle | Toggle systray and restart status\n-update-speedwm | Update speedwm using git\n-curl-weather | Curl wttr.in in a readable format\n-curl-cheatsheet | Ask the user what cheatsheet they want and then curl it." ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,10 +172,14 @@ esac
|
||||||
|
|
||||||
# Start systray
|
# Start systray
|
||||||
if [ -e "${BINDIR}$SYSTRAY" ]; then
|
if [ -e "${BINDIR}$SYSTRAY" ]; then
|
||||||
if [ -e "/usr/share/dwm-nopadding" ]; then
|
if [ -e "/usr/share/speedwm-nopadding" ]; then
|
||||||
if [ -e "$HOME/.config/dwm-de/dwmrc" ]; then
|
if [ -e "$HOME/.config/speedwm-de/speedwmrc" ]; then
|
||||||
grep "vertpad" $HOME/.config/dwm-de/dwmrc > /tmp/out
|
if [ "$SHOW_SYSTRAY_WHEN_BARPADDING" = "true" ]; then
|
||||||
|
USE
|
||||||
|
else
|
||||||
|
grep "barpaddingv" $HOME/.config/speedwm-de/speedwmrc > /tmp/out
|
||||||
grep "0" /tmp/out > /dev/null && USE
|
grep "0" /tmp/out > /dev/null && USE
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
USE
|
USE
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue