Browse Source

xinit.sh

master
RinRi 2 years ago
parent
commit
0d86504fd7
5 changed files with 11 additions and 111 deletions
  1. +0
    -32
      scripts/status/battery.sh
  2. +0
    -29
      scripts/status/clock.sh
  3. +0
    -20
      scripts/status/internet.sh
  4. +0
    -29
      scripts/status/volume.sh
  5. +11
    -1
      scripts/xinit.sh

+ 0
- 32
scripts/status/battery.sh View File

@@ -1,32 +0,0 @@
#!/bin/sh

# Prints all batteries, their percentage remaining and an emoji corresponding
# to charge status (🔌 for plugged up, 🔋 for discharging on battery, etc.).

case $BUTTON in
3) notify-send "🔋 Battery module" "🔋: discharging
🛑: not charging
♻: stagnant charge
🔌: charging
⚡: charged
❗: battery very low!
- Scroll to change adjust xbacklight." ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac

# acpi alternative
# acpi | sed "s/Battery [0-9]: //;s/[Dd]ischarging, /🔋/;s/[Nn]ot charging, /🛑/;s/[Cc]harging, /🔌/;s/[Uu]nknown, /♻️/;s/[Ff]ull, /⚡/;s/ \(remaining\|until charged\)//"; exit

# Loop through all attached batteries.
for battery in /sys/class/power_supply/BAT?
do
# Get its remaining capacity and charge status.
capacity=$(cat "$battery"/capacity 2>/dev/null) || break
status=$(sed "s/[Dd]ischarging/🔋/;s/[Nn]ot charging/🛑/;s/[Cc]harging/🔌/;s/[Uu]nknown/♻️/;s/[Ff]ull/⚡/" "$battery"/status)

# If it is discharging and 25% or less, we will add a ❗ as a warning.
[ "$capacity" -le 25 ] && [ "$status" = "🔋" ] && warn="❗"

printf "%s%s%s%% " "$status" "$warn" "$capacity"
unset warn
done | sed 's/ *$//'

+ 0
- 29
scripts/status/clock.sh View File

@@ -1,29 +0,0 @@
#!/bin/sh

clock=$(date '+%I')

case "$clock" in
"00") icon="🕛" ;;
"01") icon="🕐" ;;
"02") icon="🕑" ;;
"03") icon="🕒" ;;
"04") icon="🕓" ;;
"05") icon="🕔" ;;
"06") icon="🕕" ;;
"07") icon="🕖" ;;
"08") icon="🕗" ;;
"09") icon="🕘" ;;
"10") icon="🕙" ;;
"11") icon="🕚" ;;
"12") icon="🕛" ;;
esac

case $BUTTON in
1) notify-send "This Month" "$(cal --color=always | sed "s/..7m/<b><span color=\"red\">/;s/..27m/<\/span><\/b>/")" && notify-send "Appointments" "$(calcurse -d3)" ;;
2) setsid -f st -e calcurse ;;
3) notify-send "📅 Time/date module" "\- Left click to show upcoming appointments for the next three days via \`calcurse -d3\` and show the month via \`cal\`
- Middle click opens calcurse if installed" ;;
6) st -e nvim "$0" ;;
esac

date "+%Y %b %d (%a) $icon%I:%M%p"

+ 0
- 20
scripts/status/internet.sh View File

@@ -1,20 +0,0 @@
#!/bin/sh

case $BUTTON in
1) st -e nmtui;;
3) notify-send "Internet module" "\- Click to connect
n: no wifi connection
w: wifi connection with quality
n: no ethernet
e: ethernet working
🔒: vpn is active
" ;;
6) st -e nvim "$0" ;;
esac

case "$(cat /sys/class/net/w*/operstate 2>/dev/null)" in
down) wifiicon="" ;;
up) wifiicon="$(awk '/^\s*w/ { print "", int($3 * 100 / 70) "% " }' /proc/net/wireless)" ;;
esac

printf "%s%s%s\n" "$wifiicon" "$(sed "s/down//;s/up//" /sys/class/net/e*/operstate 2>/dev/null)" "$(sed "s/.*/🔒/" /sys/class/net/tun*/operstate 2>/dev/null)"

+ 0
- 29
scripts/status/volume.sh View File

@@ -1,29 +0,0 @@
#!/bin/sh

# Prints the current volume or 🔇 if muted.

case $BUTTON in
1) setsid -f st -e pulsemixer ;;
2) pamixer -t ;;
4) pamixer --allow-boost -i 1 ;;
5) pamixer --allow-boost -d 1 ;;
3) notify-send "📢 Volume module" "\- Shows volume 🔊, 🔇 if muted.
- Middle click to mute.
- Scroll to change." ;;
6) st -e nvim "$0" ;;
esac

[ $(pamixer --get-mute) = true ] && echo 🔇 && exit

vol="$(pamixer --get-volume)"

if [ "$vol" -gt "70" ]; then
icon="🔊"
elif [ "$vol" -lt "30" ]; then
icon="🔈"
else
icon="🔉"
fi

echo "$icon$vol%"


+ 11
- 1
scripts/xinit.sh View File

@@ -1,11 +1,21 @@
#!/bin/sh

lxpolkit &
slstatus &
dunst &
setxkbmap -layout us,ru -option grp:alt_shift_toggle &
xbanish &
xrdb ~/.Xresources &
feh --bg-scale ~/walls/collections/wallhaven-wyrqg7.png &
wmname LG3D &
feh --bg-fill ~/walls/current.png &
picom --experimental-backends &
xautolock -time 5 -locker slock.sh &
brightnessctl set 100% &
wmname LG3D &
emacs --daemon &
eval $(gnome-keyring-daemon --start) &
export SSH_AUTH_SOCK &
#killall pulseaudio
~/scripts/start-jack.sh &
cadence &
mount ~/nextcloud &

Loading…
Cancel
Save