2019-01-31 09:41:03 +01:00
|
|
|
#+TITLE: Polybar Configuration
|
|
|
|
#+PROPERTY: header-args+ :comments both
|
|
|
|
#+PROPERTY: header-args+ :mkdirp yes
|
|
|
|
#+PROPERTY: header-args+ :tangle ~/.config/polybar/config
|
|
|
|
|
|
|
|
* Colors
|
|
|
|
#+begin_src conf
|
|
|
|
[colors]
|
|
|
|
base00 = ${xrdb:color0:#000000}
|
|
|
|
base01 = ${xrdb:color10:#000000}
|
|
|
|
base02 = ${xrdb:color11:#000000}
|
|
|
|
base03 = ${xrdb:color8:#000000}
|
|
|
|
base04 = ${xrdb:color12:#000000}
|
|
|
|
base05 = ${xrdb:color7:#000000}
|
|
|
|
base06 = ${xrdb:color13:#000000}
|
|
|
|
base07 = ${xrdb:color15:#000000}
|
|
|
|
base08 = ${xrdb:color1:#000000}
|
|
|
|
base09 = ${xrdb:color9:#000000}
|
|
|
|
base0A = ${xrdb:color3:#000000}
|
|
|
|
base0B = ${xrdb:color2:#000000}
|
|
|
|
base0C = ${xrdb:color6:#000000}
|
|
|
|
base0D = ${xrdb:color4:#000000}
|
|
|
|
base0E = ${xrdb:color5:#000000}
|
|
|
|
base0F = ${xrdb:color14:#000000}
|
|
|
|
|
|
|
|
; 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
|
|
|
|
|
|
|
|
* VM
|
|
|
|
#+begin_src conf
|
|
|
|
[global/wm]
|
|
|
|
margin-top = 5
|
|
|
|
margin-bottom = 5
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
* Top Bar
|
|
|
|
#+BEGIN_SRC conf
|
|
|
|
[bar/top]
|
|
|
|
enable-ipc = true
|
|
|
|
override-redirect = false
|
|
|
|
bottom = false
|
|
|
|
fixed-center = true
|
|
|
|
|
|
|
|
width = 100%
|
|
|
|
height = 27
|
|
|
|
radius = 0.0
|
|
|
|
|
|
|
|
background = ${colors.background}
|
|
|
|
foreground = ${colors.foreground}
|
|
|
|
|
|
|
|
line-size = 3
|
|
|
|
|
|
|
|
border-size = 0
|
|
|
|
|
|
|
|
padding-left = 2
|
|
|
|
padding-right = 2
|
|
|
|
|
|
|
|
module-margin-left = 1
|
|
|
|
module-margin-right = 1
|
|
|
|
|
|
|
|
font-0 = SauceCodePro Nerd Font:style=Medium,Regular:pixelsize=10;1
|
|
|
|
font-1 = unifont:fontformat=truetype:size=8:antialias=false;0
|
|
|
|
font-2 = Weather Icons:size=10;1
|
|
|
|
|
|
|
|
modules-left = i3
|
|
|
|
modules-center = xwindow
|
2019-02-03 17:54:54 +01:00
|
|
|
modules-right = unread_mail cpu battery temperature date
|
2019-01-31 09:41:03 +01:00
|
|
|
|
|
|
|
tray-position = right
|
|
|
|
tray-padding = 2
|
|
|
|
#tray-transparent = true
|
|
|
|
#tray-background = #0063ff
|
|
|
|
|
|
|
|
#cursor-click = pointer
|
|
|
|
#cursor-scroll = ns-resize
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* Bottom Bar
|
|
|
|
#+BEGIN_SRC conf
|
|
|
|
[bar/bottom]
|
|
|
|
enable-ipc = true
|
|
|
|
override-redirect = false
|
|
|
|
bottom = true
|
|
|
|
fixed-center = true
|
|
|
|
|
|
|
|
width = 100%
|
|
|
|
height = 27
|
|
|
|
radius = 0.0
|
|
|
|
|
|
|
|
background = ${colors.background}
|
|
|
|
foreground = ${colors.foreground}
|
|
|
|
|
|
|
|
line-size = 3
|
|
|
|
|
|
|
|
border-size = 0
|
|
|
|
|
|
|
|
padding-left = 2
|
|
|
|
padding-right = 2
|
|
|
|
|
|
|
|
module-margin-left = 1
|
|
|
|
module-margin-right = 1
|
|
|
|
|
|
|
|
font-0 = SauceCodePro Nerd Font:style=Medium,Regular:pixelsize=10;1
|
|
|
|
font-1 = unifont:fontformat=truetype:size=8:antialias=false;0
|
|
|
|
font-2 = Weather Icons:size=10;1
|
|
|
|
# font-3 = siji:pixelsize=10;1
|
|
|
|
|
|
|
|
modules-left = mpd pulseaudio
|
|
|
|
# modules-center = xwindow
|
2019-02-03 17:54:54 +01:00
|
|
|
modules-right = filesystem xkeyboard nordvpn chromecast screenshot weather emacs caffeine redshift
|
2019-01-31 09:41:03 +01:00
|
|
|
|
|
|
|
# tray-position = right
|
|
|
|
# tray-padding = 2
|
|
|
|
#tray-transparent = true
|
|
|
|
#tray-background = #0063ff
|
|
|
|
|
|
|
|
#cursor-click = pointer
|
|
|
|
#cursor-scroll = ns-resize
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* Show Windows Title
|
|
|
|
#+BEGIN_SRC conf
|
|
|
|
[module/xwindow]
|
|
|
|
type = internal/xwindow
|
|
|
|
label = %title:0:30:...%
|
|
|
|
#+END_SRC
|
|
|
|
|
2019-02-03 17:54:54 +01:00
|
|
|
* Current Layout of the Keyboard
|
2019-01-31 09:41:03 +01:00
|
|
|
#+BEGIN_SRC conf
|
|
|
|
[module/xkeyboard]
|
|
|
|
type = internal/xkeyboard
|
|
|
|
|
|
|
|
# List of indicators to ignore
|
|
|
|
blacklist-0 = num lock
|
|
|
|
|
|
|
|
format = <label-layout>
|
|
|
|
format-prefix = " "
|
|
|
|
format-prefix-foreground = ${colors.foreground}
|
|
|
|
format-prefix-underline = ${colors.background}
|
|
|
|
|
|
|
|
label-layout = %layout%
|
|
|
|
label-layout-underline = ${colors.background}
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* Mount filesystem and show available space
|
|
|
|
#+BEGIN_SRC conf
|
|
|
|
[module/filesystem]
|
|
|
|
type = internal/fs
|
|
|
|
|
|
|
|
interval = 25
|
|
|
|
|
|
|
|
# List of mountpoints to display
|
|
|
|
mount-0 = /
|
|
|
|
|
2019-02-03 17:54:54 +01:00
|
|
|
label-mounted = %{Fcolors.blue}%mountpoint%%{F-}: %percentage_used%%
|
2019-01-31 09:41:03 +01:00
|
|
|
label-unmounted = %mountpoint%
|
|
|
|
label-unmounted-foreground = ${colors.comments}
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* I3 - Information about workspaces and active one
|
|
|
|
#+BEGIN_SRC conf
|
|
|
|
[module/i3]
|
|
|
|
type = internal/i3
|
|
|
|
|
|
|
|
enable-scroll = false
|
|
|
|
wrapping-scroll = false
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
** TODO - Choose some nice icons
|
|
|
|
#+BEGIN_SRC conf
|
2019-02-03 17:54:54 +01:00
|
|
|
ws-icon-default =
|
2019-01-31 09:41:03 +01:00
|
|
|
ws-icon-0 = 1;
|
|
|
|
ws-icon-1 = 2;
|
|
|
|
ws-icon-2 = 3;
|
|
|
|
ws-icon-3 = 4;
|
|
|
|
ws-icon-4 = 5;
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
#+BEGIN_SRC conf
|
|
|
|
format = <label-state> <label-mode>
|
|
|
|
index-sort = true
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
** Colors
|
|
|
|
#+BEGIN_SRC conf
|
|
|
|
label-mode-foreground = ${colors.foreground}
|
|
|
|
label-mode-background = ${colors.turquoise}
|
|
|
|
label-mode-padding = 1
|
|
|
|
|
|
|
|
# focused = Active workspace on focused monitor
|
|
|
|
label-focused = %icon% %index%
|
|
|
|
label-focused-foreground = ${colors.foreground}
|
|
|
|
label-focused-background = ${colors.background}
|
|
|
|
label-focused-underline = ${colors.turquoise}
|
|
|
|
label-focused-padding = 1
|
|
|
|
|
|
|
|
# unfocused = Inactive workspace on any monitor
|
|
|
|
label-unfocused = %icon% %index%
|
|
|
|
label-unfocused-foreground = ${colors.foreground}
|
|
|
|
label-unfocused-background = ${colors.background}
|
|
|
|
label-unfocused-underline = ${colors.background}
|
|
|
|
label-unfocused-padding = 1
|
|
|
|
|
|
|
|
# visible = Active workspace on unfocused monitor
|
|
|
|
label-visible = %icon% %index%
|
|
|
|
label-visible-background = ${colors.background}
|
|
|
|
label-visible-underline = ${colors.turquoise}
|
|
|
|
label-visible-padding = 1
|
|
|
|
|
|
|
|
# urgent = Workspace with urgency hint set
|
|
|
|
label-urgent = %icon% %index%
|
|
|
|
label-urgent-background = ${colors.red}
|
|
|
|
label-urgent-padding = 1
|
|
|
|
|
|
|
|
# Separator in between workspaces
|
|
|
|
#label-separator = |
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* Music using MPD
|
|
|
|
#+BEGIN_SRC conf
|
|
|
|
[module/mpd]
|
|
|
|
type = internal/mpd
|
2019-02-03 17:54:54 +01:00
|
|
|
format-online = <icon-prev> <toggle> <icon-next> %{A1:termite -e "ncmpcpp" &:}<label-song>%{A}
|
2019-01-31 09:41:03 +01:00
|
|
|
|
|
|
|
format-online-spacing = 0
|
|
|
|
format-online-padding = 0
|
|
|
|
|
|
|
|
label-offline = mpd is offline
|
|
|
|
format-offline = <label-offline>
|
|
|
|
format-offline-foreground = #777
|
|
|
|
|
|
|
|
label-song = %artist% - %title%
|
|
|
|
label-song-maxlen = 30
|
|
|
|
label-song-ellipsis = true
|
|
|
|
|
|
|
|
icon-prev = 寧
|
|
|
|
icon-stop = 栗
|
|
|
|
icon-play = 契
|
|
|
|
icon-pause =
|
|
|
|
icon-next = 嶺
|
|
|
|
icon-random = 咽
|
|
|
|
icon-repeat = 凌
|
|
|
|
|
|
|
|
# Used to display the state of random/repeat/repeatone/single
|
|
|
|
# Only applies if <icon-[random|repeat|repeatone|single]> is used
|
|
|
|
toggle-on-foreground = ${colors.foreground-light}
|
|
|
|
toggle-off-foreground = ${colors.comments}
|
|
|
|
|
|
|
|
bar-progress-width = 15
|
|
|
|
bar-progress-indicator = |
|
|
|
|
bar-progress-fill = ─
|
|
|
|
bar-progress-empty = ─
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* Backlight level
|
|
|
|
#+BEGIN_SRC conf
|
|
|
|
[module/xbacklight]
|
|
|
|
type = internal/xbacklight
|
|
|
|
|
|
|
|
format = <ramp>
|
|
|
|
ramp-0 =
|
|
|
|
ramp-1 =
|
|
|
|
ramp-2 =
|
|
|
|
ramp-3 =
|
|
|
|
ramp-4 =
|
|
|
|
ramp-5 =
|
|
|
|
ramp-6 =
|
|
|
|
ramp-7 =
|
|
|
|
ramp-8 =
|
|
|
|
ramp-9 =
|
|
|
|
ramp-10 =
|
|
|
|
ramp-11 =
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* CPU Usage
|
|
|
|
#+BEGIN_SRC conf
|
2019-02-03 17:54:54 +01:00
|
|
|
[module/cpu]
|
|
|
|
type = internal/cpu
|
|
|
|
interval = 2
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-02-03 17:54:54 +01:00
|
|
|
format-prefix-foreground = ${colors.foreground}
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-02-03 17:54:54 +01:00
|
|
|
format-underline = ${colors.background}
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-02-03 17:54:54 +01:00
|
|
|
label = %{A1:termite -e "htop" &:} %percentage:2%% %{A}
|
2019-01-31 09:41:03 +01:00
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* Available Memory
|
|
|
|
#+BEGIN_SRC conf
|
2019-02-03 17:54:54 +01:00
|
|
|
[module/memory]
|
|
|
|
type = internal/memory
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-02-03 17:54:54 +01:00
|
|
|
interval = 2
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-02-03 17:54:54 +01:00
|
|
|
format-prefix = " "
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-02-03 17:54:54 +01:00
|
|
|
format-prefix-foreground = ${colors.foreground-dark}
|
|
|
|
format-underline = #4bffdc
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-02-03 17:54:54 +01:00
|
|
|
label = %percentage_used%%
|
2019-01-31 09:41:03 +01:00
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* Date
|
|
|
|
#+BEGIN_SRC conf
|
2019-02-03 17:54:54 +01:00
|
|
|
[module/date]
|
|
|
|
type = internal/date
|
|
|
|
interval = 1
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-02-03 17:54:54 +01:00
|
|
|
# Open google calendar on left right
|
|
|
|
date = %{A1:$BROWSER https\://calendar.google.com/ &:} %d-%m%{A}
|
|
|
|
date-alt = "%{A1:$BROWSER https\://calendar.google.com/ &:} %d-%m-%Y%{A}"
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-02-03 17:54:54 +01:00
|
|
|
time = %H:%M
|
|
|
|
time-alt = %H:%M:%S
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-02-03 17:54:54 +01:00
|
|
|
label = %date% %time%
|
2019-01-31 09:41:03 +01:00
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* Sound Volume
|
|
|
|
#+BEGIN_SRC conf
|
2019-02-03 17:54:54 +01:00
|
|
|
[module/pulseaudio]
|
|
|
|
type = internal/pulseaudio
|
|
|
|
|
|
|
|
# Open pavucontrol on left right
|
|
|
|
format-volume =%{A1:pavucontrol &:}<label-volume> <bar-volume>%{A}
|
|
|
|
|
|
|
|
label-volume = %percentage%%
|
|
|
|
label-volume-foreground = ${root.foreground}
|
|
|
|
|
|
|
|
label-muted = ﱝ muted
|
|
|
|
|
|
|
|
bar-volume-width = 10
|
|
|
|
bar-volume-foreground-0 = ${colors.green}
|
|
|
|
bar-volume-foreground-1 = ${colors.green}
|
|
|
|
bar-volume-foreground-2 = ${colors.blue}
|
|
|
|
bar-volume-foreground-3 = ${colors.blue}
|
|
|
|
bar-volume-foreground-4 = ${colors.red}
|
|
|
|
bar-volume-foreground-5 = ${colors.red}
|
|
|
|
bar-volume-foreground-6 = ${colors.red}
|
|
|
|
bar-volume-gradient = false
|
|
|
|
bar-volume-indicator = |
|
|
|
|
bar-volume-indicator-font = 2
|
|
|
|
bar-volume-fill = ─
|
|
|
|
bar-volume-fill-font = 2
|
|
|
|
bar-volume-empty = ─
|
|
|
|
bar-volume-empty-font = 2
|
|
|
|
bar-volume-empty-foreground = ${colors.foreground}
|
2019-01-31 09:41:03 +01:00
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* Battery
|
|
|
|
#+BEGIN_SRC conf
|
2019-02-03 17:54:54 +01:00
|
|
|
[module/battery]
|
|
|
|
type = internal/battery
|
|
|
|
|
|
|
|
battery = BAT0
|
|
|
|
adapter = ADP1
|
|
|
|
full-at = 95
|
|
|
|
|
|
|
|
format-charging = %{A1:xfce4-power-manager-settings &:}<ramp-capacity> <label-charging>%{A}
|
|
|
|
format-charging-underline = ${colors.blue}
|
|
|
|
|
|
|
|
format-discharging = %{A1:xfce4-power-manager-settings &:}<ramp-capacity> <label-discharging>%{A}
|
|
|
|
format-discharging-underline = ${colors.red}
|
|
|
|
|
|
|
|
format-full-prefix = %{A1:xfce4-power-manager-settings &:} %{A}
|
|
|
|
format-full-prefix-foreground = ${colors.foreground}
|
|
|
|
format-full-underline = ${colors.background}
|
|
|
|
|
|
|
|
ramp-capacity-0 =
|
|
|
|
ramp-capacity-1 =
|
|
|
|
ramp-capacity-2 =
|
|
|
|
ramp-capacity-3 =
|
|
|
|
ramp-capacity-4 =
|
|
|
|
ramp-capacity-foreground = ${colors.foreground}
|
|
|
|
|
|
|
|
animation-charging-0 =
|
|
|
|
animation-charging-1 =
|
|
|
|
animation-charging-2 =
|
|
|
|
animation-charging-3 =
|
|
|
|
animation-charging-4 =
|
|
|
|
animation-charging-foreground = ${colors.foreground}
|
|
|
|
animation-charging-framerate = 750
|
|
|
|
|
|
|
|
animation-discharging-0 =
|
|
|
|
animation-discharging-1 =
|
|
|
|
animation-discharging-2 =
|
|
|
|
animation-discharging-3 =
|
|
|
|
animation-discharging-4 =
|
|
|
|
animation-discharging-foreground = ${colors.foreground}
|
|
|
|
animation-discharging-framerate = 750
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* Temperature
|
2019-01-31 09:41:03 +01:00
|
|
|
#+BEGIN_SRC conf
|
|
|
|
[module/temperature]
|
|
|
|
type = internal/temperature
|
|
|
|
|
|
|
|
interval = 5
|
|
|
|
thermal-zone = 0
|
|
|
|
warn-temperature = 70
|
|
|
|
;; Temperature off one cpu core
|
|
|
|
hwmon-path = /sys/devices/platform/coretemp.0/hwmon/hwmon1/temp2_input
|
|
|
|
|
2019-02-03 17:54:54 +01:00
|
|
|
format = %{A1:termite -e "watch sensors" &:}<ramp> <label>%{A}
|
2019-01-31 09:41:03 +01:00
|
|
|
format-underline = ${colors.background}
|
|
|
|
format-warn = <ramp> <label-warn>
|
|
|
|
format-warn-underline = ${colors.red}
|
|
|
|
|
|
|
|
label = %temperature-c%
|
|
|
|
label-warn = %temperature-c%
|
|
|
|
label-warn-foreground = ${colors.red}
|
|
|
|
|
|
|
|
ramp-0 =
|
|
|
|
ramp-1 =
|
|
|
|
ramp-2 =
|
|
|
|
ramp-3 =
|
|
|
|
ramp-4 =
|
|
|
|
ramp-foreground = ${colors.foreground}
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* Settings
|
|
|
|
#+BEGIN_SRC conf
|
|
|
|
[settings]
|
|
|
|
screenchange-reload = true
|
|
|
|
#compositing-background = xor
|
|
|
|
#compositing-background = screen
|
|
|
|
#compositing-foreground = source
|
|
|
|
#compositing-border = over
|
|
|
|
#+END_SRC
|
|
|
|
|
2019-02-03 17:54:54 +01:00
|
|
|
* Unread Mails
|
2019-01-31 09:41:03 +01:00
|
|
|
|
|
|
|
#+BEGIN_SRC conf
|
|
|
|
[module/unread_mail]
|
|
|
|
type = custom/script
|
|
|
|
|
|
|
|
label-font = 2
|
|
|
|
format-underline = ${colors.background}
|
|
|
|
click-left = termite -e "tmuxinator start neomutt" &
|
|
|
|
format = <label>
|
|
|
|
exec = ~/.config/polybar/scripts/unread_mails.sh
|
|
|
|
interval = 1
|
|
|
|
#+END_SRC
|
|
|
|
|
2019-02-03 17:54:54 +01:00
|
|
|
** Unread Mail Scripts
|
|
|
|
:PROPERTIES:
|
|
|
|
:header-args: :tangle ~/.config/polybar/scripts/unread_mails.sh
|
|
|
|
:header-args+: :comments both :mkdirp yes
|
|
|
|
:header-args+: :shebang "#!/usr/bin/env bash"
|
|
|
|
:END:
|
|
|
|
#+begin_src bash
|
|
|
|
mails=$(du -a ~/.mail/*/Inbox/new/* 2>/dev/null | sed -n '$=')
|
|
|
|
|
|
|
|
if [[ -z "$mails" ]]; then
|
|
|
|
echo ""
|
|
|
|
else
|
|
|
|
echo "%{F#859900}%{F-}"
|
|
|
|
fi
|
|
|
|
#+end_src
|
|
|
|
|
2019-01-31 09:41:03 +01:00
|
|
|
* Redshift
|
|
|
|
#+BEGIN_SRC conf
|
|
|
|
[module/redshift]
|
|
|
|
type = custom/script
|
|
|
|
|
|
|
|
label-font = 2
|
|
|
|
format-underline = ${colors.background}
|
|
|
|
click-left = ~/.config/polybar/scripts/redshift.sh toggle
|
|
|
|
format = <label>
|
|
|
|
exec = ~/.config/polybar/scripts/redshift.sh
|
|
|
|
interval = 1
|
|
|
|
#+END_SRC
|
|
|
|
|
2019-02-03 17:54:54 +01:00
|
|
|
** Redshift Scripts
|
|
|
|
:PROPERTIES:
|
|
|
|
:header-args: :tangle ~/.config/polybar/scripts/redshift.sh
|
|
|
|
:header-args+: :comments both :mkdirp yes
|
|
|
|
:header-args+: :shebang "#!/usr/bin/env bash"
|
|
|
|
:END:
|
|
|
|
#+begin_src bash
|
|
|
|
if pgrep -x "redshift" >/dev/null; then
|
|
|
|
echo "盛";
|
|
|
|
else
|
|
|
|
echo "";
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$1" = "toggle" ]; then
|
|
|
|
if pgrep -x "redshift" >/dev/null; then
|
|
|
|
killall redshift;
|
|
|
|
else
|
|
|
|
nohup redshift > /dev/null 2>&1 &
|
|
|
|
fi
|
|
|
|
fi
|
2019-01-31 09:41:03 +01:00
|
|
|
#+end_src
|
2019-02-03 17:54:54 +01:00
|
|
|
|
2019-03-05 22:04:20 +01:00
|
|
|
* Emacs
|
2019-02-03 17:54:54 +01:00
|
|
|
|
2019-01-31 09:41:03 +01:00
|
|
|
#+begin_src conf
|
|
|
|
[module/emacs]
|
|
|
|
type = custom/script
|
|
|
|
|
|
|
|
label-font = 2
|
|
|
|
format-underline = ${colors.background}
|
2019-02-03 17:54:54 +01:00
|
|
|
click-left = ~/.config/polybar/scripts/emacsclient.sh &
|
|
|
|
click-right = emacs &
|
2019-01-31 09:41:03 +01:00
|
|
|
format = <label>
|
2019-02-03 17:54:54 +01:00
|
|
|
exec = ~/.config/polybar/scripts/emacsserver.sh
|
|
|
|
interval = 5
|
2019-01-31 09:41:03 +01:00
|
|
|
#+end_src
|
|
|
|
|
|
|
|
** Emacs Server Scripts
|
|
|
|
:PROPERTIES:
|
2019-02-03 17:54:54 +01:00
|
|
|
:header-args: :tangle ~/.config/polybar/scripts/emacsserver.sh
|
2019-01-31 09:41:03 +01:00
|
|
|
:header-args+: :comments both :mkdirp yes
|
|
|
|
:header-args+: :shebang "#!/usr/bin/env bash"
|
|
|
|
:END:
|
|
|
|
|
|
|
|
#+BEGIN_SRC bash
|
2019-02-03 17:54:54 +01:00
|
|
|
if test -e "/tmp/emacs1000/server" || test -e "~/.emacs.d/server"; then
|
|
|
|
echo "%{F#859900}%{F-}";
|
|
|
|
else
|
|
|
|
echo "";
|
|
|
|
fi
|
2019-01-31 09:41:03 +01:00
|
|
|
#+END_SRC
|
|
|
|
|
2019-02-03 17:54:54 +01:00
|
|
|
** Emacs Client Script
|
|
|
|
:PROPERTIES:
|
|
|
|
:header-args: :tangle ~/.config/polybar/scripts/emacsclient.sh
|
|
|
|
:header-args+: :comments both :mkdirp yes
|
|
|
|
:header-args+: :shebang "#!/usr/bin/env bash"
|
|
|
|
:END:
|
|
|
|
|
|
|
|
#+BEGIN_SRC bash
|
|
|
|
emacsclient -create-frame --alternate-editor=""
|
|
|
|
#+END_SRC
|
2019-01-31 09:41:20 +01:00
|
|
|
|
2019-02-03 17:54:54 +01:00
|
|
|
* NordVPN
|
2019-01-31 09:41:03 +01:00
|
|
|
#+BEGIN_SRC conf
|
|
|
|
[module/nordvpn]
|
|
|
|
type = custom/script
|
|
|
|
|
|
|
|
format-underline = ${colors.background}
|
|
|
|
click-left = ~/.config/polybar/scripts/nordvpn-toggle.sh
|
|
|
|
format = <label>
|
|
|
|
exec = ~/.config/polybar/scripts/nordvpn.sh
|
|
|
|
interval = 5
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
** Nordvpn Toggle script
|
|
|
|
:PROPERTIES:
|
|
|
|
:header-args: :tangle ~/.config/polybar/scripts/nordvpn-toggle.sh
|
|
|
|
:header-args+: :comments both :mkdirp yes
|
|
|
|
:header-args+: :shebang "#!/usr/bin/env bash"
|
|
|
|
:END:
|
|
|
|
#+BEGIN_SRC bash
|
|
|
|
vpnstatus=`nordvpn status`;
|
|
|
|
|
|
|
|
if [[ ${vpnstatus} == *"Disconnected"* ]]; then
|
|
|
|
nordvpn connect
|
|
|
|
else
|
|
|
|
nordvpn disconnect
|
|
|
|
fi
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
** Nordvpn Status script
|
|
|
|
:PROPERTIES:
|
|
|
|
:header-args: :tangle ~/.config/polybar/scripts/nordvpn.sh
|
|
|
|
:header-args+: :comments both :mkdirp yes
|
|
|
|
:header-args+: :shebang "#!/usr/bin/env bash"
|
|
|
|
:END:
|
|
|
|
#+BEGIN_SRC bash
|
|
|
|
vpnstatus=`nordvpn status`;
|
|
|
|
|
|
|
|
if [[ ${vpnstatus} == *"Disconnected"* ]]; then
|
|
|
|
echo "";
|
|
|
|
else
|
|
|
|
country=`echo -e $vpnstatus | sed 's/^.*Country: \(\w*\) .*$/\1/'`
|
|
|
|
echo "%{F#859900}%{F-} $country";
|
|
|
|
fi
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* TODO Caffeine
|
|
|
|
#+BEGIN_SRC conf
|
|
|
|
[module/caffeine]
|
|
|
|
type = custom/script
|
|
|
|
|
|
|
|
label-font = 2
|
|
|
|
format-underline = ${colors.background}
|
|
|
|
click-left = xautolock -disable && notify-send "Lock Disabled"
|
|
|
|
click-right = xautolock -enable && notify-send "Lock Enabled"
|
|
|
|
format = <label>
|
|
|
|
exec = echo -e "\uf0f4"
|
|
|
|
interval = 1
|
|
|
|
#+END_SRC
|
|
|
|
|
2019-02-03 17:54:54 +01:00
|
|
|
* Weather
|
2019-01-31 09:41:03 +01:00
|
|
|
https://github.com/x70b1/polybar-scripts/tree/master/polybar-scripts/openweathermap-fullfeatured
|
|
|
|
|
|
|
|
#+begin_src conf
|
|
|
|
[module/weather]
|
|
|
|
type = custom/script
|
2019-02-03 17:54:54 +01:00
|
|
|
|
2019-01-31 09:41:03 +01:00
|
|
|
exec = ~/.config/polybar/scripts/weather.sh
|
2019-02-03 17:54:54 +01:00
|
|
|
click-left = ~/.config/polybar/scripts/weatheropen.sh
|
|
|
|
|
2019-01-31 09:41:03 +01:00
|
|
|
interval = 600
|
|
|
|
label-font = 3
|
|
|
|
#+end_src
|
|
|
|
|
2019-02-03 17:54:54 +01:00
|
|
|
** Emacs Server Scripts
|
|
|
|
:PROPERTIES:
|
|
|
|
:header-args: :tangle ~/.config/polybar/scripts/weather.sh
|
|
|
|
:header-args+: :comments both :mkdirp yes
|
|
|
|
:header-args+: :shebang "#!/usr/bin/env bash"
|
|
|
|
:END:
|
|
|
|
|
|
|
|
#+BEGIN_SRC bash
|
|
|
|
get_icon() {
|
|
|
|
case $1 in
|
|
|
|
01d) icon="";;
|
|
|
|
01n) icon="";;
|
|
|
|
02d) icon="";;
|
|
|
|
02n) icon="";;
|
|
|
|
03*) icon="";;
|
|
|
|
04*) icon="";;
|
|
|
|
09d) icon="";;
|
|
|
|
09n) icon="";;
|
|
|
|
10d) icon="";;
|
|
|
|
10n) icon="";;
|
|
|
|
11d) icon="";;
|
|
|
|
11n) icon="";;
|
|
|
|
13d) icon="";;
|
|
|
|
13n) icon="";;
|
|
|
|
50d) icon="";;
|
|
|
|
50n) icon="";;
|
|
|
|
,*) icon="";
|
|
|
|
esac
|
|
|
|
|
|
|
|
echo $icon
|
|
|
|
}
|
|
|
|
|
|
|
|
get_duration() {
|
|
|
|
|
|
|
|
osname=$(uname -s)
|
|
|
|
|
|
|
|
case $osname in
|
|
|
|
,*BSD) date -r "$1" -u +%H:%M;;
|
|
|
|
,*) date --date="@$1" -u +%H:%M;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
KEY="a705adc4ce0e271801051b9460ecb1cd"
|
|
|
|
CITY=""
|
|
|
|
UNITS="metric"
|
|
|
|
SYMBOL="°"
|
|
|
|
|
|
|
|
API="https://api.openweathermap.org/data/2.5"
|
|
|
|
|
|
|
|
if [ -n "$CITY" ]; then
|
|
|
|
if [ "$CITY" -eq "$CITY" ] 2>/dev/null; then
|
|
|
|
CITY_PARAM="id=$CITY"
|
|
|
|
else
|
|
|
|
CITY_PARAM="q=$CITY"
|
|
|
|
fi
|
|
|
|
|
|
|
|
current=$(curl -sf "$API/weather?appid=$KEY&$CITY_PARAM&units=$UNITS")
|
|
|
|
forecast=$(curl -sf "$API/forecast?appid=$KEY&$CITY_PARAM&units=$UNITS&cnt=1")
|
|
|
|
else
|
|
|
|
location=$(curl -sf https://location.services.mozilla.com/v1/geolocate?key=geoclue)
|
|
|
|
|
|
|
|
if [ -n "$location" ]; then
|
|
|
|
location_lat="$(echo "$location" | jq '.location.lat')"
|
|
|
|
location_lon="$(echo "$location" | jq '.location.lng')"
|
|
|
|
|
|
|
|
current=$(curl -sf "$API/weather?appid=$KEY&lat=$location_lat&lon=$location_lon&units=$UNITS")
|
|
|
|
forecast=$(curl -sf "$API/forecast?appid=$KEY&lat=$location_lat&lon=$location_lon&units=$UNITS&cnt=1")
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -n "$current" ] && [ -n "$forecast" ]; then
|
|
|
|
current_temp=$(echo "$current" | jq ".main.temp" | cut -d "." -f 1)
|
|
|
|
current_icon=$(echo "$current" | jq -r ".weather[0].icon")
|
|
|
|
|
|
|
|
forecast_temp=$(echo "$forecast" | jq ".list[].main.temp" | cut -d "." -f 1)
|
|
|
|
forecast_icon=$(echo "$forecast" | jq -r ".list[].weather[0].icon")
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$current_temp" -gt "$forecast_temp" ]; then
|
|
|
|
trend="" #
|
|
|
|
elif [ "$forecast_temp" -gt "$current_temp" ]; then
|
|
|
|
trend="" #
|
|
|
|
else
|
|
|
|
trend="" #
|
|
|
|
fi
|
|
|
|
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-02-03 17:54:54 +01:00
|
|
|
sun_rise=$(echo "$current" | jq ".sys.sunrise")
|
|
|
|
sun_set=$(echo "$current" | jq ".sys.sunset")
|
|
|
|
now=$(date +%s)
|
|
|
|
|
|
|
|
if [ "$sun_rise" -gt "$now" ]; then
|
|
|
|
daytime=" $(get_duration "$((sun_rise-now))")"
|
|
|
|
elif [ "$sun_set" -gt "$now" ]; then
|
|
|
|
daytime=" $(get_duration "$((sun_set-now))")"
|
|
|
|
else
|
|
|
|
daytime=" $(get_duration "$((sun_rise-now))")"
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "$(get_icon "$current_icon") $current_temp$SYMBOL $trend $(get_icon "$forecast_icon") $forecast_temp$SYMBOL $daytime"
|
|
|
|
fi
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
** TODO Open Weather Webpage
|
|
|
|
:PROPERTIES:
|
|
|
|
:header-args: :tangle ~/.config/polybar/scripts/weatheropen.sh
|
|
|
|
:header-args+: :comments both :mkdirp yes
|
|
|
|
:header-args+: :shebang "#!/usr/bin/env bash"
|
|
|
|
:END:
|
|
|
|
- [ ] Find a way to open a web page with detailed forecast with the current location
|
|
|
|
|
|
|
|
#+BEGIN_SRC bash
|
|
|
|
# location=$(curl -sf https://location.services.mozilla.com/v1/geolocate?key=geoclue)
|
|
|
|
|
|
|
|
# if [ -n "$location" ]; then
|
|
|
|
# location_lat="$(echo "$location" | jq '.location.lat')"
|
|
|
|
# location_lon="$(echo "$location" | jq '.location.lng')"
|
|
|
|
# else
|
|
|
|
|
|
|
|
# fi
|
|
|
|
$BROWSER https://www.yahoo.com/news/weather/france/grenoble/grenoble-593720
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* TODO [#A] Network
|
2019-01-31 09:41:03 +01:00
|
|
|
#+begin_src conf
|
|
|
|
[module/network]
|
|
|
|
type = internal/network
|
|
|
|
interface = wlp3s0
|
|
|
|
|
|
|
|
; Seconds to sleep between updates
|
|
|
|
; Default: 1
|
|
|
|
interval = 3.0
|
|
|
|
|
|
|
|
; ; Test connectivity every Nth update
|
|
|
|
; ; A value of 0 disables the feature
|
|
|
|
; ; NOTE: Experimental (needs more testing)
|
|
|
|
; ; Default: 0
|
|
|
|
; ;ping-interval = 3
|
|
|
|
|
|
|
|
; ; @deprecated: Define min width using token specifiers (%downspeed:min% and %upspeed:min%)
|
|
|
|
; ; Minimum output width of upload/download rate
|
|
|
|
; ; Default: 3
|
|
|
|
; udspeed-minwidth = 5
|
|
|
|
|
|
|
|
; ; Accumulate values from all interfaces
|
|
|
|
; ; when querying for up/downspeed rate
|
|
|
|
; ; Default: false
|
|
|
|
; accumulate-stats = true
|
|
|
|
|
|
|
|
; ; Consider an `UNKNOWN` interface state as up.
|
|
|
|
; ; Some devices have an unknown state, even when they're running
|
|
|
|
; ; Default: false
|
|
|
|
; unknown-as-up = true
|
|
|
|
|
|
|
|
; ; Available tags:
|
|
|
|
; ; <label-connected> (default)
|
|
|
|
; ; <ramp-signal>
|
|
|
|
format-connected-prefix = " "
|
|
|
|
format-connected = <label-connected>
|
|
|
|
|
|
|
|
; ; Available tags:
|
|
|
|
; ; <label-disconnected> (default)
|
|
|
|
; format-disconnected = <label-disconnected>
|
|
|
|
|
|
|
|
; ; Available tags:
|
|
|
|
; ; <label-connected> (default)
|
|
|
|
; ; <label-packetloss>
|
|
|
|
; ; <animation-packetloss>
|
|
|
|
; format-packetloss = <animation-packetloss> <label-connected>
|
|
|
|
|
|
|
|
; ; Available tokens:
|
|
|
|
; ; %ifname% [wireless+wired]
|
|
|
|
; ; %local_ip% [wireless+wired]
|
|
|
|
; ; %local_ip6% [wireless+wired]
|
|
|
|
; ; %essid% [wireless]
|
|
|
|
; ; %signal% [wireless]
|
|
|
|
; ; %upspeed% [wireless+wired]
|
|
|
|
; ; %downspeed% [wireless+wired]
|
|
|
|
; ; %linkspeed% [wired]
|
|
|
|
; ; Default: %ifname% %local_ip%
|
|
|
|
label-connected = %essid%
|
|
|
|
; label-connected-foreground = #eefafafa
|
|
|
|
|
|
|
|
; ; Available tokens:
|
|
|
|
; ; %ifname% [wireless+wired]
|
|
|
|
; ; Default: (none)
|
|
|
|
; label-disconnected = not connected
|
|
|
|
; label-disconnected-foreground = #66ffffff
|
|
|
|
|
|
|
|
; ; Available tokens:
|
|
|
|
; ; %ifname% [wireless+wired]
|
|
|
|
; ; %local_ip% [wireless+wired]
|
|
|
|
; ; %local_ip6% [wireless+wired]
|
|
|
|
; ; %essid% [wireless]
|
|
|
|
; ; %signal% [wireless]
|
|
|
|
; ; %linkspeed% [wired]
|
|
|
|
; ; Default: (none)
|
|
|
|
; ;label-packetloss = %essid%
|
|
|
|
; ;label-packetloss-foreground = #eefafafa
|
|
|
|
|
|
|
|
; ; Only applies if <ramp-signal> is used
|
|
|
|
; ramp-signal-0 = 😱
|
|
|
|
; ramp-signal-1 = 😠
|
|
|
|
; ramp-signal-2 = 😒
|
|
|
|
; ramp-signal-3 = 😊
|
|
|
|
; ramp-signal-4 = 😃
|
|
|
|
; ramp-signal-5 = 😈
|
|
|
|
|
|
|
|
; ; Only applies if <animation-packetloss> is used
|
|
|
|
; animation-packetloss-0 = ⚠
|
|
|
|
; animation-packetloss-0-foreground = #ffa64c
|
|
|
|
; animation-packetloss-1 = 📶
|
|
|
|
; animation-packetloss-1-foreground = #000000
|
|
|
|
; ; Framerate in milliseconds
|
|
|
|
; animation-packetloss-framerate = 500
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
* Logout
|
|
|
|
#+BEGIN_SRC conf
|
|
|
|
[module/logout]
|
|
|
|
type = custom/text
|
|
|
|
content = ""
|
|
|
|
click-left = i3exit switch_user
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* Hibernate
|
|
|
|
#+BEGIN_SRC conf
|
|
|
|
[module/hibernate]
|
|
|
|
type = custom/text
|
|
|
|
content = ""
|
|
|
|
click-left = i3exit hibernate
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* Shutdown
|
|
|
|
#+BEGIN_SRC conf
|
|
|
|
[module/shutdown]
|
|
|
|
type = custom/text
|
|
|
|
content = ""
|
|
|
|
click-left = i3exit shutdown
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* Reboot
|
|
|
|
#+BEGIN_SRC conf
|
|
|
|
[module/reboot]
|
|
|
|
type = custom/text
|
|
|
|
content = ""
|
|
|
|
click-left = i3exit logout
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* Lock
|
|
|
|
#+BEGIN_SRC conf
|
|
|
|
[module/lock]
|
|
|
|
type = custom/text
|
|
|
|
content = ""
|
|
|
|
click-left = blurlock
|
|
|
|
#+END_SRC
|
|
|
|
|
2019-02-03 17:54:54 +01:00
|
|
|
* TODO [#B] Screenshot
|
|
|
|
- [ ] the right click is not working
|
|
|
|
|
2019-01-31 09:41:03 +01:00
|
|
|
#+BEGIN_SRC conf
|
|
|
|
[module/screenshot]
|
|
|
|
type = custom/text
|
|
|
|
content = ""
|
|
|
|
click-left = scrot -e 'feh $f -x' --delay 1
|
|
|
|
click-right = scrot -s -e 'feh $f -x'
|
|
|
|
#+END_SRC
|
2019-02-03 17:54:54 +01:00
|
|
|
|
|
|
|
* ChromeCast Play/Pause
|
|
|
|
#+BEGIN_SRC conf
|
|
|
|
[module/chromecast]
|
|
|
|
type = custom/script
|
|
|
|
content = "懶"
|
|
|
|
click-left = catt play
|
|
|
|
click-right = catt pause
|
|
|
|
#+END_SRC
|