Update sxmo hooks, prompt, profile, and bashrc
Signed-off-by: Aleksandar 'The Cobra' Widulski <thecobra@riseup.net>
This commit is contained in:
parent
1907aa119c
commit
89e0dd41a7
|
@ -0,0 +1 @@
|
|||
. ~/.bashrc
|
3
.bashrc
3
.bashrc
|
@ -38,7 +38,8 @@ update() { boas sh -c 'apk update && apk upgrade -aiv && apk fix'; }
|
|||
|
||||
# Im too lazy to type
|
||||
copy() {
|
||||
tee >(wl-copy)
|
||||
printf '%s' "$(</dev/stdin)" | tee >(wl-copy)
|
||||
echo
|
||||
}
|
||||
|
||||
# Source colors for tty
|
||||
|
|
|
@ -58,11 +58,6 @@ case "$WMCLASS" in
|
|||
sxmo_daemons.sh running lisgd -q &&
|
||||
printf "%s" "$icon_ton" || printf "%s" "$icon_tof"
|
||||
) ^ 1 ^ toggle_daemon 'Lisgd' lisgd sxmo_hooks.sh lisgdstart
|
||||
$icon_bth Bluetooth $(
|
||||
rfkill -rn | grep bluetooth | grep -qE "unblocked unblocked" &&
|
||||
printf %b "$icon_ton" || printf %b "$icon_tof";
|
||||
printf %b "^ 1 ^ doas sxmo_bluetoothtoggle.sh && sxmo_hooks.sh statusbar bluetooth"
|
||||
)
|
||||
$icon_wif Wifi $(
|
||||
rfkill -rn | grep wlan | grep -qE "unblocked unblocked" &&
|
||||
printf %b "$icon_ton" || printf %b "$icon_tof";
|
||||
|
@ -505,10 +500,6 @@ case "$WMCLASS" in
|
|||
$icon_phn Dialer ^ 0 ^ sxmo_modemdial.sh
|
||||
$icon_msg Texts ^ 0 ^ sxmo_modemtext.sh
|
||||
$icon_usr Contacts ^ 0 ^ sxmo_contactmenu.sh
|
||||
$(
|
||||
rfkill -rn | grep bluetooth | grep -qE "unblocked unblocked" &&
|
||||
printf %b "$icon_bth Bluetooth ^ 1 ^ sxmo_bluetoothmenu.sh"
|
||||
)
|
||||
$(command -v megapixels >/dev/null && echo "$icon_cam Camera ^ 0 ^ GDK_SCALE=2 megapixels")
|
||||
$(
|
||||
if [ -z "$SXMO_DISABLE_LEDS" ]; then
|
||||
|
|
|
@ -229,13 +229,13 @@ _volume() {
|
|||
|
||||
VOL="$(sxmo_audio.sh vol get)"
|
||||
if [ -z "$VOL" ] || [ "$VOL" -eq 0 ]; then
|
||||
printf "%s" "$icon_mut"
|
||||
printf "%s " "$icon_mut"
|
||||
elif [ "$VOL" -gt 66 ]; then
|
||||
printf "%s" "$icon_spk"
|
||||
printf "%s " "$icon_spk"
|
||||
elif [ "$VOL" -gt 33 ]; then
|
||||
printf "%s" "$icon_spm"
|
||||
printf "%s " "$icon_spm"
|
||||
elif [ "$VOL" -gt 0 ]; then
|
||||
printf "%s" "$icon_spl"
|
||||
printf "%s " "$icon_spl"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -252,7 +252,7 @@ set_cputemp() {
|
|||
}
|
||||
|
||||
_ram() {
|
||||
printf '%s%s' "$icon_ram" "$(free -h | awk '{print $3}' | sed '2!d')"
|
||||
printf '%s %s' "$icon_ram" "$(free -h | awk '{print $3}' | sed '2!d')"
|
||||
}
|
||||
|
||||
set_ram() {
|
||||
|
@ -260,7 +260,7 @@ set_ram() {
|
|||
}
|
||||
|
||||
_cpuusage() {
|
||||
printf "%s%s%%" "$icon_cpu" "$(printf "scale=2;%s/%s\n" "$(ps aux | awk 'BEGIN {sum=0} {sum+=$3}; END {print sum}')" "$(nproc --all)" | bc)"
|
||||
printf "%s %s%%" "$icon_cpu" "$(printf "scale=2;%s/%s\n" "$(ps aux | awk 'BEGIN {sum=0} {sum+=$3}; END {print sum}')" "$(nproc --all)" | bc)"
|
||||
}
|
||||
|
||||
set_cpuusage() {
|
||||
|
@ -268,7 +268,7 @@ set_cpuusage() {
|
|||
}
|
||||
|
||||
_linux() {
|
||||
printf '%s%s' "$icon_tux" "$(uname -r)"
|
||||
printf '%s %s' "$icon_tux" "$(uname -r)"
|
||||
}
|
||||
|
||||
set_linux() {
|
||||
|
|
1
.profile
1
.profile
|
@ -1,4 +1,3 @@
|
|||
export EDITOR=vim
|
||||
export INVIDIOUS="https://invidious.snopyta.org"
|
||||
export PATH="$HOME/.local/bin:$PATH"
|
||||
[ -r ~/.bashrc ] && case $_ in *i*) . ~/.bashrc;; esac
|
||||
|
|
22
.prompt
22
.prompt
|
@ -105,17 +105,9 @@ __prompt() {
|
|||
CMD_TIME="$(((PROMPT_RT1M-LAST_RT1M)/1000000))"
|
||||
CMD_TIME="${CMD_TIME:-0}"
|
||||
|
||||
local LAST_US="$((10#0${LAST_RT: -6}))"
|
||||
local LAST_US="${LAST_US:-0}"
|
||||
local PROMPT_US="${PROMPT_RT: -6}"
|
||||
local PROMPT_US_CLN="$((10#0$PROMPT_US))"
|
||||
local PROMPT_US_CLN="${PROMPT_US_CLN:-0}"
|
||||
|
||||
[[ $PROMPT_US_CLN < $LAST_US ]] &&
|
||||
CMD_US="$((1$PROMPT_US-$LAST_US))" ||
|
||||
CMD_US="$(($PROMPT_US_CLN-$LAST_US))"
|
||||
CMD_US="$((10#0$CMD_US))"
|
||||
CMD_US="$(($PROMPT_RT1M-$LAST_RT1M))"
|
||||
[[ ${#CMD_US} -lt 6 ]] || CMD_US="${CMD_US: -6}"
|
||||
CMD_US="$((10#0$CMD_US))"
|
||||
|
||||
# Set prompt sections
|
||||
|
||||
|
@ -142,18 +134,18 @@ __prompt() {
|
|||
done
|
||||
|
||||
# [user@homeserver:~]
|
||||
local COL="$([[ $UID == 0 ]] && printf %s "$RED" || printf %s "$YLW")"
|
||||
local UHD="$BLD$BLU[$COL\u$PRP@$CYN\h$PRP:$GRN\w$BLU]"
|
||||
local COL="$([[ $UID == 0 ]] && printf '%s' "$RED" || printf '%s' "$YLW")"
|
||||
local UHD="${BLD}${BLU}[${COL}\u${PRP}@${CYN}\h${PRP}:${GRN}\w${BLU}]"
|
||||
|
||||
# 2y 351d 12m 43s 382969μs
|
||||
local TIME="$YLW$(__get_cmd_time)"
|
||||
local TIME="${YLW}$(__get_cmd_time)"
|
||||
|
||||
# Random colored $ or #
|
||||
local RAND256="\[\033[38;2;$RANDOM;$RANDOM;${RANDOM}m\]"
|
||||
local IND="$RAND256\\$"
|
||||
local IND="${RAND256}\\$"
|
||||
|
||||
# Set the prompt
|
||||
PS1="$NON$SIG$UHD $TIME $IND $NON"
|
||||
PS1="${NON}${SIG}${UHD} ${TIME} ${IND} ${NON}"
|
||||
}
|
||||
|
||||
PROMPT_COMMAND=__prompt
|
||||
|
|
Loading…
Reference in New Issue