power menu, redshift, polybar
This commit is contained in:
41
.config/polybar/scripts/popup-calendar/README.md
Normal file
41
.config/polybar/scripts/popup-calendar/README.md
Normal file
@@ -0,0 +1,41 @@
|
||||
# Script: popup-calendar
|
||||
|
||||
A small script that displays the date and opens a small popup calendar with YAD when clicked.
|
||||
|
||||

|
||||
|
||||
|
||||
## Dependencies
|
||||
|
||||
* [`yad`](https://sourceforge.net/projects/yad-dialog/)
|
||||
* `xdotool`
|
||||
|
||||
|
||||
## Configuration
|
||||
|
||||
Change these values if you want:
|
||||
|
||||
```sh
|
||||
BAR_HEIGHT=22
|
||||
BORDER_SIZE=1
|
||||
YAD_WIDTH=222
|
||||
YAD_HEIGHT=188
|
||||
DATE="$(date +"%a %d %H:%M")"
|
||||
```
|
||||
|
||||
If you use a tiling window manager you should enable floating for `yad-calendar`. This example is for `i3wm`:
|
||||
|
||||
```ini
|
||||
for_window [class="Yad" title="yad-calendar"] floating enable
|
||||
```
|
||||
|
||||
|
||||
## Module
|
||||
|
||||
```ini
|
||||
[module/popup-calendar]
|
||||
type = custom/script
|
||||
exec = ~/polybar-scripts/popup-calendar.sh
|
||||
interval = 5
|
||||
click-left = ~/polybar-scripts/popup-calendar.sh --popup &
|
||||
```
|
||||
41
.config/polybar/scripts/popup-calendar/popup-calendar.sh
Normal file
41
.config/polybar/scripts/popup-calendar/popup-calendar.sh
Normal 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
|
||||
BIN
.config/polybar/scripts/popup-calendar/screenshots/1.png
Normal file
BIN
.config/polybar/scripts/popup-calendar/screenshots/1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
Reference in New Issue
Block a user