added script stuff to swaybar, fixed fonts

This commit is contained in:
opal
2024-09-28 10:54:24 -07:00
parent 5492a527c0
commit b382e491b8
3 changed files with 100 additions and 77 deletions

View File

@@ -27,9 +27,9 @@
(add-hook mode (lambda () (display-line-numbers-mode 0)))) (add-hook mode (lambda () (display-line-numbers-mode 0))))
;; Font configuration ;; Font configuration
(set-face-attribute 'default nil :font "Monospace" :height 200) (set-face-attribute 'default nil :font "Monospace" :height 190)
(set-face-attribute 'fixed-pitch nil :font "Monospace" :height 200) (set-face-attribute 'fixed-pitch nil :font "Monospace" :height 190)
(set-face-attribute 'variable-pitch nil :font "ETBembo" :height 200) (set-face-attribute 'variable-pitch nil :font "ETBembo" :height 190)
(defun opal/org-font-setup () (defun opal/org-font-setup ()
;; Replace list hyphen with dot ;; Replace list hyphen with dot

View File

@@ -203,7 +203,7 @@ exec_always pgrep -x dunst > /dev/null || dunst
#exec_always pgrep -x wlsunset > /dev/null || wlsunset -l 47.6 -L -122.3 -t 2000 -T 3000 #exec_always pgrep -x wlsunset > /dev/null || wlsunset -l 47.6 -L -122.3 -t 2000 -T 3000
# Gammastep until wlsunset becomes a thing again: # Gammastep until wlsunset becomes a thing again:
exec_always pgrep -x gammastep > /dev/null || gammastep -l 47.6062:-122.3321 -t 4000:3500 exec_always pgrep -x gammastep > /dev/null || gammastep -l 47.6062:-122.3321 -t 3000:2500
# udiskie - auto usb mounting # udiskie - auto usb mounting
exec /usr/bin/udiskie & exec /usr/bin/udiskie &
@@ -232,13 +232,6 @@ exec hash dbus-update-activation-environment 2>/dev/null && dbus-update-activati
# DECORATIONS # DECORATIONS
####################### #######################
# SwayFX specific directions
#corner_radius 3
#shadows enable
#default_dim_inactive 0.1
#blur enable
#blur_xray disable
# Gaps # Gaps
smart_gaps off smart_gaps off
gaps inner 5 gaps inner 5
@@ -308,7 +301,7 @@ bindswitch --reload --locked lid:on output $laptop disable
bindswitch --reload --locked lid:off output $laptop enable bindswitch --reload --locked lid:off output $laptop enable
# Monitors # Monitors
output HDMI-A-1 scale 2.0 #output HDMI-A-1 scale 2.0
# Wallpaper # Wallpaper
output * bg ~/.config/wallpapers/greek-ruins.jpg fill output * bg ~/.config/wallpapers/greek-ruins.jpg fill
@@ -355,9 +348,10 @@ bindsym $mod+Shift+0 move container to workspace $ws7
####################### #######################
bar { bar {
#swaybar_command waybar
position top position top
font "ETBembo 17" font "ETBembo 17"
height 40
icon_theme "Papirus"
strip_workspace_numbers yes strip_workspace_numbers yes
status_command ~/.config/sway/scripts/bar.sh status_command ~/.config/sway/scripts/bar.sh
@@ -368,5 +362,5 @@ bar {
focused_workspace #323232AA #5c5c5cAA #FFFFFFAA focused_workspace #323232AA #5c5c5cAA #FFFFFFAA
} }
#status_command while date +'%Y-%m-%d %I:%M:%S %p'; do sleep 1; done #swaybar_command waybar
} }

View File

@@ -1,74 +1,103 @@
#!/bin/bash #!/bin/bash
get_date() { get_date() {
echo -n "$(date '+%Y-%m-%d %H:%M')" echo -n "$(date '+%a %d/%m/%y %H:%M')"
} }
get_battery() { get_battery() {
BATTERY_PATH="/sys/class/power_supply/BAT0" BATTERY_PATH="/sys/class/power_supply/BAT0"
if [ -f "$BATTERY_PATH/capacity" ]; then
BAT_PERCENT=$(cat "$BATTERY_PATH/capacity")
BAT_STATUS=$(cat "$BATTERY_PATH/status")
if [ "$BAT_STATUS" == "Charging" ]; then
echo -n "󱐋 $BAT_PERCENT%"
else
echo -n "󰁹 $BAT_PERCENT%"
fi
else if [ -f "$BATTERY_PATH/capacity" ]; then
echo -n "Battery not found" BAT_PERCENT=$(cat "$BATTERY_PATH/capacity")
fi BAT_STATUS=$(cat "$BATTERY_PATH/status")
# Determine battery icon based on percentage
case $BAT_PERCENT in
9[5-9]|100)
ICON="󰁹" # Full battery (95%-100%)
;;
9[0-4])
ICON="󰂂" # 90%-94% battery
;;
8[0-9])
ICON="󰂁" # 80% battery
;;
7[0-9])
ICON="󰂀" # 70% battery
;;
6[0-9])
ICON="󰁿" # 60% battery
;;
5[0-9])
ICON="󰁾" # 50% battery
;;
4[0-9])
ICON="󰁽" # 40% battery
;;
3[0-9])
ICON="󰁼" # 30% battery
;;
2[0-9])
ICON="󰁻" # 20% battery
;;
1[0-9])
ICON="󰂃" # 10% battery
;;
*)
ICON="󰂃" # Critical battery (less than 10%)
;;
esac
# Display charging icon if the battery is charging
if [ "$BAT_STATUS" == "Charging" ] || [ "$BAT_STATUS" == "Unknown" ]; then
echo -n "󱐋 $BAT_PERCENT%"
else
echo -n "$ICON $BAT_PERCENT%"
fi
# Send notifications at critical levels
case $BAT_PERCENT in
30)
notify-send -u normal "Battery at 30%" "Consider plugging in."
;;
20)
notify-send -u normal "Battery at 20%" "Battery is getting low."
;;
10)
notify-send -u critical "Battery at 10%" "Battery is critically low!"
;;
[0-5])
notify-send -u critical "Battery at 5%" "Battery is about to die!"
;;
esac
else
echo -n "Battery not found"
fi
}
get_volume() {
# Get the default sink (output device)
SINK=$(pactl info | awk -F': ' '/Default Sink/ {print $2}')
# Get the volume percentage
VOLUME=$(pactl get-sink-volume "$SINK" | awk '{print $5}' | head -n1)
# Get the mute status
MUTE_STATUS=$(pactl get-sink-mute "$SINK" | awk '{print $2}')
# Check if the output is muted
if [ "$MUTE_STATUS" == "no" ]; then
# Volume is not muted, display the volume percentage
echo -n "$VOLUME"
else
# Volume is muted, display mute icon
echo -n " Muted"
fi
} }
while true; do while true; do
echo "$(get_date) $(get_battery)" echo "$(get_volume) $(get_date) $(get_battery)"
sleep 5 sleep 1
done done
# #echo "🎧 $song_status $media_artist - $media_song | ⌨ $language | $network_active $interface_easyname ($ping ms) | 🏋 $loadavg_5min | $audio_active $audio_volume% | $battery_pluggedin $battery_charge | "
# #############
# # Commands
# #############
# # Audio and multimedia
# audio_volume=$(pamixer --sink `pactl list sinks short | grep RUNNING | awk '{print $1}'` --get-volume)
# audio_is_muted=$(pamixer --sink `pactl list sinks short | grep RUNNING | awk '{print $1}'` --get-mute)
# media_artist=$(playerctl metadata artist)
# media_song=$(playerctl metadata title)
# player_status=$(playerctl status)
# # Removed weather because we are requesting it too many times to have a proper
# # refresh on the bar
# #weather=$(curl -Ss 'https://wttr.in/Pontevedra?0&T&Q&format=1')
# if [ $battery_status = "discharging" ];
# then
# battery_pluggedin='⚠'
# else
# battery_pluggedin='⚡'
# fi
# if ! [ $network ]
# then
# network_active="⛔"
# else
# network_active="⇆"
# fi
# if [ $player_status = "Playing" ]
# then
# song_status='▶'
# elif [ $player_status = "Paused" ]
# then
# song_status='⏸'
# else
# song_status='⏹'
# fi
# if [ $audio_is_muted = "true" ]
# then
# audio_active='🔇'
# else
# audio_active='🔊'
# fr