Update polybar config and scripts
This commit is contained in:
610
polybar.org
610
polybar.org
@@ -62,7 +62,7 @@ font-1 = unifont:fontformat=truetype:size=8:antialias=false;0
|
||||
|
||||
modules-left = i3 xwindow
|
||||
modules-center =
|
||||
modules-right = mpd pulseaudio tunnel_homelab tunnel_esrf dunst cursor unread_mail calendar timer battery date tray
|
||||
modules-right = pipewire music tunnel_homelab tunnel_esrf dunst lockscreen cursor unread_mail calendar timer battery date tray
|
||||
|
||||
# wm-restack = i3
|
||||
#+END_SRC
|
||||
@@ -128,42 +128,6 @@ label-urgent-background = ${colors.red}
|
||||
label-urgent-padding = 1
|
||||
#+END_SRC
|
||||
|
||||
* Music using MPD
|
||||
#+BEGIN_SRC conf
|
||||
[module/mpd]
|
||||
type = internal/mpd
|
||||
format-online = <toggle> %{A1:$TERMINAL -e tmux new-session -A -s ncmpcpp ncmpcpp:}<label-song>%{A}
|
||||
|
||||
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.fg}
|
||||
toggle-off-foreground = ${colors.gray}
|
||||
|
||||
bar-progress-width = 15
|
||||
bar-progress-indicator = |
|
||||
bar-progress-fill = ─
|
||||
bar-progress-empty = ─
|
||||
#+END_SRC
|
||||
|
||||
* Backlight level
|
||||
#+BEGIN_SRC conf
|
||||
[module/xbacklight]
|
||||
@@ -212,39 +176,536 @@ time-alt = %H:%M:%S
|
||||
label = %date% %time%
|
||||
#+END_SRC
|
||||
|
||||
* Music
|
||||
#+BEGIN_SRC conf
|
||||
[module/music]
|
||||
type = custom/script
|
||||
|
||||
format-underline = ${colors.bg}
|
||||
format = <label>
|
||||
exec = ~/.config/polybar/scripts/music-status.sh
|
||||
interval = 0.5
|
||||
#+END_SRC
|
||||
|
||||
** Music Status
|
||||
:PROPERTIES:
|
||||
:header-args: :tangle ~/.config/polybar/scripts/music-status.sh
|
||||
:header-args+: :comments both :mkdirp yes
|
||||
:header-args+: :shebang "#!/usr/bin/env bash"
|
||||
:END:
|
||||
#+begin_src bash
|
||||
playerctlstatus=$(playerctl --player=jellyfin-tui status 2> /dev/null)
|
||||
title=$(playerctl --player=jellyfin-tui metadata xesam:title 2>/dev/null)
|
||||
artist=$(playerctl --player=jellyfin-tui metadata xesam:artist 2>/dev/null)
|
||||
|
||||
display_song=""
|
||||
if [[ -n "$title" && -n "$artist" ]]; then
|
||||
[[ ${#title} -gt 20 ]] && title="${title:0:20}…"
|
||||
[[ ${#artist} -gt 15 ]] && artist="${artist:0:15}…"
|
||||
display_song="$title ($artist)"
|
||||
fi
|
||||
|
||||
if [[ $playerctlstatus == "" ]]; then
|
||||
echo "%{A1:~/.config/polybar/scripts/music-open.sh:}%{A}"
|
||||
elif [[ $playerctlstatus =~ "Playing" ]]; then
|
||||
echo "$display_song %{A1:playerctl --player=jellyfin-tui previous:}️%{A} %{A1:playerctl --player=jellyfin-tui pause:}️%{A} %{A1:playerctl --player=jellyfin-tui next:}️%{A}"
|
||||
else
|
||||
echo "$display_song %{A1:playerctl --player=jellyfin-tui previous:}️%{A} %{A1:playerctl --player=jellyfin-tui play:}️%{A} %{A1:playerctl --player=jellyfin-tui next:}️%{A}"
|
||||
fi
|
||||
#+end_src
|
||||
|
||||
** Open Calendar
|
||||
:PROPERTIES:
|
||||
:header-args: :tangle ~/.config/polybar/scripts/music-open.sh
|
||||
:header-args+: :comments both :mkdirp yes
|
||||
:header-args+: :shebang "#!/usr/bin/env bash"
|
||||
:END:
|
||||
#+begin_src bash
|
||||
$TERMINAL --class jellyfin-tui -e tmux new-session -A -s jellyfin jellyfin-tui >/dev/null 2>%1 &
|
||||
#+end_src
|
||||
|
||||
* Sound Volume
|
||||
#+BEGIN_SRC conf
|
||||
[module/pulseaudio]
|
||||
type = internal/pulseaudio
|
||||
[module/pipewire]
|
||||
type = custom/script
|
||||
tail = true
|
||||
format-underline = ${colors.cyan}
|
||||
label-foreground = ${colors.foreground}
|
||||
|
||||
sink = alsa_output.pci-0000_00_1f.3-platform-sof_sdw.HiFi__hw_sofsoundwire_2__sink
|
||||
|
||||
# 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.fg}
|
||||
# Icons mixed from Font Awesome 5 and Material Icons
|
||||
# You can copy-paste your options for each possible action, which is more
|
||||
# trouble-free but repetitive, or apply only the relevant ones (for example
|
||||
# --sink-blacklist is only needed for next-sink).
|
||||
exec = ~/.config/polybar/scripts/pipewire.sh --icons-volume " , " --icon-muted " " --sink-nickname "alsa_output.pci-0000_00_1f.3-platform-sof_sdw.HiFi__Speaker__sink:Speakers" listen
|
||||
click-right = exec pwvucontrol &
|
||||
click-left = ~/.config/polybar/scripts/pipewire.sh togmute
|
||||
click-middle = ~/.config/polybar/scripts/pipewire.sh next-sink
|
||||
scroll-up = ~/.config/polybar/scripts/pipewire.sh --volume-max 130 up
|
||||
scroll-down = ~/.config/polybar/scripts/pipewire.sh --volume-max 130 down
|
||||
#+END_SRC
|
||||
|
||||
** PipeWire - Status and Control
|
||||
:PROPERTIES:
|
||||
:header-args: :tangle ~/.config/polybar/scripts/pipewire.sh
|
||||
:header-args+: :comments both :mkdirp yes
|
||||
:header-args+: :shebang "#!/usr/bin/env bash"
|
||||
:END:
|
||||
|
||||
#+begin_src bash
|
||||
#!/bin/bash
|
||||
|
||||
# Defaults for configurable values, expected to be set by command-line arguments
|
||||
AUTOSYNC="no"
|
||||
COLOR_MUTED="%{F#6b6b6b}"
|
||||
ICON_MUTED=
|
||||
ICON_SINK=
|
||||
NOTIFICATIONS="no"
|
||||
OSD="no"
|
||||
SINK_NICKNAMES_PROP=
|
||||
VOLUME_STEP=2
|
||||
VOLUME_MAX=130
|
||||
# shellcheck disable=SC2016
|
||||
FORMAT='$VOL_ICON ${VOL_LEVEL}% $ICON_SINK $SINK_NICKNAME'
|
||||
declare -A SINK_NICKNAMES
|
||||
declare -a ICONS_VOLUME
|
||||
declare -a SINK_BLACKLIST
|
||||
|
||||
# Environment & global constants for the script
|
||||
END_COLOR="%{F-}" # For Polybar colors
|
||||
LANGUAGE=en_US # Some calls depend on English outputs of pactl
|
||||
|
||||
# Get the name of the default sink
|
||||
# This function is modified to better handle PipeWire output
|
||||
function getCurrSinkName() {
|
||||
if ! pactl info &> /dev/null; then return 1; fi
|
||||
curSinkName=$(pactl info | sed -n 's/Default Sink: *//p')
|
||||
}
|
||||
|
||||
# Saves the currently default sink into a variable named `curSink`. It will
|
||||
# return an error code when pipewire isn't running.
|
||||
function getCurSink() {
|
||||
getCurrSinkName
|
||||
curSink=$(pactl list sinks short | grep -F "$curSinkName" | awk '{print $1}')
|
||||
}
|
||||
|
||||
# Saves the sink passed by parameter's volume into a variable named `VOL_LEVEL`.
|
||||
function getCurVol() {
|
||||
VOL_LEVEL=$(pactl list sinks | grep -A 15 'Sink #'"$1"'' | grep 'Volume:' | grep -E -v 'Base Volume:' | awk -F : '{print $3; exit}' | grep -o -P '.{0,3}%' | sed 's/.$//' | tr -d ' ')
|
||||
}
|
||||
|
||||
# Saves the name to be displayed for the sink passed by parameter into a
|
||||
# variable called `SINK_NICKNAME`.
|
||||
# If a mapping for the sink name exists, that is used. Otherwise, the string
|
||||
# "Sink #<index>" is used.
|
||||
function getNickname() {
|
||||
# First check if we have a user-provided nickname
|
||||
if [[ -n "${SINK_NICKNAMES[$curSinkName]}" ]]; then
|
||||
SINK_NICKNAME="${SINK_NICKNAMES[$curSinkName]}"
|
||||
else
|
||||
# Otherwise use the sink description
|
||||
SINK_NICKNAME=$(pactl list sinks | grep -A 10 'Sink #'"$1"'' | grep 'Description:' | sed 's/^.*Description: //')
|
||||
fi
|
||||
}
|
||||
|
||||
# Saves the status of the sink passed by parameter into a variable named
|
||||
# `isMuted`.
|
||||
function getIsMuted() {
|
||||
isMuted=$(pactl list sinks | grep -A 15 'Sink #'"$1"'' | awk '/Mute/ {print $2; exit}')
|
||||
}
|
||||
|
||||
# Saves all the sink inputs of the sink passed by parameter into a string
|
||||
# named `sinkInputs`.
|
||||
function getSinkInputs() {
|
||||
sinkInputs=$(pactl list sink-inputs | grep -B 4 "sink: $1 " | awk '/index:/{print $2}')
|
||||
}
|
||||
|
||||
function volUp() {
|
||||
# Obtaining the current volume from pacmd into $VOL_LEVEL.
|
||||
if ! getCurSink; then
|
||||
echo "PipeWire not running"
|
||||
return 1
|
||||
fi
|
||||
getCurVol "$curSink"
|
||||
local maxLimit=$((VOLUME_MAX - VOLUME_STEP))
|
||||
|
||||
# Checking the volume upper bounds so that if VOLUME_MAX was 100% and the
|
||||
# increase percentage was 3%, a 99% volume would top at 100% instead
|
||||
# of 102%. If the volume is above the maximum limit, nothing is done.
|
||||
if [ "$VOL_LEVEL" -le "$VOLUME_MAX" ] && [ "$VOL_LEVEL" -ge "$maxLimit" ]; then
|
||||
pactl set-sink-volume "$curSink" "$VOLUME_MAX%"
|
||||
elif [ "$VOL_LEVEL" -lt "$maxLimit" ]; then
|
||||
pactl set-sink-volume "$curSink" "+$VOLUME_STEP%"
|
||||
fi
|
||||
|
||||
if [ $OSD = "yes" ]; then showOSD "$curSink"; fi
|
||||
if [ $AUTOSYNC = "yes" ]; then volSync; fi
|
||||
}
|
||||
|
||||
function volDown() {
|
||||
# Pactl already handles the volume lower bounds so that negative values
|
||||
# are ignored.
|
||||
if ! getCurSink; then
|
||||
echo "PipeWire not running"
|
||||
return 1
|
||||
fi
|
||||
pactl set-sink-volume "$curSink" "-$VOLUME_STEP%"
|
||||
|
||||
if [ $OSD = "yes" ]; then showOSD "$curSink"; fi
|
||||
if [ $AUTOSYNC = "yes" ]; then volSync; fi
|
||||
}
|
||||
|
||||
function volSync() {
|
||||
if ! getCurSink; then
|
||||
echo "PipeWire not running"
|
||||
return 1
|
||||
fi
|
||||
getSinkInputs "$curSink"
|
||||
getCurVol "$curSink"
|
||||
|
||||
# Every output found in the active sink has their volume set to the
|
||||
# current one. This will only be called if $AUTOSYNC is `yes`.
|
||||
for each in $sinkInputs; do
|
||||
pactl set-sink-input-volume "$each" "$VOL_LEVEL%"
|
||||
done
|
||||
}
|
||||
|
||||
function volMute() {
|
||||
# Switch to mute/unmute the volume with pactl.
|
||||
if ! getCurSink; then
|
||||
echo "PipeWire not running"
|
||||
return 1
|
||||
fi
|
||||
if [ "$1" = "toggle" ]; then
|
||||
getIsMuted "$curSink"
|
||||
if [ "$isMuted" = "yes" ]; then
|
||||
pactl set-sink-mute "$curSink" "no"
|
||||
else
|
||||
pactl set-sink-mute "$curSink" "yes"
|
||||
fi
|
||||
elif [ "$1" = "mute" ]; then
|
||||
pactl set-sink-mute "$curSink" "yes"
|
||||
elif [ "$1" = "unmute" ]; then
|
||||
pactl set-sink-mute "$curSink" "no"
|
||||
fi
|
||||
|
||||
if [ $OSD = "yes" ]; then showOSD "$curSink"; fi
|
||||
}
|
||||
|
||||
function nextSink() {
|
||||
# The final sinks list, removing the blacklisted ones from the list of
|
||||
# currently available sinks.
|
||||
if ! getCurSink; then
|
||||
echo "PipeWire not running"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Obtaining a tuple of sink indexes after removing the blacklisted devices
|
||||
# with their name.
|
||||
sinks=()
|
||||
local i=0
|
||||
while read -r line; do
|
||||
index=$(echo "$line" | cut -f1)
|
||||
name=$(echo "$line" | cut -f2)
|
||||
|
||||
# If it's in the blacklist, continue the main loop. Otherwise, add
|
||||
# it to the list.
|
||||
for sink in "${SINK_BLACKLIST[@]}"; do
|
||||
if [ "$sink" = "$name" ]; then
|
||||
continue 2
|
||||
fi
|
||||
done
|
||||
|
||||
sinks[$i]="$index"
|
||||
i=$((i + 1))
|
||||
done < <(pactl list short sinks)
|
||||
|
||||
# If the resulting list is empty, nothing is done
|
||||
if [ ${#sinks[@]} -eq 0 ]; then return; fi
|
||||
|
||||
# If the current sink is greater or equal than last one, pick the first
|
||||
# sink in the list. Otherwise just pick the next sink avaliable.
|
||||
local newSink
|
||||
if [ "$curSink" -ge "${sinks[-1]}" ]; then
|
||||
newSink=${sinks[0]}
|
||||
else
|
||||
for sink in "${sinks[@]}"; do
|
||||
if [ "$curSink" -lt "$sink" ]; then
|
||||
newSink=$sink
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# The new sink is set
|
||||
echo $newSink
|
||||
pactl set-default-sink "$newSink"
|
||||
|
||||
# Move all audio threads to new sink
|
||||
local inputs
|
||||
inputs="$(pactl list short sink-inputs | cut -f 1)"
|
||||
for i in $inputs; do
|
||||
pactl move-sink-input "$i" "$newSink"
|
||||
done
|
||||
|
||||
if [ $NOTIFICATIONS = "yes" ]; then
|
||||
getNickname "$newSink"
|
||||
|
||||
if command -v dunstify &>/dev/null; then
|
||||
notify="dunstify --replace 201839192"
|
||||
else
|
||||
notify="notify-send"
|
||||
fi
|
||||
$notify "PipeWire" "Changed output to $SINK_NICKNAME" --icon=audio-headphones-symbolic &
|
||||
fi
|
||||
}
|
||||
|
||||
# This function assumes that PipeWire is already running. It only supports
|
||||
# KDE OSDs for now. It will show a system message with the status of the
|
||||
# sink passed by parameter, or the currently active one by default.
|
||||
function showOSD() {
|
||||
if [ -z "$1" ]; then
|
||||
curSink="$1"
|
||||
else
|
||||
getCurSink
|
||||
fi
|
||||
getCurVol "$curSink"
|
||||
getIsMuted "$curSink"
|
||||
qdbus org.kde.kded /modules/kosd showVolume "$VOL_LEVEL" "$isMuted"
|
||||
}
|
||||
|
||||
function listen() {
|
||||
local firstRun=0
|
||||
|
||||
# Listen for changes and immediately create new output for the bar.
|
||||
# This is faster than having the script on an interval.
|
||||
LANG=$LANGUAGE pactl subscribe 2>/dev/null | {
|
||||
while true; do
|
||||
{
|
||||
# If this is the first time just continue and print the current
|
||||
# state. Otherwise wait for events. This is to prevent the
|
||||
# module being empty until an event occurs.
|
||||
if [ $firstRun -eq 0 ]; then
|
||||
firstRun=1
|
||||
else
|
||||
read -r event || break
|
||||
# Avoid double events
|
||||
if ! echo "$event" | grep -e "on card" -e "on sink" -e "on server"; then
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
} &>/dev/null
|
||||
output
|
||||
done
|
||||
}
|
||||
}
|
||||
|
||||
function output() {
|
||||
if ! getCurSink; then
|
||||
echo "PipeWire not running"
|
||||
return 1
|
||||
fi
|
||||
getCurVol "$curSink"
|
||||
getIsMuted "$curSink"
|
||||
getNickname "$curSink"
|
||||
|
||||
# Debug output - uncomment if needed
|
||||
# echo "Debug: curSink=$curSink curSinkName=$curSinkName SINK_NICKNAME=$SINK_NICKNAME SINK_NICKNAMES=${SINK_NICKNAMES[$curSinkName]}" >&2
|
||||
|
||||
# Fixed volume icons over max volume
|
||||
local iconsLen=${#ICONS_VOLUME[@]}
|
||||
if [ "$iconsLen" -ne 0 ]; then
|
||||
local volSplit=$((VOLUME_MAX / iconsLen))
|
||||
for i in $(seq 1 "$iconsLen"); do
|
||||
if [ $((i * volSplit)) -ge "$VOL_LEVEL" ]; then
|
||||
VOL_ICON="${ICONS_VOLUME[$((i-1))]}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
else
|
||||
VOL_ICON=""
|
||||
fi
|
||||
|
||||
# Showing the formatted message
|
||||
if [ "$isMuted" = "yes" ]; then
|
||||
# shellcheck disable=SC2034
|
||||
VOL_ICON=$ICON_MUTED
|
||||
echo "${COLOR_MUTED}$(eval echo "$FORMAT")${END_COLOR}"
|
||||
else
|
||||
eval echo "$FORMAT"
|
||||
fi
|
||||
}
|
||||
|
||||
function usage() {
|
||||
echo "\
|
||||
Usage: $0 [OPTION...] ACTION
|
||||
|
||||
Options: [defaults]
|
||||
--autosync | --no-autosync whether to maintain same volume for all
|
||||
programs [$AUTOSYNC]
|
||||
--color-muted <rrggbb> color in which to format when muted
|
||||
[${COLOR_MUTED:4:-1}]
|
||||
--notifications | --no-notifications whether to show notifications when
|
||||
changing sinks [$NOTIFICATIONS]
|
||||
--osd | --no-osd whether to display KDE's OSD message
|
||||
[$OSD]
|
||||
--icon-muted <icon> icon to use when muted [none]
|
||||
--icon-sink <icon> icon to use for sink [none]
|
||||
--format <string> use a format string to control the output
|
||||
Available variables: \$VOL_ICON,
|
||||
\$VOL_LEVEL, \$ICON_SINK, and
|
||||
\$SINK_NICKNAME
|
||||
[$FORMAT]
|
||||
--icons-volume <icon>[,<icon>...] icons for volume, from lower to higher
|
||||
[none]
|
||||
--volume-max <int> maximum volume to which to allow
|
||||
increasing [$VOLUME_MAX]
|
||||
--volume-step <int> step size when inc/decrementing volume
|
||||
[$VOLUME_STEP]
|
||||
--sink-blacklist <name>[,<name>...] sinks to ignore when switching [none]
|
||||
--sink-nicknames-from <prop> pacmd property to use for sink names,
|
||||
unless overriden by --sink-nickname.
|
||||
Its possible values are listed under
|
||||
the 'properties' key in the output of
|
||||
\`pacmd list-sinks\` [none]
|
||||
--sink-nickname <name>:<nick> nickname to assign to given sink name,
|
||||
taking priority over
|
||||
--sink-nicknames-from. May be given
|
||||
multiple times, and 'name' is exactly as
|
||||
listed in the output of
|
||||
\`pactl list sinks short | cut -f2\`
|
||||
[none]
|
||||
|
||||
Actions:
|
||||
help display this message and exit
|
||||
output print the PipeWire status once
|
||||
listen listen for changes in PipeWire to automatically update
|
||||
this script's output
|
||||
up, down increase or decrease the default sink's volume
|
||||
mute, unmute mute or unmute the default sink's audio
|
||||
togmute switch between muted and unmuted
|
||||
next-sink switch to the next available sink
|
||||
sync synchronize all the output streams volume to be the same as
|
||||
the current sink's volume
|
||||
|
||||
Author:
|
||||
Mario Ortiz Manero
|
||||
More info on GitHub:
|
||||
https://github.com/marioortizmanero/polybar-pulseaudio-control
|
||||
Modified for PipeWire compatibility"
|
||||
}
|
||||
|
||||
while [[ "$1" = --* ]]; do
|
||||
unset arg
|
||||
unset val
|
||||
if [[ "$1" = *=* ]]; then
|
||||
arg="${1//=*/}"
|
||||
val="${1//*=/}"
|
||||
shift
|
||||
else
|
||||
arg="$1"
|
||||
# Support space-separated values, but also value-less flags
|
||||
if [[ "$2" != --* ]]; then
|
||||
val="$2"
|
||||
shift
|
||||
fi
|
||||
shift
|
||||
fi
|
||||
|
||||
case "$arg" in
|
||||
--autosync)
|
||||
AUTOSYNC=yes
|
||||
;;
|
||||
--no-autosync)
|
||||
AUTOSYNC=no
|
||||
;;
|
||||
--color-muted|--colour-muted)
|
||||
COLOR_MUTED="%{F#$val}"
|
||||
;;
|
||||
--notifications)
|
||||
NOTIFICATIONS=yes
|
||||
;;
|
||||
--no-notifications)
|
||||
NOTIFICATIONS=no
|
||||
;;
|
||||
--osd)
|
||||
OSD=yes
|
||||
;;
|
||||
--no-osd)
|
||||
OSD=no
|
||||
;;
|
||||
--icon-muted)
|
||||
ICON_MUTED="$val"
|
||||
;;
|
||||
--icon-sink)
|
||||
# shellcheck disable=SC2034
|
||||
ICON_SINK="$val"
|
||||
;;
|
||||
--icons-volume)
|
||||
IFS=, read -r -a ICONS_VOLUME <<< "$val"
|
||||
;;
|
||||
--volume-max)
|
||||
VOLUME_MAX="$val"
|
||||
;;
|
||||
--volume-step)
|
||||
VOLUME_STEP="$val"
|
||||
;;
|
||||
--sink-blacklist)
|
||||
IFS=, read -r -a SINK_BLACKLIST <<< "$val"
|
||||
;;
|
||||
--sink-nicknames-from)
|
||||
SINK_NICKNAMES_PROP="$val"
|
||||
;;
|
||||
--sink-nickname)
|
||||
SINK_NICKNAMES["${val//:*/}"]="${val//*:}"
|
||||
;;
|
||||
--format)
|
||||
FORMAT="$val"
|
||||
;;
|
||||
*)
|
||||
echo "Unrecognised option: $arg" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
case "$1" in
|
||||
up)
|
||||
volUp
|
||||
;;
|
||||
down)
|
||||
volDown
|
||||
;;
|
||||
togmute)
|
||||
volMute toggle
|
||||
;;
|
||||
mute)
|
||||
volMute mute
|
||||
;;
|
||||
unmute)
|
||||
volMute unmute
|
||||
;;
|
||||
sync)
|
||||
volSync
|
||||
;;
|
||||
listen)
|
||||
listen
|
||||
;;
|
||||
next-sink)
|
||||
nextSink
|
||||
;;
|
||||
output)
|
||||
output
|
||||
;;
|
||||
help)
|
||||
usage
|
||||
;;
|
||||
*)
|
||||
echo "Unrecognised action: $1" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
#+end_src
|
||||
|
||||
* Battery
|
||||
#+BEGIN_SRC conf
|
||||
[module/battery]
|
||||
@@ -370,7 +831,7 @@ interval = 5
|
||||
: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')
|
||||
next_events=$(khal list "$(date +"%H:%M")" 23:59 --format "{start-time} - {title}" -df 'SKIPME' 2>/dev/null | grep -v 'SKIPME' | grep -v 'No events')
|
||||
|
||||
cal_icon=""
|
||||
cal_nb=""
|
||||
@@ -510,7 +971,7 @@ type = custom/script
|
||||
|
||||
format-underline = ${colors.bg}
|
||||
click-left = ~/.config/polybar/scripts/lockscreen-toggle.sh >/dev/null 2>%1 &
|
||||
click-right = ~/.local/bin/lockscreen >/dev/null 2>%1 &
|
||||
click-right = ~/.config/polybar/scripts/lockscreen-activate.sh >/dev/null 2>%1 &
|
||||
format = <label>
|
||||
exec = ~/.config/polybar/scripts/lockscreen-status.sh
|
||||
|
||||
@@ -542,13 +1003,26 @@ fi
|
||||
#+begin_src bash
|
||||
if pgrep -x "xautolock" >/dev/null ; then
|
||||
pkill xautolock && \
|
||||
dunstify --replace=13602 'Lock Screen ' 'Desactivated'
|
||||
dunstify --replace=13602 'Lock Screen ' 'Desactivated'; xset s off -dpms
|
||||
else
|
||||
xautolock -locker "~/.local/bin/lockscreen" -detectsleep -time 30 -notify 60 -notifier "dunstify --replace=31846 -u critical -t 10000 -- 'Locking Screen' '60 seconds'" &
|
||||
xset s on +dpms
|
||||
dunstify --replace=13602 'Lock Screen ' 'Activated'
|
||||
fi
|
||||
#+end_src
|
||||
|
||||
** Activate Lock Screen
|
||||
:PROPERTIES:
|
||||
:header-args: :tangle ~/.config/polybar/scripts/lockscreen-activate.sh
|
||||
:header-args+: :comments both :mkdirp yes
|
||||
:header-args+: :shebang "#!/usr/bin/env bash"
|
||||
:END:
|
||||
|
||||
#+begin_src bash
|
||||
~/.local/bin/lockscreen &
|
||||
xset s activate
|
||||
#+end_src
|
||||
|
||||
* Network
|
||||
** Modules
|
||||
#+begin_src conf
|
||||
|
||||
Reference in New Issue
Block a user