summaryrefslogtreecommitdiff
path: root/config/X/xmobar/scripts/whscreen
blob: 030493bb0b8bb9c1a8a2e664a55b1a72a87ac125 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash

# # -- Based on mouse
# # Get mouse location, only X matters
# X=$(\
#   xdotool getmouselocation -s \
#   | head -n1 \
#   | cut -f2 -d'='\
# )

# Based on active window
X=$(xdotool getwindowgeometry -s $(xdotool getwindowfocus) | grep "X" | cut -d'=' -f2)

# For dual monitor setup
monitor_width="$(\
  xdotool getdisplaygeometry \
    | cut -d ' ' -f 1 \
)"

# If '-' number is negative
[[ "$((${X} - ${monitor_width}))" -lt 0 ]] \
  && echo -n '<' \
  || echo -n '>'