Add dotfiles
This commit is contained in:
parent
49bfe1a4d3
commit
b6e01a720b
52 changed files with 4701 additions and 0 deletions
20
dwmbar/config
Normal file
20
dwmbar/config
Normal file
|
@ -0,0 +1,20 @@
|
|||
#!/bin/bash
|
||||
|
||||
# What modules, in what order
|
||||
MODULES="voidupdates kernel ram cpuload cputemp battery time date"
|
||||
|
||||
# Modules that require an active internet connection
|
||||
ONLINE_MODULES="weather internet"
|
||||
|
||||
# Delay between showing the status bar
|
||||
DELAY="0.05"
|
||||
|
||||
# Where the custom modules are stored
|
||||
CUSTOM_DIR="/home/$USER/.config/dwmbar/modules/custom/"
|
||||
|
||||
# Separator between modules
|
||||
SEPARATOR=" | "
|
||||
|
||||
# Padding at the end and beginning of the status bar
|
||||
RIGHT_PADDING=" "
|
||||
LEFT_PADDING=" "
|
27
dwmbar/modules/archupdates
Executable file
27
dwmbar/modules/archupdates
Executable file
|
@ -0,0 +1,27 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Prints out the number of pacman updates (Arch Linux)
|
||||
# Requires an internet connection
|
||||
# Depends on yay and checkupdates (pacman-contrib)
|
||||
# Optional: add --devel flag to the yay cmd to check for *-git package updates.
|
||||
|
||||
PREFIX=' Updates: '
|
||||
|
||||
get_updates()
|
||||
{
|
||||
if ! updates_arch=$(checkupdates 2> /dev/null | wc -l ); then
|
||||
updates_arch=0
|
||||
fi
|
||||
|
||||
if ! updates_aur=$(yay -Qum 2> /dev/null | wc -l); then
|
||||
updates_aur=0
|
||||
fi
|
||||
|
||||
updates=$(("$updates_arch" + "$updates_aur"))
|
||||
|
||||
echo "$PREFIX$updates"
|
||||
}
|
||||
|
||||
if [ $(( 10#$(date '+%M') % 3 )) -eq 0 ] && [ $(( 10#$(date '+%S') )) -eq 5 ]; then
|
||||
get_updates
|
||||
fi
|
13
dwmbar/modules/backlight
Executable file
13
dwmbar/modules/backlight
Executable file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Prints the backlight percentage
|
||||
# Requires the light package
|
||||
|
||||
PREFIX='ﯧ'
|
||||
|
||||
get_backlight()
|
||||
{
|
||||
echo "$PREFIX $(light | sed 's/\..*//g')%"
|
||||
}
|
||||
|
||||
get_backlight
|
43
dwmbar/modules/battery
Executable file
43
dwmbar/modules/battery
Executable file
|
@ -0,0 +1,43 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Prints out battery percentage
|
||||
|
||||
CHARGING_ICON=' '
|
||||
WARNING_ICON=' '
|
||||
BATTERY_FULL_ICON=''
|
||||
BATTERY_2_ICON=''
|
||||
BATTERY_3_ICON=''
|
||||
BATTERY_4_ICON=''
|
||||
|
||||
FULL_AT=98
|
||||
|
||||
BAT_ICON=""
|
||||
ICON=""
|
||||
|
||||
get_battery()
|
||||
{
|
||||
# The vast majority of people only use one battery.
|
||||
|
||||
if [ -d /sys/class/power_supply/BAT0 ]; then
|
||||
capacity=$(cat /sys/class/power_supply/BAT0/capacity)
|
||||
charging=$(cat /sys/class/power_supply/BAT0/status)
|
||||
if [[ "$charging" == "Charging" ]]; then
|
||||
ICON="$CHARGING_ICON"
|
||||
elif [[ $capacity -le 25 ]]; then
|
||||
ICON="$WARNING_ICON"
|
||||
fi
|
||||
|
||||
if [[ $capacity -ge $FULL_AT ]]; then
|
||||
BAT_ICON=$BATTERY_FULL_ICON
|
||||
elif [[ $capacity -le 25 ]]; then
|
||||
BAT_ICON=$BATTERY_4_ICON
|
||||
elif [[ $capacity -le 60 ]]; then
|
||||
BAT_ICON=$BATTERY_3_ICON
|
||||
elif [[ $capacity -le $FULL_AT ]]; then
|
||||
BAT_ICON=$BATTERY_2_ICON
|
||||
fi
|
||||
fi
|
||||
echo "$ICON$BAT_ICON $capacity%"
|
||||
}
|
||||
|
||||
get_battery
|
21
dwmbar/modules/bluetooth
Executable file
21
dwmbar/modules/bluetooth
Executable file
|
@ -0,0 +1,21 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Prints out the bluetooth status
|
||||
|
||||
BLUETOOTH_ON_ICON=''
|
||||
BLUETOOTH_OFF_ICON=''
|
||||
|
||||
get_bluetooth()
|
||||
{
|
||||
status=$(systemctl is-active bluetooth.service)
|
||||
|
||||
if [ "$status" == "active" ]
|
||||
then
|
||||
echo "$BLUETOOTH_ON_ICON"
|
||||
else
|
||||
:
|
||||
#echo "$BLUETOOTH_OFF_ICON"
|
||||
fi
|
||||
}
|
||||
|
||||
get_bluetooth
|
32
dwmbar/modules/cpuload
Executable file
32
dwmbar/modules/cpuload
Executable file
|
@ -0,0 +1,32 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Prints out the CPU load percentage
|
||||
|
||||
PREFIX=' '
|
||||
|
||||
get_load()
|
||||
{
|
||||
# Get the first line with aggregate of all CPUs
|
||||
cpu_last=($(head -n1 /proc/stat))
|
||||
cpu_last_sum="${cpu_last[@]:1}"
|
||||
cpu_last_sum=$((${cpu_last_sum// /+}))
|
||||
|
||||
sleep 0.05
|
||||
|
||||
cpu_now=($(head -n1 /proc/stat))
|
||||
cpu_sum="${cpu_now[@]:1}"
|
||||
cpu_sum=$((${cpu_sum// /+}))
|
||||
|
||||
cpu_delta=$((cpu_sum - cpu_last_sum))
|
||||
cpu_idle=$((cpu_now[4]- cpu_last[4]))
|
||||
cpu_used=$((cpu_delta - cpu_idle))
|
||||
cpu_usage=$((100 * cpu_used / cpu_delta))
|
||||
|
||||
# Keep this as last for our next read
|
||||
cpu_last=("${cpu_now[@]}")
|
||||
cpu_last_sum=$cpu_sum
|
||||
|
||||
echo "$PREFIX $cpu_usage%"
|
||||
}
|
||||
|
||||
get_load
|
25
dwmbar/modules/cputemp
Executable file
25
dwmbar/modules/cputemp
Executable file
|
@ -0,0 +1,25 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Gets temperature of the CPU
|
||||
# Dependencies: lm_sensors
|
||||
|
||||
PREFIX=' '
|
||||
FIRE=' '
|
||||
|
||||
WARNING_LEVEL=80
|
||||
|
||||
get_cputemp()
|
||||
{
|
||||
# CPU_T=$(cat /sys/devices/platform/coretemp.0/hwmon/hwmon?/temp2_input)
|
||||
# CPU_TEMP=$(expr $CPU_T / 1000)
|
||||
|
||||
CPU_TEMP="$(sensors | grep temp1 | awk 'NR==1{gsub("+", " "); gsub("\\..", " "); print $2}')"
|
||||
|
||||
if [ "$CPU_TEMP" -ge $WARNING_LEVEL ]; then
|
||||
PREFIX="$FIRE$PREFIX"
|
||||
fi
|
||||
|
||||
echo "$PREFIX$CPU_TEMP°C"
|
||||
}
|
||||
|
||||
get_cputemp
|
12
dwmbar/modules/date
Executable file
12
dwmbar/modules/date
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Prints out the date
|
||||
|
||||
PREFIX=''
|
||||
|
||||
get_date()
|
||||
{
|
||||
echo "$PREFIX $(date '+%d-%m-%y (%a)')"
|
||||
}
|
||||
|
||||
get_date
|
12
dwmbar/modules/day_of_week
Executable file
12
dwmbar/modules/day_of_week
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Prints out the date
|
||||
|
||||
PREFIX=''
|
||||
|
||||
get_day()
|
||||
{
|
||||
echo "$PREFIX $(date '+%a')"
|
||||
}
|
||||
|
||||
get_day
|
11
dwmbar/modules/daypercentage
Executable file
11
dwmbar/modules/daypercentage
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
PREFIX = ' '
|
||||
|
||||
import datetime
|
||||
|
||||
now = datetime.datetime.now()
|
||||
minutes = now.hour * 60 + now.minute
|
||||
percentage = round(minutes * 100 / 1440)
|
||||
|
||||
print(PREFIX + str(percentage) + "%")
|
12
dwmbar/modules/default_shell
Executable file
12
dwmbar/modules/default_shell
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Prints out the name of the default shell
|
||||
|
||||
PREFIX=' '
|
||||
|
||||
get_default_shell()
|
||||
{
|
||||
echo "$PREFIX$(echo $SHELL |sed 's/.*\///g')"
|
||||
}
|
||||
|
||||
get_default_shell
|
16
dwmbar/modules/disksize
Executable file
16
dwmbar/modules/disksize
Executable file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Prints out the total disk memory and the available memory
|
||||
|
||||
PREFIX=' '
|
||||
|
||||
get_disk()
|
||||
{
|
||||
TOTAL_SIZE=$( df -h --total | tail -1 | awk {'printf $2'})
|
||||
USED_SIZE=$(df -h --total | tail -1 | awk {'printf $3'})
|
||||
PERCENTAGE=$(df -h --total | tail -1 | awk {'printf $5'})
|
||||
|
||||
echo "$USED_SIZE/$TOTAL_SIZE ($PERCENTAGE)"
|
||||
}
|
||||
|
||||
get_disk
|
16
dwmbar/modules/ethernet
Executable file
16
dwmbar/modules/ethernet
Executable file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Prints out if there is an ethernet cable connected
|
||||
|
||||
ETHERNET_ICON=''
|
||||
|
||||
get_ethernet()
|
||||
{
|
||||
if [ -d /sys/class/net/eth? ]; then
|
||||
if [ "$(cat /sys/class/net/eth?/carrier)" == "1" ]; then
|
||||
echo "$ETHERNET_ICON"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
get_ethernet
|
13
dwmbar/modules/fanspeed
Executable file
13
dwmbar/modules/fanspeed
Executable file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Prints the fan RPM
|
||||
# Depends on lm_sensors
|
||||
|
||||
PREFIX=' '
|
||||
|
||||
get_fan_speed()
|
||||
{
|
||||
echo "$PREFIX$(sensors | grep fan1 | awk 'NR==1{print $2}') RPM"
|
||||
}
|
||||
|
||||
get_fan_speed
|
12
dwmbar/modules/hostname
Executable file
12
dwmbar/modules/hostname
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Prints USER@hostname
|
||||
|
||||
PREFIX=' '
|
||||
|
||||
get_hostname()
|
||||
{
|
||||
echo "$PREFIX$USER@$(hostname)"
|
||||
}
|
||||
|
||||
get_hostname
|
BIN
dwmbar/modules/internet
Executable file
BIN
dwmbar/modules/internet
Executable file
Binary file not shown.
12
dwmbar/modules/kernel
Executable file
12
dwmbar/modules/kernel
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Prints out the kernel version
|
||||
|
||||
PREFIX=' '
|
||||
|
||||
get_kernel()
|
||||
{
|
||||
echo "$PREFIX$(uname -r)"
|
||||
}
|
||||
|
||||
get_kernel
|
14
dwmbar/modules/localip
Executable file
14
dwmbar/modules/localip
Executable file
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Prints out your local IP
|
||||
|
||||
PREFIX='ﯱ '
|
||||
|
||||
get_local_ip()
|
||||
{
|
||||
IP=$(ip addr | grep -e "inet " | awk 'NR==2' | sed 's/^.*inet.//g; s/\/.*//g')
|
||||
|
||||
echo "$PREFIX$IP"
|
||||
}
|
||||
|
||||
get_local_ip
|
14
dwmbar/modules/mail
Executable file
14
dwmbar/modules/mail
Executable file
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Prints number of unread mail
|
||||
# Requires mutt/neomutt
|
||||
|
||||
MAIL_DIR="/home/$USER/Mail/INBOX/new/*"
|
||||
PREFIX=' :'
|
||||
|
||||
get_mail()
|
||||
{
|
||||
echo "$PREFIX$(du -a $MAIL_DIR 2>/dev/null | wc -l)"
|
||||
}
|
||||
|
||||
get_mail
|
25
dwmbar/modules/mpd
Executable file
25
dwmbar/modules/mpd
Executable file
|
@ -0,0 +1,25 @@
|
|||
#!/bin/bash
|
||||
|
||||
PREFIX_PLAY=' '
|
||||
PREFIX_PAUSE=' '
|
||||
|
||||
get_mpd()
|
||||
{
|
||||
current_song="$(mpc current)"
|
||||
|
||||
if [[ "$current_song" = "" ]]; then
|
||||
echo " "
|
||||
exit 0
|
||||
else
|
||||
playpause=$(mpc | awk '/\[.*]/{split($0, a, " "); print a[1]}')
|
||||
if [[ "$playpause" = "[playing]" ]]; then
|
||||
current_song="$PREFIX_PLAY $current_song"
|
||||
elif [[ "$playpause" = "[paused]" ]]; then
|
||||
current_song="$PREFIX_PAUSE $current_song"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "$current_song"
|
||||
}
|
||||
|
||||
get_mpd
|
31
dwmbar/modules/networkdowntraffic
Executable file
31
dwmbar/modules/networkdowntraffic
Executable file
|
@ -0,0 +1,31 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Prints out the current down network traffic in MB
|
||||
|
||||
PREFIX=' '
|
||||
|
||||
get_down_traffic()
|
||||
{
|
||||
RECEIVE1=0
|
||||
RECEIVE2=0
|
||||
|
||||
IFACES=$(ip -o link show | awk -F': ' '{print $2}')
|
||||
for IFACE in $IFACES; do
|
||||
if [ $IFACE != "lo" ]; then
|
||||
RECEIVE1=$(($(ip -s -c link show $IFACE | tail -n3 | head -n 1 | cut -d " " -f5) + $RECEIVE1))
|
||||
fi
|
||||
done
|
||||
|
||||
sleep 1
|
||||
|
||||
IFACES=$(ip -o link show | awk -F': ' '{print $2}')
|
||||
for IFACE in $IFACES; do
|
||||
if [ $IFACE != "lo" ]; then
|
||||
RECEIVE2=$(($(ip -s -c link show $IFACE | tail -n3 | head -n 1 | cut -d " " -f5) + $RECEIVE2))
|
||||
fi
|
||||
done
|
||||
|
||||
echo "$PREFIX$(expr $(expr $RECEIVE2 - $RECEIVE1 ) / 1000)KB/s"
|
||||
}
|
||||
|
||||
get_down_traffic
|
32
dwmbar/modules/networkuptraffic
Executable file
32
dwmbar/modules/networkuptraffic
Executable file
|
@ -0,0 +1,32 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Prints out the current up network traffic in MB
|
||||
|
||||
PREFIX=' '
|
||||
|
||||
get_up_traffic()
|
||||
{
|
||||
TRANSMIT1=0
|
||||
TRANSMIT2=0
|
||||
|
||||
IFACES=$(ip -o link show | awk -F': ' '{print $2}')
|
||||
for IFACE in $IFACES; do
|
||||
if [ $IFACE != "lo" ]; then
|
||||
TRANSMIT1=$(($(ip -s -c link show $IFACE | tail -n1 | cut -d " " -f5) + TRANSMIT1))
|
||||
fi
|
||||
done
|
||||
|
||||
sleep 1
|
||||
|
||||
IFACES=$(ip -o link show | awk -F': ' '{print $2}')
|
||||
for IFACE in $IFACES; do
|
||||
if [ $IFACE != "lo" ]; then
|
||||
TRANSMIT2=$(($(ip -s -c link show $IFACE | tail -n1 | cut -d " " -f5) + TRANSMIT2))
|
||||
fi
|
||||
done
|
||||
|
||||
echo "$PREFIX$(expr $(expr $TRANSMIT2 - $TRANSMIT1) / 1000)KB/s"
|
||||
}
|
||||
|
||||
get_up_traffic
|
||||
|
22
dwmbar/modules/nvidia_gpu_temp
Executable file
22
dwmbar/modules/nvidia_gpu_temp
Executable file
|
@ -0,0 +1,22 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Gets temperature of the GPU
|
||||
# Dependencies: nvidia drivers and nvidia-settings
|
||||
|
||||
PREFIX=' '
|
||||
FIRE=' '
|
||||
|
||||
WARNING_LEVEL=80
|
||||
|
||||
get_gputemp()
|
||||
{
|
||||
GPU_TEMP="$(nvidia-settings -q gpucoretemp -t | head -n 1)"
|
||||
|
||||
if [ "$GPU_TEMP" -ge $WARNING_LEVEL ]; then
|
||||
PREFIX="$FIRE$PREFIX"
|
||||
fi
|
||||
|
||||
echo "$PREFIX$GPU_TEMP°C"
|
||||
}
|
||||
|
||||
get_gputemp
|
14
dwmbar/modules/os-release
Executable file
14
dwmbar/modules/os-release
Executable file
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Prints out your OS name
|
||||
|
||||
PREFIX=' '
|
||||
|
||||
get_os_name()
|
||||
{
|
||||
OS=$(cat /etc/os-release | head -n 1 | sed 's/NAME=//g')
|
||||
|
||||
echo "$PREFIX$OS"
|
||||
}
|
||||
|
||||
get_os_name
|
14
dwmbar/modules/process_count
Executable file
14
dwmbar/modules/process_count
Executable file
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Prints out your process count
|
||||
|
||||
PREFIX=' '
|
||||
|
||||
get_proc_count()
|
||||
{
|
||||
PROC_COUNT=$(ps -Al | wc -l)
|
||||
|
||||
echo "$PREFIX$PROC_COUNT"
|
||||
}
|
||||
|
||||
get_proc_count
|
13
dwmbar/modules/publicip
Executable file
13
dwmbar/modules/publicip
Executable file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Prints out your public IP address
|
||||
# Depends on curl
|
||||
|
||||
PREFIX=' '
|
||||
|
||||
get_pub_ip()
|
||||
{
|
||||
echo "$PREFIX$(curl -s ifconfig.co)"
|
||||
}
|
||||
|
||||
get_pub_ip
|
16
dwmbar/modules/ram
Executable file
16
dwmbar/modules/ram
Executable file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Prints the total ram and used ram in Mb
|
||||
|
||||
PREFIX=' '
|
||||
|
||||
get_ram()
|
||||
{
|
||||
TOTAL_RAM=$(free -mh --si | awk {'print $2'} | head -n 2 | tail -1)
|
||||
USED_RAM=$(free -mh --si | awk {'print $3'} | head -n 2 | tail -1)
|
||||
MB="MB"
|
||||
|
||||
echo "$USED_RAM/$TOTAL_RAM"
|
||||
}
|
||||
|
||||
get_ram
|
13
dwmbar/modules/ram_perc
Executable file
13
dwmbar/modules/ram_perc
Executable file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Prints the total ram and used ram in Mb
|
||||
|
||||
PREFIX=' '
|
||||
|
||||
get_ram()
|
||||
{
|
||||
USED_RAM=$(free | awk '/Mem/{printf("%d"), $3/$2*100}')
|
||||
echo "$PREFIX$USED_RAM%"
|
||||
}
|
||||
|
||||
get_ram
|
13
dwmbar/modules/redshift
Executable file
13
dwmbar/modules/redshift
Executable file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Prints out the screen color temperature
|
||||
# Requires the redshift package
|
||||
|
||||
PREFIX=''
|
||||
|
||||
get_redshift()
|
||||
{
|
||||
echo "$PREFIX$(redshift -p 2> /dev/null | grep "temp" | awk '{print $3}')"
|
||||
}
|
||||
|
||||
get_redshift
|
10
dwmbar/modules/src/internet.c
Normal file
10
dwmbar/modules/src/internet.c
Normal file
|
@ -0,0 +1,10 @@
|
|||
#include <stdio.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
char *internet_icon = " ";
|
||||
|
||||
printf("%s\n", internet_icon);
|
||||
|
||||
return 0;
|
||||
}
|
18
dwmbar/modules/sunmoon
Executable file
18
dwmbar/modules/sunmoon
Executable file
|
@ -0,0 +1,18 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Outputs sun if its daytime and moon if its nighttime
|
||||
# Requires the redshift package
|
||||
|
||||
SUN_ICON='盛'
|
||||
MOON_ICON=''
|
||||
|
||||
get_sunmoon()
|
||||
{
|
||||
if [[ $(redshift -p | grep "Period" | awk '{print $2}') == "Night" ]]; then
|
||||
echo "$MOON_ICON"
|
||||
else
|
||||
echo "$SUN_ICON"
|
||||
fi
|
||||
}
|
||||
|
||||
get_sunmoon
|
12
dwmbar/modules/time
Executable file
12
dwmbar/modules/time
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Prints out the time
|
||||
|
||||
PREFIX=' '
|
||||
|
||||
get_time()
|
||||
{
|
||||
echo "$PREFIX$(date '+%H:%M')"
|
||||
}
|
||||
|
||||
get_time
|
15
dwmbar/modules/todo
Executable file
15
dwmbar/modules/todo
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Prints number of todos
|
||||
# Requires t todo manager (https://github.com/sjl/t)
|
||||
|
||||
TASKS_DIR="/home/$USER/.todo"
|
||||
TASKS_NAME="tasks"
|
||||
PREFIX=': '
|
||||
|
||||
get_todo()
|
||||
{
|
||||
echo "$PREFIX$(t --task-dir $TASKS_DIR --list $TASKS_NAME | wc -l)"
|
||||
}
|
||||
|
||||
get_todo
|
23
dwmbar/modules/tor
Executable file
23
dwmbar/modules/tor
Executable file
|
@ -0,0 +1,23 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Prints if the tor service is enabled or not
|
||||
# Requires tor
|
||||
|
||||
TOR_ENABLED='ﴣ'
|
||||
TOR_DISABLED=''
|
||||
|
||||
get_tor()
|
||||
{
|
||||
status=$(systemctl is-active tor.service)
|
||||
|
||||
if [ "$status" == "active" ]
|
||||
then
|
||||
echo "$TOR_ENABLED"
|
||||
else
|
||||
:
|
||||
#echo "$TOR_DISABLED"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
get_tor
|
13
dwmbar/modules/uptime
Executable file
13
dwmbar/modules/uptime
Executable file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Prints the total ram and used ram in Mb
|
||||
|
||||
PREFIX=''
|
||||
|
||||
get_uptime()
|
||||
{
|
||||
UPTIME=$(uptime | sed 's/.*up \([^,]*\), .*/\1/')
|
||||
echo "$PREFIX$UPTIME"
|
||||
}
|
||||
|
||||
get_uptime
|
14
dwmbar/modules/username
Executable file
14
dwmbar/modules/username
Executable file
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Prints the effective username of the current user
|
||||
|
||||
PREFIX=''
|
||||
|
||||
get_username()
|
||||
{
|
||||
USERNAME=$(whoami)
|
||||
|
||||
echo "$PREFIX $USERNAME"
|
||||
}
|
||||
|
||||
get_username
|
18
dwmbar/modules/voidupdates
Executable file
18
dwmbar/modules/voidupdates
Executable file
|
@ -0,0 +1,18 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Prints the number of updates for Void Linux
|
||||
|
||||
PREFIX=' Updates: '
|
||||
|
||||
get_updates()
|
||||
{
|
||||
if ! updates=$(xbps-install -Mun 2> /dev/null | wc -l ); then
|
||||
updates=0
|
||||
fi
|
||||
|
||||
echo "$PREFIX$updates"
|
||||
}
|
||||
|
||||
if [ $(( 10#$(date '+%M') % 3 )) -eq 0 ] && [ $(( 10#$(date '+%S') )) -eq 5 ]; then
|
||||
get_updates
|
||||
fi
|
20
dwmbar/modules/volume
Executable file
20
dwmbar/modules/volume
Executable file
|
@ -0,0 +1,20 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Prints out the volume percentage
|
||||
|
||||
VOLUME_ON_ICON=''
|
||||
VOLUME_MUTED_ICON=''
|
||||
|
||||
get_volume(){
|
||||
curStatus=$(pactl get-sink-mute @DEFAULT_SINK@)
|
||||
volume=$(pactl get-sink-volume @DEFAULT_SINK@ | tail -n 2 | sed -e 's,.* \([0-9][0-9]*\)%.*,\1,' | head -n 1)
|
||||
|
||||
if [ "${curStatus}" = 'Mute: yes' ]
|
||||
then
|
||||
echo "$VOLUME_MUTED_ICON $volume%"
|
||||
else
|
||||
echo "$VOLUME_ON_ICON $volume%"
|
||||
fi
|
||||
}
|
||||
|
||||
get_volume
|
40
dwmbar/modules/volumebar
Executable file
40
dwmbar/modules/volumebar
Executable file
|
@ -0,0 +1,40 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Prints out the volume percentage
|
||||
|
||||
# Dependencies: bc
|
||||
|
||||
VOLUME_WIDTH=9
|
||||
VOLUME_SLIDER='⬤'
|
||||
VOLUME_RAIL='◯'
|
||||
VOLUME_MUTED='muted'
|
||||
|
||||
PREFIX=''
|
||||
|
||||
# If volume is >100
|
||||
ALERT='!!!'
|
||||
|
||||
get_volume(){
|
||||
active_sink=$(pacmd list-sinks | awk '/* index:/{print $3}')
|
||||
curStatus=$(pacmd list-sinks | grep -A 15 "index: $active_sink$" | awk '/muted/{ print $2}')
|
||||
volume=$(pacmd list-sinks | grep -A 15 "index: $active_sink$" | grep 'volume:' | grep -E -v 'base volume:' | awk -F : '{print $3}' | grep -o -P '.{0,3}%'| sed s/.$// | tr -d ' ')
|
||||
slider_position=$(python -c "print(($volume / 100) * $VOLUME_WIDTH)")
|
||||
|
||||
if [ "${curStatus}" = 'yes' ]
|
||||
then
|
||||
echo "$VOLUME_MUTED"
|
||||
exit 0
|
||||
else
|
||||
for i in $(seq 1 $VOLUME_WIDTH); do
|
||||
[[ $i = $slider_position ]] && BAR=$BAR$VOLUME_SLIDER
|
||||
[[ $i < $slider_position ]] && BAR=$BAR$VOLUME_SLIDER
|
||||
[[ $i > $slider_position ]] && BAR=$BAR$VOLUME_RAIL
|
||||
done
|
||||
fi
|
||||
|
||||
[[ $volume -gt 100 ]] && PREFIX=$PREFIX$ALERT
|
||||
|
||||
echo "$PREFIX$BAR"
|
||||
}
|
||||
|
||||
get_volume
|
15
dwmbar/modules/weather
Executable file
15
dwmbar/modules/weather
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Deps:
|
||||
# curl
|
||||
|
||||
|
||||
get_weather()
|
||||
{
|
||||
curl -s v2.wttr.in | grep -e "Weather" | sed -n 2p | sed s/Weather://g | sed 's/,//g' | sed 's/+//g' | sed 's/°C.*/°C/' | sed 's/.*m//'
|
||||
}
|
||||
|
||||
|
||||
if [ $(( 10#$(date '+%S') % 30 )) -eq 0 ]; then
|
||||
get_weather
|
||||
fi
|
24
dwmbar/modules/wifi
Executable file
24
dwmbar/modules/wifi
Executable file
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Gets the wifi status
|
||||
|
||||
WIFI_FULL_ICON=''
|
||||
WIFI_MID_ICON=''
|
||||
WIFI_LOW_ICON=''
|
||||
NO_WIFI_ICON=''
|
||||
|
||||
get_wifi()
|
||||
{
|
||||
if grep -q wl* "/proc/net/wireless"; then
|
||||
# Wifi quality percentage
|
||||
percentage=$(grep "^\s*w" /proc/net/wireless | awk '{ print "", int($3 * 100 / 70)}'| xargs)
|
||||
case $percentage in
|
||||
0) echo $NO_WIFI_ICON;;
|
||||
100|9[0-9]|8[0-9]|7[0-9]) echo "$WIFI_FULL_ICON" ;;
|
||||
6[0-9]|5[0-9]|4[0-9]|3[0-9]) echo "$WIFI_MID_ICON" ;;
|
||||
2[0-9]|1[0-9]|[0-9]) echo "$WIFI_LOW_ICON" ;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
get_wifi
|
Loading…
Add table
Add a link
Reference in a new issue