From 3e3e8034d4bfb87824426cdce8fad11e7c17712a Mon Sep 17 00:00:00 2001 From: Random936 Date: Mon, 28 Apr 2025 15:59:20 -0700 Subject: [PATCH] Updated polybar to run on all monitors --- dotfiles/.config/i3/config | 1 - dotfiles/.config/polybar/config.ini | 1 + dotfiles/.screenlayout/launch.sh | 1 + dotfiles/.screenlayout/polybar.sh | 9 +++++++++ home/headful-nixos.nix | 1 + 5 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 dotfiles/.screenlayout/polybar.sh diff --git a/dotfiles/.config/i3/config b/dotfiles/.config/i3/config index 16d1fd3..dbb8502 100644 --- a/dotfiles/.config/i3/config +++ b/dotfiles/.config/i3/config @@ -159,6 +159,5 @@ client.unfocused #333333 #222222 #888888 #292d2e #eeeeee #exec "xautolock -detectsleep -time 30 -locker i3lock-fancy" # Startup Applications -exec_always --no-startup-id "killall polybar; polybar" # status bar exec --no-startup-id "$HOME/.screenlayout/launch.sh &" # setup screen layout and wallpapers exec --no-startup-id "$HOME/.scripts/autostart_desktop.sh &" # run autostart desktop apps diff --git a/dotfiles/.config/polybar/config.ini b/dotfiles/.config/polybar/config.ini index a4c3db9..a16e2a5 100644 --- a/dotfiles/.config/polybar/config.ini +++ b/dotfiles/.config/polybar/config.ini @@ -11,6 +11,7 @@ disabled = #707880 width = 100% height = 24pt radius = 6 +monitor = ${env:MONITOR:} ; dpi = 96 diff --git a/dotfiles/.screenlayout/launch.sh b/dotfiles/.screenlayout/launch.sh index de2c111..0563108 100755 --- a/dotfiles/.screenlayout/launch.sh +++ b/dotfiles/.screenlayout/launch.sh @@ -10,3 +10,4 @@ function load_script() { load_script "$HOME/.screenlayout/wallpapers.sh" load_script "$HOME/.screenlayout/layout.sh" load_script "$HOME/.screenlayout/wallpapers.sh" +load_script "$HOME/.screenlayout/polybar.sh" diff --git a/dotfiles/.screenlayout/polybar.sh b/dotfiles/.screenlayout/polybar.sh new file mode 100644 index 0000000..232e2a1 --- /dev/null +++ b/dotfiles/.screenlayout/polybar.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +if which xrandr; then + for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do + MONITOR=$m polybar --reload example & + done +else + polybar --reload example & +fi diff --git a/home/headful-nixos.nix b/home/headful-nixos.nix index 1ef396e..2525dd5 100644 --- a/home/headful-nixos.nix +++ b/home/headful-nixos.nix @@ -30,6 +30,7 @@ ".scripts/autostart_desktop.sh".source = ../dotfiles/.scripts/autostart_desktop.sh; ".screenlayout/launch.sh".source = ../dotfiles/.screenlayout/launch.sh; ".screenlayout/wallpapers.sh".source = ../dotfiles/.screenlayout/wallpapers.sh; + ".screenlayout/polybar.sh".source = ../dotfiles/.screenlayout/polybar.sh; ".config/i3/config".source = ../dotfiles/.config/i3/config; ".config/rofi/config.rasi".source = ../dotfiles/.config/rofi/config.rasi; ".config/polybar/config.ini".source = ../dotfiles/.config/polybar/config.ini;