Add graphics module to show nvidia driver version

This commit is contained in:
Sravan Balaji
2024-05-04 09:02:08 -04:00
parent 510b15c7b8
commit 0089c14d6e
2 changed files with 170 additions and 6 deletions

View File

@@ -5919,6 +5919,11 @@ media-playing-overline = ${self.background}
tray-background = ${self.background} tray-background = ${self.background}
; right ; right
graphics-foreground = ${self.green}
graphics-background = ${self.background}
graphics-underline = ${self.background}
graphics-overline = ${self.background}
kernel-foreground = ${self.orange} kernel-foreground = ${self.orange}
kernel-background = ${self.background} kernel-background = ${self.background}
kernel-underline = ${self.background} kernel-underline = ${self.background}
@@ -5996,6 +6001,7 @@ Define module update intervals in seconds.
#+BEGIN_SRC conf :tangle polybar/config.ini #+BEGIN_SRC conf :tangle polybar/config.ini
[intervals] [intervals]
media-playing = 1 media-playing = 1
graphics = 86400
kernel = 86400 kernel = 86400
cpu = 1 cpu = 1
memory = 1 memory = 1
@@ -6145,7 +6151,7 @@ font-5 = "IPAPGothic:size=11;3"
; modules-right = ipc clock ; modules-right = ipc clock
modules-left = powermenu-left powermenu powermenu-right dwm volume-left volume volume-right media-playing-left media-playing-change media-playing-prev media-playing-play-pause media-playing-next media-playing media-playing-right modules-left = powermenu-left powermenu powermenu-right dwm volume-left volume volume-right media-playing-left media-playing-change media-playing-prev media-playing-play-pause media-playing-next media-playing media-playing-right
; modules-center = ; modules-center =
modules-right = kernel-left kernel kernel-right cpu-left cpu cpu-right memory-left memory memory-right filesystem-left filesystem filesystem-right date-left date date-right time-left time time-right dunst-left dunst-status dunst-clear dunst-history-view dunst-history-clear dunst-history-length dunst-right modules-right = kernel-left kernel kernel-right graphics-left graphics graphics-right cpu-left cpu cpu-right memory-left memory memory-right filesystem-left filesystem filesystem-right date-left date date-right time-left time time-right dunst-left dunst-status dunst-clear dunst-history-view dunst-history-clear dunst-history-length dunst-right
; The separator will be inserted between the output of each module ; The separator will be inserted between the output of each module
separator = "" separator = ""
@@ -6760,7 +6766,7 @@ interval = ${intervals.kernel}
; Available tags: ; Available tags:
; <output> - deprecated ; <output> - deprecated
; <label> (default) ; <label> (default)
format = %{A1:kitty bash -c "fastfetch && nvidia-smi && sleep 15":}<label>%{A} format = %{A1:kitty bash -c "fastfetch && sleep 15":}<label>%{A}
format-foreground = ${colors.kernel-foreground} format-foreground = ${colors.kernel-foreground}
format-background = ${colors.kernel-background} format-background = ${colors.kernel-background}
format-underline = ${colors.kernel-underline} format-underline = ${colors.kernel-underline}
@@ -6793,6 +6799,86 @@ label-padding = ${sizes.module-padding}
; scroll-down = echo scroll down %counter% ; scroll-down = echo scroll down %counter%
#+END_SRC #+END_SRC
**** Graphics
#+BEGIN_SRC conf :tangle polybar/config.ini
[module/graphics-left]
type = custom/text
content = " "
content-foreground = ${colors.graphics-background}
content-underline = ${colors.graphics-underline}
content-overline = ${colors.graphics-overline}
content-padding = ${sizes.module-padding}
#+END_SRC
#+BEGIN_SRC conf :tangle polybar/config.ini
[module/graphics-right]
type = custom/text
content = " "
content-foreground = ${colors.graphics-background}
content-underline = ${colors.graphics-underline}
content-overline = ${colors.graphics-overline}
content-padding = ${sizes.module-padding}
#+END_SRC
#+BEGIN_SRC conf :tangle polybar/config.ini
[module/graphics]
type = custom/script
; Available tokens:
; %counter%
; Command to be executed (using "/bin/sh -c [command]")
exec = echo "󰢮 $(modinfo nvidia | grep ^version | cut -d ' ' -f9)"
; Conditional command that, if defined, needs to exit successfully
; before the main exec command is invoked.
; Default: ""
; exec-if = pgrep -x myservice
; Will the script output continous content?
; Default: false
tail = false
; Seconds to sleep between updates
; Default: 5 (0 if `tail = true`)
interval = ${intervals.graphics}
; Available tags:
; <output> - deprecated
; <label> (default)
format = <label>
format-foreground = ${colors.graphics-foreground}
format-background = ${colors.graphics-background}
format-underline = ${colors.graphics-underline}
format-overline = ${colors.graphics-overline}
; Available tokens:
; %output%
; Default: %output%
label = %output%
label-padding = ${sizes.module-padding}
; Available tokens:
; %counter%
; %pid%
;
; "click-(left|middle|right)" will be executed using "/bin/sh -c [command]"
click-left = nvidia-settings
; click-middle = echo middle %counter%
click-right = ~/.scripts/cpu-gpu.sh --rofi
; double-click-left = echo double left %counter%
; double-click-middle = echo double middle %counter%
; double-click-right = echo double right %counter%
; Available tokens:
; %counter%
; %pid%
;
; "scroll-(up|down)" will be executed using "/bin/sh -c [command]"
; scroll-up = echo scroll up %counter%
; scroll-down = echo scroll down %counter%
#+END_SRC
**** CPU **** CPU
#+BEGIN_SRC conf :tangle polybar/config.ini #+BEGIN_SRC conf :tangle polybar/config.ini

View File

@@ -74,6 +74,11 @@ media-playing-overline = ${self.background}
tray-background = ${self.background} tray-background = ${self.background}
; right ; right
graphics-foreground = ${self.green}
graphics-background = ${self.background}
graphics-underline = ${self.background}
graphics-overline = ${self.background}
kernel-foreground = ${self.orange} kernel-foreground = ${self.orange}
kernel-background = ${self.background} kernel-background = ${self.background}
kernel-underline = ${self.background} kernel-underline = ${self.background}
@@ -135,6 +140,7 @@ maxlen = ${xrdb:polybar.maxlen:50}
[intervals] [intervals]
media-playing = 1 media-playing = 1
graphics = 86400
kernel = 86400 kernel = 86400
cpu = 1 cpu = 1
memory = 1 memory = 1
@@ -276,7 +282,7 @@ font-5 = "IPAPGothic:size=11;3"
; modules-right = ipc clock ; modules-right = ipc clock
modules-left = powermenu-left powermenu powermenu-right dwm volume-left volume volume-right media-playing-left media-playing-change media-playing-prev media-playing-play-pause media-playing-next media-playing media-playing-right modules-left = powermenu-left powermenu powermenu-right dwm volume-left volume volume-right media-playing-left media-playing-change media-playing-prev media-playing-play-pause media-playing-next media-playing media-playing-right
; modules-center = ; modules-center =
modules-right = kernel-left kernel kernel-right cpu-left cpu cpu-right memory-left memory memory-right filesystem-left filesystem filesystem-right date-left date date-right time-left time time-right dunst-left dunst-status dunst-clear dunst-history-view dunst-history-clear dunst-history-length dunst-right modules-right = kernel-left kernel kernel-right graphics-left graphics graphics-right cpu-left cpu cpu-right memory-left memory memory-right filesystem-left filesystem filesystem-right date-left date date-right time-left time time-right dunst-left dunst-status dunst-clear dunst-history-view dunst-history-clear dunst-history-length dunst-right
; The separator will be inserted between the output of each module ; The separator will be inserted between the output of each module
separator = "" separator = ""
@@ -744,7 +750,7 @@ interval = ${intervals.kernel}
; Available tags: ; Available tags:
; <output> - deprecated ; <output> - deprecated
; <label> (default) ; <label> (default)
format = %{A1:kitty bash -c "fastfetch && nvidia-smi && sleep 15":}<label>%{A} format = %{A1:kitty bash -c "fastfetch && sleep 15":}<label>%{A}
format-foreground = ${colors.kernel-foreground} format-foreground = ${colors.kernel-foreground}
format-background = ${colors.kernel-background} format-background = ${colors.kernel-background}
format-underline = ${colors.kernel-underline} format-underline = ${colors.kernel-underline}
@@ -776,6 +782,78 @@ label-padding = ${sizes.module-padding}
; scroll-up = echo scroll up %counter% ; scroll-up = echo scroll up %counter%
; scroll-down = echo scroll down %counter% ; scroll-down = echo scroll down %counter%
[module/graphics-left]
type = custom/text
content = " "
content-foreground = ${colors.graphics-background}
content-underline = ${colors.graphics-underline}
content-overline = ${colors.graphics-overline}
content-padding = ${sizes.module-padding}
[module/graphics-right]
type = custom/text
content = " "
content-foreground = ${colors.graphics-background}
content-underline = ${colors.graphics-underline}
content-overline = ${colors.graphics-overline}
content-padding = ${sizes.module-padding}
[module/graphics]
type = custom/script
; Available tokens:
; %counter%
; Command to be executed (using "/bin/sh -c [command]")
exec = echo "󰢮 $(modinfo nvidia | grep ^version | cut -d ' ' -f9)"
; Conditional command that, if defined, needs to exit successfully
; before the main exec command is invoked.
; Default: ""
; exec-if = pgrep -x myservice
; Will the script output continous content?
; Default: false
tail = false
; Seconds to sleep between updates
; Default: 5 (0 if `tail = true`)
interval = ${intervals.graphics}
; Available tags:
; <output> - deprecated
; <label> (default)
format = <label>
format-foreground = ${colors.graphics-foreground}
format-background = ${colors.graphics-background}
format-underline = ${colors.graphics-underline}
format-overline = ${colors.graphics-overline}
; Available tokens:
; %output%
; Default: %output%
label = %output%
label-padding = ${sizes.module-padding}
; Available tokens:
; %counter%
; %pid%
;
; "click-(left|middle|right)" will be executed using "/bin/sh -c [command]"
click-left = nvidia-settings
; click-middle = echo middle %counter%
click-right = ~/.scripts/cpu-gpu.sh --rofi
; double-click-left = echo double left %counter%
; double-click-middle = echo double middle %counter%
; double-click-right = echo double right %counter%
; Available tokens:
; %counter%
; %pid%
;
; "scroll-(up|down)" will be executed using "/bin/sh -c [command]"
; scroll-up = echo scroll up %counter%
; scroll-down = echo scroll down %counter%
[module/cpu-left] [module/cpu-left]
type = custom/text type = custom/text
content = " " content = " "