Skip to content

calendar: calendar display at wrong position for different i3 bar position #485

Description

@shivankgarg98

Expected behavior

calendar(yad) dialog should display near calendar button when it is clicked on i3block.

Actual behavior

calendar dialog is displayed at right bottom if i3 bar position is set at top. It is far from i3block button and mouse pointer, making it unclickable.

i3blocks config relevant to blocklet(s)

[calendar]
interval=30
LABEL=
HEIGHT=180
WIDTH=220

Output of any relevant other commands that might help diagnostics

BLOCK_X, BLOCK_Y are not used properly to calculate calendar position.

Suggested Fix

Many people use calendar on upper right corner, using below suggestion can fix the issue (tested on my installation)
Using multiple cases for different i3 bar position and checking screen constraint can give generic fix.

# calculate length of screen
RESOLUTION_X=$(xrandr --current | grep '*' | uniq | awk '{print $1}' | cut -d 'x' -f1) 
# check calendar is not crossing the screen boundary
posX=$(($BLOCK_X + $WIDTH / 2 > $RESOLUTION_X ? $RESOLUTION_X - $WIDTH : $BLOCK_X - $WIDTH / 2))
posY=0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions