Skip to content

Commit

Permalink
🔧 polybar: add support for vertical monitor
Browse files Browse the repository at this point in the history
  • Loading branch information
cristianmiranda committed Nov 8, 2024
1 parent b0dcf7c commit dd55c5e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
12 changes: 11 additions & 1 deletion home/.config/polybar/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,23 @@ cursor-scroll = ns-resize

enable-ipc = true

[bar/asus]
[bar/horizontal-1440p]
inherit = section/base
height = 24pt
monitor = ${env:MONITOR:}
tray-position = ${env:TRAY_POS:}
dpi = 96

[bar/vertical-1440p]
inherit = section/base
height = 24pt
monitor = ${env:MONITOR:}
tray-position = ${env:TRAY_POS:}
dpi = 96
modules-left = logo i3 sxhkd-ipc hotkeys-ipc
modules-center =
modules-right = trayseparator spotify github thunderbird vpn do-not-disturb trayseparator

[bar/laptop]
inherit = section/base
height = 24pt
Expand Down
9 changes: 8 additions & 1 deletion home/.config/polybar/launch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,20 @@ else
xrandr --query | grep " connected" | while read entry; do
mon=$(cut -d" " -f1 <<< "$entry")
status=$(cut -d" " -f3 <<< "$entry")
orientation=$(cut -d" " -f4 <<< "$entry")

tray_pos=""
if [ "$status" == "primary" ]; then
tray_pos="right"
fi

MONITOR=$mon TRAY_POS=$tray_pos polybar --reload asus 2>&1 | tee -a /tmp/polybar-monitor-"$mon".log & disown
if [ "$orientation" == "left" ]; then
bar="vertical-1440p"
else
bar="horizontal-1440p"
fi

MONITOR=$mon TRAY_POS=$tray_pos polybar --reload $bar 2>&1 | tee -a /tmp/polybar-monitor-"$mon".log & disown
done

else
Expand Down

0 comments on commit dd55c5e

Please sign in to comment.