literate-dotfiles/docs/polybar.html
2020-05-26 08:40:15 +02:00

1172 lines
32 KiB
HTML

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2020-05-26 mar. 08:40 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>Polybar Configuration</title>
<meta name="generator" content="Org mode" />
<meta name="author" content="Dehaeze Thomas" />
<link rel="stylesheet" type="text/css" href="./css/htmlize.css"/>
<link rel="stylesheet" type="text/css" href="./css/readtheorg.css"/>
<script type="text/javascript" src="./js/jquery.min.js"></script>
<script type="text/javascript" src="./js/bootstrap.min.js"></script>
<script type="text/javascript" src="./js/jquery.stickytableheaders.min.js"></script>
<script type="text/javascript" src="./js/readtheorg.js"></script>
</head>
<body>
<div id="org-div-home-and-up">
<a accesskey="h" href="./index.html"> UP </a>
|
<a accesskey="H" href="./index.html"> HOME </a>
</div><div id="content">
<h1 class="title">Polybar Configuration</h1>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#orge45175a">Colors</a></li>
<li><a href="#orgc8fe72e">VM</a></li>
<li><a href="#org821ed7b">Top Bar</a></li>
<li><a href="#orgb4f58e5">Show Windows Title</a></li>
<li><a href="#org00bf733">I3 - Information about workspaces and active one</a></li>
<li><a href="#orgf6d52fa">BSPWM</a></li>
<li><a href="#org937d151">Music using MPD</a></li>
<li><a href="#orgd7ff37b">Backlight level</a></li>
<li><a href="#orgbb0a618">CPU Usage</a></li>
<li><a href="#orgf6c3b32">Date</a></li>
<li><a href="#orgd1c922e">Sound Volume</a></li>
<li><a href="#orgfdbbed3">Battery</a></li>
<li><a href="#orgc01c036">Temperature</a></li>
<li><a href="#org1e00bc3">Unread Mails</a>
<ul>
<li><a href="#org2c713a7">Unread Mail Scripts</a></li>
<li><a href="#org61e09e9">Refresh Mail Scripts</a></li>
<li><a href="#orgd0fb5fc">Open Mails</a></li>
</ul>
</li>
<li><a href="#orgbf8122f">Unread News</a>
<ul>
<li><a href="#orgc9bda50">Unread News Scripts</a></li>
<li><a href="#org5fbaf38">Refresh News Scripts</a></li>
<li><a href="#org3459140">Open Newsboat</a></li>
</ul>
</li>
<li><a href="#org87f3575">Calendar</a>
<ul>
<li><a href="#org7058c70">Calendar Status Scripts</a></li>
<li><a href="#orgb67d0d9">Open Calendar</a></li>
</ul>
</li>
<li><a href="#org8bc0735">Redshift</a>
<ul>
<li><a href="#orgc95d065">Redshift - Status</a></li>
<li><a href="#org5f3dbe0">Toggle Redshift</a></li>
</ul>
</li>
<li><a href="#org10f4424">NordVPN</a>
<ul>
<li><a href="#org1858160">Nordvpn Status script</a></li>
<li><a href="#orgfb45dca">Nordvpn Toggle</a></li>
</ul>
</li>
<li><a href="#org3734bc8">Packages</a>
<ul>
<li><a href="#org9b8a9c8">Packages Status script</a></li>
<li><a href="#orgb8c1426">Refresh New Packages script</a></li>
<li><a href="#orgb3e71da">Packages Update</a></li>
</ul>
</li>
<li><a href="#orga78a541">Dunst</a>
<ul>
<li><a href="#org05dbfd7">Dunst Status script</a></li>
<li><a href="#org8b69076">Dunst Toggle</a></li>
</ul>
</li>
<li><a href="#org47fb977">Lock Screen</a>
<ul>
<li><a href="#orgba19d9f">Lock screen Status script</a></li>
<li><a href="#org8891736">Toggle Automatic Lock Screen</a></li>
</ul>
</li>
<li><a href="#org7b140fd">Network</a></li>
<li><a href="#org8c39876">Wireguard</a>
<ul>
<li><a href="#org5fe71f8">Wireguard Connection Status</a></li>
<li><a href="#orgad2cf0d">Toggle Wireguard Connection</a></li>
</ul>
</li>
<li><a href="#org1abb101">Microphone loopback</a>
<ul>
<li><a href="#orgd343aa5">Loopback Status</a></li>
<li><a href="#org417e5fc">Toggle Loopback</a></li>
</ul>
</li>
<li><a href="#org726272d">Screenshot</a></li>
<li><a href="#orgc30611d">Scripts</a>
<ul>
<li><a href="#orgfa1b0fe">Launch</a></li>
<li><a href="#org56bb827">Toggle</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div id="outline-container-orge45175a" class="outline-2">
<h2 id="orge45175a">Colors</h2>
<div class="outline-text-2" id="text-orge45175a">
<div class="org-src-container">
<pre class="src src-conf">[colors]
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}
</pre>
</div>
</div>
</div>
<div id="outline-container-orgc8fe72e" class="outline-2">
<h2 id="orgc8fe72e">VM</h2>
<div class="outline-text-2" id="text-orgc8fe72e">
<div class="org-src-container">
<pre class="src src-conf">[global/wm]
margin-top = 0
margin-bottom = 0
</pre>
</div>
</div>
</div>
<div id="outline-container-org821ed7b" class="outline-2">
<h2 id="org821ed7b">Top Bar</h2>
<div class="outline-text-2" id="text-org821ed7b">
<div class="org-src-container">
<pre class="src src-conf">[bar/top]
enable-ipc = true
override-redirect = false
bottom = false
fixed-center = false
width = 100%
height = 27
radius = 0.0
background = ${colors.bg}
foreground = ${colors.fg}
line-size = 2
border-size = 0
padding-left = 2
padding-right = 12
module-margin-left = 1
module-margin-right = 1
font-0 = Hack 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 bspwm xwindow
modules-center =
modules-right = pulseaudio wired-network wireless-network wireguard nordvpn loopback redshift lockscreen dunst packages unread_news unread_mail calendar temperature battery date
wm-restack = i3
tray-position = right
tray-detached = true
tray-padding = 0
tray-background = ${colors.bg}
</pre>
</div>
</div>
</div>
<div id="outline-container-orgb4f58e5" class="outline-2">
<h2 id="orgb4f58e5">Show Windows Title</h2>
<div class="outline-text-2" id="text-orgb4f58e5">
<div class="org-src-container">
<pre class="src src-conf">[module/xwindow]
type = internal/xwindow
label = %title:0:30:...%
</pre>
</div>
</div>
</div>
<div id="outline-container-org00bf733" class="outline-2">
<h2 id="org00bf733">I3 - Information about workspaces and active one</h2>
<div class="outline-text-2" id="text-org00bf733">
<div class="org-src-container">
<pre class="src src-conf">[module/i3]
type = internal/i3
enable-scroll = false
wrapping-scroll = false
</pre>
</div>
<div class="org-src-container">
<pre class="src src-conf">format = &lt;label-state&gt; &lt;label-mode&gt;
index-sort = true
</pre>
</div>
<div class="org-src-container">
<pre class="src src-conf">label-mode-foreground = ${colors.bg}
label-mode-background = ${colors.fg}
label-mode-padding = 1
# focused = Active workspace on focused monitor
label-focused = %icon% %index%
label-focused-foreground = ${colors.fg}
label-focused-background = ${colors.bg}
label-focused-underline = ${colors.aqua}
label-focused-padding = 1
# unfocused = Inactive workspace on any monitor
label-unfocused = %icon% %index%
label-unfocused-foreground = ${colors.fg}
label-unfocused-background = ${colors.bg}
label-unfocused-underline = ${colors.bg}
label-unfocused-padding = 1
# visible = Active workspace on unfocused monitor
label-visible = %icon% %index%
label-visible-background = ${colors.bg}
label-visible-underline = ${colors.aqua}
label-visible-padding = 1
# urgent = Workspace with urgency hint set
label-urgent = %icon% %index%
label-urgent-background = ${colors.red}
label-urgent-padding = 1
</pre>
</div>
</div>
</div>
<div id="outline-container-orgf6d52fa" class="outline-2">
<h2 id="orgf6d52fa">BSPWM</h2>
<div class="outline-text-2" id="text-orgf6d52fa">
<div class="org-src-container">
<pre class="src 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%
label-focused-foreground = ${colors.bg}
label-focused-background = ${colors.aqua}
label-focused-underline= ${colors.aqua}
label-focused-padding = 1
label-occupied = %icon%
label-occupied-underline = ${colors.fg}
label-occupied-padding = 1
label-urgent = %icon%
label-urgent-background = ${colors.red}
label-urgent-padding = 1
label-empty = %icon%
label-empty-foreground = ${colors.fg}
label-empty-padding = 1
</pre>
</div>
</div>
</div>
<div id="outline-container-org937d151" class="outline-2">
<h2 id="org937d151">Music using MPD</h2>
<div class="outline-text-2" id="text-org937d151">
<div class="org-src-container">
<pre class="src src-conf">[module/mpd]
type = internal/mpd
format-online = &lt;icon-prev&gt; &lt;toggle&gt; &lt;icon-next&gt; %{A1:$TERMINAL -e "ncmpcpp" &amp;:}&lt;label-song&gt;%{A}
format-online-spacing = 0
format-online-padding = 0
label-offline = mpd is offline
format-offline = &lt;label-offline&gt;
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 &lt;icon-[random|repeat|repeatone|single]&gt; is used
toggle-on-foreground = ${colors.fg}
toggle-off-foreground = ${colors.gray}
bar-progress-width = 15
bar-progress-indicator = |
bar-progress-fill = ─
bar-progress-empty = ─
</pre>
</div>
</div>
</div>
<div id="outline-container-orgd7ff37b" class="outline-2">
<h2 id="orgd7ff37b">Backlight level</h2>
<div class="outline-text-2" id="text-orgd7ff37b">
<div class="org-src-container">
<pre class="src src-conf">[module/xbacklight]
type = internal/xbacklight
format = &lt;ramp&gt;
ramp-0 = 
ramp-1 = 
ramp-2 = 
ramp-3 = 
ramp-4 = 
ramp-5 = 
ramp-6 = 
ramp-7 = 
ramp-8 = 
ramp-9 = 
ramp-10 = 
ramp-11 = 
</pre>
</div>
</div>
</div>
<div id="outline-container-orgbb0a618" class="outline-2">
<h2 id="orgbb0a618">CPU Usage</h2>
<div class="outline-text-2" id="text-orgbb0a618">
<div class="org-src-container">
<pre class="src src-conf">[module/cpu]
type = internal/cpu
interval = 2
format-prefix-foreground = ${colors.fg}
format-underline = ${colors.bg}
label = %{A1:$TERMINAL -e "htop" &amp;:}﬙ %percentage:2%%%{A}
</pre>
</div>
</div>
</div>
<div id="outline-container-orgf6c3b32" class="outline-2">
<h2 id="orgf6c3b32">Date</h2>
<div class="outline-text-2" id="text-orgf6c3b32">
<div class="org-src-container">
<pre class="src src-conf">[module/date]
type = internal/date
interval = 1
# Open google calendar on left right
date = %{A1:$TERMINAL -e "ikhal" &amp;:} %d-%m%{A}
date-alt = "%{A1:$TERMINAL -e \"ikhal\" &amp;:} %d-%m-%Y%{A}"
time =  %H:%M
time-alt =  %H:%M:%S
label = %date% %time%
</pre>
</div>
</div>
</div>
<div id="outline-container-orgd1c922e" class="outline-2">
<h2 id="orgd1c922e">Sound Volume</h2>
<div class="outline-text-2" id="text-orgd1c922e">
<div class="org-src-container">
<pre class="src src-conf">[module/pulseaudio]
type = internal/pulseaudio
sink = alsa_output.pci-0000_00_1f.3.analog-stereo
# Open pavucontrol on left right
format-volume =%{A1:pavucontrol &amp;:}&lt;label-volume&gt; &lt;bar-volume&gt;%{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.fg}
</pre>
</div>
</div>
</div>
<div id="outline-container-orgfdbbed3" class="outline-2">
<h2 id="orgfdbbed3">Battery</h2>
<div class="outline-text-2" id="text-orgfdbbed3">
<div class="org-src-container">
<pre class="src src-conf">[module/battery]
type = internal/battery
battery = BAT0
adapter = AC
full-at = 95
format-charging = %{A1:xfce4-power-manager-settings &amp;:}&lt;ramp-capacity&gt; &lt;label-charging&gt;%{A}
format-charging-underline = ${colors.blue}
format-discharging = %{A1:xfce4-power-manager-settings &amp;:}&lt;ramp-capacity&gt; &lt;label-discharging&gt;%{A}
format-discharging-underline = ${colors.red}
label-full = %{A1:xfce4-power-manager-settings &amp;:} %{A}
format-full-underline = ${colors.bg}
ramp-capacity-0 = 
ramp-capacity-1 = 
ramp-capacity-2 = 
ramp-capacity-3 = 
ramp-capacity-4 = 
</pre>
</div>
</div>
</div>
<div id="outline-container-orgc01c036" class="outline-2">
<h2 id="orgc01c036">Temperature</h2>
<div class="outline-text-2" id="text-orgc01c036">
<div class="org-src-container">
<pre class="src src-conf">[module/temperature]
type = internal/temperature
interval = 2
thermal-zone = 0
warn-temperature = 70
hwmon-path = /sys/devices/platform/coretemp.0/hwmon/hwmon2/temp1_input
units = false
format = %{A1:$TERMINAL --class="Floating" -e "watch sensors" &amp;:}&lt;ramp&gt; &lt;label&gt;%{A}
format-warn = &lt;ramp&gt; &lt;label-warn&gt;
label = %temperature-c%°C
label-warn = %temperature-c%°C
label-warn-foreground = ${colors.fg}
format-warn-underline = ${colors.red}
ramp-0 = 
ramp-1 = 
ramp-2 = 
ramp-3 = 
ramp-4 = 
ramp-foreground = ${colors.fg}
</pre>
</div>
</div>
</div>
<div id="outline-container-org1e00bc3" class="outline-2">
<h2 id="org1e00bc3">Unread Mails</h2>
<div class="outline-text-2" id="text-org1e00bc3">
<div class="org-src-container">
<pre class="src src-conf">[module/unread_mail]
type = custom/script
format-underline = ${colors.bg}
click-left = ~/.config/polybar/scripts/mail-open.sh &gt;/dev/null 2&gt;%1 &amp;
click-right = ~/.config/polybar/scripts/mail-refresh.sh &gt;/dev/null 2&gt;%1 &amp;
format = &lt;label&gt;
exec = ~/.config/polybar/scripts/mail-status.sh
interval = 2
</pre>
</div>
</div>
<div id="outline-container-org2c713a7" class="outline-3">
<h3 id="org2c713a7">Unread Mail Scripts</h3>
<div class="outline-text-3" id="text-org2c713a7">
<div class="org-src-container">
<pre class="src src-bash">mail_nb=`du -a ~/.mail/*/Inbox/new/* 2&gt;/dev/null | wc -l`
if [ "$mail_nb" -eq "0" ]; then
echo "";
else
echo "%{F#859900} $mail_nb%{F-}";
fi
</pre>
</div>
</div>
</div>
<div id="outline-container-org61e09e9" class="outline-3">
<h3 id="org61e09e9">Refresh Mail Scripts</h3>
<div class="outline-text-3" id="text-org61e09e9">
<div class="org-src-container">
<pre class="src src-bash">dunstify --replace=98465 "Mails " "Syncing...";
checkmail -q &amp;&amp; \
mail_nb=`du -a ~/.mail/*/Inbox/new/* 2&gt;/dev/null | wc -l` &amp;&amp; \
if [ "$mail_nb" -eq "0" ]; then
dunstify --replace=98465 "Mails " "No new mail";
fi
</pre>
</div>
</div>
</div>
<div id="outline-container-orgd0fb5fc" class="outline-3">
<h3 id="orgd0fb5fc">Open Mails</h3>
<div class="outline-text-3" id="text-orgd0fb5fc">
<div class="org-src-container">
<pre class="src src-bash">$TERMINAL -e "tmux new-session -A -s neomutt neomutt"
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-orgbf8122f" class="outline-2">
<h2 id="orgbf8122f">Unread News</h2>
<div class="outline-text-2" id="text-orgbf8122f">
<div class="org-src-container">
<pre class="src src-conf">[module/unread_news]
type = custom/script
format-underline = ${colors.bg}
click-left = ~/.config/polybar/scripts/news-open.sh &gt;/dev/null 2&gt;%1 &amp;
click-right = ~/.config/polybar/scripts/news-refresh.sh &gt;/dev/null 2&gt;%1 &amp;
format = &lt;label&gt;
exec = ~/.config/polybar/scripts/news-status.sh
interval = 60
</pre>
</div>
</div>
<div id="outline-container-orgc9bda50" class="outline-3">
<h3 id="orgc9bda50">Unread News Scripts</h3>
<div class="outline-text-3" id="text-orgc9bda50">
<div class="org-src-container">
<pre class="src src-bash"> news_nb=`newsboat -x print-unread 2&gt;/dev/null | cut -d " " -f1`
if [ -z "$news_nb" ] || [ "$news_nb" -eq "0" ]; then
echo "";
else
echo "%{F#859900} $news_nb%{F-}";
fi
</pre>
</div>
</div>
</div>
<div id="outline-container-org5fbaf38" class="outline-3">
<h3 id="org5fbaf38">Refresh News Scripts</h3>
<div class="outline-text-3" id="text-org5fbaf38">
<div class="org-src-container">
<pre class="src src-bash">dunstify --replace=38492 "Newsboat " "Reloading...";
if pgrep -x "newsboat" &gt;/dev/null; then
# If newsboat is already running, try to refresh in the tmux session
tmux send-keys -t newsboat R
else
newsboat -x reload &amp;&amp; /
news_nb=`newsboat -x print-unread | cut -d " " -f1` &amp;&amp; \
dunstify --replace=38492 "Newsboat " "$news_nb Unread News";
fi
</pre>
</div>
</div>
</div>
<div id="outline-container-org3459140" class="outline-3">
<h3 id="org3459140">Open Newsboat</h3>
<div class="outline-text-3" id="text-org3459140">
<div class="org-src-container">
<pre class="src src-bash">$TERMINAL -e "tmux new-session -A -s newsboat newsboat"
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org87f3575" class="outline-2">
<h2 id="org87f3575">Calendar</h2>
<div class="outline-text-2" id="text-org87f3575">
<div class="org-src-container">
<pre class="src src-conf">[module/calendar]
type = custom/script
format-underline = ${colors.bg}
click-left = ~/.config/polybar/scripts/calendar-open.sh &gt;/dev/null 2&gt;%1 &amp;
format = &lt;label&gt;
exec = ~/.config/polybar/scripts/calendar-status.sh
interval = 5
</pre>
</div>
</div>
<div id="outline-container-org7058c70" class="outline-3">
<h3 id="org7058c70">Calendar Status Scripts</h3>
<div class="outline-text-3" id="text-org7058c70">
<div class="org-src-container">
<pre class="src 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}"
</pre>
</div>
</div>
</div>
<div id="outline-container-orgb67d0d9" class="outline-3">
<h3 id="orgb67d0d9">Open Calendar</h3>
<div class="outline-text-3" id="text-orgb67d0d9">
<div class="org-src-container">
<pre class="src src-bash">$TERMINAL --class="Floating" -e "khal interactive"
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org8bc0735" class="outline-2">
<h2 id="org8bc0735">Redshift</h2>
<div class="outline-text-2" id="text-org8bc0735">
<div class="org-src-container">
<pre class="src src-conf">[module/redshift]
type = custom/script
format-underline = ${colors.bg}
click-left = ~/.config/polybar/scripts/redshift-toggle.sh &gt;/dev/null 2&gt;%1 &amp;
format = &lt;label&gt;
exec = ~/.config/polybar/scripts/redshift-status.sh
interval = 2
</pre>
</div>
</div>
<div id="outline-container-orgc95d065" class="outline-3">
<h3 id="orgc95d065">Redshift - Status</h3>
<div class="outline-text-3" id="text-orgc95d065">
<div class="org-src-container">
<pre class="src src-bash">if pgrep -x "redshift" &gt;/dev/null; then
echo "望";
else
echo "盛";
fi
</pre>
</div>
</div>
</div>
<div id="outline-container-org5f3dbe0" class="outline-3">
<h3 id="org5f3dbe0">Toggle Redshift</h3>
<div class="outline-text-3" id="text-org5f3dbe0">
<div class="org-src-container">
<pre class="src src-bash">if pgrep -x "redshift" &gt;/dev/null; then
killall redshift &amp;&amp; \
dunstify --replace=36492 "Redshift 望" "Turned off";
else
nohup redshift &gt; /dev/null 2&gt;&amp;1 &amp;
dunstify --replace=36492 "Redshift 望" "Starting...";
fi
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org10f4424" class="outline-2">
<h2 id="org10f4424">NordVPN</h2>
<div class="outline-text-2" id="text-org10f4424">
<div class="org-src-container">
<pre class="src src-conf">[module/nordvpn]
type = custom/script
format-underline = ${colors.bg}
click-left = ~/.config/polybar/scripts/nordvpn-toggle.sh &gt;/dev/null 2&gt;%1 &amp;
format = &lt;label&gt;
exec = ~/.config/polybar/scripts/nordvpn-status.sh
interval = 2
</pre>
</div>
</div>
<div id="outline-container-org1858160" class="outline-3">
<h3 id="org1858160">Nordvpn Status script</h3>
<div class="outline-text-3" id="text-org1858160">
<div class="org-src-container">
<pre class="src src-bash">tmpfile="/tmp/vpnstatus";
if [ -f $tmpfile ] &amp;&amp; grep -q "on" $tmpfile; then
echo "%{F#859900}%{F-}";
else
echo "";
fi
</pre>
</div>
</div>
</div>
<div id="outline-container-orgfb45dca" class="outline-3">
<h3 id="orgfb45dca">Nordvpn Toggle</h3>
<div class="outline-text-3" id="text-orgfb45dca">
<div class="org-src-container">
<pre class="src src-bash">tmpfile="/tmp/vpnstatus";
if [ -f $tmpfile ] &amp;&amp; grep -q "on" $tmpfile; then
nordvpn disconnect &amp;&amp; \
dunstify --replace=23198 "VPN" "Disconnected" &amp;&amp; \
echo "off" &gt; $tmpfile;
else
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'`;
dunstify --replace=23198 "VPN" "Connecting to $country...";
nordvpn connect $country &amp;&amp; \
dunstify --replace=23198 "VPN" "Connected to $country" &amp;&amp; \
echo "on" &gt; $tmpfile;
fi
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org3734bc8" class="outline-2">
<h2 id="org3734bc8">Packages</h2>
<div class="outline-text-2" id="text-org3734bc8">
<div class="org-src-container">
<pre class="src src-conf">[module/packages]
type = custom/script
format-underline = ${colors.bg}
click-left = ~/.config/polybar/scripts/packages-update.sh &gt;/dev/null 2&gt;%1 &amp;
click-right = ~/.config/polybar/scripts/packages-refresh.sh &gt;/dev/null 2&gt;%1 &amp;
format = &lt;label&gt;
exec = ~/.config/polybar/scripts/packages-status.sh
interval = 600
</pre>
</div>
</div>
<div id="outline-container-org9b8a9c8" class="outline-3">
<h3 id="org9b8a9c8">Packages Status script</h3>
<div class="outline-text-3" id="text-org9b8a9c8">
<div class="org-src-container">
<pre class="src src-bash">yay -Sy &gt; /dev/null 2&gt;&amp;1 &amp;&amp; \
package_nb=`yay -Qu 2&gt; /dev/null | wc -l` || \
package_nb=0
if [ "$package_nb" -eq "0" ]; then
echo "";
else
echo "%{F#859900} $package_nb%{F-}";
fi
</pre>
</div>
</div>
</div>
<div id="outline-container-orgb8c1426" class="outline-3">
<h3 id="orgb8c1426">Refresh New Packages script</h3>
<div class="outline-text-3" id="text-orgb8c1426">
<div class="org-src-container">
<pre class="src src-bash">dunstify --replace=64654 'Packages ' "Refreshing..."
yay -Sy &gt; /dev/null 2&gt;&amp;1 &amp;&amp; \
package_nb=`yay -Qu 2&gt; /dev/null | wc -l`;
if [ "$package_nb" -eq "0" ]; then
dunstify --replace=64654 'Packages ' "No upgrade available"
else
dunstify --replace=64654 'Packages ' "$(package_nb) upgrade(s) available"
fi
</pre>
</div>
</div>
</div>
<div id="outline-container-orgb3e71da" class="outline-3">
<h3 id="orgb3e71da">Packages Update</h3>
<div class="outline-text-3" id="text-orgb3e71da">
<div class="org-src-container">
<pre class="src src-bash">$TERMINAL -e "yay"
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-orga78a541" class="outline-2">
<h2 id="orga78a541">Dunst</h2>
<div class="outline-text-2" id="text-orga78a541">
<div class="org-src-container">
<pre class="src src-conf">[module/dunst]
type = custom/script
format-underline = ${colors.bg}
click-left = ~/.config/polybar/scripts/dunst-toggle.sh &gt;/dev/null 2&gt;%1 &amp;
format = &lt;label&gt;
exec = ~/.config/polybar/scripts/dunst-status.sh
interval = 2
</pre>
</div>
</div>
<div id="outline-container-org05dbfd7" class="outline-3">
<h3 id="org05dbfd7">Dunst Status script</h3>
<div class="outline-text-3" id="text-org05dbfd7">
<div class="org-src-container">
<pre class="src src-bash">tmpfile="/tmp/dunststatus";
if [ -f $tmpfile ]; then
if grep -q "on" $tmpfile; then
echo "";
elif grep -q "off" $tmpfile; then
echo "";
fi
else
echo "";
fi
</pre>
</div>
</div>
</div>
<div id="outline-container-org8b69076" class="outline-3">
<h3 id="org8b69076">Dunst Toggle</h3>
<div class="outline-text-3" id="text-org8b69076">
<div class="org-src-container">
<pre class="src src-bash">tmpfile="/tmp/dunststatus";
if [ -f $tmpfile ] &amp;&amp; grep -q "off" $tmpfile ; then
killall -SIGUSR2 dunst &amp;&amp; \
echo "on" &gt; $tmpfile;
dunstify --replace=16549 "Notifications " "Activated";
else
dunstify --replace=16549 "Notifications " "Deactivated";
sleep 1 &amp;&amp; \
killall -SIGUSR1 dunst &amp;&amp; \
echo "off" &gt; $tmpfile;
fi
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org47fb977" class="outline-2">
<h2 id="org47fb977">Lock Screen</h2>
<div class="outline-text-2" id="text-org47fb977">
<div class="org-src-container">
<pre class="src src-conf">[module/lockscreen]
type = custom/script
format-underline = ${colors.bg}
click-left = ~/.config/polybar/scripts/lockscreen-toggle.sh &gt;/dev/null 2&gt;%1 &amp;
click-right = ~/.local/bin/lockscreen &gt;/dev/null 2&gt;%1 &amp;
format = &lt;label&gt;
exec = ~/.config/polybar/scripts/lockscreen-status.sh
interval = 2
</pre>
</div>
</div>
<div id="outline-container-orgba19d9f" class="outline-3">
<h3 id="orgba19d9f">Lock screen Status script</h3>
<div class="outline-text-3" id="text-orgba19d9f">
<div class="org-src-container">
<pre class="src src-bash">if pgrep -x "xautolock" &gt;/dev/null
then
echo "";
else
echo "";
fi
</pre>
</div>
</div>
</div>
<div id="outline-container-org8891736" class="outline-3">
<h3 id="org8891736">Toggle Automatic Lock Screen</h3>
<div class="outline-text-3" id="text-org8891736">
<div class="org-src-container">
<pre class="src src-bash">if pgrep -x "xautolock" &gt;/dev/null ; then
pkill xautolock &amp;&amp; \
dunstify --replace=13602 'Lock Screen ' 'Desactivated'
else
xautolock -locker "~/.local/bin/lockscreen" -detectsleep -time 30 -notify 60 -notifier "dunstify --replace=31846 -u critical -t 10000 -- 'Locking Screen' '60 seconds'" &amp;
dunstify --replace=13602 'Lock Screen ' 'Activated'
fi
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org7b140fd" class="outline-2">
<h2 id="org7b140fd">Network</h2>
<div class="outline-text-2" id="text-org7b140fd">
<div class="org-src-container">
<pre class="src src-conf">[module/wired-network]
type = internal/network
interface = enp0s20f0u6u4
label-connected =  %local_ip%
label-connected-foreground = ${colors.fg}
label-disconnected = 
label-disconnected-foreground = #777
</pre>
</div>
<div class="org-src-container">
<pre class="src src-conf">[module/wireless-network]
type = internal/network
interface = wlp2s0
format-connected = &lt;label-connected&gt;
format-disconnected = &lt;label-disconnected&gt;
label-connected = 直 %essid%
label-connected-foreground = ${colors.fg}
label-disconnected = 睊
label-disconnected-foreground = #777
</pre>
</div>
</div>
</div>
<div id="outline-container-org8c39876" class="outline-2">
<h2 id="org8c39876">Wireguard</h2>
<div class="outline-text-2" id="text-org8c39876">
<div class="org-src-container">
<pre class="src src-conf">[module/wireguard]
type = custom/script
format-underline = ${colors.bg}
click-left = ~/.config/polybar/scripts/wireguard-toggle.sh &gt;/dev/null 2&gt;%1 &amp;
format = &lt;label&gt;
exec = ~/.config/polybar/scripts/wireguard-status.sh
interval = 2
</pre>
</div>
</div>
<div id="outline-container-org5fe71f8" class="outline-3">
<h3 id="org5fe71f8">Wireguard Connection Status</h3>
<div class="outline-text-3" id="text-org5fe71f8">
<div class="org-src-container">
<pre class="src src-bash">config="pivpn"
connection=$(sudo wg show "$config" 2&gt;/dev/null | head -n 1 | awk '{print $NF }')
if [ "$connection" = "$config" ]; then
echo "%{F#859900}%{F-}"
else
echo ""
fi
</pre>
</div>
</div>
</div>
<div id="outline-container-orgad2cf0d" class="outline-3">
<h3 id="orgad2cf0d">Toggle Wireguard Connection</h3>
<div class="outline-text-3" id="text-orgad2cf0d">
<div class="org-src-container">
<pre class="src src-bash">config="pivpn"
connection=$(sudo wg show "$config" 2&gt;/dev/null | head -n 1 | awk '{print $NF }')
if [ "$connection" = "$config" ]; then
sudo wg-quick down "$config" &amp;&amp; \
dunstify --replace=83244 "Wireguard" "Disconnected from $config"
else
sudo wg-quick up "$config" &amp;&amp; \
dunstify --replace=83244 "Wireguard" "Connected to $config"
fi
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org1abb101" class="outline-2">
<h2 id="org1abb101">Microphone loopback</h2>
<div class="outline-text-2" id="text-org1abb101">
<div class="org-src-container">
<pre class="src src-conf">[module/loopback]
type = custom/script
format-underline = ${colors.bg}
click-left = ~/.config/polybar/scripts/loopback-toggle.sh &gt;/dev/null 2&gt;%1 &amp;
format = &lt;label&gt;
exec = ~/.config/polybar/scripts/loopback-status.sh
interval = 2
</pre>
</div>
</div>
<div id="outline-container-orgd343aa5" class="outline-3">
<h3 id="orgd343aa5">Loopback Status</h3>
<div class="outline-text-3" id="text-orgd343aa5">
<div class="org-src-container">
<pre class="src src-bash">loopback=$(pactl list 2&gt;/dev/null | grep module-loopback | wc -l)
if [ "$loopback" -eq "0" ]; then
echo ""
else
echo "%{F#859900}%{F-}"
fi
</pre>
</div>
</div>
</div>
<div id="outline-container-org417e5fc" class="outline-3">
<h3 id="org417e5fc">Toggle Loopback</h3>
<div class="outline-text-3" id="text-org417e5fc">
<div class="org-src-container">
<pre class="src src-bash">loopback=$(pactl list 2&gt;/dev/null | grep module-loopback | wc -l)
if [ "$loopback" -eq "0" ]; then
pactl load-module module-loopback latency_msec=1 &amp;&amp; \
dunstify --replace=82244 "Loopback" "Enabled"
else
pactl unload-module module-loopback &amp;&amp; \
dunstify --replace=82244 "Loopback" "Disabled"
fi
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org726272d" class="outline-2">
<h2 id="org726272d">Screenshot</h2>
<div class="outline-text-2" id="text-org726272d">
<div class="org-src-container">
<pre class="src src-conf">[module/screenshot]
type = custom/text
content = ""
click-left = ~/.local/bin/screenshot &gt;/dev/null 2&gt;%1 &amp;
</pre>
</div>
</div>
</div>
<div id="outline-container-orgc30611d" class="outline-2">
<h2 id="orgc30611d">Scripts</h2>
<div class="outline-text-2" id="text-orgc30611d">
</div>
<div id="outline-container-orgfa1b0fe" class="outline-3">
<h3 id="orgfa1b0fe">Launch</h3>
<div class="outline-text-3" id="text-orgfa1b0fe">
<div class="org-src-container">
<pre class="src src-bash"># Terminate already running bar instances
killall -q polybar
# Wait until the processes have been shut down
while pgrep -u $UID -x polybar &gt;/dev/null; do sleep 1; done
# Launch Polybar, using default config location ~/.config/polybar/config
polybar top &gt;&gt;/tmp/polybar.log 2&gt;&amp;1 &amp;
# polybar bottom &amp;
echo "Polybar launched..."
</pre>
</div>
</div>
</div>
<div id="outline-container-org56bb827" class="outline-3">
<h3 id="org56bb827">Toggle</h3>
<div class="outline-text-3" id="text-org56bb827">
<div class="org-src-container">
<pre class="src src-bash"># Usage : toggle.sh top
pid=$(pgrep -f "polybar $1")
if [ ! -z "$pid" ]; then
polybar-msg -p $pid cmd toggle &gt;/dev/null 2&gt;&amp;1
fi
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="postamble" class="status">
<p class="author">Author: Dehaeze Thomas</p>
<p class="date">Created: 2020-05-26 mar. 08:40</p>
</div>
</body>
</html>