Polybar - color config with Xressources

This commit is contained in:
Thomas Dehaeze 2020-03-01 21:38:38 +01:00
parent a36353e039
commit fbd71a4d65
4 changed files with 120 additions and 86 deletions

View File

@ -232,3 +232,18 @@
Categories=ConsoleOnly;System;FileTools;FileManager Categories=ConsoleOnly;System;FileTools;FileManager
MimeType=inode/directory;inode/mount-point;x-scheme-handler/ssh;x-scheme-handler/smb;x-scheme-handler/nfs;x-scheme-handler/ftp; MimeType=inode/directory;inode/mount-point;x-scheme-handler/ssh;x-scheme-handler/smb;x-scheme-handler/nfs;x-scheme-handler/ftp;
#+end_src #+end_src
* Emacs Client
:PROPERTIES:
:header-args: :tangle ~/.local/share/applications/emacsclient.desktop
:header-args+: :comments both :mkdirp yes
:END:
#+begin_src conf
[Desktop Entry]
Name=Emacs Client
Exec=emacsclient -c %u
Icon=emacs-icon
Type=Application
Terminal=false
MimeType=x-scheme-handler/org-protocol;
NoDisplay=true
#+end_src

View File

@ -91,8 +91,8 @@
:END: :END:
#+BEGIN_SRC conf #+BEGIN_SRC conf
max-cache-ttl 60480000
default-cache-ttl 60480000 default-cache-ttl 60480000
max-cache-ttl 60480000
#+END_SRC #+END_SRC
* Redshift * Redshift

View File

@ -875,11 +875,11 @@ https://upsilon.cc/~zack/blog/posts/2010/02/integrating_Mutt_with_Org-mode/
#+end_src #+end_src
**** Link mail to orgmode - Script **** Link mail to orgmode - Script
:PROPERTIES: :PROPERTIES:
:header-args: :tangle ~/scripts/mutt-save-org-link.py :header-args: :tangle ~/scripts/mutt-save-org-link.py
:header-args+: :comments both :mkdirp yes :header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env python3" :header-args+: :shebang "#!/usr/bin/env python3"
:END: :END:
#+begin_src python #+begin_src python
import sys import sys
import email import email

View File

@ -24,41 +24,22 @@
* Colors * Colors
#+begin_src conf #+begin_src conf
[colors] [colors]
base00 = ${xrdb:color0:#000000} bg = ${xrdb:background}
base01 = ${xrdb:color10:#000000} red = ${xrdb:color1}
base02 = ${xrdb:color11:#000000} green = ${xrdb:color2}
base03 = ${xrdb:color8:#000000} yellow = ${xrdb:color3}
base04 = ${xrdb:color12:#000000} blue = ${xrdb:color4}
base05 = ${xrdb:color7:#000000} purple = ${xrdb:color5}
base06 = ${xrdb:color13:#000000} aqua = ${xrdb:color6}
base07 = ${xrdb:color15:#000000} gray = ${colors.color7}
base08 = ${xrdb:color1:#000000} darkgray = ${colors.color8}
base09 = ${xrdb:color9:#000000} darkred = ${xrdb:color9}
base0A = ${xrdb:color3:#000000} darkgreen = ${xrdb:color10}
base0B = ${xrdb:color2:#000000} darkyellow = ${xrdb:color11}
base0C = ${xrdb:color6:#000000} darkblue = ${xrdb:color12}
base0D = ${xrdb:color4:#000000} darkpurple = ${xrdb:color13}
base0E = ${xrdb:color5:#000000} darkaqua = ${xrdb:color14}
base0F = ${xrdb:color14:#000000} fg = ${xrdb:foreground}
; based on http://chriskempson.com/projects/base16/
background = ${colors.base00}
background-light = ${colors.base01}
background-selection = ${colors.base02}
comments = ${colors.base03}
foreground-dark = ${colors.base04}
foreground = ${colors.base05}
foreground-light = ${colors.base06}
foreground-light-bis = ${colors.base07}
red = ${colors.base08}
orange = ${colors.base09}
brown = ${colors.base0A}
green = ${colors.base0B}
turquoise = ${colors.base0C}
blue = ${colors.base0D}
purple = ${colors.base0E}
magenta = ${colors.base0F}
black = ${#000000}
#+end_src #+end_src
* VM * VM
@ -80,8 +61,8 @@
height = 27 height = 27
radius = 0.0 radius = 0.0
background = ${colors.background} background = ${colors.bg}
foreground = ${colors.foreground} foreground = ${colors.fg}
line-size = 2 line-size = 2
@ -99,14 +80,14 @@
modules-left = i3 bspwm xwindow modules-left = i3 bspwm xwindow
modules-center = modules-center =
modules-right = pulseaudio xbacklightredshift nordvpn lockscreen dunst unread_mail cpu battery temperature date modules-right = pulseaudio xbacklight redshift packages nordvpn lockscreen dunst unread_mail cpu battery temperature date
wm-restack = bspwm wm-restack = i3
tray-position = right tray-position = right
tray-detached = true tray-detached = true
tray-padding = 0 tray-padding = 0
tray-background = ${colors.background} tray-background = ${colors.bg}
#+END_SRC #+END_SRC
* Show Windows Title * Show Windows Title
@ -131,28 +112,28 @@
#+END_SRC #+END_SRC
#+BEGIN_SRC conf #+BEGIN_SRC conf
label-mode-foreground = ${colors.background} label-mode-foreground = ${colors.bg}
label-mode-background = ${colors.foreground} label-mode-background = ${colors.fg}
label-mode-padding = 1 label-mode-padding = 1
# focused = Active workspace on focused monitor # focused = Active workspace on focused monitor
label-focused = %icon% %index% label-focused = %icon% %index%
label-focused-foreground = ${colors.foreground} label-focused-foreground = ${colors.fg}
label-focused-background = ${colors.background} label-focused-background = ${colors.bg}
label-focused-underline = ${colors.turquoise} label-focused-underline = ${colors.aqua}
label-focused-padding = 1 label-focused-padding = 1
# unfocused = Inactive workspace on any monitor # unfocused = Inactive workspace on any monitor
label-unfocused = %icon% %index% label-unfocused = %icon% %index%
label-unfocused-foreground = ${colors.foreground} label-unfocused-foreground = ${colors.fg}
label-unfocused-background = ${colors.background} label-unfocused-background = ${colors.bg}
label-unfocused-underline = ${colors.background} label-unfocused-underline = ${colors.bg}
label-unfocused-padding = 1 label-unfocused-padding = 1
# visible = Active workspace on unfocused monitor # visible = Active workspace on unfocused monitor
label-visible = %icon% %index% label-visible = %icon% %index%
label-visible-background = ${colors.background} label-visible-background = ${colors.bg}
label-visible-underline = ${colors.turquoise} label-visible-underline = ${colors.aqua}
label-visible-padding = 1 label-visible-padding = 1
# urgent = Workspace with urgency hint set # urgent = Workspace with urgency hint set
@ -185,13 +166,13 @@
ws-icon-default = ws-icon-default =
label-focused = %icon% label-focused = %icon%
label-focused-foreground = ${colors.background} label-focused-foreground = ${colors.bg}
label-focused-background = ${colors.turquoise} label-focused-background = ${colors.aqua}
label-focused-underline= ${colors.turquoise} label-focused-underline= ${colors.aqua}
label-focused-padding = 1 label-focused-padding = 1
label-occupied = %icon% label-occupied = %icon%
label-occupied-underline = ${colors.foreground} label-occupied-underline = ${colors.fg}
label-occupied-padding = 1 label-occupied-padding = 1
label-urgent = %icon% label-urgent = %icon%
@ -199,7 +180,7 @@
label-urgent-padding = 1 label-urgent-padding = 1
label-empty = %icon% label-empty = %icon%
label-empty-foreground = ${colors.foreground} label-empty-foreground = ${colors.fg}
label-empty-padding = 1 label-empty-padding = 1
#+end_src #+end_src
@ -230,8 +211,8 @@
# Used to display the state of random/repeat/repeatone/single # Used to display the state of random/repeat/repeatone/single
# Only applies if <icon-[random|repeat|repeatone|single]> is used # Only applies if <icon-[random|repeat|repeatone|single]> is used
toggle-on-foreground = ${colors.foreground-light} toggle-on-foreground = ${colors.fg}
toggle-off-foreground = ${colors.comments} toggle-off-foreground = ${colors.gray}
bar-progress-width = 15 bar-progress-width = 15
bar-progress-indicator = | bar-progress-indicator = |
@ -265,9 +246,9 @@
type = internal/cpu type = internal/cpu
interval = 2 interval = 2
format-prefix-foreground = ${colors.foreground} format-prefix-foreground = ${colors.fg}
format-underline = ${colors.background} format-underline = ${colors.bg}
label = %{A1:$TERMINAL -e "htop" &:} ﬙ %percentage:2%% %{A} label = %{A1:$TERMINAL -e "htop" &:} ﬙ %percentage:2%% %{A}
#+END_SRC #+END_SRC
@ -318,7 +299,7 @@
bar-volume-fill-font = 2 bar-volume-fill-font = 2
bar-volume-empty = ─ bar-volume-empty = ─
bar-volume-empty-font = 2 bar-volume-empty-font = 2
bar-volume-empty-foreground = ${colors.foreground} bar-volume-empty-foreground = ${colors.fg}
#+END_SRC #+END_SRC
* Battery * Battery
@ -337,22 +318,22 @@
format-discharging-underline = ${colors.red} format-discharging-underline = ${colors.red}
format-full-prefix = %{A1:xfce4-power-manager-settings &:} %{A} format-full-prefix = %{A1:xfce4-power-manager-settings &:} %{A}
format-full-prefix-foreground = ${colors.foreground} format-full-prefix-foreground = ${colors.fg}
format-full-underline = ${colors.background} format-full-underline = ${colors.bg}
ramp-capacity-0 =  ramp-capacity-0 = 
ramp-capacity-1 =  ramp-capacity-1 = 
ramp-capacity-2 =  ramp-capacity-2 = 
ramp-capacity-3 =  ramp-capacity-3 = 
ramp-capacity-4 =  ramp-capacity-4 = 
ramp-capacity-foreground = ${colors.foreground} ramp-capacity-foreground = ${colors.fg}
animation-charging-0 =  animation-charging-0 = 
animation-charging-1 =  animation-charging-1 = 
animation-charging-2 =  animation-charging-2 = 
animation-charging-3 =  animation-charging-3 = 
animation-charging-4 =  animation-charging-4 = 
animation-charging-foreground = ${colors.foreground} animation-charging-foreground = ${colors.fg}
animation-charging-framerate = 750 animation-charging-framerate = 750
animation-discharging-0 =  animation-discharging-0 = 
@ -360,7 +341,7 @@
animation-discharging-2 =  animation-discharging-2 = 
animation-discharging-3 =  animation-discharging-3 = 
animation-discharging-4 =  animation-discharging-4 = 
animation-discharging-foreground = ${colors.foreground} animation-discharging-foreground = ${color.fg}
animation-discharging-framerate = 750 animation-discharging-framerate = 750
#+END_SRC #+END_SRC
@ -372,11 +353,10 @@
interval = 5 interval = 5
thermal-zone = 0 thermal-zone = 0
warn-temperature = 70 warn-temperature = 70
;; Temperature off one cpu core hwmon-path = /sys/devices/platform/coretemp.0/hwmon/hwmon2/temp1_input
hwmon-path = /sys/devices/platform/coretemp.0/hwmon/hwmon1/temp1_input
format = %{A1:$TERMINAL -e "watch sensors" &:}<ramp> <label>%{A} format = %{A1:$TERMINAL -e "watch sensors" &:}<ramp> <label>%{A}
format-underline = ${colors.background} format-underline = ${colors.bg}
format-warn = <ramp> <label-warn> format-warn = <ramp> <label-warn>
format-warn-underline = ${colors.red} format-warn-underline = ${colors.red}
@ -389,7 +369,7 @@
ramp-2 =  ramp-2 = 
ramp-3 =  ramp-3 = 
ramp-4 =  ramp-4 = 
ramp-foreground = ${colors.foreground} ramp-foreground = ${color.fg}
#+END_SRC #+END_SRC
* Unread Mails * Unread Mails
@ -398,7 +378,7 @@
type = custom/script type = custom/script
label-font = 2 label-font = 2
format-underline = ${colors.background} format-underline = ${colors.bg}
click-left = ~/.config/polybar/scripts/mail-open.sh click-left = ~/.config/polybar/scripts/mail-open.sh
format = <label> format = <label>
exec = ~/.config/polybar/scripts/mail-status.sh exec = ~/.config/polybar/scripts/mail-status.sh
@ -437,7 +417,7 @@
type = custom/script type = custom/script
label-font = 2 label-font = 2
format-underline = ${colors.background} format-underline = ${colors.bg}
click-left = ~/.config/polybar/scripts/redshift-toggle.sh click-left = ~/.config/polybar/scripts/redshift-toggle.sh
format = <label> format = <label>
exec = ~/.config/polybar/scripts/redshift-status.sh exec = ~/.config/polybar/scripts/redshift-status.sh
@ -477,19 +457,21 @@
[module/nordvpn] [module/nordvpn]
type = custom/script type = custom/script
format-underline = ${colors.background} format-underline = ${colors.bg}
click-left = ~/.config/polybar/scripts/nordvpn-toggle.sh click-left = ~/.config/polybar/scripts/nordvpn-toggle.sh
format = <label> format = <label>
exec = ~/.config/polybar/scripts/nordvpn-status.sh exec = ~/.config/polybar/scripts/nordvpn-status.sh
interval = 2 interval = 2
#+END_SRC #+END_SRC
** Nordvpn Status script ** TODO Nordvpn Status script
:PROPERTIES: :PROPERTIES:
:header-args: :tangle ~/.config/polybar/scripts/nordvpn-status.sh :header-args: :tangle ~/.config/polybar/scripts/nordvpn-status.sh
:header-args+: :comments both :mkdirp yes :header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash" :header-args+: :shebang "#!/usr/bin/env bash"
:END: :END:
- [ ] Should check if there is a tmpfile, if there is not, run nordvpn status and create the tmpfile accordindly
#+BEGIN_SRC bash #+BEGIN_SRC bash
tmpfile="/tmp/vpnstatus"; tmpfile="/tmp/vpnstatus";
@ -518,12 +500,49 @@
fi fi
#+END_SRC #+END_SRC
* Packages
#+BEGIN_SRC conf
[module/packages]
type = custom/script
format-underline = ${colors.bg}
click-left = ~/.config/polybar/scripts/packages-update.sh
format = <label>
exec = ~/.config/polybar/scripts/packages-status.sh
interval = 600
#+END_SRC
** Packages Status script
:PROPERTIES:
:header-args: :tangle ~/.config/polybar/scripts/packages-status.sh
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
#+BEGIN_SRC bash
packagenb=`yay -Qu 2> /dev/null | wc -l`;
if [ "$packagenb" -eq "0" ]; then
echo "";
else
echo "%{F#859900}%{F-}";
fi
#+END_SRC
** Packages Update
:PROPERTIES:
:header-args: :tangle ~/.config/polybar/scripts/packages-update.sh
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
#+BEGIN_SRC bash
$TERMINAL -e "yay" &
#+END_SRC
* Dunst * Dunst
#+BEGIN_SRC conf #+BEGIN_SRC conf
[module/dunst] [module/dunst]
type = custom/script type = custom/script
format-underline = ${colors.background} format-underline = ${colors.bg}
click-left = ~/.config/polybar/scripts/dunst-toggle.sh click-left = ~/.config/polybar/scripts/dunst-toggle.sh
format = <label> format = <label>
exec = ~/.config/polybar/scripts/dunst-status.sh exec = ~/.config/polybar/scripts/dunst-status.sh
@ -576,7 +595,7 @@
[module/lockscreen] [module/lockscreen]
type = custom/script type = custom/script
format-underline = ${colors.background} format-underline = ${colors.bg}
click-left = ~/.config/polybar/scripts/lockscreen-toggle.sh click-left = ~/.config/polybar/scripts/lockscreen-toggle.sh
click-right = ~/scripts/lockscreen.sh click-right = ~/scripts/lockscreen.sh
format = <label> format = <label>
@ -763,13 +782,13 @@ https://github.com/x70b1/polybar-scripts/tree/master/polybar-scripts/openweather
interface = enp0s20f0u9u4 interface = enp0s20f0u9u4
label-connected = %local_ip% label-connected = %local_ip%
label-connected-foreground = ${colors.foreground} label-connected-foreground = ${color.fg}
format-connected-prefix = " " format-connected-prefix = " "
format-connected = <label-connected> format-connected = <label-connected>
label-disconnected = "" label-disconnected = ""
label-disconnected-foreground = ${colors.comments} label-disconnected-foreground = ${colors.gray}
format-disconnected = <label-disconnected> format-disconnected = <label-disconnected>
@ -778,13 +797,13 @@ https://github.com/x70b1/polybar-scripts/tree/master/polybar-scripts/openweather
interface = wlp2s0 interface = wlp2s0
label-connected = %essid% label-connected = %essid%
label-connected-foreground = ${colors.foreground} label-connected-foreground = ${color.fg}
format-connected-prefix = " " format-connected-prefix = " "
format-connected = <label-connected> format-connected = <label-connected>
label-disconnected = "" label-disconnected = ""
label-disconnected-foreground = ${colors.comments} label-disconnected-foreground = ${colors.gray}
format-disconnected = <label-disconnected> format-disconnected = <label-disconnected>
#+end_src #+end_src
@ -814,7 +833,7 @@ https://github.com/x70b1/polybar-scripts/tree/master/polybar-scripts/openweather
while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done
# Launch Polybar, using default config location ~/.config/polybar/config # Launch Polybar, using default config location ~/.config/polybar/config
polybar top & polybar top >>/tmp/polybar.log 2>&1 &
# polybar bottom & # polybar bottom &
echo "Polybar launched..." echo "Polybar launched..."