initial
This commit is contained in:
commit
5e3422c5f4
11 changed files with 813 additions and 0 deletions
41
i3blocks/backlight
Executable file
41
i3blocks/backlight
Executable file
|
@ -0,0 +1,41 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Show the screen brightness value given by `xbacklight`.
|
||||
# Clicking uses `xset` to turn off the backlight, scrolling increases or decreases
|
||||
# the brightness.
|
||||
|
||||
# Copyright 2019 Johannes Lange
|
||||
#
|
||||
# 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/>.
|
||||
|
||||
|
||||
STEP_SIZE=${STEP_SIZE:-5}
|
||||
USE_SUDO=${USE_SUDO:-0}
|
||||
|
||||
# whether to use `sudo` for changing the brightness (requires a NOPASSWD rule)
|
||||
if [[ "$USE_SUDO" == "0" ]] ; then
|
||||
XBACKLIGHT_SET="xbacklight"
|
||||
else
|
||||
XBACKLIGHT_SET="sudo xbacklight"
|
||||
fi
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
3) xset dpms force off ;; # right click
|
||||
4) $XBACKLIGHT_SET -inc "$STEP_SIZE" ;; # scroll up
|
||||
5) $XBACKLIGHT_SET -dec "$STEP_SIZE" ;; # scroll down, decrease
|
||||
esac
|
||||
|
||||
|
||||
BRIGHTNESS=$(xbacklight -get | cut -f1 -d'.')
|
||||
echo "${BRIGHTNESS}%"
|
113
i3blocks/bandwidth
Executable file
113
i3blocks/bandwidth
Executable file
|
@ -0,0 +1,113 @@
|
|||
#!/usr/bin/env bash
|
||||
# Copyright (C) 2012 Stefan Breunig <stefan+measure-net-speed@mathphys.fsk.uni-heidelberg.de>
|
||||
# Copyright (C) 2014 kaueraal
|
||||
# Copyright (C) 2015 Thiago Perrotta <perrotta dot thiago at poli dot ufrj dot br>
|
||||
|
||||
# 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/>.
|
||||
|
||||
# Get custom IN and OUT labels if provided by command line arguments
|
||||
while [[ $# -gt 1 ]]; do
|
||||
key="$1"
|
||||
case "$key" in
|
||||
-i|--inlabel)
|
||||
INLABEL="$2"
|
||||
shift;;
|
||||
-o|--outlabel)
|
||||
OUTLABEL="$2"
|
||||
shift;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
[[ -z "$INLABEL" ]] && INLABEL="IN "
|
||||
[[ -z "$OUTLABEL" ]] && OUTLABEL="OUT "
|
||||
|
||||
# Use the provided interface, otherwise the device used for the default route.
|
||||
if [[ -z $INTERFACE ]] && [[ -n $BLOCK_INSTANCE ]]; then
|
||||
INTERFACE=$BLOCK_INSTANCE
|
||||
elif [[ -z $INTERFACE ]]; then
|
||||
INTERFACE=$(ip route | awk '/^default/ { print $5 ; exit }')
|
||||
fi
|
||||
|
||||
# Exit if there is no default route
|
||||
[[ -z "$INTERFACE" ]] && exit
|
||||
|
||||
# Issue #36 compliant.
|
||||
if ! [ -e "/sys/class/net/${INTERFACE}/operstate" ] || \
|
||||
(! [ "$TREAT_UNKNOWN_AS_UP" = "1" ] &&
|
||||
! [ "`cat /sys/class/net/${INTERFACE}/operstate`" = "up" ])
|
||||
then
|
||||
echo "$INTERFACE down"
|
||||
echo "$INTERFACE down"
|
||||
echo "#FF0000"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# path to store the old results in
|
||||
path="/tmp/$(basename $0)-${INTERFACE}"
|
||||
|
||||
# grabbing data for each adapter.
|
||||
read rx < "/sys/class/net/${INTERFACE}/statistics/rx_bytes"
|
||||
read tx < "/sys/class/net/${INTERFACE}/statistics/tx_bytes"
|
||||
|
||||
# get time
|
||||
time="$(date +%s)"
|
||||
|
||||
# write current data if file does not exist. Do not exit, this will cause
|
||||
# problems if this file is sourced instead of executed as another process.
|
||||
if ! [[ -f "${path}" ]]; then
|
||||
echo "${time} ${rx} ${tx}" > "${path}"
|
||||
chmod 0666 "${path}"
|
||||
fi
|
||||
|
||||
|
||||
# read previous state and update data storage
|
||||
read old < "${path}"
|
||||
echo "${time} ${rx} ${tx}" > "${path}"
|
||||
|
||||
# parse old data and calc time passed
|
||||
old=(${old//;/ })
|
||||
time_diff=$(( $time - ${old[0]} ))
|
||||
|
||||
# sanity check: has a positive amount of time passed
|
||||
[[ "${time_diff}" -gt 0 ]] || exit
|
||||
|
||||
# calc bytes transferred, and their rate in byte/s
|
||||
rx_diff=$(( $rx - ${old[1]} ))
|
||||
tx_diff=$(( $tx - ${old[2]} ))
|
||||
rx_rate=$(( $rx_diff / $time_diff ))
|
||||
tx_rate=$(( $tx_diff / $time_diff ))
|
||||
|
||||
# shift by 10 bytes to get KiB/s. If the value is larger than
|
||||
# 1024^2 = 1048576, then display MiB/s instead
|
||||
|
||||
# incoming
|
||||
echo -n "$INLABEL"
|
||||
rx_kib=$(( $rx_rate >> 10 ))
|
||||
if hash bc 2>/dev/null && [[ "$rx_rate" -gt 1048576 ]]; then
|
||||
printf '%sM' "`echo "scale=1; $rx_kib / 1024" | bc`"
|
||||
else
|
||||
echo -n "${rx_kib}K"
|
||||
fi
|
||||
|
||||
echo -n " "
|
||||
|
||||
# outgoing
|
||||
echo -n "$OUTLABEL"
|
||||
tx_kib=$(( $tx_rate >> 10 ))
|
||||
if hash bc 2>/dev/null && [[ "$tx_rate" -gt 1048576 ]]; then
|
||||
printf '%sM\n' "`echo "scale=1; $tx_kib / 1024" | bc`"
|
||||
else
|
||||
echo "${tx_kib}K"
|
||||
fi
|
12
i3blocks/battery
Executable file
12
i3blocks/battery
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Get short text battery percentages
|
||||
BAT0=$(acpi -b | grep 'Battery 0' | awk -F ', ' '{print $2}' | awk '{print $1}')
|
||||
BAT1=$(acpi -b | grep 'Battery 1' | awk -F ', ' '{print $2}' | awk '{print $1}')
|
||||
|
||||
echo "BAT0: $BAT0 BAT1: $BAT1"
|
||||
|
||||
[ ${BAT%?} -le 5 ] && exit 33
|
||||
[ ${BAT%?} -le 20 ] && echo "#FF8000"
|
||||
|
||||
exit 0
|
22
i3blocks/brightness
Executable file
22
i3blocks/brightness
Executable file
|
@ -0,0 +1,22 @@
|
|||
#!/bin/bash
|
||||
|
||||
# File paths
|
||||
BRIGHTNESS_FILE="/sys/class/backlight/intel_backlight/brightness"
|
||||
MAX_BRIGHTNESS_FILE="/sys/class/backlight/intel_backlight/max_brightness"
|
||||
|
||||
# Read the current brightness and maximum brightness values
|
||||
current_brightness=$(cat "$BRIGHTNESS_FILE")
|
||||
max_brightness=$(cat "$MAX_BRIGHTNESS_FILE")
|
||||
|
||||
# Check if max_brightness is greater than 0 to avoid division by zero
|
||||
if [ "$max_brightness" -le 0 ]; then
|
||||
echo "Error: Max brightness is not a positive number."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Calculate the brightness percentage and round to the nearest whole number
|
||||
brightness_percentage=$(echo "scale=0; ($current_brightness * 100 / $max_brightness)" | bc)
|
||||
|
||||
# Output the brightness percentage
|
||||
echo "Backlight: ${brightness_percentage}%"
|
||||
|
40
i3blocks/calendar
Executable file
40
i3blocks/calendar
Executable file
|
@ -0,0 +1,40 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
WIDTH=${WIDTH:-200}
|
||||
HEIGHT=${HEIGHT:-200}
|
||||
DATEFMT=${DATEFMT:-"+%a %d %m %Y"}
|
||||
SHORTFMT=${SHORTFMT:-"+%a %m"}
|
||||
|
||||
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))
|
||||
|
||||
swaymsg -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")"
|
36
i3blocks/config
Normal file
36
i3blocks/config
Normal file
|
@ -0,0 +1,36 @@
|
|||
separator=true
|
||||
separator_block_width=15
|
||||
|
||||
[bandwidth]
|
||||
command=~/.config/i3blocks/bandwidth
|
||||
interval=1
|
||||
color=#f38ba8
|
||||
|
||||
[volume-pipewire]
|
||||
command=~/.config/i3blocks/volume-pipewire
|
||||
interval=once
|
||||
signal=1
|
||||
|
||||
[brightness]
|
||||
command=~/.config/i3blocks/brightness
|
||||
interval=1
|
||||
color=#fab387
|
||||
|
||||
[battery]
|
||||
command=~/.config/i3blocks/battery
|
||||
interval=10
|
||||
color=#a6e3a1
|
||||
|
||||
[weather]
|
||||
command=curl -Ss 'wttr.in/Atlanta,GA?0&T&Q' | cut -c 16- | head -2 | xargs echo
|
||||
interval=3600
|
||||
color=#89b4fa
|
||||
|
||||
[calendar]
|
||||
command=~/.config/i3blocks/calendar
|
||||
interval=1
|
||||
|
||||
[time]
|
||||
command=date +"%I:%M %p"
|
||||
interval=1
|
||||
color=#cba6f7
|
91
i3blocks/volume
Executable file
91
i3blocks/volume
Executable file
|
@ -0,0 +1,91 @@
|
|||
#!/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/>.
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
# The second parameter overrides the mixer selection
|
||||
# For PulseAudio users, eventually use "pulse"
|
||||
# For Jack/Jack2 users, use "jackplug"
|
||||
# For ALSA users, you may use "default" for your primary card
|
||||
# or you may use hw:# where # is the number of the card desired
|
||||
if [[ -z "$MIXER" ]] ; then
|
||||
MIXER="default"
|
||||
if command -v pulseaudio >/dev/null 2>&1 && pulseaudio --check ; then
|
||||
# pulseaudio is running, but not all installations use "pulse"
|
||||
if amixer -D pulse info >/dev/null 2>&1 ; then
|
||||
MIXER="pulse"
|
||||
fi
|
||||
fi
|
||||
[ -n "$(lsmod | grep jack)" ] && MIXER="jackplug"
|
||||
MIXER="${2:-$MIXER}"
|
||||
fi
|
||||
|
||||
# The instance option sets the control to report and configure
|
||||
# This defaults to the first control of your selected mixer
|
||||
# For a list of the available, use `amixer -D $Your_Mixer scontrols`
|
||||
if [[ -z "$SCONTROL" ]] ; then
|
||||
SCONTROL="${BLOCK_INSTANCE:-$(amixer -D $MIXER scontrols |
|
||||
sed -n "s/Simple mixer control '\([^']*\)',0/\1/p" |
|
||||
head -n1
|
||||
)}"
|
||||
fi
|
||||
|
||||
# The first parameter sets the step to change the volume by (and units to display)
|
||||
# This may be in in % or dB (eg. 5% or 3dB)
|
||||
if [[ -z "$STEP" ]] ; then
|
||||
STEP="${1:-5%}"
|
||||
fi
|
||||
|
||||
# AMIXER(1):
|
||||
# "Use the mapped volume for evaluating the percentage representation like alsamixer, to be
|
||||
# more natural for human ear."
|
||||
NATURAL_MAPPING=${NATURAL_MAPPING:-0}
|
||||
if [[ "$NATURAL_MAPPING" != "0" ]] ; then
|
||||
AMIXER_PARAMS="-M"
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
capability() { # Return "Capture" if the device is a capture device
|
||||
amixer $AMIXER_PARAMS -D $MIXER get $SCONTROL |
|
||||
sed -n "s/ Capabilities:.*cvolume.*/Capture/p"
|
||||
}
|
||||
|
||||
volume() {
|
||||
amixer $AMIXER_PARAMS -D $MIXER get $SCONTROL $(capability)
|
||||
}
|
||||
|
||||
format() {
|
||||
|
||||
perl_filter='if (/.*\[(\d+%)\] (\[(-?\d+.\d+dB)\] )?\[(on|off)\]/)'
|
||||
perl_filter+='{CORE::say $4 eq "off" ? "MUTE" : "'
|
||||
# If dB was selected, print that instead
|
||||
perl_filter+=$([[ $STEP = *dB ]] && echo '$3' || echo '$1')
|
||||
perl_filter+='"; exit}'
|
||||
output=$(perl -ne "$perl_filter")
|
||||
echo "$LABEL$output"
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
3) amixer $AMIXER_PARAMS -q -D $MIXER sset $SCONTROL $(capability) toggle ;; # right click, mute/unmute
|
||||
4) amixer $AMIXER_PARAMS -q -D $MIXER sset $SCONTROL $(capability) ${STEP}+ unmute ;; # scroll up, increase
|
||||
5) amixer $AMIXER_PARAMS -q -D $MIXER sset $SCONTROL $(capability) ${STEP}- unmute ;; # scroll down, decrease
|
||||
esac
|
||||
|
||||
volume | format
|
176
i3blocks/volume-pipewire
Executable file
176
i3blocks/volume-pipewire
Executable 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
|
6
readme.md
Normal file
6
readme.md
Normal file
|
@ -0,0 +1,6 @@
|
|||
# lapdots
|
||||
|
||||
- bar is swaybar (should be compatible with i3bar if you just rip out that part of the config)
|
||||
- status is i3blocks (fully compatable with sway and i3blocks though the scripts might need tweaking per system)
|
||||
|
||||
colors are based on catpuccin's i3 pallete
|
26
sway/catppuccin-mocha
Normal file
26
sway/catppuccin-mocha
Normal file
|
@ -0,0 +1,26 @@
|
|||
set $rosewater #f5e0dc
|
||||
set $flamingo #f2cdcd
|
||||
set $pink #f5c2e7
|
||||
set $mauve #cba6f7
|
||||
set $red #f38ba8
|
||||
set $maroon #eba0ac
|
||||
set $peach #fab387
|
||||
set $yellow #f9e2af
|
||||
set $green #a6e3a1
|
||||
set $teal #94e2d5
|
||||
set $sky #89dceb
|
||||
set $sapphire #74c7ec
|
||||
set $blue #89b4fa
|
||||
set $lavender #b4befe
|
||||
set $text #cdd6f4
|
||||
set $subtext1 #bac2de
|
||||
set $subtext0 #a6adc8
|
||||
set $overlay2 #9399b2
|
||||
set $overlay1 #7f849c
|
||||
set $overlay0 #6c7086
|
||||
set $surface2 #585b70
|
||||
set $surface1 #45475a
|
||||
set $surface0 #313244
|
||||
set $base #1e1e2e
|
||||
set $mantle #181825
|
||||
set $crust #11111b
|
250
sway/config
Normal file
250
sway/config
Normal file
|
@ -0,0 +1,250 @@
|
|||
# color theme
|
||||
include catppuccin-mocha
|
||||
|
||||
set $mod Mod4
|
||||
|
||||
set $term kitty
|
||||
|
||||
set $menu wofi
|
||||
|
||||
set $lock swaylock --config /home/rouce/.config/swaylock/config
|
||||
|
||||
#include /etc/sway/config-vars.d/*
|
||||
|
||||
### Output configuration
|
||||
#
|
||||
# Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/)
|
||||
output * bg /home/rouce/.wallpapers/cat.png fill
|
||||
#
|
||||
# Example configuration:
|
||||
#
|
||||
# output HDMI-A-1 resolution 1920x1080 position 1920,0
|
||||
#
|
||||
# You can get the names of your outputs by running: swaymsg -t get_outputs
|
||||
|
||||
### Idle configuration
|
||||
exec swayidle -w \
|
||||
timeout 120 '$lock'
|
||||
|
||||
## Startup
|
||||
|
||||
exec --no-startup-id brightnessctl set 800
|
||||
|
||||
exec --no-startup-id nm-applet
|
||||
exec --no-startup-id owncloud
|
||||
exec --no-startup-id dunst
|
||||
exec --no-startup-id exec /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1
|
||||
exec --no-startup-id firefox-esr
|
||||
exec --no-startup-id signal-desktop
|
||||
#exec --no-startup-id /home/rouce/.bin/floating kitty --hold -e './.bin/apt'
|
||||
## ENV
|
||||
|
||||
### Input configuration
|
||||
|
||||
# Example configuration:
|
||||
|
||||
input "1739:0:Synaptics_TM3276-031" {
|
||||
dwt enabled
|
||||
tap enabled
|
||||
natural_scroll enabled
|
||||
middle_emulation enabled
|
||||
}
|
||||
|
||||
# You can get the names of your inputs by running: swaymsg -t get_inputs
|
||||
# Read `man 5 sway-inWput` for more information about this section.
|
||||
|
||||
### Key bindings
|
||||
#
|
||||
# Basics:
|
||||
#
|
||||
# Start a terminal
|
||||
bindsym $mod+Return exec $term
|
||||
|
||||
# Kill focused window
|
||||
bindsym $mod+Shift+q kill
|
||||
|
||||
# Start your launcher
|
||||
bindsym $mod+d exec $menu
|
||||
|
||||
# mouse button for dragging.
|
||||
floating_modifier $mod normal
|
||||
|
||||
# Reload the configuration file
|
||||
bindsym $mod+Shift+R reload
|
||||
|
||||
# Exit sway (logs you out of your Wayland session)
|
||||
bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit'
|
||||
|
||||
# lock
|
||||
bindsym $mod+L exec $lock
|
||||
|
||||
# Screenshot
|
||||
bindsym $mod+Shift+S exec grim -g "$(slurp -d)" - | wl-copy
|
||||
|
||||
|
||||
bindsym $mod+Shift+C exec grim -g "$(slurp -p)" -t ppm - | convert - -format '%[pixel:p{0,0}]' txt:- | tail -n 1 | cut -d ' ' -f 4 | wl-copy
|
||||
|
||||
# volume
|
||||
#bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle
|
||||
#bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5%
|
||||
#bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5%
|
||||
|
||||
# Pipewire-pulse
|
||||
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && pkill -RTMIN+1 i3blocks
|
||||
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -5% && pkill -RTMIN+1 i3blocks
|
||||
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +5% && pkill -RTMIN+1 i3blocks
|
||||
|
||||
# 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
|
||||
|
||||
# Backlight
|
||||
bindsym XF86MonBrightnessUp exec brightnessctl set +100
|
||||
bindsym XF86MonBrightnessDown exec brightnessctl set 100-
|
||||
|
||||
|
||||
#
|
||||
# Moving around:
|
||||
#
|
||||
# Or use $mod+[up|down|left|right]
|
||||
bindsym $mod+Left focus left
|
||||
bindsym $mod+Down focus down
|
||||
bindsym $mod+Up focus up
|
||||
bindsym $mod+Right focus right
|
||||
|
||||
# Ditto, with arrow 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
|
||||
#
|
||||
# Workspaces:
|
||||
#
|
||||
# Switch to workspace
|
||||
bindsym $mod+1 workspace number 1
|
||||
bindsym $mod+2 workspace number 2
|
||||
bindsym $mod+3 workspace number 3
|
||||
bindsym $mod+4 workspace number 4
|
||||
bindsym $mod+5 workspace number 5
|
||||
bindsym $mod+6 workspace number 6
|
||||
bindsym $mod+7 workspace number 7
|
||||
bindsym $mod+8 workspace number 8
|
||||
bindsym $mod+9 workspace number 9
|
||||
bindsym $mod+0 workspace number 10
|
||||
# Move focused container to workspace
|
||||
bindsym $mod+Shift+1 move container to workspace number 1
|
||||
bindsym $mod+Shift+2 move container to workspace number 2
|
||||
bindsym $mod+Shift+3 move container to workspace number 3
|
||||
bindsym $mod+Shift+4 move container to workspace number 4
|
||||
bindsym $mod+Shift+5 move container to workspace number 5
|
||||
bindsym $mod+Shift+6 move container to workspace number 6
|
||||
bindsym $mod+Shift+7 move container to workspace number 7
|
||||
bindsym $mod+Shift+8 move container to workspace number 8
|
||||
bindsym $mod+Shift+9 move container to workspace number 9
|
||||
bindsym $mod+Shift+0 move container to workspace number 10
|
||||
# Note: workspaces can have any name you want, not just numbers.
|
||||
# We just use 1-10 as the default.
|
||||
#
|
||||
# Layout stuff:
|
||||
#
|
||||
# You can "split" the current object of your focus with
|
||||
# $mod+b or $mod+v, for horizontal and vertical splits
|
||||
# respectively.
|
||||
bindsym $mod+b splith
|
||||
bindsym $mod+v splitv
|
||||
|
||||
# Switch the current container between different layout styles
|
||||
bindsym $mod+s layout stacking
|
||||
bindsym $mod+w layout tabbed
|
||||
bindsym $mod+e layout toggle split
|
||||
|
||||
# Make the current focus fullscreen
|
||||
bindsym $mod+f fullscreen
|
||||
|
||||
# Toggle the current focus between tiling and floating mode
|
||||
bindsym $mod+Shift+space floating toggle
|
||||
|
||||
# Swap focus between the tiling area and the floating area
|
||||
bindsym $mod+space focus mode_toggle
|
||||
|
||||
# Move focus to the parent container
|
||||
bindsym $mod+a focus parent
|
||||
#
|
||||
# Scratchpad:
|
||||
#
|
||||
# Sway has a "scratchpad", which is a bag of holding for windows.
|
||||
# You can send windows there and get them back later.
|
||||
|
||||
# Move the currently focused window to the scratchpad
|
||||
bindsym $mod+Shift+minus move scratchpad
|
||||
|
||||
# Show the next scratchpad window or hide the focused scratchpad window.
|
||||
# If there are multiple scratchpad windows, this command cycles through them.
|
||||
bindsym $mod+minus scratchpad show
|
||||
|
||||
## Resizing containers:
|
||||
|
||||
mode "resize" {
|
||||
# Ditto, with arrow keys
|
||||
bindsym Left resize shrink width 100px
|
||||
bindsym Down resize grow height 100px
|
||||
bindsym Up resize shrink height 100px
|
||||
bindsym Right resize grow width 100px
|
||||
|
||||
# Return to default mode
|
||||
bindsym Return mode "default"
|
||||
bindsym Escape mode "default"
|
||||
}
|
||||
bindsym $mod+r mode "resize"
|
||||
|
||||
## Windows
|
||||
|
||||
# gaps
|
||||
gaps inner 8
|
||||
gaps outer 0
|
||||
|
||||
# borders
|
||||
default_border pixel 2
|
||||
|
||||
## Bar
|
||||
|
||||
bar {
|
||||
position top
|
||||
colors {
|
||||
background $base
|
||||
statusline $text
|
||||
focused_statusline $text
|
||||
focused_separator $base
|
||||
|
||||
# target border bg text
|
||||
focused_workspace $base $mauve $crust
|
||||
active_workspace $base $surface2 $text
|
||||
inactive_workspace $base $base $text
|
||||
urgent_workspace $base $red $crust
|
||||
}
|
||||
status_command i3blocks
|
||||
|
||||
}
|
||||
|
||||
## Color theme
|
||||
|
||||
# target title bg text indicator border
|
||||
client.focused $lavender $base $text $rosewater $lavender
|
||||
client.focused_inactive $overlay0 $base $text $rosewater $overlay0
|
||||
client.unfocused $overlay0 $base $text $rosewater $overlay0
|
||||
client.urgent $peach $base $peach $overlay0 $peach
|
||||
client.placeholder $overlay0 $base $text $overlay0 $overlay0
|
||||
client.background $base
|
||||
|
||||
## Floating
|
||||
|
||||
for_window [app_id="desktopclient.owncloud.com.owncloud"] floating enable
|
||||
for_window [app_id="org.gnome.FileRoller"] floating enable
|
||||
for_window [app_id="nemo"] floating enable
|
||||
for_window [app_id="nwg-look"] floating enable
|
||||
|
||||
for_window [app_id="yad"] floating enable
|
||||
for_window [app_id="qalculate-gtk"] floating enable
|
||||
for_window [app_id="gcolor3"] floating enable
|
Loading…
Add table
Reference in a new issue