From 0746f016d89d71635adef11238b74922bf6c1a76 Mon Sep 17 00:00:00 2001 From: tiago Date: Thu, 18 May 2023 11:56:19 +0100 Subject: [PATCH] added modules for gpu temp, changed cpu temp module and some laptop ajustments --- .config/i3/config | 6 +-- .config/polybar/config.ini | 68 +++++++++++++++++++++--- .config/polybar/launch.sh | 19 +++++-- .config/polybar/modules.ini | 80 +++++++++++++++++------------ .config/polybar/scripts/cpu_temp.sh | 3 ++ .config/polybar/scripts/gpu_temp.sh | 3 ++ .config/rofi/config.rasi | 2 - 7 files changed, 133 insertions(+), 48 deletions(-) create mode 100755 .config/polybar/scripts/cpu_temp.sh create mode 100755 .config/polybar/scripts/gpu_temp.sh diff --git a/.config/i3/config b/.config/i3/config index a39f05b..df321e7 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -152,9 +152,9 @@ bindsym $mod+9 workspace number $ws9 bindsym $mod+0 workspace number $ws10 # assign workspace to output -workspace $ws1 output HDMI-1-0 -workspace $ws2 output HDMI-1-0 -workspace $ws5 output eDP-1 +workspace $ws1 output primary +workspace $ws2 output primary +workspace $ws5 output nonprimary # move focused container to workspace bindsym $mod+Shift+1 move container to workspace number $ws1 diff --git a/.config/polybar/config.ini b/.config/polybar/config.ini index c53a3b1..274fe82 100644 --- a/.config/polybar/config.ini +++ b/.config/polybar/config.ini @@ -23,7 +23,68 @@ include-file = $HOME/.config/polybar/themes/macchiato.ini screenchange-reload = true pseudo-transparency = true -[bar/default] +[section/base] +monitor = ${env:MONITOR:eDP1} + +[bar/main] +inherit = section/base +width = 99.4% +height = 24pt +offset-x = 0.3% +offset-y = 0.7% +;radius = 8 + +modules-left = i3 sep title +modules-center = date dot time +modules-right = cpu dot gpu dot memory dot backlight dot pulseaudio sep filesystem sep battery + +background = ${colors.base} +foreground = ${colors.text} +line-size = 3pt +padding-right = 1 + +font-0 = FiraCode Nerd Font:size=10:weight=medium;2 +font-1 = JetBrainsMono Nerd Font:size=10:weight=bold;2 +font-2 = Inter:size=10:weight=regular;2 + +cursor-click = pointer +enable-ipc = true + +tray-position = right + +override-redirect = true +wm-restack = i3 + +[bar/secondary] +inherit = section/base +width = 99.4% +height = 24pt +offset-x = 0.3% +offset-y = 0.7% +;radius = 8 + +modules-left = i3 +modules-center = date dot time +modules-right = cpu dot gpu dot memory dot pulseaudio sep filesystem + +background = ${colors.base} +foreground = ${colors.text} +line-size = 3pt +padding-right = 1 + +font-0 = FiraCode Nerd Font:size=10:weight=medium;2 +font-1 = JetBrainsMono Nerd Font:size=10:weight=bold;2 +font-2 = Inter:size=10:weight=regular;2 + +cursor-click = pointer +;cursor-scroll = ns-resize +enable-ipc = true + +override-redirect = true +wm-restack = i3 + +[bar/laptop] +inherit = section/base width = 99.4% height = 24pt offset-x = 0.3% @@ -47,10 +108,5 @@ cursor-click = pointer ;cursor-scroll = ns-resize enable-ipc = true -tray-position = right - override-redirect = true wm-restack = i3 - -scroll-up = "#i3.prev" -scroll-down = "#i3.next" diff --git a/.config/polybar/launch.sh b/.config/polybar/launch.sh index 853b2ea..f885385 100755 --- a/.config/polybar/launch.sh +++ b/.config/polybar/launch.sh @@ -1,11 +1,24 @@ -#!/usr/bin/env sh +#!/usr/bin/env bash + # Terminate already running bar instances killall -q polybar # Wait until the processes have been shut down while pgrep -x polybar >/dev/null; do sleep 1; done -# Launch polybar -polybar default & +screens=$(xrandr --listactivemonitors | grep -v "Monitors" | cut -d" " -f6) +if [[ $(xrandr --listactivemonitors | grep -v "Monitors" | cut -d" " -f4 | cut -d"+" -f2- | uniq | wc -l) == 1 ]]; then + MONITOR=$(polybar --list-monitors | cut -d":" -f1) TRAY_POS=right polybar main & +else + primary=$(xrandr --query | grep primary | cut -d" " -f1) + + for m in $screens; do + if [[ $primary == "$m" ]]; then + MONITOR=$m TRAY_POS=right polybar main & + else + MONITOR=$m TRAY_POS=none polybar secondary & + fi + done +fi diff --git a/.config/polybar/modules.ini b/.config/polybar/modules.ini index f2605f8..e90b5fb 100644 --- a/.config/polybar/modules.ini +++ b/.config/polybar/modules.ini @@ -39,19 +39,53 @@ label-urgent-padding = 1 label-empty = %name% label-empty-padding = 1 -[module/cpu] -type = internal/cpu -interval = 1 -label = CPU %percentage%% +[module/title] +type = internal/xwindow format =