mirror of
https://github.com/bvanroll/_dotfiles.git
synced 2025-08-30 04:22:47 +00:00
initial commit
This commit is contained in:
48
.config/i3blocks/calendar/README.md
Normal file
48
.config/i3blocks/calendar/README.md
Normal file
@@ -0,0 +1,48 @@
|
||||
# calendar
|
||||
|
||||
Shows the current date and time. When clicked, a calendar popup is created.
|
||||
|
||||
This is similar to the rofi-calendar blocklet, but without the rofi dependency and with a slightly more advanced popup (at least in my opinion).
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
# Dependencies
|
||||
|
||||
* yad
|
||||
* xdotool (for positioning of the popup)
|
||||
|
||||
# Installation
|
||||
|
||||
* Copy the script into your directory of choice, e.g. ~/.i3blocks/blocklets
|
||||
* Give it execution permission (`chmod +x calendar`)
|
||||
* Add the script to your i3blocks.conf, for example like this:
|
||||
|
||||
```ini
|
||||
[calendar]
|
||||
command=$SCRIPT_DIR/calendar
|
||||
interval=1
|
||||
LABEL=
|
||||
DATEFMT=+%H:%M:%S
|
||||
# SHORTFMT=+%H:%M:%S
|
||||
HEIGHT=180
|
||||
WIDTH=220
|
||||
```
|
||||
|
||||
* Add `for_window [class="Yad"] floating enable` to your i3 config file.
|
||||
Unfortunately this is neccessary [because of a bug in `yad`](https://sourceforge.net/p/yad-dialog/tickets/301/).
|
||||
You may skip this step if you want to open the calendar popup as a normal tile instead.
|
||||
|
||||
# Configuration
|
||||
|
||||
Parameters _[deprecated!]_:
|
||||
|
||||
* `-f FMT`: date/time format (default _+%a %d.%m.%Y %H:%M:%S_)
|
||||
* `-W WIDTH`: width of the window (default _200_)
|
||||
* `-H HEIGHT`: height of the window (default _200_)
|
||||
|
||||
Additionally you may want to
|
||||
|
||||
* change the placement of the popup
|
||||
* change the parameters for `yad` to change the appearance of the popup
|
40
.config/i3blocks/calendar/calendar
Executable file
40
.config/i3blocks/calendar/calendar
Executable file
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
WIDTH=${WIDTH:-200}
|
||||
HEIGHT=${HEIGHT:-200}
|
||||
DATEFMT=${DATEFMT:-"+%a %d.%m.%Y %H:%M:%S"}
|
||||
SHORTFMT=${SHORTFMT:-"+%H:%M:%S"}
|
||||
|
||||
OPTIND=1
|
||||
while getopts ":f:W:H:" opt; do
|
||||
case $opt in
|
||||
f) DATEFMT="$OPTARG" ;;
|
||||
W) WIDTH="$OPTARG" ;;
|
||||
H) HEIGHT="$OPTARG" ;;
|
||||
\?)
|
||||
echo "Invalid option: -$OPTARG" >&2
|
||||
exit 1
|
||||
;;
|
||||
:)
|
||||
echo "Option -$OPTARG requires an argument." >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
case "$BLOCK_BUTTON" in
|
||||
1|2|3)
|
||||
|
||||
# the position of the upper left corner of the popup
|
||||
posX=$(($BLOCK_X - $WIDTH / 2))
|
||||
posY=$(($BLOCK_Y - $HEIGHT))
|
||||
|
||||
i3-msg -q "exec yad --calendar \
|
||||
--width=$WIDTH --height=$HEIGHT \
|
||||
--undecorated --fixed \
|
||||
--close-on-unfocus --no-buttons \
|
||||
--posx=$posX --posy=$posY \
|
||||
> /dev/null"
|
||||
esac
|
||||
echo "$LABEL$(date "$DATEFMT")"
|
||||
echo "$LABEL$(date "$SHORTFMT")"
|
BIN
.config/i3blocks/calendar/screenshot1.png
Normal file
BIN
.config/i3blocks/calendar/screenshot1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
BIN
.config/i3blocks/calendar/screenshot2.png
Normal file
BIN
.config/i3blocks/calendar/screenshot2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
Reference in New Issue
Block a user