polybar/i3: calendar

This commit is contained in:
Michael Grote 2021-06-29 07:26:38 +02:00
commit ab00395a44
6 changed files with 128 additions and 18 deletions

View file

@ -33,6 +33,7 @@ alias sduo="sudo"
alias suso="sudo"
alias sdou="sudo"
alias sodu="sudo"
alias sodo="sudo"
alias susdo="sudo"
alias sudo-i="sudo -i"
alias cd..="cd .."

View file

@ -1,10 +1,3 @@
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
# Please see https://i3wm.org/docs/userguide.html for a complete reference!
@ -41,10 +34,10 @@ bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOU
floating_modifier $mod
# start a terminal
bindsym $mod+Return exec i3-sensible-terminal
bindsym $mod+Return exec alacritty
# kill focused window
bindsym $mod+q kill
bindsym $mod++shift+q kill
# start dmenu (a program launcher)
bindsym $mod+d exec --no-startup-id i3-dmenu-desktop
@ -78,6 +71,18 @@ bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
# resize focused window
bindsym $mod+Control+j resize shrink width 10 px or 10 ppt
bindsym $mod+Control+k resize grow height 10 px or 10 ppt
bindsym $mod+Control+l resize shrink height 10 px or 10 ppt
bindsym $mod+Control+h resize grow width 10 px or 10 ppt
# alternatively, you can use the cursor keys:
bindsym $mod+Control+Left resize shrink width 10 px or 10 ppt
bindsym $mod+Control+Down resize grow height 10 px or 10 ppt
bindsym $mod+Control+Up resize shrink height 10 px or 10 ppt
bindsym $mod+Control+Right resize grow width 10 px or 10 ppt
# split in horizontal orientation
bindsym $mod+v split h
@ -180,16 +185,19 @@ mode "resize" {
bindsym $mod+r mode "default"
}
bindsym $mod+r mode "resize"
# bindsym $mod+r mode "resize" #deaktiviert
<<<<<<< HEAD
# keine Fensterrahmen wenn nur ein Fenster angezeigt wird
hide_edge_borders smart
for_window [class=".*"] border pixel 1
# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
# auskommentiert weil polybar verwendet wird
#bar {
# status_command i3status
#}
# polybar
exec_always --no-startup-id /home/mg/dotfiles/polybar/launch.sh
# feh
exec --no-startup-id /usr/bin/feh --bg-scale /home/mg/dotfiles/i3/wallpaper/dogg.jpg
# polybar/popup-calendar
for_window [class="Yad" title="yad-calendar"] floating enable

BIN
i3/wallpaper/dogg.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 KiB

View file

@ -39,7 +39,7 @@ font-0 = fixed:pixelsize=10;1
font-1 = unifont:fontformat=truetype:size=8:antialias=false;0
font-2 = siji:pixelsize=10;1
modules-left = i3
modules-center =
modules-center = popup-calendar
modules-right = nightscout_script backlight alsa memory cpu wlan eth_intern eth_dock battery date powermenu
tray-position = right
tray-padding = 2
@ -57,6 +57,12 @@ exec = /home/mg/dotfiles/polybar/nightscout_cgm.sh
interval = 120
format-prefix = "BZ "
[module/popup-calendar]
type = custom/script
exec = /home/mg/dotfiles/polybar/popup-calendar.sh
interval = 5
click-left = /home/mg/dotfiles/polybar/popup-calendar.sh --popup &
[module/xwindow]
type = internal/xwindow
label = %title:0:30:...%

41
polybar/popup-calendar.sh Executable file
View file

@ -0,0 +1,41 @@
#!/bin/sh
BAR_HEIGHT=22 # 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 +"%a %d %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_x" --posy="$pos_y" \
--title="yad-calendar" --borders=0 >/dev/null &
;;
*)
echo "$DATE"
;;
esac

54
q Normal file
View file

@ -0,0 +1,54 @@
diff --git a/cheat-sheets/i3.md b/cheat-sheets/i3.md
index 56165b3..76fa2c7 100644
--- a/cheat-sheets/i3.md
+++ b/cheat-sheets/i3.md
@@ -18,7 +18,7 @@
`mod + r` toggle resize mode
mod + Strg + < move Workspace to on the left/right
mod + Shift + s Enable Lockscreen
-
+mod + Shift + Pfeiltasten tauscht Fenster
## Resize-Mode
`hl/links/rechts` breite +-
`jk/oben/unten` höhe +-
diff --git a/i3/config b/i3/config
index 19b3d27..7a70e88 100644
--- a/i3/config
+++ b/i3/config
@@ -181,7 +181,9 @@ mode "resize" {
}

bindsym $mod+r mode "resize"
-
+# ausblenden von Fensterrahmen bei nur einem Fenster
+hide_edge_borders smart
+#
# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
# auskommntiert weil polybar verwendet wird
diff --git a/polybar/config b/polybar/config
index 002c385..b401e6d 100644
--- a/polybar/config
+++ b/polybar/config
@@ -39,8 +39,8 @@ font-0 = fixed:pixelsize=10;1
font-1 = unifont:fontformat=truetype:size=8:antialias=false;0
font-2 = siji:pixelsize=10;1
modules-left = i3
-modules-center =
-modules-right = nightscout_script backlight alsa memory cpu wlan eth_intern eth_dock battery date powermenu
+modules-center = nightscout_script backlight alsa memory cpu wlan eth_intern eth_dock battery date powermenu
+modules-right =
tray-position = right
tray-padding = 2
tray-background = #888888
diff --git a/polybar/launch.sh b/polybar/launch.sh
index 70a82ec..a1038be 100755
--- a/polybar/launch.sh
+++ b/polybar/launch.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Terminate already running bar instances
+# Terminate already running instances
killall -q polybar
# Launch bar
for m in $(polybar --list-monitors | cut -d":" -f1); do