Add window hover script, sticky floating window i3 keybind

This commit is contained in:
Riyyi
2019-04-28 04:00:24 +02:00
parent 55b414f0a7
commit 30ed143583
2 changed files with 23 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
#!/bin/sh
# Enable mathematics in POSIX shell
calc() { awk "BEGIN{print $*}"; }
# Calculate size
MON_WIDTH=$(xdotool getdisplaygeometry | awk '{print $1}')
MON_HEIGHT=$(xdotool getdisplaygeometry | awk '{print $2}')
NEW_WIDTH=$(calc "$MON_WIDTH * 0.25")
NEW_HEIGHT=$(calc "$NEW_WIDTH / 16 * 9")
# Calculate position
BORDER=23
X=$(calc "$MON_WIDTH - $NEW_WIDTH - $BORDER")
Y=$(calc "$MON_HEIGHT - $NEW_HEIGHT - $BORDER")
# Set window
CURRENT=$(xdotool getwindowfocus)
xdotool windowsize "$CURRENT" "$NEW_WIDTH" "$NEW_HEIGHT"
xdotool windowmove "$CURRENT" "$X" "$Y"