Initial commit
This commit is contained in:
10
home/.config/polybar/scripts/compton-toggle.sh
Executable file
10
home/.config/polybar/scripts/compton-toggle.sh
Executable file
@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
START="al-compositor --start"
|
||||
STOP="al-compositor --stop"
|
||||
|
||||
if (pgrep -x "compton" > /dev/null); then
|
||||
$STOP
|
||||
else
|
||||
$START
|
||||
fi
|
11
home/.config/polybar/scripts/compton.sh
Executable file
11
home/.config/polybar/scripts/compton.sh
Executable file
@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#The icon that would change color
|
||||
icon=" "
|
||||
|
||||
if pgrep -x "compton" > /dev/null
|
||||
then
|
||||
echo "%{F#EFF0F1}$icon"
|
||||
else
|
||||
echo "%{F#484852}$icon"
|
||||
fi
|
7
home/.config/polybar/scripts/killbar
Executable file
7
home/.config/polybar/scripts/killbar
Executable file
@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
killall -q polybar
|
||||
|
||||
while pgrep -u $UID -x polybar >/dev/null; do sleep 0.5; done
|
||||
|
||||
echo "Bars stopped..."
|
41
home/.config/polybar/scripts/launch-polybar
Executable file
41
home/.config/polybar/scripts/launch-polybar
Executable file
@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# config location
|
||||
CONF_PATH=$HOME/.config/polybar
|
||||
|
||||
# Check WM
|
||||
cur_wm=$(wmctrl -m | grep Name | cut -d " " -f2)
|
||||
|
||||
if [[ $1 == --reload ]]; then
|
||||
if ! [[ $cur_wm == i3 ]]; then
|
||||
openbox --restart
|
||||
al-compositor --restart
|
||||
al-tint2restart
|
||||
else
|
||||
echo -e "WARN: Option [--reload] not meant for i3..\n\nUse [Super]+[Shift]+r to reload i3\n"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Terminate already running bar instances
|
||||
killall -q polybar
|
||||
|
||||
if pgrep -x "tint2" >/dev/null; then
|
||||
echo "Tint is running, not launching bars"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Wait until the processes have been shut down
|
||||
while pgrep -u $UID -x polybar >/dev/null; do sleep 0.5; done
|
||||
|
||||
|
||||
echo "WM is $cur_wm... Launching appropriate bars"
|
||||
|
||||
if [[ $cur_wm == i3 ]]; then # if i3 launch the i3-bar
|
||||
polybar -r --config=$CONF_PATH/config i3-bar &
|
||||
|
||||
else # otherwise we assume openbox
|
||||
polybar -r --config=$CONF_PATH/config openbox-bar &
|
||||
|
||||
fi
|
||||
|
||||
echo "Bars launched..."
|
13
home/.config/polybar/scripts/network.sh
Executable file
13
home/.config/polybar/scripts/network.sh
Executable file
@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
online=$(ip addr | grep "state UP" | cut -d ":" -f2)
|
||||
|
||||
#connected=""
|
||||
#offline=""
|
||||
connected=" "
|
||||
offline=" "
|
||||
if [[ "$online" ]]; then
|
||||
echo %{F#8FA1B3}${connected}
|
||||
else
|
||||
echo %{F#E7816B}${offline}; sleep 0.6; echo %{F#8FA1B3}${offline}
|
||||
fi
|
11
home/.config/polybar/scripts/pkg.sh
Executable file
11
home/.config/polybar/scripts/pkg.sh
Executable file
@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
pac=$(checkupdates | wc -l)
|
||||
|
||||
if [[ "$pac" > "1" ]]; then
|
||||
echo %{F#6BA4E7}$pac %{F#6BA4E7}
|
||||
|
||||
else
|
||||
echo
|
||||
|
||||
fi
|
36
home/.config/polybar/scripts/redshift
Executable file
36
home/.config/polybar/scripts/redshift
Executable file
@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#Usage : redshift.sh [toggle]
|
||||
|
||||
START='redshift'
|
||||
STOP="killall redshift"
|
||||
if [[ "$@" = *toggle* ]]; then
|
||||
if pgrep redshift > /dev/null
|
||||
then
|
||||
$STOP
|
||||
else
|
||||
$START &
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# Specifying the icon(s) in the script
|
||||
# This allows us to change its appearance conditionally
|
||||
icon=""
|
||||
|
||||
pgrep -x redshift &> /dev/null
|
||||
if [[ $? -eq 0 ]]; then
|
||||
temp=$(redshift -p 2>/dev/null | grep temp | cut -d' ' -f3)
|
||||
temp=${temp//K/}
|
||||
fi
|
||||
|
||||
# OPTIONAL: Append ' ${temp}K' after $icon
|
||||
if [[ -z $temp ]]; then
|
||||
echo "%{F#8FA1B3} $icon " # Greyed out (not running)
|
||||
elif [[ $temp -ge 5000 ]]; then
|
||||
echo "%{F#6BA4E7} $icon " # Blue
|
||||
elif [[ $temp -ge 4000 ]]; then
|
||||
echo "%{F#F9F1AF} $icon " # Yellow
|
||||
else
|
||||
echo "%{F#E7816B} $icon " # Orange
|
||||
fi
|
32
home/.config/polybar/scripts/trash
Executable file
32
home/.config/polybar/scripts/trash
Executable file
@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
TRASH_DIRECTORY="${BLOCK_INSTANCE}"
|
||||
|
||||
if [[ "${TRASH_DIRECTORY}" = "" ]]; then
|
||||
TRASH_DIRECTORY="${XDG_DATA_HOME:-${HOME}/.local/share}/Trash"
|
||||
fi
|
||||
|
||||
# Left click
|
||||
if [[ "${BLOCK_BUTTON}" -eq 1 ]]; then
|
||||
xdg-open "${TRASH_DIRECTORY}/files"
|
||||
# Right click
|
||||
elif [[ "${BLOCK_BUTTON}" -eq 3 ]]; then
|
||||
# Delete all files permanently (unlink them)
|
||||
rm -r "${TRASH_DIRECTORY}/files"
|
||||
rm -r "${TRASH_DIRECTORY}/info"
|
||||
# Create new directory
|
||||
mkdir "${TRASH_DIRECTORY}/files"
|
||||
mkdir "${TRASH_DIRECTORY}/info"
|
||||
fi
|
||||
|
||||
TRASH_COUNT=$(ls -U -1 "${TRASH_DIRECTORY}/files" | wc -l)
|
||||
|
||||
URGENT_VALUE=30
|
||||
|
||||
echo "${TRASH_COUNT}"
|
||||
echo "${TRASH_COUNT}"
|
||||
echo ""
|
||||
|
||||
if [[ "${TRASH_COUNT}" -ge "${URGENT_VALUE}" ]]; then
|
||||
exit 31
|
||||
fi
|
Reference in New Issue
Block a user