2019-01-31 09:41:03 +01:00
|
|
|
#+TITLE: Polybar Configuration
|
2019-05-16 21:13:08 +02:00
|
|
|
:DRAWER:
|
2020-01-11 22:04:28 +01:00
|
|
|
#+STARTUP: overview
|
|
|
|
|
|
|
|
#+LANGUAGE: en
|
|
|
|
#+EMAIL: dehaeze.thomas@gmail.com
|
|
|
|
#+AUTHOR: Dehaeze Thomas
|
|
|
|
|
|
|
|
#+HTML_LINK_HOME: ./index.html
|
|
|
|
#+HTML_LINK_UP: ./index.html
|
|
|
|
|
2020-01-11 22:24:51 +01:00
|
|
|
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="./css/htmlize.css"/>
|
|
|
|
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="./css/readtheorg.css"/>
|
|
|
|
#+HTML_HEAD: <script type="text/javascript" src="./js/jquery.min.js"></script>
|
|
|
|
#+HTML_HEAD: <script type="text/javascript" src="./js/bootstrap.min.js"></script>
|
|
|
|
#+HTML_HEAD: <script type="text/javascript" src="./js/jquery.stickytableheaders.min.js"></script>
|
|
|
|
#+HTML_HEAD: <script type="text/javascript" src="./js/readtheorg.js"></script>
|
2020-01-11 22:04:28 +01:00
|
|
|
|
2019-12-30 17:21:56 +01:00
|
|
|
#+PROPERTY: header-args :comments no
|
2019-01-31 09:41:03 +01:00
|
|
|
#+PROPERTY: header-args+ :mkdirp yes
|
|
|
|
#+PROPERTY: header-args+ :tangle ~/.config/polybar/config
|
2019-05-16 21:13:08 +02:00
|
|
|
:END:
|
2019-01-31 09:41:03 +01:00
|
|
|
|
|
|
|
* Colors
|
|
|
|
#+begin_src conf
|
2019-04-05 09:28:01 +02:00
|
|
|
[colors]
|
2020-03-01 21:38:38 +01:00
|
|
|
bg = ${xrdb:background}
|
|
|
|
red = ${xrdb:color1}
|
|
|
|
green = ${xrdb:color2}
|
|
|
|
yellow = ${xrdb:color3}
|
|
|
|
blue = ${xrdb:color4}
|
|
|
|
purple = ${xrdb:color5}
|
|
|
|
aqua = ${xrdb:color6}
|
|
|
|
gray = ${colors.color7}
|
|
|
|
darkgray = ${colors.color8}
|
|
|
|
darkred = ${xrdb:color9}
|
|
|
|
darkgreen = ${xrdb:color10}
|
|
|
|
darkyellow = ${xrdb:color11}
|
|
|
|
darkblue = ${xrdb:color12}
|
|
|
|
darkpurple = ${xrdb:color13}
|
|
|
|
darkaqua = ${xrdb:color14}
|
|
|
|
fg = ${xrdb:foreground}
|
2019-01-31 09:41:03 +01:00
|
|
|
#+end_src
|
|
|
|
|
|
|
|
* VM
|
|
|
|
#+begin_src conf
|
2019-04-04 10:27:43 +02:00
|
|
|
[global/wm]
|
2019-12-30 17:21:56 +01:00
|
|
|
margin-top = 0
|
|
|
|
margin-bottom = 0
|
2019-01-31 09:41:03 +01:00
|
|
|
#+end_src
|
|
|
|
|
|
|
|
* Top Bar
|
|
|
|
#+BEGIN_SRC conf
|
|
|
|
[bar/top]
|
|
|
|
enable-ipc = true
|
|
|
|
override-redirect = false
|
|
|
|
bottom = false
|
2019-05-16 21:13:08 +02:00
|
|
|
fixed-center = false
|
2019-01-31 09:41:03 +01:00
|
|
|
|
|
|
|
width = 100%
|
|
|
|
height = 27
|
|
|
|
radius = 0.0
|
|
|
|
|
2020-03-01 21:38:38 +01:00
|
|
|
background = ${colors.bg}
|
|
|
|
foreground = ${colors.fg}
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-05-16 21:13:08 +02:00
|
|
|
line-size = 2
|
2019-01-31 09:41:03 +01:00
|
|
|
|
|
|
|
border-size = 0
|
|
|
|
|
|
|
|
padding-left = 2
|
2020-01-12 17:15:09 +01:00
|
|
|
padding-right = 12
|
2019-01-31 09:41:03 +01:00
|
|
|
|
|
|
|
module-margin-left = 1
|
|
|
|
module-margin-right = 1
|
|
|
|
|
2019-04-10 16:56:26 +02:00
|
|
|
font-0 = Hack Nerd Font:style=Medium,Regular:pixelsize=10;1
|
2019-01-31 09:41:03 +01:00
|
|
|
font-1 = unifont:fontformat=truetype:size=8:antialias=false;0
|
|
|
|
font-2 = Weather Icons:size=10;1
|
|
|
|
|
2019-12-30 17:21:56 +01:00
|
|
|
modules-left = i3 bspwm xwindow
|
2019-05-16 21:13:08 +02:00
|
|
|
modules-center =
|
2020-11-15 19:26:54 +01:00
|
|
|
modules-right = pulseaudio wired-network wireless-network wireguard nordvpn bluetooth redshift lockscreen dunst packages unread_news unread_mail calendar temperature battery date
|
2019-12-30 17:21:56 +01:00
|
|
|
|
2020-03-01 21:38:38 +01:00
|
|
|
wm-restack = i3
|
2019-01-31 09:41:03 +01:00
|
|
|
|
|
|
|
tray-position = right
|
2019-12-16 21:36:02 +01:00
|
|
|
tray-detached = true
|
2019-05-16 21:13:08 +02:00
|
|
|
tray-padding = 0
|
2020-03-01 21:38:38 +01:00
|
|
|
tray-background = ${colors.bg}
|
2019-01-31 09:41:03 +01:00
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* Show Windows Title
|
|
|
|
#+BEGIN_SRC conf
|
|
|
|
[module/xwindow]
|
|
|
|
type = internal/xwindow
|
|
|
|
label = %title:0:30:...%
|
|
|
|
#+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
|
|
|
|
|
|
|
|
#+BEGIN_SRC conf
|
2019-04-04 10:27:43 +02:00
|
|
|
format = <label-state> <label-mode>
|
|
|
|
index-sort = true
|
2019-01-31 09:41:03 +01:00
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
#+BEGIN_SRC conf
|
2020-03-01 21:38:38 +01:00
|
|
|
label-mode-foreground = ${colors.bg}
|
|
|
|
label-mode-background = ${colors.fg}
|
2019-04-10 16:58:12 +02:00
|
|
|
label-mode-padding = 1
|
|
|
|
|
|
|
|
# focused = Active workspace on focused monitor
|
|
|
|
label-focused = %icon% %index%
|
2020-03-01 21:38:38 +01:00
|
|
|
label-focused-foreground = ${colors.fg}
|
|
|
|
label-focused-background = ${colors.bg}
|
|
|
|
label-focused-underline = ${colors.aqua}
|
2019-04-10 16:58:12 +02:00
|
|
|
label-focused-padding = 1
|
|
|
|
|
|
|
|
# unfocused = Inactive workspace on any monitor
|
|
|
|
label-unfocused = %icon% %index%
|
2020-03-01 21:38:38 +01:00
|
|
|
label-unfocused-foreground = ${colors.fg}
|
|
|
|
label-unfocused-background = ${colors.bg}
|
|
|
|
label-unfocused-underline = ${colors.bg}
|
2019-04-10 16:58:12 +02:00
|
|
|
label-unfocused-padding = 1
|
|
|
|
|
|
|
|
# visible = Active workspace on unfocused monitor
|
|
|
|
label-visible = %icon% %index%
|
2020-03-01 21:38:38 +01:00
|
|
|
label-visible-background = ${colors.bg}
|
|
|
|
label-visible-underline = ${colors.aqua}
|
2019-04-10 16:58:12 +02:00
|
|
|
label-visible-padding = 1
|
|
|
|
|
|
|
|
# urgent = Workspace with urgency hint set
|
|
|
|
label-urgent = %icon% %index%
|
|
|
|
label-urgent-background = ${colors.red}
|
|
|
|
label-urgent-padding = 1
|
2019-01-31 09:41:03 +01:00
|
|
|
#+END_SRC
|
|
|
|
|
2019-12-30 17:21:56 +01:00
|
|
|
* BSPWM
|
|
|
|
#+begin_src conf
|
|
|
|
[module/bspwm]
|
|
|
|
type = internal/bspwm
|
|
|
|
|
|
|
|
pin-workspaces = true
|
|
|
|
enable-click = true
|
|
|
|
enable-scroll = false
|
|
|
|
|
|
|
|
; Use fuzzy (partial) matching on labels when assigning
|
|
|
|
; icons to workspaces
|
|
|
|
; Example: code;♚ will apply the icon to all workspaces
|
|
|
|
; containing 'code' in the label
|
|
|
|
fuzzy-match = false
|
|
|
|
|
|
|
|
|
|
|
|
ws-icon-0 = code;
|
|
|
|
ws-icon-1 = web;
|
|
|
|
ws-icon-2 = mail;
|
|
|
|
ws-icon-3 = misc;
|
|
|
|
ws-icon-4 = figs;ﬧ
|
|
|
|
ws-icon-default =
|
|
|
|
|
|
|
|
label-focused = %icon%
|
2020-03-01 21:38:38 +01:00
|
|
|
label-focused-foreground = ${colors.bg}
|
|
|
|
label-focused-background = ${colors.aqua}
|
|
|
|
label-focused-underline= ${colors.aqua}
|
2019-12-30 17:21:56 +01:00
|
|
|
label-focused-padding = 1
|
|
|
|
|
|
|
|
label-occupied = %icon%
|
2020-03-01 21:38:38 +01:00
|
|
|
label-occupied-underline = ${colors.fg}
|
2019-12-30 17:21:56 +01:00
|
|
|
label-occupied-padding = 1
|
|
|
|
|
|
|
|
label-urgent = %icon%
|
|
|
|
label-urgent-background = ${colors.red}
|
|
|
|
label-urgent-padding = 1
|
|
|
|
|
|
|
|
label-empty = %icon%
|
2020-03-01 21:38:38 +01:00
|
|
|
label-empty-foreground = ${colors.fg}
|
2019-12-30 17:21:56 +01:00
|
|
|
label-empty-padding = 1
|
|
|
|
#+end_src
|
|
|
|
|
2019-01-31 09:41:03 +01:00
|
|
|
* Music using MPD
|
|
|
|
#+BEGIN_SRC conf
|
2019-04-10 16:58:12 +02:00
|
|
|
[module/mpd]
|
|
|
|
type = internal/mpd
|
2020-01-12 17:15:09 +01:00
|
|
|
format-online = <icon-prev> <toggle> <icon-next> %{A1:$TERMINAL -e "ncmpcpp" &:}<label-song>%{A}
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-04-10 16:58:12 +02:00
|
|
|
format-online-spacing = 0
|
|
|
|
format-online-padding = 0
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-04-10 16:58:12 +02:00
|
|
|
label-offline = mpd is offline
|
|
|
|
format-offline = <label-offline>
|
|
|
|
format-offline-foreground = #777
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-04-10 16:58:12 +02:00
|
|
|
label-song = %artist% - %title%
|
|
|
|
label-song-maxlen = 30
|
|
|
|
label-song-ellipsis = true
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-04-10 16:58:12 +02:00
|
|
|
icon-prev = 寧
|
|
|
|
icon-stop = 栗
|
|
|
|
icon-play = 契
|
|
|
|
icon-pause =
|
|
|
|
icon-next = 嶺
|
|
|
|
icon-random = 咽
|
|
|
|
icon-repeat = 凌
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-04-10 16:58:12 +02:00
|
|
|
# Used to display the state of random/repeat/repeatone/single
|
|
|
|
# Only applies if <icon-[random|repeat|repeatone|single]> is used
|
2020-03-01 21:38:38 +01:00
|
|
|
toggle-on-foreground = ${colors.fg}
|
|
|
|
toggle-off-foreground = ${colors.gray}
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-04-10 16:58:12 +02:00
|
|
|
bar-progress-width = 15
|
|
|
|
bar-progress-indicator = |
|
|
|
|
bar-progress-fill = ─
|
|
|
|
bar-progress-empty = ─
|
2019-01-31 09:41:03 +01:00
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* Backlight level
|
|
|
|
#+BEGIN_SRC conf
|
2019-04-10 16:58:12 +02:00
|
|
|
[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 =
|
2019-01-31 09:41:03 +01:00
|
|
|
#+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
|
|
|
|
2020-03-01 21:38:38 +01:00
|
|
|
format-prefix-foreground = ${colors.fg}
|
|
|
|
format-underline = ${colors.bg}
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2020-03-27 15:37:24 +01:00
|
|
|
label = %{A1:$TERMINAL -e "htop" &:} %percentage:2%%%{A}
|
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
|
2020-01-12 17:15:09 +01:00
|
|
|
date = %{A1:$TERMINAL -e "ikhal" &:} %d-%m%{A}
|
|
|
|
date-alt = "%{A1:$TERMINAL -e \"ikhal\" &:} %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
|
|
|
|
|
2019-04-04 12:36:10 +02:00
|
|
|
sink = alsa_output.pci-0000_00_1f.3.analog-stereo
|
|
|
|
|
2019-02-03 17:54:54 +01:00
|
|
|
# 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
|
2020-03-01 21:38:38 +01:00
|
|
|
bar-volume-empty-foreground = ${colors.fg}
|
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
|
2020-03-26 09:55:15 +01:00
|
|
|
adapter = AC
|
2019-02-03 17:54:54 +01:00
|
|
|
full-at = 95
|
|
|
|
|
2020-03-27 15:37:24 +01:00
|
|
|
format-charging = %{A1:xfce4-power-manager-settings &:}<ramp-capacity> <label-charging>%{A}
|
2019-02-03 17:54:54 +01:00
|
|
|
format-charging-underline = ${colors.blue}
|
|
|
|
|
2020-03-27 15:37:24 +01:00
|
|
|
format-discharging = %{A1:xfce4-power-manager-settings &:}<ramp-capacity> <label-discharging>%{A}
|
2019-02-03 17:54:54 +01:00
|
|
|
format-discharging-underline = ${colors.red}
|
|
|
|
|
2020-03-26 09:55:15 +01:00
|
|
|
label-full = %{A1:xfce4-power-manager-settings &:} %{A}
|
2020-03-01 21:38:38 +01:00
|
|
|
format-full-underline = ${colors.bg}
|
2019-02-03 17:54:54 +01:00
|
|
|
|
|
|
|
ramp-capacity-0 =
|
|
|
|
ramp-capacity-1 =
|
|
|
|
ramp-capacity-2 =
|
|
|
|
ramp-capacity-3 =
|
|
|
|
ramp-capacity-4 =
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* Temperature
|
2020-03-22 23:02:58 +01:00
|
|
|
#+begin_src conf
|
2019-01-31 09:41:03 +01:00
|
|
|
[module/temperature]
|
|
|
|
type = internal/temperature
|
2020-03-22 23:02:58 +01:00
|
|
|
interval = 2
|
2019-01-31 09:41:03 +01:00
|
|
|
thermal-zone = 0
|
|
|
|
warn-temperature = 70
|
2020-03-01 21:38:38 +01:00
|
|
|
hwmon-path = /sys/devices/platform/coretemp.0/hwmon/hwmon2/temp1_input
|
2020-03-22 23:02:58 +01:00
|
|
|
units = false
|
|
|
|
format = %{A1:$TERMINAL --class="Floating" -e "watch sensors" &:}<ramp> <label>%{A}
|
2019-01-31 09:41:03 +01:00
|
|
|
format-warn = <ramp> <label-warn>
|
2020-03-22 23:02:58 +01:00
|
|
|
label = %temperature-c%°C
|
|
|
|
label-warn = %temperature-c%°C
|
|
|
|
label-warn-foreground = ${colors.fg}
|
2019-01-31 09:41:03 +01:00
|
|
|
format-warn-underline = ${colors.red}
|
|
|
|
ramp-0 =
|
|
|
|
ramp-1 =
|
|
|
|
ramp-2 =
|
|
|
|
ramp-3 =
|
|
|
|
ramp-4 =
|
2020-03-22 23:02:58 +01:00
|
|
|
ramp-foreground = ${colors.fg}
|
|
|
|
#+end_src
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-02-03 17:54:54 +01:00
|
|
|
* Unread Mails
|
2019-01-31 09:41:03 +01:00
|
|
|
#+BEGIN_SRC conf
|
2019-04-10 16:58:12 +02:00
|
|
|
[module/unread_mail]
|
|
|
|
type = custom/script
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2020-03-22 23:02:58 +01:00
|
|
|
format-underline = ${colors.bg}
|
2020-04-10 16:37:42 +02:00
|
|
|
click-left = ~/.config/polybar/scripts/mail-open.sh >/dev/null 2>%1 &
|
|
|
|
click-right = ~/.config/polybar/scripts/mail-refresh.sh >/dev/null 2>%1 &
|
2019-04-10 16:58:12 +02:00
|
|
|
format = <label>
|
2019-12-16 11:38:04 +01:00
|
|
|
exec = ~/.config/polybar/scripts/mail-status.sh
|
2020-04-03 11:34:21 +02:00
|
|
|
interval = 2
|
2019-01-31 09:41:03 +01:00
|
|
|
#+END_SRC
|
|
|
|
|
2019-02-03 17:54:54 +01:00
|
|
|
** Unread Mail Scripts
|
2019-12-16 11:38:04 +01:00
|
|
|
:PROPERTIES:
|
|
|
|
:header-args: :tangle ~/.config/polybar/scripts/mail-status.sh
|
|
|
|
:header-args+: :comments both :mkdirp yes
|
|
|
|
:header-args+: :shebang "#!/usr/bin/env bash"
|
|
|
|
:END:
|
2019-02-03 17:54:54 +01:00
|
|
|
#+begin_src bash
|
2020-03-19 15:20:33 +01:00
|
|
|
mail_nb=`du -a ~/.mail/*/Inbox/new/* 2>/dev/null | wc -l`
|
2019-02-03 17:54:54 +01:00
|
|
|
|
2020-03-19 15:20:33 +01:00
|
|
|
if [ "$mail_nb" -eq "0" ]; then
|
|
|
|
echo "";
|
2019-02-03 17:54:54 +01:00
|
|
|
else
|
2020-03-19 15:20:33 +01:00
|
|
|
echo "%{F#859900} $mail_nb%{F-}";
|
2019-02-03 17:54:54 +01:00
|
|
|
fi
|
|
|
|
#+end_src
|
|
|
|
|
2020-04-02 22:06:26 +02:00
|
|
|
** Refresh Mail Scripts
|
|
|
|
:PROPERTIES:
|
|
|
|
:header-args: :tangle ~/.config/polybar/scripts/mail-refresh.sh
|
|
|
|
:header-args+: :comments both :mkdirp yes
|
|
|
|
:header-args+: :shebang "#!/usr/bin/env bash"
|
|
|
|
:END:
|
|
|
|
#+begin_src bash
|
|
|
|
dunstify --replace=98465 "Mails " "Syncing...";
|
2020-04-06 23:56:37 +02:00
|
|
|
checkmail -q && \
|
2020-04-03 11:34:21 +02:00
|
|
|
mail_nb=`du -a ~/.mail/*/Inbox/new/* 2>/dev/null | wc -l` && \
|
|
|
|
if [ "$mail_nb" -eq "0" ]; then
|
|
|
|
dunstify --replace=98465 "Mails " "No new mail";
|
|
|
|
fi
|
2020-04-02 22:06:26 +02:00
|
|
|
#+end_src
|
|
|
|
|
2019-12-16 11:38:04 +01:00
|
|
|
** Open Mails
|
|
|
|
:PROPERTIES:
|
|
|
|
:header-args: :tangle ~/.config/polybar/scripts/mail-open.sh
|
|
|
|
:header-args+: :comments both :mkdirp yes
|
|
|
|
:header-args+: :shebang "#!/usr/bin/env bash"
|
|
|
|
:END:
|
|
|
|
#+begin_src bash
|
2020-04-10 16:37:42 +02:00
|
|
|
$TERMINAL -e "tmux new-session -A -s neomutt neomutt"
|
2019-12-16 11:38:04 +01:00
|
|
|
#+end_src
|
|
|
|
|
2020-04-02 22:06:18 +02:00
|
|
|
* Unread News
|
|
|
|
#+BEGIN_SRC conf
|
|
|
|
[module/unread_news]
|
|
|
|
type = custom/script
|
|
|
|
|
|
|
|
format-underline = ${colors.bg}
|
2020-04-10 16:37:42 +02:00
|
|
|
click-left = ~/.config/polybar/scripts/news-open.sh >/dev/null 2>%1 &
|
|
|
|
click-right = ~/.config/polybar/scripts/news-refresh.sh >/dev/null 2>%1 &
|
2020-04-02 22:06:18 +02:00
|
|
|
format = <label>
|
|
|
|
exec = ~/.config/polybar/scripts/news-status.sh
|
|
|
|
interval = 60
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
** Unread News Scripts
|
|
|
|
:PROPERTIES:
|
|
|
|
:header-args: :tangle ~/.config/polybar/scripts/news-status.sh
|
|
|
|
:header-args+: :comments both :mkdirp yes
|
|
|
|
:header-args+: :shebang "#!/usr/bin/env bash"
|
|
|
|
:END:
|
|
|
|
#+begin_src bash
|
|
|
|
news_nb=`newsboat -x print-unread 2>/dev/null | cut -d " " -f1`
|
|
|
|
|
|
|
|
if [ -z "$news_nb" ] || [ "$news_nb" -eq "0" ]; then
|
|
|
|
echo "";
|
|
|
|
else
|
|
|
|
echo "%{F#859900} $news_nb%{F-}";
|
|
|
|
fi
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
** Refresh News Scripts
|
|
|
|
:PROPERTIES:
|
|
|
|
:header-args: :tangle ~/.config/polybar/scripts/news-refresh.sh
|
|
|
|
:header-args+: :comments both :mkdirp yes
|
|
|
|
:header-args+: :shebang "#!/usr/bin/env bash"
|
|
|
|
:END:
|
|
|
|
#+begin_src bash
|
2020-04-05 11:28:40 +02:00
|
|
|
dunstify --replace=38492 "Newsboat " "Reloading...";
|
|
|
|
|
2020-04-03 11:34:21 +02:00
|
|
|
if pgrep -x "newsboat" >/dev/null; then
|
2020-04-05 11:28:40 +02:00
|
|
|
# If newsboat is already running, try to refresh in the tmux session
|
|
|
|
tmux send-keys -t newsboat R
|
2020-04-03 11:34:21 +02:00
|
|
|
else
|
|
|
|
newsboat -x reload && /
|
|
|
|
news_nb=`newsboat -x print-unread | cut -d " " -f1` && \
|
|
|
|
dunstify --replace=38492 "Newsboat " "$news_nb Unread News";
|
|
|
|
fi
|
2020-04-02 22:06:18 +02:00
|
|
|
#+end_src
|
|
|
|
|
|
|
|
** Open Newsboat
|
|
|
|
:PROPERTIES:
|
|
|
|
:header-args: :tangle ~/.config/polybar/scripts/news-open.sh
|
|
|
|
:header-args+: :comments both :mkdirp yes
|
|
|
|
:header-args+: :shebang "#!/usr/bin/env bash"
|
|
|
|
:END:
|
|
|
|
#+begin_src bash
|
2020-04-10 16:37:42 +02:00
|
|
|
$TERMINAL -e "tmux new-session -A -s newsboat newsboat"
|
2020-04-02 22:06:18 +02:00
|
|
|
#+end_src
|
|
|
|
|
2020-05-01 00:32:00 +02:00
|
|
|
* Calendar
|
|
|
|
#+BEGIN_SRC conf
|
|
|
|
[module/calendar]
|
|
|
|
type = custom/script
|
|
|
|
|
|
|
|
format-underline = ${colors.bg}
|
|
|
|
click-left = ~/.config/polybar/scripts/calendar-open.sh >/dev/null 2>%1 &
|
|
|
|
format = <label>
|
|
|
|
exec = ~/.config/polybar/scripts/calendar-status.sh
|
|
|
|
interval = 5
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
** Calendar Status Scripts
|
|
|
|
:PROPERTIES:
|
|
|
|
:header-args: :tangle ~/.config/polybar/scripts/calendar-status.sh
|
|
|
|
:header-args+: :comments both :mkdirp yes
|
|
|
|
:header-args+: :shebang "#!/usr/bin/env bash"
|
|
|
|
:END:
|
|
|
|
|
|
|
|
#+begin_src bash
|
|
|
|
next_events=$(khal list "$(date +"%H:%M")" 23:59 --format "{start-time} - {title}" -df 'SKIPME' | grep -v 'SKIPME' | grep -v 'No events')
|
|
|
|
|
|
|
|
cal_icon=""
|
|
|
|
cal_nb=""
|
|
|
|
cal_desc=""
|
|
|
|
|
|
|
|
if [ -n "$next_events" ]; then
|
|
|
|
events_number="$(echo "$next_events" | wc -l)"
|
|
|
|
|
|
|
|
if [ "$events_number" -gt "1" ]; then
|
|
|
|
cal_nb=" ($events_number)"
|
|
|
|
fi
|
|
|
|
|
|
|
|
next_timed_events=$(echo "$next_events" | sed -e '/^[^0-9]/d')
|
|
|
|
if [ -z "$next_timed_events" ]; then
|
|
|
|
# Only full day events
|
|
|
|
cal_desc=" $(echo "$next_events" | sed -e '/^[0-9]/d;s/^ - //' | head -n 1 | cut -c 1-15)"
|
|
|
|
else
|
|
|
|
cal_desc=" $(echo "$next_timed_events" | head -n 1 | cut -c 1-20)"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "${cal_icon}${cal_nb}${cal_desc}"
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
** Open Calendar
|
|
|
|
:PROPERTIES:
|
|
|
|
:header-args: :tangle ~/.config/polybar/scripts/calendar-open.sh
|
|
|
|
:header-args+: :comments both :mkdirp yes
|
|
|
|
:header-args+: :shebang "#!/usr/bin/env bash"
|
|
|
|
:END:
|
|
|
|
#+begin_src bash
|
|
|
|
$TERMINAL --class="Floating" -e "khal interactive"
|
|
|
|
#+end_src
|
|
|
|
|
2019-01-31 09:41:03 +01:00
|
|
|
* Redshift
|
|
|
|
#+BEGIN_SRC conf
|
2019-04-10 16:58:12 +02:00
|
|
|
[module/redshift]
|
|
|
|
type = custom/script
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2020-03-01 21:38:38 +01:00
|
|
|
format-underline = ${colors.bg}
|
2020-04-10 16:37:42 +02:00
|
|
|
click-left = ~/.config/polybar/scripts/redshift-toggle.sh >/dev/null 2>%1 &
|
2019-04-10 16:58:12 +02:00
|
|
|
format = <label>
|
2019-12-16 11:38:04 +01:00
|
|
|
exec = ~/.config/polybar/scripts/redshift-status.sh
|
|
|
|
interval = 2
|
2019-01-31 09:41:03 +01:00
|
|
|
#+END_SRC
|
|
|
|
|
2020-04-03 11:34:21 +02:00
|
|
|
** Redshift - Status
|
2019-12-16 11:38:04 +01:00
|
|
|
:PROPERTIES:
|
|
|
|
:header-args: :tangle ~/.config/polybar/scripts/redshift-status.sh
|
|
|
|
:header-args+: :comments both :mkdirp yes
|
|
|
|
:header-args+: :shebang "#!/usr/bin/env bash"
|
|
|
|
:END:
|
2019-02-03 17:54:54 +01:00
|
|
|
#+begin_src bash
|
|
|
|
if pgrep -x "redshift" >/dev/null; then
|
2019-12-16 11:38:04 +01:00
|
|
|
echo "望";
|
2019-02-03 17:54:54 +01:00
|
|
|
else
|
2019-12-16 11:38:04 +01:00
|
|
|
echo "盛";
|
2019-02-03 17:54:54 +01:00
|
|
|
fi
|
2019-12-16 11:38:04 +01:00
|
|
|
#+end_src
|
2019-02-03 17:54:54 +01:00
|
|
|
|
2019-12-16 11:38:04 +01:00
|
|
|
** Toggle Redshift
|
|
|
|
:PROPERTIES:
|
|
|
|
:header-args: :tangle ~/.config/polybar/scripts/redshift-toggle.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
|
2020-04-03 11:34:21 +02:00
|
|
|
killall redshift && \
|
2020-04-10 16:37:42 +02:00
|
|
|
dunstify --replace=36492 "Redshift 望" "Turned off";
|
2019-12-16 11:38:04 +01:00
|
|
|
else
|
|
|
|
nohup redshift > /dev/null 2>&1 &
|
2020-04-03 11:34:21 +02:00
|
|
|
dunstify --replace=36492 "Redshift 望" "Starting...";
|
2019-02-03 17:54:54 +01:00
|
|
|
fi
|
2019-01-31 09:41:03 +01:00
|
|
|
#+end_src
|
2019-02-03 17:54:54 +01:00
|
|
|
|
|
|
|
* NordVPN
|
2019-01-31 09:41:03 +01:00
|
|
|
#+BEGIN_SRC conf
|
2019-04-10 16:58:12 +02:00
|
|
|
[module/nordvpn]
|
|
|
|
type = custom/script
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2020-03-01 21:38:38 +01:00
|
|
|
format-underline = ${colors.bg}
|
2020-04-10 16:37:42 +02:00
|
|
|
click-left = ~/.config/polybar/scripts/nordvpn-toggle.sh >/dev/null 2>%1 &
|
2019-04-10 16:58:12 +02:00
|
|
|
format = <label>
|
2019-12-16 11:38:04 +01:00
|
|
|
exec = ~/.config/polybar/scripts/nordvpn-status.sh
|
2019-05-16 21:13:08 +02:00
|
|
|
interval = 2
|
2019-01-31 09:41:03 +01:00
|
|
|
#+END_SRC
|
|
|
|
|
2020-03-22 23:02:58 +01:00
|
|
|
** Nordvpn Status script
|
2019-12-16 11:38:04 +01:00
|
|
|
:PROPERTIES:
|
|
|
|
:header-args: :tangle ~/.config/polybar/scripts/nordvpn-status.sh
|
|
|
|
:header-args+: :comments both :mkdirp yes
|
|
|
|
:header-args+: :shebang "#!/usr/bin/env bash"
|
|
|
|
:END:
|
2020-03-01 21:38:38 +01:00
|
|
|
|
2019-01-31 09:41:03 +01:00
|
|
|
#+BEGIN_SRC bash
|
2020-02-17 22:11:08 +01:00
|
|
|
tmpfile="/tmp/vpnstatus";
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2020-02-17 22:11:08 +01:00
|
|
|
if [ -f $tmpfile ] && grep -q "on" $tmpfile; then
|
2019-05-16 21:13:08 +02:00
|
|
|
echo "%{F#859900}%{F-}";
|
2019-01-31 09:41:03 +01:00
|
|
|
else
|
2019-05-16 21:13:08 +02:00
|
|
|
echo "";
|
2019-01-31 09:41:03 +01:00
|
|
|
fi
|
|
|
|
#+END_SRC
|
|
|
|
|
2019-12-16 11:38:04 +01:00
|
|
|
** Nordvpn Toggle
|
|
|
|
: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
|
2020-02-17 22:11:08 +01:00
|
|
|
tmpfile="/tmp/vpnstatus";
|
|
|
|
|
|
|
|
if [ -f $tmpfile ] && grep -q "on" $tmpfile; then
|
2020-04-03 11:34:21 +02:00
|
|
|
nordvpn disconnect && \
|
|
|
|
dunstify --replace=23198 "VPN" "Disconnected" && \
|
|
|
|
echo "off" > $tmpfile;
|
2019-12-16 11:38:04 +01:00
|
|
|
else
|
2020-04-06 23:56:37 +02:00
|
|
|
country=`cat ~/.local/data/nordvpn_countries.txt | sed 's/\s*\t\s*/ /g ; s/\s/\n/g ; s/_/ /g ; /^[a-zA-Z]/!d ; s/\(.*\)/\L\1/' | rofi -i -dmenu | sed 's/\s/_/g'`;
|
2019-12-16 11:38:04 +01:00
|
|
|
dunstify --replace=23198 "VPN" "Connecting to $country...";
|
2020-04-03 11:34:21 +02:00
|
|
|
nordvpn connect $country && \
|
|
|
|
dunstify --replace=23198 "VPN" "Connected to $country" && \
|
|
|
|
echo "on" > $tmpfile;
|
2019-12-16 11:38:04 +01:00
|
|
|
fi
|
2019-04-10 16:58:12 +02:00
|
|
|
#+END_SRC
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2020-03-01 21:38:38 +01:00
|
|
|
* Packages
|
|
|
|
#+BEGIN_SRC conf
|
|
|
|
[module/packages]
|
|
|
|
type = custom/script
|
|
|
|
|
|
|
|
format-underline = ${colors.bg}
|
2020-04-10 16:37:42 +02:00
|
|
|
click-left = ~/.config/polybar/scripts/packages-update.sh >/dev/null 2>%1 &
|
|
|
|
click-right = ~/.config/polybar/scripts/packages-refresh.sh >/dev/null 2>%1 &
|
2020-03-01 21:38:38 +01:00
|
|
|
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
|
2020-04-01 17:23:45 +02:00
|
|
|
yay -Sy > /dev/null 2>&1 && \
|
2020-04-06 00:11:57 +02:00
|
|
|
package_nb=`yay -Qu 2> /dev/null | wc -l` || \
|
|
|
|
package_nb=0
|
|
|
|
|
2020-03-19 15:20:33 +01:00
|
|
|
|
|
|
|
if [ "$package_nb" -eq "0" ]; then
|
2020-04-06 00:11:57 +02:00
|
|
|
echo "";
|
2020-03-01 21:38:38 +01:00
|
|
|
else
|
2020-04-06 00:11:57 +02:00
|
|
|
echo "%{F#859900} $package_nb%{F-}";
|
2020-03-01 21:38:38 +01:00
|
|
|
fi
|
|
|
|
#+END_SRC
|
|
|
|
|
2020-04-02 22:06:26 +02:00
|
|
|
** Refresh New Packages script
|
|
|
|
:PROPERTIES:
|
|
|
|
:header-args: :tangle ~/.config/polybar/scripts/packages-refresh.sh
|
|
|
|
:header-args+: :comments both :mkdirp yes
|
|
|
|
:header-args+: :shebang "#!/usr/bin/env bash"
|
|
|
|
:END:
|
|
|
|
#+BEGIN_SRC bash
|
|
|
|
dunstify --replace=64654 'Packages ' "Refreshing..."
|
2020-04-03 11:34:21 +02:00
|
|
|
|
2020-04-02 22:06:26 +02:00
|
|
|
yay -Sy > /dev/null 2>&1 && \
|
2020-04-03 11:34:21 +02:00
|
|
|
package_nb=`yay -Qu 2> /dev/null | wc -l`;
|
2020-04-02 22:06:26 +02:00
|
|
|
|
|
|
|
if [ "$package_nb" -eq "0" ]; then
|
|
|
|
dunstify --replace=64654 'Packages ' "No upgrade available"
|
|
|
|
else
|
|
|
|
dunstify --replace=64654 'Packages ' "$(package_nb) upgrade(s) available"
|
|
|
|
fi
|
|
|
|
#+END_SRC
|
|
|
|
|
2020-03-01 21:38:38 +01:00
|
|
|
** 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
|
2020-04-10 16:37:42 +02:00
|
|
|
$TERMINAL -e "yay"
|
2020-03-01 21:38:38 +01:00
|
|
|
#+END_SRC
|
|
|
|
|
2019-04-10 16:58:12 +02:00
|
|
|
* Dunst
|
|
|
|
#+BEGIN_SRC conf
|
|
|
|
[module/dunst]
|
2019-06-22 17:21:08 +02:00
|
|
|
type = custom/script
|
|
|
|
|
2020-03-01 21:38:38 +01:00
|
|
|
format-underline = ${colors.bg}
|
2020-04-10 16:37:42 +02:00
|
|
|
click-left = ~/.config/polybar/scripts/dunst-toggle.sh >/dev/null 2>%1 &
|
2019-06-22 17:21:08 +02:00
|
|
|
format = <label>
|
2019-12-16 11:38:04 +01:00
|
|
|
exec = ~/.config/polybar/scripts/dunst-status.sh
|
2019-06-22 17:21:08 +02:00
|
|
|
interval = 2
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
** Dunst Status script
|
2019-12-16 11:38:04 +01:00
|
|
|
:PROPERTIES:
|
|
|
|
:header-args: :tangle ~/.config/polybar/scripts/dunst-status.sh
|
|
|
|
:header-args+: :comments both :mkdirp yes
|
|
|
|
:header-args+: :shebang "#!/usr/bin/env bash"
|
|
|
|
:END:
|
2019-06-22 17:21:08 +02:00
|
|
|
#+BEGIN_SRC bash
|
|
|
|
tmpfile="/tmp/dunststatus";
|
|
|
|
|
|
|
|
if [ -f $tmpfile ]; then
|
|
|
|
if grep -q "on" $tmpfile; then
|
|
|
|
echo "";
|
|
|
|
elif grep -q "off" $tmpfile; then
|
2019-12-16 11:38:04 +01:00
|
|
|
echo "";
|
2019-06-22 17:21:08 +02:00
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "";
|
|
|
|
fi
|
2019-01-31 09:41:03 +01:00
|
|
|
#+END_SRC
|
|
|
|
|
2019-12-16 11:38:04 +01:00
|
|
|
** Dunst Toggle
|
|
|
|
:PROPERTIES:
|
|
|
|
:header-args: :tangle ~/.config/polybar/scripts/dunst-toggle.sh
|
|
|
|
:header-args+: :comments both :mkdirp yes
|
|
|
|
:header-args+: :shebang "#!/usr/bin/env bash"
|
|
|
|
:END:
|
|
|
|
#+BEGIN_SRC bash
|
|
|
|
tmpfile="/tmp/dunststatus";
|
|
|
|
|
2020-04-03 11:34:21 +02:00
|
|
|
if [ -f $tmpfile ] && grep -q "off" $tmpfile ; then
|
|
|
|
killall -SIGUSR2 dunst && \
|
|
|
|
echo "on" > $tmpfile;
|
|
|
|
dunstify --replace=16549 "Notifications " "Activated";
|
2019-12-16 11:38:04 +01:00
|
|
|
else
|
2020-04-03 11:34:21 +02:00
|
|
|
dunstify --replace=16549 "Notifications " "Deactivated";
|
|
|
|
sleep 1 && \
|
|
|
|
killall -SIGUSR1 dunst && \
|
|
|
|
echo "off" > $tmpfile;
|
2019-12-16 11:38:04 +01:00
|
|
|
fi
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* Lock Screen
|
2019-12-16 08:53:47 +01:00
|
|
|
#+BEGIN_SRC conf
|
|
|
|
[module/lockscreen]
|
|
|
|
type = custom/script
|
|
|
|
|
2020-03-01 21:38:38 +01:00
|
|
|
format-underline = ${colors.bg}
|
2020-04-10 16:37:42 +02:00
|
|
|
click-left = ~/.config/polybar/scripts/lockscreen-toggle.sh >/dev/null 2>%1 &
|
|
|
|
click-right = ~/.local/bin/lockscreen >/dev/null 2>%1 &
|
2019-12-16 08:53:47 +01:00
|
|
|
format = <label>
|
2019-12-16 11:38:04 +01:00
|
|
|
exec = ~/.config/polybar/scripts/lockscreen-status.sh
|
2019-12-17 15:31:15 +01:00
|
|
|
|
2019-12-16 08:53:47 +01:00
|
|
|
interval = 2
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
** Lock screen Status script
|
|
|
|
:PROPERTIES:
|
2019-12-16 11:38:04 +01:00
|
|
|
:header-args: :tangle ~/.config/polybar/scripts/lockscreen-status.sh
|
2019-12-16 08:53:47 +01:00
|
|
|
:header-args+: :comments both :mkdirp yes
|
|
|
|
:header-args+: :shebang "#!/usr/bin/env bash"
|
|
|
|
:END:
|
|
|
|
#+BEGIN_SRC bash
|
|
|
|
if pgrep -x "xautolock" >/dev/null
|
|
|
|
then
|
2019-12-16 11:38:04 +01:00
|
|
|
echo "";
|
2019-12-16 08:53:47 +01:00
|
|
|
else
|
2019-12-16 11:38:04 +01:00
|
|
|
echo "";
|
2019-12-16 08:53:47 +01:00
|
|
|
fi
|
|
|
|
#+END_SRC
|
|
|
|
|
2019-12-17 15:31:15 +01:00
|
|
|
** Toggle Automatic Lock Screen
|
|
|
|
:PROPERTIES:
|
|
|
|
:header-args: :tangle ~/.config/polybar/scripts/lockscreen-toggle.sh
|
|
|
|
:header-args+: :comments both :mkdirp yes
|
|
|
|
:header-args+: :shebang "#!/usr/bin/env bash"
|
|
|
|
:END:
|
|
|
|
|
|
|
|
#+begin_src bash
|
2020-04-03 11:34:21 +02:00
|
|
|
if pgrep -x "xautolock" >/dev/null ; then
|
|
|
|
pkill xautolock && \
|
|
|
|
dunstify --replace=13602 'Lock Screen ' 'Desactivated'
|
2019-12-17 15:31:15 +01:00
|
|
|
else
|
2020-04-06 23:56:37 +02:00
|
|
|
xautolock -locker "~/.local/bin/lockscreen" -detectsleep -time 30 -notify 60 -notifier "dunstify --replace=31846 -u critical -t 10000 -- 'Locking Screen' '60 seconds'" &
|
2020-04-03 11:34:21 +02:00
|
|
|
dunstify --replace=13602 'Lock Screen ' 'Activated'
|
2019-12-17 15:31:15 +01:00
|
|
|
fi
|
|
|
|
#+end_src
|
|
|
|
|
2019-05-16 21:13:08 +02:00
|
|
|
* Network
|
2019-01-31 09:41:03 +01:00
|
|
|
#+begin_src conf
|
2019-05-16 21:13:08 +02:00
|
|
|
[module/wired-network]
|
2019-01-31 09:41:03 +01:00
|
|
|
type = internal/network
|
2020-11-15 19:02:51 +01:00
|
|
|
interface = ens12u2u4u4
|
2019-05-16 21:13:08 +02:00
|
|
|
|
2020-11-15 19:02:51 +01:00
|
|
|
label-connected = %{A1:bash ~/.config/polybar/scripts/connection-toggle.sh ens12u2u4u4 >/dev/null 2>%1 &:} %local_ip%%{A}
|
2020-04-10 16:37:55 +02:00
|
|
|
label-connected-foreground = ${colors.fg}
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2020-11-15 19:02:51 +01:00
|
|
|
label-disconnected = %{A1:bash ~/.config/polybar/scripts/connection-toggle.sh ens12u2u4u4 >/dev/null 2>%1 &:}%{A}
|
2020-04-10 16:37:55 +02:00
|
|
|
label-disconnected-foreground = #777
|
|
|
|
#+end_src
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2020-04-10 16:37:55 +02:00
|
|
|
#+begin_src conf
|
2019-05-16 21:13:08 +02:00
|
|
|
[module/wireless-network]
|
|
|
|
type = internal/network
|
|
|
|
interface = wlp2s0
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-05-16 21:13:08 +02:00
|
|
|
format-connected = <label-connected>
|
2020-04-10 16:37:55 +02:00
|
|
|
format-disconnected = <label-disconnected>
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2020-11-15 19:02:51 +01:00
|
|
|
label-connected = %{A1:bash ~/.config/polybar/scripts/connection-toggle.sh wlp2s0 >/dev/null 2>%1 &:}直 %essid%%{A}
|
2020-04-10 16:37:55 +02:00
|
|
|
label-connected-foreground = ${colors.fg}
|
2019-05-16 21:13:08 +02:00
|
|
|
|
2020-11-15 19:02:51 +01:00
|
|
|
label-disconnected = %{A1:bash ~/.config/polybar/scripts/connection-toggle.sh wlp2s0 >/dev/null 2>%1 &:}直%{A}
|
2020-04-10 16:37:55 +02:00
|
|
|
label-disconnected-foreground = #777
|
2019-05-16 21:13:08 +02:00
|
|
|
#+end_src
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2020-11-15 19:02:51 +01:00
|
|
|
** Toggle Wifi or Ethernet
|
|
|
|
:PROPERTIES:
|
|
|
|
:header-args: :tangle ~/.config/polybar/scripts/connection-toggle.sh
|
|
|
|
:header-args+: :comments both :mkdirp yes
|
|
|
|
:header-args+: :shebang "#!/usr/bin/env bash"
|
|
|
|
:END:
|
|
|
|
|
|
|
|
#+begin_src bash
|
|
|
|
# Check if an argument is passed
|
|
|
|
if [ -z "$1" ]
|
|
|
|
then
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
isdevicedown=$(nmcli device status | grep ^$1 | grep disconnected)
|
|
|
|
|
|
|
|
if [ -z "$isdevicedown" ]
|
|
|
|
then
|
|
|
|
dunstify --replace=84847 "$1" "Disconnecting..." && \
|
|
|
|
nmcli device disconnect $1 && \
|
|
|
|
dunstify --replace=84847 "$1" "Disconnected"
|
|
|
|
else
|
|
|
|
dunstify --replace=84847 "$1" "Connection..." && \
|
|
|
|
nmcli device connect $1 && \
|
|
|
|
dunstify --replace=84847 "$1" "Connected"
|
|
|
|
fi
|
|
|
|
#+end_src
|
|
|
|
|
2020-11-15 19:26:54 +01:00
|
|
|
* Blueooth
|
|
|
|
#+BEGIN_SRC conf
|
|
|
|
[module/bluetooth]
|
|
|
|
type = custom/script
|
|
|
|
|
|
|
|
format-underline = ${colors.bg}
|
|
|
|
click-left = ~/.config/polybar/scripts/bluetooth-toggle.sh >/dev/null 2>%1 &
|
|
|
|
format = <label>
|
|
|
|
exec = ~/.config/polybar/scripts/bluetooth-status.sh
|
|
|
|
|
|
|
|
interval = 2
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
** Bluetooth Connection Status
|
|
|
|
:PROPERTIES:
|
|
|
|
:header-args: :tangle ~/.config/polybar/scripts/bluetooth-status.sh
|
|
|
|
:header-args+: :comments both :mkdirp yes
|
|
|
|
:header-args+: :shebang "#!/usr/bin/env bash"
|
|
|
|
:END:
|
|
|
|
|
|
|
|
#+begin_src bash
|
|
|
|
controllerid="9C:B6:D0:96:6E:C0"
|
|
|
|
|
|
|
|
isconnected=$(bluetoothctl show $controllerid | grep Powered | grep yes)
|
|
|
|
|
|
|
|
if [ -z "$isconnected" ]
|
|
|
|
then
|
|
|
|
echo ""
|
|
|
|
else
|
|
|
|
echo "%{F#859900}%{F-}"
|
|
|
|
fi
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
** Toggle Bluetooth Connection
|
|
|
|
:PROPERTIES:
|
|
|
|
:header-args: :tangle ~/.config/polybar/scripts/bluetooth-toggle.sh
|
|
|
|
:header-args+: :comments both :mkdirp yes
|
|
|
|
:header-args+: :shebang "#!/usr/bin/env bash"
|
|
|
|
:END:
|
|
|
|
|
|
|
|
#+begin_src bash
|
|
|
|
controllerid="9C:B6:D0:96:6E:C0"
|
|
|
|
|
|
|
|
isconnected=$(bluetoothctl show $controllerid | grep Powered | grep yes)
|
|
|
|
|
|
|
|
if [ -z "$isconnected" ]
|
|
|
|
then
|
|
|
|
bluetoothctl power on && \
|
|
|
|
dunstify --replace=88498 "Bluetooth" "Power ON"
|
|
|
|
else
|
|
|
|
bluetoothctl power off && \
|
|
|
|
dunstify --replace=88498 "Bluetooth" "Power OFF"
|
|
|
|
fi
|
|
|
|
#+end_src
|
|
|
|
|
2020-03-27 15:37:24 +01:00
|
|
|
* Wireguard
|
|
|
|
#+BEGIN_SRC conf
|
|
|
|
[module/wireguard]
|
|
|
|
type = custom/script
|
|
|
|
|
|
|
|
format-underline = ${colors.bg}
|
2020-04-10 16:37:42 +02:00
|
|
|
click-left = ~/.config/polybar/scripts/wireguard-toggle.sh >/dev/null 2>%1 &
|
2020-03-27 15:37:24 +01:00
|
|
|
format = <label>
|
|
|
|
exec = ~/.config/polybar/scripts/wireguard-status.sh
|
|
|
|
|
|
|
|
interval = 2
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
** Wireguard Connection Status
|
|
|
|
:PROPERTIES:
|
|
|
|
:header-args: :tangle ~/.config/polybar/scripts/wireguard-status.sh
|
|
|
|
:header-args+: :comments both :mkdirp yes
|
|
|
|
:header-args+: :shebang "#!/usr/bin/env bash"
|
|
|
|
:END:
|
|
|
|
|
|
|
|
#+begin_src bash
|
2020-11-03 11:33:19 +01:00
|
|
|
config="homelab"
|
2020-03-27 15:37:24 +01:00
|
|
|
|
|
|
|
connection=$(sudo wg show "$config" 2>/dev/null | head -n 1 | awk '{print $NF }')
|
|
|
|
|
|
|
|
if [ "$connection" = "$config" ]; then
|
2020-04-01 17:23:45 +02:00
|
|
|
echo "%{F#859900}%{F-}"
|
2020-03-27 15:37:24 +01:00
|
|
|
else
|
|
|
|
echo ""
|
|
|
|
fi
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
** Toggle Wireguard Connection
|
|
|
|
:PROPERTIES:
|
|
|
|
:header-args: :tangle ~/.config/polybar/scripts/wireguard-toggle.sh
|
|
|
|
:header-args+: :comments both :mkdirp yes
|
|
|
|
:header-args+: :shebang "#!/usr/bin/env bash"
|
|
|
|
:END:
|
|
|
|
|
|
|
|
#+begin_src bash
|
2020-11-03 11:33:19 +01:00
|
|
|
config="homelab"
|
2020-03-27 15:37:24 +01:00
|
|
|
|
|
|
|
connection=$(sudo wg show "$config" 2>/dev/null | head -n 1 | awk '{print $NF }')
|
|
|
|
|
|
|
|
if [ "$connection" = "$config" ]; then
|
2020-04-03 11:34:21 +02:00
|
|
|
sudo wg-quick down "$config" && \
|
|
|
|
dunstify --replace=83244 "Wireguard" "Disconnected from $config"
|
2020-03-27 15:37:24 +01:00
|
|
|
else
|
2020-04-03 11:34:21 +02:00
|
|
|
sudo wg-quick up "$config" && \
|
|
|
|
dunstify --replace=83244 "Wireguard" "Connected to $config"
|
2020-03-27 15:37:24 +01:00
|
|
|
fi
|
|
|
|
#+end_src
|
|
|
|
|
2020-04-30 21:57:54 +02:00
|
|
|
* Microphone loopback
|
|
|
|
#+BEGIN_SRC conf
|
|
|
|
[module/loopback]
|
|
|
|
type = custom/script
|
|
|
|
|
|
|
|
format-underline = ${colors.bg}
|
|
|
|
click-left = ~/.config/polybar/scripts/loopback-toggle.sh >/dev/null 2>%1 &
|
|
|
|
format = <label>
|
|
|
|
exec = ~/.config/polybar/scripts/loopback-status.sh
|
|
|
|
|
|
|
|
interval = 2
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
** Loopback Status
|
|
|
|
:PROPERTIES:
|
|
|
|
:header-args: :tangle ~/.config/polybar/scripts/loopback-status.sh
|
|
|
|
:header-args+: :comments both :mkdirp yes
|
|
|
|
:header-args+: :shebang "#!/usr/bin/env bash"
|
|
|
|
:END:
|
|
|
|
|
|
|
|
#+begin_src bash
|
|
|
|
loopback=$(pactl list 2>/dev/null | grep module-loopback | wc -l)
|
|
|
|
|
2020-05-01 00:32:00 +02:00
|
|
|
if [ "$loopback" -eq "0" ]; then
|
2020-04-30 21:57:54 +02:00
|
|
|
echo ""
|
|
|
|
else
|
|
|
|
echo "%{F#859900}%{F-}"
|
|
|
|
fi
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
** Toggle Loopback
|
|
|
|
:PROPERTIES:
|
|
|
|
:header-args: :tangle ~/.config/polybar/scripts/loopback-toggle.sh
|
|
|
|
:header-args+: :comments both :mkdirp yes
|
|
|
|
:header-args+: :shebang "#!/usr/bin/env bash"
|
|
|
|
:END:
|
|
|
|
|
|
|
|
#+begin_src bash
|
|
|
|
loopback=$(pactl list 2>/dev/null | grep module-loopback | wc -l)
|
|
|
|
|
2020-05-01 00:32:00 +02:00
|
|
|
if [ "$loopback" -eq "0" ]; then
|
2020-04-30 21:57:54 +02:00
|
|
|
pactl load-module module-loopback latency_msec=1 && \
|
|
|
|
dunstify --replace=82244 "Loopback" "Enabled"
|
|
|
|
else
|
|
|
|
pactl unload-module module-loopback && \
|
|
|
|
dunstify --replace=82244 "Loopback" "Disabled"
|
|
|
|
fi
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
|
2019-05-16 21:13:08 +02:00
|
|
|
* Screenshot
|
2019-02-03 17:54:54 +01:00
|
|
|
|
2019-01-31 09:41:03 +01:00
|
|
|
#+BEGIN_SRC conf
|
|
|
|
[module/screenshot]
|
|
|
|
type = custom/text
|
2019-12-16 11:38:04 +01:00
|
|
|
content = ""
|
2020-04-10 16:37:42 +02:00
|
|
|
click-left = ~/.local/bin/screenshot >/dev/null 2>%1 &
|
2019-01-31 09:41:03 +01:00
|
|
|
#+END_SRC
|
2019-02-03 17:54:54 +01:00
|
|
|
|
2019-04-04 10:26:07 +02:00
|
|
|
* Scripts
|
|
|
|
** Launch
|
2019-12-16 11:38:04 +01:00
|
|
|
:PROPERTIES:
|
|
|
|
:header-args: :tangle ~/.config/polybar/scripts/launch.sh
|
|
|
|
:header-args+: :comments both :mkdirp yes
|
|
|
|
:header-args+: :shebang "#!/usr/bin/env bash"
|
|
|
|
:END:
|
2019-04-04 10:26:07 +02:00
|
|
|
|
|
|
|
#+begin_src bash
|
|
|
|
# Terminate already running bar instances
|
|
|
|
killall -q polybar
|
|
|
|
|
|
|
|
# Wait until the processes have been shut down
|
|
|
|
while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done
|
|
|
|
|
|
|
|
# Launch Polybar, using default config location ~/.config/polybar/config
|
2020-03-01 21:38:38 +01:00
|
|
|
polybar top >>/tmp/polybar.log 2>&1 &
|
2019-04-10 16:58:12 +02:00
|
|
|
# polybar bottom &
|
2019-04-04 10:26:07 +02:00
|
|
|
|
|
|
|
echo "Polybar launched..."
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
** Toggle
|
2019-12-16 11:38:04 +01:00
|
|
|
:PROPERTIES:
|
|
|
|
:header-args: :tangle ~/.config/polybar/scripts/toggle.sh
|
|
|
|
:header-args+: :comments both :mkdirp yes
|
|
|
|
:header-args+: :shebang "#!/usr/bin/env bash"
|
|
|
|
:END:
|
2019-04-04 10:26:07 +02:00
|
|
|
|
|
|
|
#+begin_src bash
|
|
|
|
# Usage : toggle.sh top
|
|
|
|
|
|
|
|
pid=$(pgrep -f "polybar $1")
|
|
|
|
|
|
|
|
if [ ! -z "$pid" ]; then
|
|
|
|
polybar-msg -p $pid cmd toggle >/dev/null 2>&1
|
|
|
|
fi
|
|
|
|
#+end_src
|