From 4c5c4894719a77ad361688bfde7d1f328c8a4a2d Mon Sep 17 00:00:00 2001 From: Michael Grote Date: Fri, 9 Feb 2024 19:03:05 +0100 Subject: [PATCH] remove polybar Signed-off-by: Michael Grote --- polybar/config | 37 ---- scripts/polybar/launch.sh | 13 -- scripts/polybar/nightscout_cgm.sh | 37 ---- scripts/polybar/polywins.sh | 242 -------------------------- scripts/polybar/popup-calendar.sh | 41 ----- scripts/polybar/system-cpu-loadavg.sh | 3 - scripts/polybar/time.sh | 3 - 7 files changed, 376 deletions(-) delete mode 100644 polybar/config delete mode 100755 scripts/polybar/launch.sh delete mode 100755 scripts/polybar/nightscout_cgm.sh delete mode 100755 scripts/polybar/polywins.sh delete mode 100755 scripts/polybar/popup-calendar.sh delete mode 100755 scripts/polybar/system-cpu-loadavg.sh delete mode 100755 scripts/polybar/time.sh diff --git a/polybar/config b/polybar/config deleted file mode 100644 index a4a9739..0000000 --- a/polybar/config +++ /dev/null @@ -1,37 +0,0 @@ -include-directory = ~/dotfiles/polybar/conf.d - - -[bar/defaults] -background = ${colors.background} -foreground = ${colors.foreground} -padding-left = 0 -padding-right = 2 -module-margin-left = 1 -module-margin-right = 2 -font-0 = fixed:pixelsize=10;1 -font-1 = unifont:fontformat=truetype:size=8:antialias=false;0 -font-2 = siji:pixelsize=10;1 -separator = | -separator-foreground = #32CD32 - -[settings] -screenchange-reload = true - -[global/wm] -margin-top = 5 -margin-bottom = 5 - -[bar/oben] -inherit = bar/defaults -modules-left = i3 -modules-center = dunst -modules-right = wired wireless backlight cpu system-cpu-loadavg memory filesystem battery -tray-position = right -tray-padding = 2 - -[bar/unten] -inherit = bar/defaults -bottom = true -modules-left = startmenu -modules-center = polywins -modules-right = pulseaudio time diff --git a/scripts/polybar/launch.sh b/scripts/polybar/launch.sh deleted file mode 100755 index 06b6260..0000000 --- a/scripts/polybar/launch.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -# Terminate already running bar instances -killall -q polybar - -export DISPLAY=:0 - -# Launch bar1 and bar2 -echo "---" | tee -a /tmp/polybar1.log /tmp/polybar2.log -polybar --config=~/dotfiles/polybar/config oben 2>&1 | tee -a /tmp/polybar1.log & disown -polybar --config=~/dotfiles/polybar/config unten 2>&1 | tee -a /tmp/polybar2.log & disown - -echo "Bars launched..." diff --git a/scripts/polybar/nightscout_cgm.sh b/scripts/polybar/nightscout_cgm.sh deleted file mode 100755 index 3bd023c..0000000 --- a/scripts/polybar/nightscout_cgm.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -api_url=$(curl -s -X GET "https://nightscout.mgrote.net/api/v1/entries/sgv?count=1&token=polybar-dbd088fd5b49a4da") -#echo $api_url -if [ $? -ne 0 ]; then - echo "---" -else - symbol=$(echo $api_url | awk '{print $4}') - #echo $symbol - wert=$(echo $api_url | awk '{printf "%.1f\n",$3*0.0555}') - #echo $wert - case $symbol in - '"SingleDown"') - echo $wert "⇓" - ;; - '"SingleUp"') - echo $wert "⇑" - ;; - '"DoubleDown"') - echo $wert "⇓⇓" - ;; - '"DoubleUp"') - echo $wert "⇑⇑" - ;; - '"FortyFiveDown"') - echo $wert "⇘" - ;; - '"FortyFiveUp"') - echo $wert "⇗" - ;; - '"Flat"') - echo $wert "⇒" - ;; - *) - echo $symbol - ;; - esac -fi diff --git a/scripts/polybar/polywins.sh b/scripts/polybar/polywins.sh deleted file mode 100755 index 575eef4..0000000 --- a/scripts/polybar/polywins.sh +++ /dev/null @@ -1,242 +0,0 @@ -#!/bin/sh -# POLYWINS - -# SETTINGS {{{ --- - -active_text_color="#FFFFFF" -active_bg="#32CD32" -active_underline="#FF8800" - -inactive_text_color="#FFFFFF" -inactive_bg= -inactive_underline= - -separator="|" -show="window_class" # options: window_title, window_class, window_classname -forbidden_classes="Polybar Conky Gmrun" -empty_desktop_message="" - -char_limit=10 -max_windows=15 -char_case="lower" # normal, upper, lower -add_spaces="true" -resize_increment=16 -wm_border_width=1 # setting this might be required for accurate resize position - -# --- }}} - - -main() { - # If no argument passed... - if [ -z "$2" ]; then - # ...print new window list every time - # the active window changes or - # a window is opened or closed - xprop -root -spy _NET_CLIENT_LIST _NET_ACTIVE_WINDOW | - while IFS= read -r _; do - generate_window_list - done - - # If arguments are passed, run requested on-click function - else - "$@" - fi -} - - - -# ON-CLICK FUNCTIONS {{{ --- - -raise_or_minimize() { - if [ "$(get_active_wid)" = "$1" ]; then - wmctrl -ir "$1" -b toggle,hidden - else - wmctrl -ir "$1" -b remove,hidden; wmctrl -ia "$1" - fi -} - -close() { - wmctrl -ic "$1" -} - -slop_resize() { - wmctrl -ia "$1" - wmctrl -ir "$1" -e "$(slop -f 0,%x,%y,%w,%h)" -} - -increment_size() { - while IFS="[ .]" read -r wid ws wx wy ww wh _; do - test "$wid" != "$1" && continue - x=$(( wx - wm_border_width * 2 - resize_increment / 2 )) - y=$(( wy - wm_border_width * 2 - resize_increment / 2 )) - w=$(( ww + resize_increment )) - h=$(( wh + resize_increment )) - done <<-EOF - $(wmctrl -lG) - EOF - - wmctrl -ir "$1" -e "0,$x,$y,$w,$h" -} - -decrement_size() { - while IFS="[ .]" read -r wid ws wx wy ww wh _; do - test "$wid" != "$1" && continue - x=$(( wx - wm_border_width * 2 + resize_increment / 2 )) - y=$(( wy - wm_border_width * 2 + resize_increment / 2 )) - w=$(( ww - resize_increment )) - h=$(( wh - resize_increment )) - done <<-EOF - $(wmctrl -lG) - EOF - - wmctrl -ir "$1" -e "0,$x,$y,$w,$h" -} - -# --- }}} - - - -# WINDOW LIST SETUP {{{ --- - -active_left="%{F$active_text_color}" -active_right="%{F-}" -inactive_left="%{F$inactive_text_color}" -inactive_right="%{F-}" -separator="%{F$inactive_text_color}$separator%{F-}" - -if [ -n "$active_underline" ]; then - active_left="${active_left}%{+u}%{u$active_underline}" - active_right="%{-u}${active_right}" -fi - -if [ -n "$active_bg" ]; then - active_left="${active_left}%{B$active_bg}" - active_right="%{B-}${active_right}" -fi - -if [ -n "$inactive_underline" ]; then - inactive_left="${inactive_left}%{+u}%{u$inactive_underline}" - inactive_right="%{-u}${inactive_right}" -fi - -if [ -n "$inactive_bg" ]; then - inactive_left="${inactive_left}%{B$inactive_bg}" - inactive_right="%{B-}${inactive_right}" -fi - -get_active_wid() { - active_wid=$(xprop -root _NET_ACTIVE_WINDOW) - active_wid="${active_wid#*\# }" - active_wid="${active_wid%,*}" # Necessary for XFCE - while [ ${#active_wid} -lt 10 ]; do - active_wid="0x0${active_wid#*x}" - done - echo "$active_wid" -} - -get_active_workspace() { - wmctrl -d | - while IFS="[ .]" read -r number active_status _; do - test "$active_status" = "*" && echo "$number" && break - done -} - -generate_window_list() { - active_workspace=$(get_active_workspace) - active_wid=$(get_active_wid) - window_count=0 - on_click="$0" - - # Format each window name one by one - # Space and . are both used as IFS, - # because classname and class are separated by '.' - while IFS="[ .\.]" read -r wid ws cname cls host title; do - # Don't show the window if on another workspace (-1 = sticky) - if [ "$ws" != "$active_workspace" ] && [ "$ws" != "-1" ]; then - continue - fi - - # Don't show the window if its class is forbidden - case "$forbidden_classes" in - *$cls*) continue ;; - esac - - # If max number of windows reached, just increment - # the windows counter - if [ "$window_count" -ge "$max_windows" ]; then - window_count=$(( window_count + 1 )) - continue - fi - - # Show the user-selected window property - case "$show" in - "window_class") w_name="$cls" ;; - "window_classname") w_name="$cname" ;; - "window_title") w_name="$title" ;; - esac - - # Use user-selected character case - case "$char_case" in - "lower") w_name=$( - echo "$w_name" | tr '[:upper:]' '[:lower:]' - ) ;; - "upper") w_name=$( - echo "$w_name" | tr '[:lower:]' '[:upper:]' - ) ;; - esac - - # Truncate displayed name to user-selected limit - if [ "${#w_name}" -gt "$char_limit" ]; then - w_name="$(echo "$w_name" | cut -c1-$((char_limit-1)))…" - fi - - # Apply add-spaces setting - if [ "$add_spaces" = "true" ]; then - w_name=" $w_name " - fi - - # Add left and right formatting to displayed name - if [ "$wid" = "$active_wid" ]; then - w_name="${active_left}${w_name}${active_right}" - else - w_name="${inactive_left}${w_name}${inactive_right}" - fi - - # Add separator unless the window is first in list - if [ "$window_count" != 0 ]; then - printf "%s" "$separator" - fi - - # Add on-click action Polybar formatting - printf "%s" "%{A1:$on_click raise_or_minimize $wid:}" - printf "%s" "%{A2:$on_click close $wid:}" - printf "%s" "%{A3:$on_click slop_resize $wid:}" - printf "%s" "%{A4:$on_click increment_size $wid:}" - printf "%s" "%{A5:$on_click decrement_size $wid:}" - # Print the final window name - printf "%s" "$w_name" - printf "%s" "%{A}%{A}%{A}%{A}%{A}" - - window_count=$(( window_count + 1 )) - done <<-EOF - $(wmctrl -lx) - EOF - - # After printing all the windows, - # print number of hidden windows - if [ "$window_count" -gt "$max_windows" ]; then - printf "%s" "+$(( window_count - max_windows ))" - fi - - # Print empty desktop message if no windows are open - if [ "$window_count" = 0 ]; then - printf "%s" "$empty_desktop_message" - fi - - # Print newline - echo "" -} - -# --- }}} - -main "$@" diff --git a/scripts/polybar/popup-calendar.sh b/scripts/polybar/popup-calendar.sh deleted file mode 100755 index cf1b498..0000000 --- a/scripts/polybar/popup-calendar.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh - -BAR_HEIGHT=25 # polybar height -BORDER_SIZE=1 # border size from your wm settings -YAD_WIDTH=222 # 222 is minimum possible value -YAD_HEIGHT=193 # 193 is minimum possible value -DATE="$(date +"%d.%m.%Y // %H:%M")" - -case "$1" in ---popup) - if [ "$(xdotool getwindowfocus getwindowname)" = "yad-calendar" ]; then - exit 0 - fi - - eval "$(xdotool getmouselocation --shell)" - eval "$(xdotool getdisplaygeometry --shell)" - - # X - if [ "$((X + YAD_WIDTH / 2 + BORDER_SIZE))" -gt "$WIDTH" ]; then #Right side - : $((pos_x = WIDTH - YAD_WIDTH - BORDER_SIZE)) - elif [ "$((X - YAD_WIDTH / 2 - BORDER_SIZE))" -lt 0 ]; then #Left side - : $((pos_x = BORDER_SIZE)) - else #Center - : $((pos_x = X - YAD_WIDTH / 2)) - fi - - # Y - if [ "$Y" -gt "$((HEIGHT / 2))" ]; then #Bottom - : $((pos_y = HEIGHT - YAD_HEIGHT - BAR_HEIGHT - BORDER_SIZE)) - else #Top - : $((pos_y = BAR_HEIGHT + BORDER_SIZE)) - fi - - yad --calendar --undecorated --fixed --close-on-unfocus --no-buttons \ - --width="$YAD_WIDTH" --height="$YAD_HEIGHT" --posx="$pos_y" --posy="$pos_y" \ - --title="yad-calendar" --borders=0 >/dev/null & - ;; -*) - echo "$DATE" - ;; -esac diff --git a/scripts/polybar/system-cpu-loadavg.sh b/scripts/polybar/system-cpu-loadavg.sh deleted file mode 100755 index 944ff49..0000000 --- a/scripts/polybar/system-cpu-loadavg.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -awk '{print $1}' < /proc/loadavg diff --git a/scripts/polybar/time.sh b/scripts/polybar/time.sh deleted file mode 100755 index 12b8ba1..0000000 --- a/scripts/polybar/time.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -date +"%d.%m.%Y %R"