add i3 config

This commit is contained in:
ipu 2024-11-24 12:08:46 +03:00
commit fa8b6825ed
7 changed files with 711 additions and 0 deletions

289
i3/.config/i3/config Normal file
View file

@ -0,0 +1,289 @@
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
# Please see https://i3wm.org/docs/userguide.html for a complete reference!
set $mod Mod4
# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
# font pango:monospace 8
# This font is widely installed, provides lots of unicode glyphs, right-to-left
# text rendering and scalability on retina/hidpi displays (thanks to pango).
font pango:DejaVu Sans Mono 10
# font pango: Noto Sans Regular 8
set $bg #282828
set $red #cc241d
set $green #98971a
set $yellow #d79921
set $blue #458588
set $purple #b16286
set $aqua #689d68
set $gray #a89984
set $darkgray #1d2021
set $lightgray #bdae93
# Remove window borders
for_window [class="^.*"] border pixel 1
# class border backgr. text indicator child_border
for_window [class="^.*"] client.focused #77dd77 #285577 #ffffff #2e9ef4 #285577
# Start XDG autostart .desktop files using dex. See also
# https://wiki.archlinux.org/index.php/XDG_Autostart
# exec --no-startup-id dex --autostart --environment i3
exec --no-startup-id /usr/lib/xfce-polkit/xfce-polkit
exec --no-startup-id picom --fade-in-step=1 --fade-out-step=1 --fade-delta=0 -b
gaps inner 10
gaps outer -5
smart_gaps on
# The combination of xss-lock, nm-applet and pactl is a popular choice, so
# they are included here as an example. Modify as you see fit.
# xss-lock grabs a logind suspend inhibit lock and will use i3lock to lock the
# screen before suspend. Use loginctl lock-session to lock your screen.
# exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork
# NetworkManager is the most popular way to manage wireless networks on Linux,
# and nm-applet is a desktop environment-independent system tray GUI for it.
exec --no-startup-id nm-applet
set $refresh_i3status pkill -RTMIN+1 i3blocks
# English/Russian keyboard
exec --no-startup-id setxkbmap -model pc105 -layout us,ru -option "grp:alt_shift_toggle"
# Use pactl to adjust volume in PulseAudio.
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +5% && $refresh_i3status
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -5% && $refresh_i3status
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status
bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status
# Media player controls
bindsym XF86AudioPlay exec playerctl play-pause
bindsym XF86AudioPause exec playerctl play-pause
bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous
# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
# switch/iterate between workspaces
bindsym $mod+Tab workspace next
bindsym $mod+Shift+Tab workspace prev
# move tiling windows via drag & drop by left-clicking into the title bar,
# or left-clicking anywhere into the window while holding the floating modifier.
tiling_drag modifier titlebar
# change focus
bindsym $mod+j focus left
bindsym $mod+k focus down
bindsym $mod+l focus up
bindsym $mod+semicolon focus right
# alternatively, you can use the cursor keys:
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# move focused window
bindsym $mod+Shift+j move left
bindsym $mod+Shift+k move down
bindsym $mod+Shift+l move up
bindsym $mod+Shift+semicolon move right
# alternatively, you can use the cursor keys:
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
# split in horizontal orientation
bindsym $mod+h split h
# split in vertical orientation
bindsym $mod+v split v
# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle
# change container layout (stacked, tabbed, toggle split)
bindsym $mod+s layout stacking
bindsym $mod+g layout tabbed
bindsym $mod+e layout toggle split
# toggle tiling / floating
bindsym $mod+Shift+space floating toggle
# toggle sticky
bindsym $mod+Shift+s sticky toggle
# change focus between tiling / floating windows
bindsym $mod+space focus mode_toggle
# focus the parent container
bindsym $mod+a focus parent
# focus the child container
#bindsym $mod+d focus child
# Define names for default workspaces for which we configure key bindings later on.
# We use variables to avoid repeating the names in multiple places.
set $ws1 "1:  "
set $ws2 "2:  "
set $ws3 "3"
set $ws4 "4"
set $ws5 "5"
set $ws6 "6"
set $ws7 "7"
set $ws8 "8"
set $ws9 "9"
set $ws10 "10"
# switch to workspace
bindsym $mod+1 workspace number $ws1
bindsym $mod+2 workspace number $ws2
bindsym $mod+3 workspace number $ws3
bindsym $mod+4 workspace number $ws4
bindsym $mod+5 workspace number $ws5
bindsym $mod+6 workspace number $ws6
bindsym $mod+7 workspace number $ws7
bindsym $mod+8 workspace number $ws8
bindsym $mod+9 workspace number $ws9
bindsym $mod+0 workspace number $ws10
# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace number $ws1
bindsym $mod+Shift+2 move container to workspace number $ws2
bindsym $mod+Shift+3 move container to workspace number $ws3
bindsym $mod+Shift+4 move container to workspace number $ws4
bindsym $mod+Shift+5 move container to workspace number $ws5
bindsym $mod+Shift+6 move container to workspace number $ws6
bindsym $mod+Shift+7 move container to workspace number $ws7
bindsym $mod+Shift+8 move container to workspace number $ws8
bindsym $mod+Shift+9 move container to workspace number $ws9
bindsym $mod+Shift+0 move container to workspace number $ws10
# resize window (you can also use the mouse for that)
mode "resize" {
bindsym j resize shrink width 5 px or 5 ppt
bindsym k resize grow height 5 px or 5 ppt
bindsym l resize shrink height 5 px or 5 ppt
bindsym semicolon resize grow width 5 px or 5 ppt
# same bindings, but for the arrow keys
bindsym Left resize shrink width 5 px or 5 ppt
bindsym Down resize grow height 5 px or 5 ppt
bindsym Up resize shrink height 5 px or 5 ppt
bindsym Right resize grow width 5 px or 5 ppt
# back to normal: Enter or Escape or $mod+r
bindsym Return mode "default"
bindsym Escape mode "default"
bindsym $mod+r mode "default"
}
bindsym $mod+r mode "resize"
# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
bar {
status_command i3blocks
# status_command ~/.config/i3/scripts/i3status_custom.sh
separator_symbol " | "
colors {
# bar background color
background $bg
# text color used for blocks that do not have a color specified.
statusline $lightgray
# workspaces section
# border backgr. text
focused_workspace $lightgray $lightgray $bg
inactive_workspace $darkgray $darkgray $lightgray
active_workspace $darkgray $darkgray $lightgray
urgent_workspace $red $red $bg
}
}
bindsym ISO_Next_Group exec pkill -RTMIN+3 i3blocks
# set floating (nontiling) for apps needing it
for_window [class="Yad" instance="yad"] floating enable
for_window [class="Galculator" instance="galculator"] floating enable
for_window [class="Blueberry.py" instance="blueberry.py"] floating enable
# set floating (nontiling) for special apps
for_window [class="Xsane" instance="xsane"] floating enable
for_window [class="pavucontrol" instance="pavucontrol"] floating enable
for_window [class="qt5ct" instance="qt5ct"] floating enable
for_window [class="Blueberry.py" instance="blueberry.py"] floating enable
for_window [class="Bluetooth-sendto" instance="bluetooth-sendto"] floating enable
for_window [class="Pamac-manager"] floating enable
for_window [window_role="About"] floating enable
for_window [window_role="pop-up"] floating enable
for_window [class="spectacle"] floating enable
# kill focused window
bindsym $mod+Shift+q kill
# reload the configuration file
bindsym $mod+Shift+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r restart
# terminal
bindsym $mod+Return exec kitty -o background_opacity=0.98
# file manager
bindsym $mod+n exec thunar
# firefox browser
bindsym $mod+w exec firefox
# program launcher rofi
bindsym $mod+d exec "rofi -modi drun,run -show drun"
# screenshot
bindsym Print exec --no-startup-id spectacle -r
bindsym Shift+Print exec --no-startup-id spectacle -f
# wallpaper
exec_always feh --bg-fill /home/ipu/Pictures/Wallpapers/anime-kita.png
# power menu
set $Locker /home/$USER/.config/scripts/lock && sleep 1
set $mode_system System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown
mode "$mode_system" {
bindsym l exec --no-startup-id $Locker, mode "default"
bindsym e exec --no-startup-id i3-msg exit, mode "default"
bindsym s exec --no-startup-id $Locker && systemctl suspend, mode "default"
bindsym h exec --no-startup-id $Locker && systemctl hibernate, mode "default"
bindsym r exec --no-startup-id systemctl reboot, mode "default"
bindsym Shift+s exec --no-startup-id systemctl poweroff -i, mode "default"
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+Pause mode "$mode_system"
# class border|backgr|text|indicator|child_border
client.focused $lightgray $lightgray $bg $purple $lightgray
client.focused_inactive $darkgray $darkgray $lightgray $purple $darkgray
client.unfocused $darkgray $darkgray $lightgray $purple $darkgray
client.urgent $red $red $white $red $red

View file

@ -0,0 +1,7 @@
#!/bin/sh
i3status | while :
do
read line
echo "$(xkblayout-state print %e) | $line" || exit 1
done

View file

@ -0,0 +1,37 @@
[memory]
command=~/.config/i3blocks/modules/memory
label=ram
interval=30
[iface]
command=~/.config/i3blocks/modules/iface
LABEL=wlan
#IFACE=wlan0
#ADDRESS_FAMILY=inet6?
# color=#00FF00
interval=30
# set this to 1 to display the name of the connected WIFI interface instead of the IP address.
display_wifi_name=0
[volume-pipewire]
command=~/.config/i3blocks/modules/volume-pipewire
interval=once
signal=1
USE_ALSA_NAME=1
LONG_FORMAT="${SYMB} ${VOL}%"
DEFAULT_COLOR="#a0a0a0"
[language]
command=xkblayout-state print %s | awk '{print $0}'
interval=5
signal=3
[calendar]
command=~/.config/i3blocks/modules/calendar
interval=1
LABEL=
DATEFMT=+%a %d.%m.%Y %H:%M:%S
# SHORTFMT=+%H:%M:%S
HEIGHT=180
WIDTH=220

View file

@ -0,0 +1,40 @@
#!/usr/bin/env sh
WIDTH=${WIDTH:-200}
HEIGHT=${HEIGHT:-200}
DATEFMT=${DATEFMT:-"+%a %d.%m.%Y %H:%M:%S"}
SHORTFMT=${SHORTFMT:-"+%H:%M:%S"}
OPTIND=1
while getopts ":f:W:H:" opt; do
case $opt in
f) DATEFMT="$OPTARG" ;;
W) WIDTH="$OPTARG" ;;
H) HEIGHT="$OPTARG" ;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
:)
echo "Option -$OPTARG requires an argument." >&2
exit 1
;;
esac
done
case "$BLOCK_BUTTON" in
1|2|3)
# the position of the upper left corner of the popup
posX=$(($BLOCK_X - $WIDTH / 2))
posY=$(($BLOCK_Y - $HEIGHT))
i3-msg -q "exec yad --calendar \
--width=$WIDTH --height=$HEIGHT \
--undecorated --fixed \
--close-on-unfocus --no-buttons \
--posx=$posX --posy=$posY \
> /dev/null"
esac
echo "$LABEL$(date "$DATEFMT")"
echo "$LABEL$(date "$SHORTFMT")"

View file

@ -0,0 +1,89 @@
#!/usr/bin/env bash
# Copyright (C) 2014 Julien Bonjean <julien@bonjean.info>
# Copyright (C) 2014 Alexander Keller <github@nycroth.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#------------------------------------------------------------------------
# Use the provided interface, otherwise the device used for the default route.
IF="${IFACE:-$BLOCK_INSTANCE}"
IF="${IF:-$(ip route | awk '/^default/ { print $5 ; exit }')}"
# Exit if there is no default route
[[ -z "$IF" ]] && exit
#------------------------------------------------------------------------
# As per #36 -- It is transparent: e.g. if the machine has no battery or wireless
# connection (think desktop), the corresponding block should not be displayed.
[[ ! -d /sys/class/net/${IF} ]] && exit
#------------------------------------------------------------------------
AF=${ADDRESS_FAMILY:-inet6?}
LABEL="${LABEL:-}"
for flag in "$1" "$2"; do
case "$flag" in
-4)
AF=inet ;;
-6)
AF=inet6 ;;
-L)
if [[ "$IF" = "" ]]; then
LABEL="iface"
else
LABEL="$IF:"
fi ;;
esac
done
if [[ "$IF" = "" ]] || [[ "$(cat /sys/class/net/$IF/operstate)" = 'down' ]]; then
echo "${LABEL} down" # full text
echo "${LABEL} down" # short text
echo \#FF0000 # color
exit
fi
# if no interface is found, use the first device with a global scope
IPADDR=$(ip addr show $IF | perl -n -e "/$AF ([^ \/]+).* scope global/ && print \$1 and exit")
case $BLOCK_BUTTON in
3) echo -n "$IPADDR" | xclip -q -se c ;;
esac
if [[ "${display_wifi_name}" == "1" ]];
then
# try to guess the wifi name
if command -v iw > /dev/null && iw $IF info > /dev/null 2>&1;
then
WIFI_NAME=$(iw $IF info | grep -Po '(?<=ssid ).*' | tr -d " \t\n\r")
if [[ $BLOCK_BUTTON -eq 1 ]];
then
message="$LABEL $WIFI_NAME ($IPADDR)"
else
message="$LABEL $WIFI_NAME"
fi
else
message="$LABEL $IPADDR"
fi
else
message="$LABEL $IPADDR"
fi
#------------------------------------------------------------------------
echo "$message"

View file

@ -0,0 +1,73 @@
#!/usr/bin/env sh
# Copyright (C) 2014 Julien Bonjean <julien@bonjean.info>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
TYPE="${BLOCK_INSTANCE:-mem}"
PERCENT="${PERCENT:-true}"
awk -v type=$TYPE -v percent=$PERCENT '
/^MemTotal:/ {
mem_total=$2
}
/^MemFree:/ {
mem_free=$2
}
/^Buffers:/ {
mem_free+=$2
}
/^Cached:/ {
mem_free+=$2
}
/^SwapTotal:/ {
swap_total=$2
}
/^SwapFree:/ {
swap_free=$2
}
END {
if (type == "swap") {
free=swap_free/1024/1024
used=(swap_total-swap_free)/1024/1024
total=swap_total/1024/1024
} else {
free=mem_free/1024/1024
used=(mem_total-mem_free)/1024/1024
total=mem_total/1024/1024
}
pct=0
if (total > 0) {
pct=used/total*100
}
# full text
if (percent == "true" ) {
printf("%.1fG/%.1fG (%.f%%)\n", used, total, pct)
} else {
printf("%.1fG/%.1fG\n", used, total)
}
# short text
printf("%.f%%\n", pct)
# color
if (pct > 90) {
print("#FF0000")
} else if (pct > 80) {
print("#FFAE00")
} else if (pct > 70) {
print("#FFF600")
}
}
' /proc/meminfo

View file

@ -0,0 +1,176 @@
#!/bin/bash
# Displays the default device, volume, and mute status for i3blocks
set -a
AUDIO_HIGH_SYMBOL=${AUDIO_HIGH_SYMBOL:-' '}
AUDIO_MED_THRESH=${AUDIO_MED_THRESH:-50}
AUDIO_MED_SYMBOL=${AUDIO_MED_SYMBOL:-' '}
AUDIO_LOW_THRESH=${AUDIO_LOW_THRESH:-0}
AUDIO_LOW_SYMBOL=${AUDIO_LOW_SYMBOL:-' '}
AUDIO_MUTED_SYMBOL=${AUDIO_MUTED_SYMBOL:-' '}
AUDIO_DELTA=${AUDIO_DELTA:-5}
DEFAULT_COLOR=${DEFAULT_COLOR:-"#ffffff"}
MUTED_COLOR=${MUTED_COLOR:-"#a0a0a0"}
LONG_FORMAT=${LONG_FORMAT:-'${SYMB} ${VOL}% [${INDEX}:${NAME}]'}
SHORT_FORMAT=${SHORT_FORMAT:-'${SYMB} ${VOL}% [${INDEX}]'}
USE_ALSA_NAME=${USE_ALSA_NAME:-0}
USE_DESCRIPTION=${USE_DESCRIPTION:-0}
SUBSCRIBE=${SUBSCRIBE:-0}
MIXER=${MIXER:-""}
SCONTROL=${SCONTROL:-""}
while getopts F:Sf:adH:M:L:X:T:t:C:c:i:m:s:h opt; do
case "$opt" in
S) SUBSCRIBE=1 ;;
F) LONG_FORMAT="$OPTARG" ;;
f) SHORT_FORMAT="$OPTARG" ;;
a) USE_ALSA_NAME=1 ;;
d) USE_DESCRIPTION=1 ;;
H) AUDIO_HIGH_SYMBOL="$OPTARG" ;;
M) AUDIO_MED_SYMBOL="$OPTARG" ;;
L) AUDIO_LOW_SYMBOL="$OPTARG" ;;
X) AUDIO_MUTED_SYMBOL="$OPTARG" ;;
T) AUDIO_MED_THRESH="$OPTARG" ;;
t) AUDIO_LOW_THRESH="$OPTARG" ;;
C) DEFAULT_COLOR="$OPTARG" ;;
c) MUTED_COLOR="$OPTARG" ;;
i) AUDIO_INTERVAL="$OPTARG" ;;
m) MIXER="$OPTARG" ;;
s) SCONTROL="$OPTARG" ;;
h) printf \
"Usage: volume-pulseaudio [-S] [-F format] [-f format] [-p] [-a|-d] [-H symb] [-M symb]
[-L symb] [-X symb] [-T thresh] [-t thresh] [-C color] [-c color] [-i inter]
[-m mixer] [-s scontrol] [-h]
Options:
-F, -f\tOutput format (-F long format, -f short format) to use, with exposed variables:
\${SYMB}, \${VOL}, \${INDEX}, \${NAME}
-S\tSubscribe to volume events (requires persistent block, always uses long format)
-a\tUse ALSA name if possible
-d\tUse device description instead of name if possible
-H\tSymbol to use when audio level is high. Default: '$AUDIO_HIGH_SYMBOL'
-M\tSymbol to use when audio level is medium. Default: '$AUDIO_MED_SYMBOL'
-L\tSymbol to use when audio level is low. Default: '$AUDIO_LOW_SYMBOL'
-X\tSymbol to use when audio is muted. Default: '$AUDIO_MUTED_SYMBOL'
-T\tThreshold for medium audio level. Default: $AUDIO_MED_THRESH
-t\tThreshold for low audio level. Default: $AUDIO_LOW_THRESH
-C\tColor for non-muted audio. Default: $DEFAULT_COLOR
-c\tColor for muted audio. Default: $MUTED_COLOR
-i\tInterval size of volume increase/decrease. Default: $AUDIO_DELTA
-m\tUse the given mixer.
-s\tUse the given scontrol.
-h\tShow this help text
" && exit 0;;
esac
done
if [[ -z "$MIXER" ]] ; then
MIXER="default"
if amixer -D pulse info >/dev/null 2>&1 ; then
MIXER="pulse"
fi
fi
if [[ -z "$SCONTROL" ]] ; then
SCONTROL=$(amixer -D "$MIXER" scontrols | sed -n "s/Simple mixer control '\([^']*\)',0/\1/p" | head -n1)
fi
CAPABILITY=$(amixer -D $MIXER get $SCONTROL | sed -n "s/ Capabilities:.*cvolume.*/Capture/p")
function move_sinks_to_new_default {
DEFAULT_SINK=$1
pactl list sink-inputs | grep 'Sink Input #' | grep -o '[0-9]\+' | while read SINK
do
pactl move-sink-input $SINK $DEFAULT_SINK
done
}
function set_default_playback_device_next {
inc=${1:-1}
num_devices=$(pactl list sinks | grep -c Name:)
sink_arr=($(pactl list sinks | grep Name: | sed -r 's/\s+Name: (.+)/\1/'))
default_sink=$(pactl get-default-sink)
default_sink_index=$(for i in "${!sink_arr[@]}"; do if [[ "$default_sink" = "${sink_arr[$i]}" ]]; then echo "$i"; fi done)
default_sink_index=$(( ($default_sink_index + $num_devices + $inc) % $num_devices ))
default_sink=${sink_arr[$default_sink_index]}
pactl set-default-sink $default_sink
move_sinks_to_new_default $default_sink
}
case "$BLOCK_BUTTON" in
1) set_default_playback_device_next ;;
2) amixer -q -D $MIXER sset $SCONTROL $CAPABILITY toggle ;;
3) set_default_playback_device_next -1 ;;
4) amixer -q -D $MIXER sset $SCONTROL $CAPABILITY $AUDIO_DELTA%+ ;;
5) amixer -q -D $MIXER sset $SCONTROL $CAPABILITY $AUDIO_DELTA%- ;;
esac
function print_format {
echo "$1" | envsubst '${SYMB}${VOL}${INDEX}${NAME}'
}
function print_block {
ACTIVE="$(pactl list sinks | grep "State\: RUNNING" -B4 -A55)"
if [[ $ACTIVE = "" ]] ; then
ACTIVE="$(pactl list sinks | grep "$(pactl get-default-sink)" -B4 -A55)"
fi
ACTIVE="$(echo "$ACTIVE" | grep "Name:\|Volume: \(front-left\|mono\)\|Mute:\|api.alsa.pcm.card = \|node.nick = ")"
for Name in NAME MUTED VOL INDEX NICK; do
read $Name
done < <(echo "$ACTIVE")
INDEX=$(echo "$INDEX" | grep -o '".*"' | sed 's/"//g')
VOL=$(echo "$VOL" | grep -o "[0-9]*%" | head -1 )
VOL="${VOL%?}"
NAME=$(echo "$NICK" | grep -o '".*"' | sed 's/"//g')
if [[ $USE_ALSA_NAME == 1 ]] ; then
ALSA_NAME=$(pactl list sinks |\
awk '/^\s*\*/{f=1}/^\s*index:/{f=0}f' |\
grep "alsa.name\|alsa.mixer_name" |\
head -n1 |\
sed 's/.*= "\(.*\)".*/\1/')
NAME=${ALSA_NAME:-$NAME}
elif [[ $USE_DESCRIPTION == 1 ]] ; then
DESCRIPTION=$(pactl list sinks | grep "State\: RUNNING" -B4 -A55 | grep 'Description: ' | sed 's/^.*: //')
NAME=${DESCRIPTION:-$NAME}
fi
if [[ $MUTED =~ "no" ]] ; then
SYMB=$AUDIO_HIGH_SYMBOL
[[ $VOL -le $AUDIO_MED_THRESH ]] && SYMB=$AUDIO_MED_SYMBOL
[[ $VOL -le $AUDIO_LOW_THRESH ]] && SYMB=$AUDIO_LOW_SYMBOL
COLOR=$DEFAULT_COLOR
else
SYMB=$AUDIO_MUTED_SYMBOL
COLOR=$MUTED_COLOR
fi
if [[ $ACTIVE = "" ]] ; then
echo "Sound inactive"
COLOR='#222225'
fi
if [[ $SUBSCRIBE == 1 ]] ; then
print_format "$LONG_FORMAT"
else
print_format "$LONG_FORMAT"
print_format "$SHORT_FORMAT"
echo "$COLOR"
fi
}
print_block
if [[ $SUBSCRIBE == 1 ]] ; then
while read -r EVENT; do
print_block
done < <(pactl subscribe | stdbuf -oL grep change)
fi