Skip to content

Commit

Permalink
Merge branch 'master' into i3cp
Browse files Browse the repository at this point in the history
  • Loading branch information
kgilmer committed Aug 20, 2021
2 parents fa58745 + 65ca8bf commit 15192b6
Show file tree
Hide file tree
Showing 11 changed files with 206 additions and 6 deletions.
5 changes: 5 additions & 0 deletions conf.d/10_app-launcher
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# next workspace
#
# Open next available workspace
[app-launcher]
interval=once
2 changes: 1 addition & 1 deletion conf.d/10_next-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
#
# Open next available workspace
[next-workspace-widget]
interval=60
interval=once
5 changes: 5 additions & 0 deletions conf.d/80_microphone
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# microphone
#
# Display Microphone Level and Status
[microphone]
interval=5
52 changes: 51 additions & 1 deletion debian/changelog
Original file line number Diff line number Diff line change
@@ -1,9 +1,59 @@
regolith-i3xrocks-config (3.6.0-1) bionic; urgency=medium
regolith-i3xrocks-config (4.0.0-1) bionic; urgency=medium

[ Ken Gilmer ]
* Vend Xresource file

-- Regolith Linux <[email protected]> Sun, 17 Jan 2021 09:10:40 -0800
regolith-i3xrocks-config (3.6.6-1) bionic; urgency=medium

[ Ken Gilmer ]
* Fix microphone block config, was a copy from volume w/out change

-- Regolith Linux <[email protected]> Sun, 04 Jul 2021 08:02:40 -0700

regolith-i3xrocks-config (3.6.5-1) bionic; urgency=medium

[ Ken Gilmer ]
* Pass units to launch action. Addresses https://github.com/regolith-linux/regolith-i3xrocks-config/issues/120.

-- Regolith Linux <[email protected]> Thu, 10 Jun 2021 21:49:22 -0700

regolith-i3xrocks-config (3.6.4-1) bionic; urgency=medium

[ Ken Gilmer ]
* Remove invalid Xresource key segment from microphone block

-- Regolith Linux <[email protected]> Thu, 27 May 2021 16:41:36 -0700

regolith-i3xrocks-config (3.6.3-1) bionic; urgency=medium

[ Ken Gilmer ]
* Add missing dependency to net-traffic script on iproute2

-- Regolith Linux <[email protected]> Wed, 28 Apr 2021 21:26:39 -0700

regolith-i3xrocks-config (3.6.2-1) bionic; urgency=medium

[ Ken Gilmer ]
* Fix control file
* Fix config for app-launcher, remove incorrect interval on next-workspace

-- Regolith Linux <[email protected]> Sat, 24 Apr 2021 22:03:44 -0700

regolith-i3xrocks-config (3.6.1-1) bionic; urgency=medium

[ Ken Gilmer ]
* Take nicolas-lopez's contribution via gist as microphone status indicator. Related to https://github.com/regolith-linux/regolith-i3xrocks-config/issues/105.
* Add app launcher status indicator

-- Regolith Linux <[email protected]> Sun, 18 Apr 2021 18:14:46 -0700

regolith-i3xrocks-config (3.5.7-1) bionic; urgency=medium

[ Ken Gilmer ]
* remove debugging output flag in net-traffic script

-- Regolith Linux <[email protected]> Tue, 19 Jan 2021 09:01:20 -0800

regolith-i3xrocks-config (3.5.6-1) bionic; urgency=medium

Expand Down
21 changes: 19 additions & 2 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ Package: i3xrocks-net-traffic
Architecture: any
Depends: ${misc:Depends},
bc,
regolith-i3xrocks-config
regolith-i3xrocks-config,
iproute2
Recommends:
gnome-control-center
Description: Indicator to show network I/O status.
Expand Down Expand Up @@ -143,6 +144,14 @@ Depends: ${misc:Depends},
Description: Indicator to show volume.
An i3xrocks indicator for showing the current sound volume.

Package: i3xrocks-microphone
Architecture: any
Depends: ${misc:Depends},
regolith-i3xrocks-config,
alsa-utils
Description: Indicator to show microphone level.
An i3xrocks indicator for showing the current microphone level.

Package: i3xrocks-weather
Architecture: any
Depends: ${misc:Depends},
Expand Down Expand Up @@ -188,4 +197,12 @@ Depends: ${misc:Depends},
regolith-rofication,
regolith-i3xrocks-config
Description: Status indicator for rofication
See active system notifications on the bar.
See active system notifications on the bar.

Package: i3xrocks-app-launcher
Architecture: any
Depends: ${misc:Depends},
regolith-i3xrocks-config,
rofi
Description: Button to open app launcher.
An i3xrocks widget to open app launcher dialog.
2 changes: 2 additions & 0 deletions debian/i3xrocks-app-launcher.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
scripts/app-launcher /usr/share/i3xrocks
conf.d/10_app-launcher /etc/regolith/i3xrocks/conf.d
2 changes: 2 additions & 0 deletions debian/i3xrocks-microphone.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
scripts/microphone /usr/share/i3xrocks
conf.d/80_microphone /etc/regolith/i3xrocks/conf.d
17 changes: 17 additions & 0 deletions scripts/app-launcher
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

BUTTON=${button:-}
VALUE_COLOR=${color:-$(xrescat i3xrocks.value.color "#D8DEE9")}

LABEL_ICON=${label_icon:-$(xrescat i3xrocks.label.app_launcher )}
LABEL_COLOR=${label_color:-$(xrescat i3xrocks.label.color "#7B8394")}
VALUE_FONT=${font:-$(xrescat i3xrocks.value.font "Source Code Pro Medium 13")}

echo "<span color=\"${LABEL_COLOR}\">${LABEL_ICON}</span><span font_desc=\"${VALUE_FONT}\" color=\"${VALUE_COLOR}\"> </span>" # full text
echo "<span font_desc=\"${VALUE_FONT}\" color=\"${VALUE_COLOR}\"> </span>" # short text

if [ "x${BUTTON}" == "x1" ]; then
rofi_theme=$(xrescat rofi.theme "/etc/regolith/styles/lascaille/rofi.rasi")
rofi_launch="rofi -show drun -theme $rofi_theme"
eval "$rofi_launch"
fi
101 changes: 101 additions & 0 deletions scripts/microphone
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
#!/bin/bash

# Copyright (c) 2020 Guillaume Deflaux, Marco Buzzanca
#
# Based on the work of:
# 2014 Julien Bonjean <[email protected]>
# 2014 Alexander Keller <[email protected]>
#
# GNU GENERAL PUBLIC LICENSE
# Version 3, 29 June 2007
#
# 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 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)
STEP="${1:-$(xrescat i3xrocks.mic.step 5)}"

# The second parameter sets the unit. It can be '%' or 'dB' only.
UNIT="${2:-$(xrescat i3xrocks.mic.unit %)}"

# The third parameter overrides the mixer selection
# For PulseAudio users, 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
MIXER="default"
pactl list 1>/dev/null && MIXER="pulse"
lsmod | grep -q jack && MIXER="jackplug"
MIXER="${3:-$(xrescat i3xrocks.mic.mixer $MIXER)}"

# 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`
SCONTROL="${BLOCK_INSTANCE:-$(
amixer -D $MIXER scontrols |
sed -n "s/Simple mixer control '\([A-Za-z0-9 ]*\)',0/\1/p" |
grep Capture
)}"

mixer_capability() { # Return "Capture" if the device is a capture device
amixer -D $MIXER get $SCONTROL |
sed -n "s/ Capabilities:.*cvolume.*/Capture/p"
}

mixer_info() {
amixer -D $MIXER get $SCONTROL $(mixer_capability)
}

# Returns "on" if not mute, "off" if mute
mixer_status() {
mixer_info | sed -n "s/.*\[\(on\|off\)\].*/\1/p" | head -n 1
}

mixer_value() {
VAL=$(mixer_info | sed -n -E "s/.*\[(-?[0-9]+.?[0-9]+)$UNIT\].*/\1/p" | head -n 1)
if [ -z "$VAL" ]; then
# return empty string of same width to prevent bar shift.
echo " "
else
echo "$VAL$UNIT"
fi
}

ACTION_1=$(xrescat i3xrocks.action.mic.left "true")
ACTION_2=$(xrescat i3xrocks.action.mic.middle "true")
ACTION_3=$(xrescat i3xrocks.action.mic.right "amixer -q -D $MIXER sset $SCONTROL $(mixer_capability) toggle")
ACTION_4=$(xrescat i3xrocks.action.mic.scrollup "amixer -q -D $MIXER sset $SCONTROL $(mixer_capability) ${STEP}${UNIT}+")
ACTION_5=$(xrescat i3xrocks.action.mic.scrolldn "amixer -q -D $MIXER sset $SCONTROL $(mixer_capability) ${STEP}${UNIT}-")
case $BLOCK_BUTTON in
1) eval $ACTION_1 ;;
2) eval $ACTION_2 ;;
3) eval $ACTION_3 ;;
4) eval $ACTION_4 ;;
5) eval $ACTION_5 ;;
esac

LABEL_COLOR=${label_color:-$(xrescat i3xrocks.label.color "#E6E1CF")}

if [ "$(mixer_status)" == "on" ]; then
ICON=${icon_on:-$(xrescat i3xrocks.label.mic )}
VALUE_COLOR=${color:-$(xrescat i3xrocks.value.color "#E6E1CF")}
else
ICON=${icon_mute:-$(xrescat i3xrocks.label.mic.mute )}
VALUE_COLOR=${warn_color:-$(xrescat i3xrocks.warning "#FFD580")}
fi

VALUE_FONT=${font:-$(xrescat i3xrocks.value.font "Source Code Pro Medium 13")}
VALUE=$(mixer_value)

echo "<span color=\"${LABEL_COLOR}\">${ICON}</span><span font_desc=\"${VALUE_FONT}\" color=\"${VALUE_COLOR}\"> $VALUE</span>"
1 change: 0 additions & 1 deletion scripts/net-traffic
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

set -Eeu -o pipefail

set -x
# Note: net-traffic uses interval type 'repeat' so cannot use button events.
# See https://github.com/vivien/i3blocks#interval

Expand Down
4 changes: 3 additions & 1 deletion scripts/weather
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ VALUE_WEATHER_FORMAT="?format=${VALUE_WEATHER_FORMAT}"

# Determine units to use for temperature
# We don't supply a default here because wttr.in is "smart" enough to choose for us
ACTION_WEATHER_UNIT=""
WEATHER_UNIT=${weather_unit:-$(xrescat i3xrocks.weather.units "")}
if [ -n "${WEATHER_UNIT}" ]; then
ACTION_WEATHER_UNIT="?${WEATHER_UNIT}"
WEATHER_UNIT="&${WEATHER_UNIT}"
fi

Expand All @@ -29,6 +31,6 @@ fi
echo "<span font_desc=\"${VALUE_FONT}\" color=\"${VALUE_COLOR}\">${WEATHER}</span>"

if [ ! "x${BUTTON}" == "x" ]; then
ACTION=$(xrescat i3xrocks.action.weather "xdg-open https://wttr.in/${VALUE_WEATHER_LOCATION}")
ACTION=$(xrescat i3xrocks.action.weather "xdg-open https://wttr.in/${VALUE_WEATHER_LOCATION}${ACTION_WEATHER_UNIT}")
/usr/bin/i3-msg -q exec "$ACTION"
fi

0 comments on commit 15192b6

Please sign in to comment.