From 4d731c3564f7d0d026b176ee068d02dcdab86fde Mon Sep 17 00:00:00 2001 From: Felix Steghofer Date: Tue, 15 Jan 2019 21:56:16 +0100 Subject: [PATCH] no border for termite --- .config/i3/config | 2 + .config/polybar/battery-combined-udev.pid | 1 + .config/polybar/battery-combined-udev.sh | 99 +++++++++++++++++++++++ .config/polybar/config | 3 - .config/polybar/popup-calendar.sh | 27 +++++++ .config/polybar/system-cpu-temppercore.sh | 3 + 6 files changed, 132 insertions(+), 3 deletions(-) create mode 100644 .config/polybar/battery-combined-udev.pid create mode 100755 .config/polybar/battery-combined-udev.sh create mode 100755 .config/polybar/popup-calendar.sh create mode 100755 .config/polybar/system-cpu-temppercore.sh diff --git a/.config/i3/config b/.config/i3/config index 392542f..ab0007a 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -205,6 +205,7 @@ bindsym $mod+r mode "resize" # Set the shortcuts and what they do for_window [class="Yad"] floating enable +for_window [class="Termite"] border pixel 1 set $mode_display ext1->int->tv (3), ext1->int (2), External (x), Internal (i) mode "$mode_display" { @@ -267,6 +268,7 @@ exec i3-msg workspace $ws1 # Start default applications exec_always --no-startup-id $HOME/.config/polybar/launch.sh +exec_always --no-startup-id $HOME/Pictures/Wallpapers/Annapurna.jpg exec_always --no-startup-id numlockx on exec_always --no-startup-id sudo tlp start exec --no-startup-id greenclip daemon diff --git a/.config/polybar/battery-combined-udev.pid b/.config/polybar/battery-combined-udev.pid new file mode 100644 index 0000000..ba7a0b6 --- /dev/null +++ b/.config/polybar/battery-combined-udev.pid @@ -0,0 +1 @@ +7545 diff --git a/.config/polybar/battery-combined-udev.sh b/.config/polybar/battery-combined-udev.sh new file mode 100755 index 0000000..0d6f3c3 --- /dev/null +++ b/.config/polybar/battery-combined-udev.sh @@ -0,0 +1,99 @@ +#!/bin/sh + +battery_print() { + path_ac="/sys/class/power_supply/AC" + path_battery_0="/sys/class/power_supply/BAT0" + path_battery_1="/sys/class/power_supply/BAT1" + + ac=0 + battery_level_0=0 + battery_level_1=0 + battery_max_0=0 + battery_max_1=0 + + if [ -f "$path_ac/online" ]; then + ac=$(cat "$path_ac/online") + fi + + if [ -f "$path_battery_0/energy_now" ]; then + battery_level_0=$(cat "$path_battery_0/energy_now") + fi + + if [ -f "$path_battery_0/energy_full" ]; then + battery_max_0=$(cat "$path_battery_0/energy_full") + fi + + if [ -f "$path_battery_1/energy_now" ]; then + battery_level_1=$(cat "$path_battery_1/energy_now") + fi + + if [ -f "$path_battery_1/energy_full" ]; then + battery_max_1=$(cat "$path_battery_1/energy_full") + fi + + battery_level=$(("$battery_level_0 + $battery_level_1")) + battery_max=$(("$battery_max_0 + $battery_max_1")) + + battery_percent=$(("$battery_level * 100")) + battery_percent=$(("$battery_percent / $battery_max")) + + if [ "$ac" -eq 1 ]; then + icon="" + + if [ "$battery_percent" -gt 97 ]; then + echo "$icon" + else + if [ "$battery_percent" -gt 85 ]; then + load="" + elif [ "$battery_percent" -gt 60 ]; then + load="" + elif [ "$battery_percent" -gt 35 ]; then + load="" + elif [ "$battery_percent" -gt 10 ]; then + load="" + else + load="" + fi + echo "$icon $load $battery_percent%" + fi + else + if [ "$battery_percent" -gt 85 ]; then + icon="" + elif [ "$battery_percent" -gt 60 ]; then + icon="" + elif [ "$battery_percent" -gt 35 ]; then + icon="" + elif [ "$battery_percent" -gt 10 ]; then + icon="" + else + icon="" + fi + + echo "$icon $battery_percent%" + fi +} + +path_pid="$HOME/.config/polybar/battery-combined-udev.pid" + +case "$1" in + --update) + pid=$(cat $path_pid) + + if [ "$pid" != "" ]; then + kill -10 "$pid" + fi + ;; + *) + echo $$ > $path_pid + + trap exit INT + trap "echo" USR1 + + while true; do + battery_print + + sleep 30 & + wait + done + ;; +esac diff --git a/.config/polybar/config b/.config/polybar/config index a0936d0..d8b5312 100644 --- a/.config/polybar/config +++ b/.config/polybar/config @@ -49,9 +49,6 @@ modules-right = cpu system-cpu-temppercore memory tray-position = left tray-padding = 2 -tray-transparent = true -tray-background = #0063ff -;tray-detached = false [module/pulseaudio] type = internal/pulseaudio diff --git a/.config/polybar/popup-calendar.sh b/.config/polybar/popup-calendar.sh new file mode 100755 index 0000000..3d0ead1 --- /dev/null +++ b/.config/polybar/popup-calendar.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +YAD_WIDTH=200 +YAD_HEIGHT=200 +BOTTOM=false +DATE=" $(date +"%a %d.%m.%y")  $(date +"%H:%M")" + +case "$1" in + --popup) + eval "$(xdotool getmouselocation --shell)" + + if [ $BOTTOM = true ]; then + : $(( pos_y = Y - YAD_HEIGHT - 20 )) + : $(( pos_x = X - (YAD_WIDTH / 2) )) + else + : $(( pos_y = Y + 20 )) + : $(( pos_x = X - (YAD_WIDTH / 2) )) + fi + + yad --calendar --undecorated --fixed --close-on-unfocus --no-buttons \ + --width=$YAD_WIDTH --height=$YAD_HEIGHT --posx=$pos_x --posy=$pos_y \ + > /dev/null + ;; + *) + echo "$DATE" + ;; +esac diff --git a/.config/polybar/system-cpu-temppercore.sh b/.config/polybar/system-cpu-temppercore.sh new file mode 100755 index 0000000..1ebc3b2 --- /dev/null +++ b/.config/polybar/system-cpu-temppercore.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +sensors | grep Core | awk '{print substr($3, 2, length($3)-5)}' | tr "\\n" " " | sed 's/ /°C /g' | sed 's/ $//'