Completely rewrite modules, remove old status script, merge dwmblocks
fork in to the makefile.
This commit is contained in:
parent
0fcdf896b6
commit
7228d3f921
344
LICENSE
344
LICENSE
|
@ -1,3 +1,5 @@
|
|||
License for dwm:
|
||||
|
||||
MIT/X Consortium License
|
||||
© 2006-2019 Anselm R Garbe <anselm@garbe.ca>
|
||||
© 2006-2009 Jukka Salmi <jukka at salmi dot ch>
|
||||
|
@ -36,3 +38,345 @@ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
License for dwmblocks:
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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 2 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, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
|
|
20
Makefile
20
Makefile
|
@ -10,10 +10,13 @@ SRC = draw.c speedwm.c main.c
|
|||
OBJ = ${SRC:.c=.o}
|
||||
|
||||
ifdef USEIPC
|
||||
all: options speedwm speedwm-ipc
|
||||
else
|
||||
all: options speedwm
|
||||
IPC=speedwm-ipc
|
||||
endif
|
||||
ifdef USESTATUS
|
||||
STATUS=status
|
||||
endif
|
||||
|
||||
all: options speedwm ${IPC} ${STATUS}
|
||||
|
||||
options:
|
||||
@echo speedwm build options:
|
||||
|
@ -30,6 +33,13 @@ ${OBJ}: options.mk
|
|||
speedwm: ${OBJ}
|
||||
${CC} -o $@ ${OBJ} ${LDFLAGS}
|
||||
|
||||
ifdef USESTATUS
|
||||
status: status.o
|
||||
$(CC) status.o $(CFLAGS) $(LDFLAGS) -o status
|
||||
status.o: status.c status.h
|
||||
$(CC) -c status.c
|
||||
endif
|
||||
|
||||
ifdef USEIPC
|
||||
speedwm-ipc: toggle/ipc-speedwm-msg.o
|
||||
${CC} -o $@ toggle/ipc-speedwm-msg.c ${LDFLAGS} ; rm -f ipc-speedwm-msg.o
|
||||
|
@ -38,6 +48,7 @@ endif
|
|||
clean:
|
||||
rm -f speedwm *.o speedwm-${VERSION}.tar.gz
|
||||
rm -f speedwm-ipc
|
||||
rm -f status
|
||||
rm -f *.html *.php
|
||||
echo "Cleaned!"
|
||||
|
||||
|
@ -89,6 +100,7 @@ install: all
|
|||
mkdir -p ${DESTDIR}${PREFIX}/share/xsessions/
|
||||
mkdir -p ${DESTDIR}${PREFIX}/share/pixmaps/
|
||||
[ -f speedwm-ipc ] && cp -f speedwm-ipc ${DESTDIR}${PREFIX}/bin || :
|
||||
[ -f status ] && cp -f status ${DESTDIR}${PREFIX}/bin || :
|
||||
[ -f speedwm ] && cp -f speedwm ${DESTDIR}${PREFIX}/bin || :
|
||||
[ -f docs/entry.desktop ] && cp -f docs/entry.desktop ${DESTDIR}${PREFIX}/share/xsessions/speedwm.desktop || :
|
||||
[ -f speedwm-ipc ] && chmod 755 ${DESTDIR}${PREFIX}/bin/speedwm-ipc || :
|
||||
|
@ -101,9 +113,11 @@ install: all
|
|||
cp -f docs/example.* ${DESTDIR}${PREFIX}/share/speedwm/
|
||||
cp -f scripts/speedwm* ${DESTDIR}${PREFIX}/bin ; chmod +x ${DESTDIR}${PREFIX}/bin/speedwm*
|
||||
chmod 755 ${DESTDIR}${PREFIX}/bin/speedwm
|
||||
[ -f status ] && chmod 755 ${DESTDIR}${PREFIX}/bin/status || :
|
||||
make modules_install
|
||||
[ -f ${DESTDIR}${PREFIX}/bin/speedwm ] && rm -f drw.o speedwm.o util.o speedwm speedwm-ipc || :
|
||||
echo ${VERSION} > ${DESTDIR}${PREFIX}/share/speedwm/speedwm-version
|
||||
rm -f status
|
||||
rm -f *.o
|
||||
|
||||
modules_install:
|
||||
|
|
|
@ -186,7 +186,7 @@ speedwm.status.defaultstatus:
|
|||
|
||||
!! Status bar script to run
|
||||
|
||||
speedwm.status.status: speedwm_status
|
||||
speedwm.status.status: status &
|
||||
|
||||
speedwm.status.statusallmons: 1 ! Display status text on all monitors (0/1)
|
||||
|
||||
|
|
|
@ -2,29 +2,22 @@
|
|||
# battery module for status/stellar
|
||||
|
||||
# load config
|
||||
. $HOME/.config/speedwm/statusrc
|
||||
BINDIR="$(dirname $(command -v speedwm_status))/"
|
||||
|
||||
# argument 1
|
||||
ARG1="$1"
|
||||
module_config
|
||||
[ -e "$HOME/.config/speedwm/statusrc" ] && . $HOME/.config/speedwm/statusrc
|
||||
|
||||
# clicking
|
||||
CLICK() {
|
||||
# values
|
||||
ICON="$ITEM11_ICON"
|
||||
BUTTON="$(cat /tmp/speedwm-button)"
|
||||
BATTERY_FULL="$(acpi)"
|
||||
[ -e "/tmp/speedwm-button" ] && BUTTON="$(cat /tmp/speedwm-button)" || BUTTON="0"
|
||||
|
||||
command -v acpi > /dev/null || exit
|
||||
command -v acpi > /dev/null && BATTERY_FULL="$(acpi)" || return
|
||||
|
||||
case "$TERMINAL" in
|
||||
"") TERMINAL=st
|
||||
esac
|
||||
|
||||
# no spacing if there's no icon
|
||||
if [ "$ICON" != "" ]; then
|
||||
ICONSPACING=" " # one character spacing
|
||||
fi
|
||||
# default terminal
|
||||
[ -z "$TERMINAL" ] && TERMINAL=st
|
||||
|
||||
# enable icon spacing
|
||||
[ ! -z "$ICON" ] && ICONSPACING=" " # one character spacing
|
||||
|
||||
# send the notification
|
||||
SEND_NOTIF() {
|
||||
|
@ -37,41 +30,27 @@ CLICK() {
|
|||
exit 0
|
||||
}
|
||||
|
||||
command -v notify-send > /dev/null && SEND_NOTIF
|
||||
echo "FATAL: libnotify not installed, can't send notification."
|
||||
|
||||
exit 1
|
||||
command -v notify-send > /dev/null && SEND_NOTIF || echo "FATAL: libnotify not installed, can't send notification."
|
||||
exit 1
|
||||
}
|
||||
|
||||
# information itself
|
||||
PRINT() {
|
||||
if [ "$ENABLE_ITEM11" = "true" ]; then
|
||||
# print capacity
|
||||
if [ -e "/sys/class/power_supply/BAT0/capacity" ]; then
|
||||
echo "$ITEM11_SEPARATOR $ITEM11_ICON $(cat /sys/class/power_supply/BAT0/capacity)%"
|
||||
fi
|
||||
[ "$ENABLE_ITEM11" != "true" ] && return
|
||||
|
||||
# print capacity for second battery if it exists
|
||||
if [ -e "/sys/class/power_supply/BAT1/capacity" ]; then
|
||||
echo "$ITEM11_SEPARATOR $ITEM11_ICON $(cat /sys/class/power_supply/BAT1/capacity)%"
|
||||
fi
|
||||
# battery 0, copy + paste this if you need more than one battery
|
||||
[ -e "/sys/class/power_supply/BAT0/capacity" ] && BATTERY="${BATTERY}$(cat /sys/class/power_supply/BAT0/capacity)%" || return
|
||||
|
||||
# show charging status
|
||||
if [ -e "${BINDIR}acpi" ]; then
|
||||
if [ "$ITEM11_SHOW_CHARGING_STATUS" = "true" ]; then
|
||||
CHARGESTATUS=$(echo ", $(acpi | awk '{ print $3 }' | sed "s|,||g" | sed "s|Discharging|$ITEM11_DISCHARGING_TEXT|g; s|Charging|$ITEM11_CHARGING_TEXT|g; s|Fully charged|$ITEM11_FULL_TEXT|g")") && echo $CHARGESTATUS
|
||||
fi
|
||||
fi
|
||||
echo "$ITEM11_SEPARATOR $ITEM11_ICON $BATTERY"
|
||||
|
||||
# append extra text
|
||||
if [ "$ITEM11_APPEND" != "" ]; then
|
||||
echo "$ITEM11_APPEND"
|
||||
fi
|
||||
fi
|
||||
# print charging status
|
||||
command -v acpi > /dev/null && [ "$ITEM11_SHOW_CHARGING_STATUS" ] && \
|
||||
CHARGESTATUS=$(echo ", $(acpi | awk '{ print $3 }' | sed "s|,||g; s|Discharging|$ITEM11_DISCHARGING_TEXT|g; s|Charging|$ITEM11_CHARGING_TEXT|g; s|Fully charged|$ITEM11_FULL_TEXT|g")") && \
|
||||
[ ! -z "$CHARGESTATUS" ] && echo "$CHARGESTATUS"
|
||||
}
|
||||
|
||||
# argument 1
|
||||
case "$ARG1" in
|
||||
case "$1" in
|
||||
"") CLICK ;;
|
||||
"--print-file") PRINT > /tmp/module_bat ;;
|
||||
"--print") PRINT ;;
|
||||
|
|
134
modules/module_config
Executable file
134
modules/module_config
Executable file
|
@ -0,0 +1,134 @@
|
|||
#!/bin/sh
|
||||
# Module for writing the initial config
|
||||
|
||||
MK() {
|
||||
mkdir -p $HOME/.config/speedwm/
|
||||
# write config
|
||||
cat <<CONFIG > ~/.config/speedwm/statusrc
|
||||
# speedwm status module configuration
|
||||
#
|
||||
# This shell script which acts as a configuration file should be configured in /bin/sh compatible syntax. For best compatibility, I suggest that you only use POSIX compliant shell. No bash, no fish and no zsh. Of course if /bin/sh is Bash then you don't strictly NEED to keep it POSIX compliant.
|
||||
#
|
||||
# You can however use if statements, case, variables, shell commands, cat << EOF, etc.
|
||||
#
|
||||
# To apply these changes, simply restart the status bar.
|
||||
|
||||
# General settings
|
||||
SEPARATOR="❰" # Separator to use. Alternative separators: "❰", "<", "|"
|
||||
|
||||
# Status bar modules
|
||||
# Set to true/false to enable/disable.
|
||||
# Keep in mind, if the dependencies are not installed, then they will not be used regardless of what the option is set to.
|
||||
ENABLE_ITEM1=true # Enable RAM usage (true/false)
|
||||
ENABLE_ITEM2=true # Enable Time (HH:MM) (true/false)
|
||||
ENABLE_ITEM3=true # Enable Date (DD/MM/YY) (true/false)
|
||||
ENABLE_ITEM4=true # Enable Volume/Mute status (<perc>%) (true/false)
|
||||
ENABLE_ITEM5=true # Enable Weather (true/false)
|
||||
ENABLE_ITEM6=true # Enable Network Traffic (<num> kb/s (true/false)
|
||||
ENABLE_ITEM7=true # Enable dfmpeg status (true/false)
|
||||
ENABLE_ITEM8=true # Enable CPU temp (true/false)
|
||||
ENABLE_ITEM9=true # Enable music status (true/false)
|
||||
ENABLE_ITEM10=false # Enable newsboat unread (true/false)
|
||||
ENABLE_ITEM11=true # Enable battery percentage and charging status (true/false)
|
||||
|
||||
# Status bar module icons
|
||||
# Make sure dwm supports this icon/glyph.
|
||||
ITEM1_ICON=" " # Icon for ITEM1
|
||||
ITEM2_ICON=" " # Icon for ITEM2
|
||||
ITEM3_ICON=" " # Icon for ITEM3
|
||||
ITEM4_ICON=" " # Icon for ITEM4
|
||||
ITEM5_ICON=" " # Icon for ITEM5
|
||||
ITEM6_ICON=" " # Icon for ITEM6
|
||||
ITEM7_ICON=" " # Icon for ITEM7
|
||||
ITEM8_ICON=" " # Icon for ITEM8
|
||||
ITEM9_ICON=" " # Icon for ITEM9
|
||||
ITEM10_ICON=" " # Icon for ITEM10
|
||||
ITEM11_ICON=" " # Icon for ITEM11
|
||||
|
||||
# Status bar module separators
|
||||
ITEM1_SEPARATOR="\$SEPARATOR" # Separator for ITEM1
|
||||
ITEM2_SEPARATOR="\$SEPARATOR" # Separator for ITEM2
|
||||
ITEM3_SEPARATOR="\$SEPARATOR" # Separator for ITEM3
|
||||
ITEM4_SEPARATOR="\$SEPARATOR" # Separator for ITEM4
|
||||
ITEM5_SEPARATOR="\$SEPARATOR" # Separator for ITEM5
|
||||
ITEM6_SEPARATOR="\$SEPARATOR" # Separator for ITEM6
|
||||
ITEM7_SEPARATOR="\$SEPARATOR" # Separator for ITEM7
|
||||
ITEM8_SEPARATOR="\$SEPARATOR" # Separator for ITEM8
|
||||
ITEM9_SEPARATOR="\$SEPARATOR" # Separator for ITEM9
|
||||
ITEM10_SEPARATOR="\$SEPARATOR" # Separator for ITEM10
|
||||
ITEM11_SEPARATOR="\$SEPARATOR" # Separator for ITEM11
|
||||
|
||||
# RAM format
|
||||
# Format to display the RAM status in
|
||||
#
|
||||
# @u - Used RAM
|
||||
# @t - Total RAM
|
||||
#
|
||||
# Example: @u/@t
|
||||
ITEM1_FORMAT="@u/@t"
|
||||
|
||||
# Time format
|
||||
# Format to display the time in
|
||||
#
|
||||
# @h - Hour
|
||||
# @m - Minute
|
||||
# @s - Second
|
||||
#
|
||||
# Example: @h:@m
|
||||
ITEM2_FORMAT="@h:@m"
|
||||
|
||||
# Date format
|
||||
# Format to display the date in
|
||||
#
|
||||
# @d - Day
|
||||
# @m - Month
|
||||
# @y - Year
|
||||
#
|
||||
# Example: @d/@m/@y
|
||||
ITEM3_FORMAT="@d/@m/@y"
|
||||
|
||||
ITEM4_SHOW_MUTE="true" # Show mute status (true/false)
|
||||
ITEM4_MUTE_TEXT="(Muted)" # Text to display when muted (text)
|
||||
|
||||
# Net format
|
||||
# Format to display the transmitted/received bytes in
|
||||
#
|
||||
# @t - Transmitted
|
||||
# @r - Received
|
||||
#
|
||||
# Example: @t kb/s
|
||||
ITEM6_FORMAT="@t kb/s"
|
||||
|
||||
ITEM7_RECORDING_TEXT="Recording" # Text to display when recording (text)
|
||||
|
||||
ITEM8_FORMAT_CELSIUS="true" # Format temperature in Celsius (true/false)
|
||||
|
||||
ITEM9_BACKEND="auto" # Backend for the music status (cmus/mocp/auto)
|
||||
|
||||
# Music format
|
||||
# Format to display the music status in
|
||||
#
|
||||
# @a - Artist
|
||||
# @t - Title
|
||||
# @g - Genre
|
||||
# @ab - Album
|
||||
# @tt - Total time
|
||||
# @te - Time elapsed
|
||||
#
|
||||
# Example: @a - @t from @ab (@g) [@te/@tt]
|
||||
ITEM9_FORMAT="@a - @t from @ab (@g) [@te/@tt]"
|
||||
|
||||
ITEM10_TEXT="unread articles!" # Text to display next to unread article count (text)
|
||||
|
||||
ITEM11_SHOW_CHARGING_STATUS=true # Show 'Charging', 'Not charging' or 'Fully charged' status after the percentage. (true/false)
|
||||
ITEM11_DISCHARGING_TEXT="Not charging" # Text when not charging (text)
|
||||
ITEM11_CHARGING_TEXT="Charging" # Text when charging (text)
|
||||
ITEM11_FULL_TEXT="Fully charged" # Text when fully charged (text)
|
||||
|
||||
# For the rest of the options, see status.h.
|
||||
CONFIG
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
[ -e "$HOME/.config/speedwm/statusrc" ] || MK
|
|
@ -1,11 +1,12 @@
|
|||
#!/bin/sh
|
||||
# date module for status/stellar
|
||||
|
||||
# load config
|
||||
. $HOME/.config/speedwm/statusrc
|
||||
BINDIR="$(dirname $(command -v speedwm_status))/"
|
||||
command -v date > /dev/null || exit
|
||||
|
||||
# load config
|
||||
module_config
|
||||
[ -e "$HOME/.config/speedwm/statusrc" ] && . $HOME/.config/speedwm/statusrc
|
||||
|
||||
ARG1="$1"
|
||||
|
||||
# click
|
||||
CLICK() {
|
||||
|
@ -21,67 +22,40 @@ CLICK() {
|
|||
DATE_WEEK="$(date +%W)" # week number
|
||||
DATE_WEEKDAY="$(date +%w)" # day of the week in number
|
||||
ICON="$ITEM3_ICON" # icon is first argument
|
||||
BUTTON="$(cat /tmp/speedwm-button)" # button
|
||||
|
||||
case "$TERMINAL" in
|
||||
"") TERMINAL=st
|
||||
esac
|
||||
|
||||
# no spacing if there's no icon
|
||||
if [ "$ICON" != "" ]; then
|
||||
ICONSPACING=" " # one character spacing
|
||||
fi
|
||||
[ -e "/tmp/speedwm-button" ] && BUTTON="$(cat /tmp/speedwm-button)" || BUTTON="0"
|
||||
|
||||
[ -z "$TERMINAL" ] && TERMINAL=st
|
||||
[ ! -z "$ICON" ] && ICONSPACING=" " # one character spacing
|
||||
|
||||
# check value of button
|
||||
case "$BUTTON" in
|
||||
"3") RCAL ;;
|
||||
"3") pgrep -x gsimplecal > /dev/null && pkill gsimplecal || gsimplecal ; return ;;
|
||||
esac
|
||||
|
||||
# send the notification
|
||||
SEND_NOTIF() {
|
||||
FULL_DATE="$(printf "${ICON}${ICONSPACING}$DATE_DAY_W_LONG, $DATE_MONTH_W_LONG, $DATE_DAY $DATE_YEAR\nWeek: $DATE_WEEK\nDay of the week: $DATE_WEEKDAY")"
|
||||
notify-send "$FULL_DATE"
|
||||
FULL_DATE="$(printf "${ICON}${ICONSPACING}$DATE_DAY_W_LONG, $DATE_MONTH_W_LONG, $DATE_DAY $DATE_YEAR\nWeek: $DATE_WEEK\nDay of the week: $DATE_WEEKDAY")" && notify-send "$FULL_DATE"
|
||||
|
||||
# some output
|
||||
echo "Notification sent successfully!"
|
||||
echo "INFO: $FULL_DATE"
|
||||
|
||||
exit 0
|
||||
return
|
||||
}
|
||||
|
||||
command -v notify-send > /dev/null && SEND_NOTIF
|
||||
echo "FATAL: libnotify not installed, can't send notification."
|
||||
command -v notify-send > /dev/null && SEND_NOTIF || echo "FATAL: libnotify not installed, can't send notification."
|
||||
|
||||
exit 1
|
||||
return
|
||||
}
|
||||
|
||||
# information itself
|
||||
PRINT() {
|
||||
if [ "$ENABLE_ITEM3" = "true" ]; then
|
||||
if [ -e "${DATEBINDIR}date" ]; then
|
||||
DAY="$(date +%d)"
|
||||
MONTH="$(date +%m)"
|
||||
YEAR="$(date +%Y)"
|
||||
|
||||
echo "$ITEM3_SEPARATOR $ITEM3_ICON $ITEM3_FORMAT$ITEM3_APPEND" | sed "s|@d|$DAY|; s|@m|$MONTH|; s|@y|$YEAR|"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# run calendar applet
|
||||
RCAL() {
|
||||
pgrep -x gsimplecal > /dev/null && isrunning=true
|
||||
|
||||
if [ "$isrunning" = "true" ]; then
|
||||
pkill gsimplecal
|
||||
exit
|
||||
else
|
||||
gsimplecal
|
||||
isrunning=true
|
||||
exit
|
||||
fi
|
||||
[ "$ENABLE_ITEM3" = "true" ] && DAY="$(date +%d)" && MONTH="$(date +%m)" && YEAR="$(date +%Y)" && \
|
||||
echo "$ITEM3_SEPARATOR $ITEM3_ICON $ITEM3_FORMAT" | sed "s|@d|$DAY|; s|@m|$MONTH|; s|@y|$YEAR|"
|
||||
}
|
||||
|
||||
# argument 1
|
||||
case "$ARG1" in
|
||||
case "$1" in
|
||||
"") CLICK ;;
|
||||
"--print-file") PRINT > /tmp/module_date ;;
|
||||
"--print") PRINT ;;
|
||||
|
|
|
@ -1,83 +1,60 @@
|
|||
#!/bin/sh
|
||||
# dfmpeg module for status/stellar
|
||||
|
||||
# load config
|
||||
. $HOME/.config/speedwm/statusrc
|
||||
BINDIR="$(dirname $(command -v speedwm_status))/"
|
||||
command -v speedwm-dfmpeg > /dev/null || exit
|
||||
|
||||
ARG1="$1"
|
||||
# load config
|
||||
module_config
|
||||
[ -e "$HOME/.config/speedwm/statusrc" ] && . $HOME/.config/speedwm/statusrc
|
||||
|
||||
# click
|
||||
CLICK() {
|
||||
# values
|
||||
DFMPEG_CMD="speedwm-dfmpeg -s"
|
||||
DFMPEG_REC_PATH="$(cat /tmp/outputfilename)"
|
||||
DFMPEG_STOP_CMD="speedwm-dfmpeg -s" # command to run to stop recording
|
||||
ICON="$ITEM7_ICON"
|
||||
BUTTON="$(cat /tmp/speedwm-button)"
|
||||
DFMPEG_ENCODING="Not encoding" # placeholder, we can override this later
|
||||
[ -e "/tmp/outputfilename" ] && DFMPEG_REC_PATH="$(cat /tmp/outputfilename)"
|
||||
[ -e "/tmp/speedwm-button" ] && BUTTON="$(cat /tmp/speedwm-button)"
|
||||
[ -z "$TERMINAL" ] && TERMINAL=st
|
||||
|
||||
pgrep -x ffmpeg || exit 1
|
||||
|
||||
case "$TERMINAL" in
|
||||
"") TERMINAL=st
|
||||
esac
|
||||
pgrep -x ffmpeg > /dev/null || return
|
||||
|
||||
case "$BUTTON" in
|
||||
"3") speedwm-dfmpeg ; exit ;;
|
||||
"2") $DFMPEG_CMD ; exit ;;
|
||||
"2") $DFMPEG_STOP_CMD ; exit ;;
|
||||
esac
|
||||
|
||||
# check if recording audio
|
||||
if [ -e "/tmp/isaudio" ]; then
|
||||
DFMPEG_AUDIO="Recording audio"
|
||||
else
|
||||
DFMPEG_AUDIO="Not recording audio"
|
||||
fi
|
||||
|
||||
# check if encoding
|
||||
if [ -e "/tmp/isencoding" ]; then
|
||||
if [ -e "/tmp/encoding-codec" ]; then
|
||||
DFMPEG_ENCODING="Encoding with $(cat /tmp/encoding-codec)"
|
||||
else
|
||||
DFMPEG_ENCODING="Encoding"
|
||||
fi
|
||||
else
|
||||
DFMPEG_ENCODING="Not encoding"
|
||||
fi
|
||||
|
||||
# no spacing if there's no icon
|
||||
if [ "$ICON" != "" ]; then
|
||||
ICONSPACING=" " # one character spacing
|
||||
fi
|
||||
# check a few things
|
||||
[ -e "/tmp/isaudio" ] && DFMPEG_AUDIO="Recording audio" || DFMPEG_AUDIO="Not recording audio"
|
||||
[ -e "/tmp/isencoding" ] && DFMPEG_ENCODING="Encoding"
|
||||
[ -e "/tmp/encoding-codec" ] && DFMPEG_ENCODING="Encoding with $(cat /tmp/encoding-codec)"
|
||||
[ ! -z "$ICON" ] && ICONSPACING=" " # one character spacing
|
||||
|
||||
# send the notification
|
||||
SEND_NOTIF() {
|
||||
FULL_RECSTATUS="$(printf "${ICON}${ICONSPACING}Recording video $DFMPEG_REC_PATH\n${DFMPEG_AUDIO}, ${DFMPEG_ENCODING}\nMiddle click to stop recording.")"
|
||||
notify-send "$FULL_RECSTATUS"
|
||||
|
||||
# some output
|
||||
echo "Notification sent successfully!"
|
||||
echo "INFO: $FULL_RECSTATUS"
|
||||
|
||||
exit 0
|
||||
return
|
||||
}
|
||||
|
||||
command -v notify-send > /dev/null && SEND_NOTIF
|
||||
echo "FATAL: libnotify not installed, can't send notification."
|
||||
|
||||
exit 1
|
||||
command -v notify-send > /dev/null && SEND_NOTIF || echo "FATAL: libnotify not installed, can't send notification."
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
# information itself
|
||||
PRINT() {
|
||||
# Check if we're recording with dfmpeg or not
|
||||
if [ "$ENABLE_ITEM7" = "true" ]; then
|
||||
if [ -e "/tmp/dfmpeg-recording" ]; then
|
||||
echo "$ITEM7_SEPARATOR $ITEM7_ICON $ITEM7_RECORDING_TEXT$ITEM7_APPEND"
|
||||
fi
|
||||
fi
|
||||
# check if we're recording with dfmpeg or not
|
||||
[ "$ENABLE_ITEM7" = "true" ] && [ -e "/tmp/dfmpeg-recording" ] && echo "$ITEM7_SEPARATOR $ITEM7_ICON $ITEM7_RECORDING_TEXT"
|
||||
}
|
||||
|
||||
# argument 1
|
||||
case "$ARG1" in
|
||||
case "$1" in
|
||||
"") CLICK ;;
|
||||
"--print-file") PRINT > /tmp/module_dfmpeg ;;
|
||||
"--print") PRINT ;;
|
||||
|
|
|
@ -2,240 +2,114 @@
|
|||
# music module for status/stellar
|
||||
|
||||
# load config
|
||||
. $HOME/.config/speedwm/statusrc
|
||||
BINDIR="$(dirname $(command -v speedwm_status))/"
|
||||
module_config
|
||||
[ -e "$HOME/.config/speedwm/statusrc" ] && . $HOME/.config/speedwm/statusrc
|
||||
[ "$ENABLE_ITEM9" = "true" ] || exit
|
||||
|
||||
ARG1="$1"
|
||||
# get information, the following functions depend on this
|
||||
GETPROP() {
|
||||
# get backend from the two available options, please pr for more ;)
|
||||
[ "$ITEM9_BACKEND" = "auto" ] && pgrep -x cmus > /dev/null && ITEM9_BACKEND=cmus || pgrep -x mocp > /dev/null && ITEM9_BACKEND=mocp
|
||||
[ "$ITEM9_BACKEND" = "cmus" ] && command -v cmus > /dev/null || ITEM9_BACKEND=mocp
|
||||
[ "$ITEM9_BACKEND" = "mocp" ] && command -v mocp > /dev/null || ITEM9_BACKEND=cmus
|
||||
[ -z "$ITEM9_BACKEND" ] && exit
|
||||
pgrep -x "$ITEM9_BACKEND" > /dev/null || exit
|
||||
|
||||
# for cmus
|
||||
CMUS() {
|
||||
MUSIC_FILENAME="$(basename "$(cmus-remote -C status | grep file)")"
|
||||
MUSIC_FILENAME_CUT="$(basename "$(cmus-remote -C status | grep file)"| sed 's|\(.*\)[.].*|\1|')"
|
||||
MUSIC_FILEDIR="$(dirname "$(cmus-remote -C status | grep file | sed 's/file //g')")"
|
||||
MUSIC_ARTIST="$(cmus-remote -C status | grep "tag artist" | sed "s|\&|stellar_amp|g; s/tag artist //g")"
|
||||
MUSIC_TITLE="$(cmus-remote -C status | grep "tag title" | sed "s|\&|stellar_amp|g; s/tag title //g")"
|
||||
MUSIC_ALBUM="$(cmus-remote -C status | grep "tag album " | head -n 1 | sed "s|\&|stellar_amp|g; s/tag album //g")"
|
||||
MUSIC_GENRE="$(cmus-remote -C status | grep "tag genre" | sed "s/tag genre //g")"
|
||||
MUSIC_TIMEELAPSED="$(cmus-remote -Q | grep position | sed "s/position //g" | awk '{printf "%02d:%02d:%02d",$0/3600,$0%3600/60,$0%60}' | sed "s/00://")"
|
||||
MUSIC_TIMETOTAL="$(cmus-remote -Q | grep duration | sed "s/duration //g" | awk '{printf "%02d:%02d:%02d",$0/3600,$0%3600/60,$0%60}' | sed "s/00://")"
|
||||
MUSIC_REPEAT="$(cmus-remote -C status | grep 'repeat ' | sed "s/true/Yes/; s/false/No/; s/set repeat //")"
|
||||
MUSIC_SHUFFLE="$(cmus-remote -C status | grep 'shuffle' | sed "s/on/Yes/; s/off/No/; s/set shuffle //")"
|
||||
|
||||
# for notification
|
||||
FULL_MUSIC="$(printf "${ICON}${ICONSPACING}Artist: $MUSIC_ARTIST\nTitle: $MUSIC_TITLE\nAlbum: $MUSIC_ALBUM\nGenre: $MUSIC_GENRE\nTime elapsed: $MUSIC_TIMEELAPSED\nTotal time: $MUSIC_TIMETOTAL\nFile: $MUSIC_FILENAME\nDirectory: $MUSIC_FILEDIR\nPath: $MUSIC_FILEDIR/$MUSIC_FILENAME\nRepeat: $MUSIC_REPEAT\nShuffle: $MUSIC_SHUFFLE" | sed "s/stellar_amp/\&/g")"
|
||||
}
|
||||
|
||||
# for mocp
|
||||
MOCP() {
|
||||
MUSIC_FILENAME="$(basename "$(mocp -Q %file)")"
|
||||
MUSIC_FILENAME_CUT="$(basename "$(mocp -Q %file)" | sed 's|\(.*\)[.].*|\1|')"
|
||||
MUSIC_FILEDIR="$(dirname "$(mocp -Q %file)")"
|
||||
MUSIC_ARTIST="$(mocp -Q %artist | sed "s|\&|stellar_amp|g")"
|
||||
MUSIC_TITLE="$(mocp -Q %song | sed "s|\&|stellar_amp|g")"
|
||||
MUSIC_ALBUM="$(mocp -Q %album | sed "s|\&|stellar_amp|g")"
|
||||
MUSIC_TIMEELAPSED="$(mocp -Q %ct)"
|
||||
MUSIC_TIMETOTAL="$(mocp -Q %tt)"
|
||||
# todo: genre
|
||||
|
||||
# for notification
|
||||
FULL_MUSIC="$(printf "${ICON}${ICONSPACING}Artist: $MUSIC_ARTIST\nTitle: $MUSIC_TITLE\nAlbum: $MUSIC_ALBUM\nTime elapsed: $MUSIC_TIMEELAPSED\nTotal time: $MUSIC_TIMETOTAL\nFile: $MUSIC_FILENAME\nDirectory: $MUSIC_FILEDIR\nPath: $MUSIC_FILEDIR/$MUSIC_FILENAME" | sed "s/stellar_amp/\&/g")"
|
||||
}
|
||||
|
||||
[ "$ITEM9_BACKEND" = "cmus" ] && CMUS || MOCP
|
||||
}
|
||||
|
||||
GETPROP
|
||||
|
||||
CLICK() {
|
||||
# values
|
||||
ICON="$ITEM9_ICON"
|
||||
BUTTON="$(cat /tmp/speedwm-button)"
|
||||
|
||||
if [ "$ITEM9_BACKEND" = "auto" ]; then
|
||||
command -v mocp > /dev/null && ITEM9_BACKEND=mocp
|
||||
command -v cmus > /dev/null && ITEM9_BACKEND=cmus
|
||||
else
|
||||
if [ "$ITEM9_BACKEND" = "cmus" ]; then
|
||||
command -v cmus > /dev/null || ITEM9_BACKEND=mocp
|
||||
elif [ "$ITEM9_BACKEND" = "mocp" ]; then
|
||||
command -v mocp > /dev/null || ITEM9_BACKEND=cmus
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# for cmus
|
||||
CMUS() {
|
||||
MUSIC_FILENAME="$(basename "$(cmus-remote -C status | grep file)")"
|
||||
MUSIC_FILENAME_CUT="$(basename "$(cmus-remote -C status | grep file)"| sed 's|\(.*\)[.].*|\1|')"
|
||||
MUSIC_FILEDIR="$(dirname "$(cmus-remote -C status | grep file | sed 's/file //g')")"
|
||||
MUSIC_ARTIST="$(cmus-remote -C status | grep "tag artist" | sed "s/tag artist //g")"
|
||||
MUSIC_SONG="$(cmus-remote -C status | grep "tag title" | sed "s/tag title //g")"
|
||||
MUSIC_ALBUM="$(cmus-remote -C status | grep "tag album" | head -n 1 | sed "s/tag album //g")"
|
||||
MUSIC_GENRE="$(cmus-remote -C status | grep "tag genre" | sed "s/tag genre //g")"
|
||||
MUSIC_TIMEELAPSED="$(cmus-remote -Q | grep position | sed "s/position //g" | awk '{printf "%02d:%02d:%02d",$0/3600,$0%3600/60,$0%60}' | sed "s/00://")"
|
||||
MUSIC_TIMETOTAL="$(cmus-remote -Q | grep duration | sed "s/duration //g" | awk '{printf "%02d:%02d:%02d",$0/3600,$0%3600/60,$0%60}' | sed "s/00://")"
|
||||
MUSIC_REPEAT="$(cmus-remote -C status | grep 'repeat ' | sed "s/true/Yes/; s/false/No/; s/set repeat //")"
|
||||
MUSIC_SHUFFLE="$(cmus-remote -C status | grep 'shuffle' | sed "s/on/Yes/; s/off/No/; s/set shuffle //")"
|
||||
}
|
||||
|
||||
# for mocp
|
||||
MOCP() {
|
||||
MUSIC_FILENAME="$(basename "$(mocp -Q %file)")"
|
||||
MUSIC_FILENAME_CUT="$(basename "$(mocp -Q %file)" | sed 's|\(.*\)[.].*|\1|')"
|
||||
MUSIC_FILEDIR="$(dirname "$(mocp -Q %file)")"
|
||||
MUSIC_ARTIST="$(mocp -Q %artist)"
|
||||
MUSIC_SONG="$(mocp -Q %song)"
|
||||
MUSIC_ALBUM="$(mocp -Q %album)"
|
||||
MUSIC_TIMEELAPSED="$(mocp -Q %ct)"
|
||||
MUSIC_TIMETOTAL="$(mocp -Q %tt)"
|
||||
# todo: genre
|
||||
}
|
||||
|
||||
# set variables with content
|
||||
case "$ITEM9_BACKEND" in
|
||||
"cmus") CMUS ;;
|
||||
"mocp") MOCP ;;
|
||||
esac
|
||||
|
||||
# terminal
|
||||
case "$TERMINAL" in
|
||||
"") TERMINAL=st
|
||||
esac
|
||||
[ -z "$TERMINAL" ] && TERMINAL=st
|
||||
[ ! -z "$ICON" ] && ICONSPACING=" " # one character spacing
|
||||
|
||||
# button
|
||||
case "$BUTTON" in
|
||||
"3") $TERMINAL -e $ITEM9_BACKEND ; exit ;;
|
||||
esac
|
||||
|
||||
# no spacing if there's no icon
|
||||
if [ "$ICON" != "" ]; then
|
||||
ICONSPACING=" " # one character spacing
|
||||
fi
|
||||
|
||||
# send the notification
|
||||
SEND_NOTIF() {
|
||||
if [ "$ITEM9_BACKEND" = "cmus" ]; then
|
||||
FULL_MUSIC="$(printf "${ICON}${ICONSPACING}Artist: $MUSIC_ARTIST\nTitle: $MUSIC_SONG\nAlbum: $MUSIC_ALBUM\nGenre: $MUSIC_GENRE\nTime elapsed: $MUSIC_TIMEELAPSED\nTotal time: $MUSIC_TIMETOTAL\nFile: $MUSIC_FILENAME\nDirectory: $MUSIC_FILEDIR\nPath: $MUSIC_FILEDIR/$MUSIC_FILENAME\nRepeat: $MUSIC_REPEAT\nShuffle: $MUSIC_SHUFFLE")"
|
||||
else
|
||||
FULL_MUSIC="$(printf "${ICON}${ICONSPACING}Artist: $MUSIC_ARTIST\nTitle: $MUSIC_SONG\nAlbum: $MUSIC_ALBUM\nTime elapsed: $MUSIC_TIMEELAPSED\nTotal time: $MUSIC_TIMETOTAL\nFile: $MUSIC_FILENAME\nDirectory: $MUSIC_FILEDIR\nPath: $MUSIC_FILEDIR/$MUSIC_FILENAME")"
|
||||
fi
|
||||
|
||||
notify-send "$FULL_MUSIC"
|
||||
|
||||
# some information
|
||||
echo "Notification sent successfully!"
|
||||
echo "INFO: $FULL_MUSIC"
|
||||
|
||||
exit 0
|
||||
return
|
||||
}
|
||||
|
||||
command -v notify-send > /dev/null && SEND_NOTIF
|
||||
echo "FATAL: libnotify not installed, can't send notification."
|
||||
|
||||
exit 1
|
||||
command -v notify-send > /dev/null && SEND_NOTIF || echo "FATAL: libnotify not installed, can't send notification."
|
||||
return
|
||||
}
|
||||
|
||||
# information itself
|
||||
PRINT() {
|
||||
# Auto set backend if set to auto
|
||||
if [ "$ITEM9_BACKEND" = "auto" ]; then
|
||||
if [ -e "${BINDIR}cmus" ]; then
|
||||
ITEM9_BACKEND="cmus"
|
||||
elif [ -e "${BINDIR}mocp" ]; then
|
||||
ITEM9_BACKEND="mocp"
|
||||
fi
|
||||
fi
|
||||
# define mocp data
|
||||
define_mocp_data() {
|
||||
# filename
|
||||
[ "$(mocp -Q %file | head -n 1)" != "" ] && [ "$ITEM9_DISPLAY_FILE" = "true" ] && echo "$MUSIC_FILENAME_CUT" && return
|
||||
|
||||
if [ "$ENABLE_ITEM9" = "true" ]; then
|
||||
if [ "$ITEM9_BACKEND" = "mocp" ]; then
|
||||
if [ -e "${BINDIR}mocp" ]; then
|
||||
if [ "$(echo $(mocp -Q %file))" != "" ]; then
|
||||
# put data together
|
||||
data="$(printf "$ITEM9_FORMAT" | sed "s|@ab|$MUSIC_ALBUM|; s|@t|$MUSIC_TITLE|; s|@g||; s|@a|$MUSIC_ARTIST|; s|@tt|$MUSIC_TIMETOTAL|; s|@te|$MUSIC_TIMEELAPSED|; s| ||g")" || return
|
||||
}
|
||||
|
||||
# filename
|
||||
if [ "$ITEM9_DISPLAY_FILE" = "true" ]; then
|
||||
if [ "$(mocp -Q %file | head -n 1)" != "" ]; then
|
||||
echo "$ITEM9_SEPARATOR $ITEM9_ICON $ITEM9_PRE_FILE$(basename "$(mocp -Q %file)" | sed 's|\(.*\)[.].*|\1|')$ITEM9_POST_FILE"
|
||||
fi
|
||||
else
|
||||
# define cmus data
|
||||
define_cmus_data() {
|
||||
# filename
|
||||
[ "$(cmus-remote -C status | head -n 1 | awk '{ print $2 }')" = "playing" ] && [ "$ITEM9_DISPLAY_FILE" = "true" ] && echo "$MUSIC_FILENAME_CUT" && return
|
||||
MUSIC_TITLE="$(cmus-remote -C status | grep "tag title" | sed "s|\&|stellar_amp|g; s/tag title //g")"
|
||||
|
||||
# artist
|
||||
if [ "$ITEM9_DISPLAY_ARTIST" = "true" ]; then
|
||||
if [ "$(mocp -Q %artist | head -n 1)" != "" ]; then
|
||||
MUSIC_ARTIST="$(mocp -Q %artist | sed "s|\&|stellar_amp|g")"
|
||||
fi
|
||||
fi
|
||||
# put data together
|
||||
data="$(printf "$ITEM9_FORMAT" | sed "s|@ab|$MUSIC_ALBUM|; s|@t|$MUSIC_TITLE|; s|@g|$MUSIC_GENRE|; s|@a|$MUSIC_ARTIST|; s|@tt|$MUSIC_TIMETOTAL|; s|@te|$MUSIC_TIMEELAPSED|; s| ||g; s|() ||g")"
|
||||
}
|
||||
|
||||
# title
|
||||
if [ "$ITEM9_DISPLAY_TITLE" = "true" ]; then
|
||||
if [ "$(mocp -Q %song | head -n 1)" != "" ]; then
|
||||
MUSIC_SONG="$(mocp -Q %song | sed "s|\&|stellar_amp|g")"
|
||||
fi
|
||||
fi
|
||||
[ "$ITEM9_BACKEND" = "cmus" ] && define_cmus_data || define_mocp_data
|
||||
|
||||
# album
|
||||
if [ "$ITEM9_DISPLAY_ALBUM" = "true" ]; then
|
||||
if [ "$(mocp -Q %album | head -n 1)" != "" ]; then
|
||||
MUSIC_ALBUM="$(mocp -Q %album | sed "s|\&|stellar_amp|g")"
|
||||
echo "$MUSIC_ARTIST $MUSIC_SONG $MUSIC_ALBUM" | grep -q stellar_amp && EXTRASPACE=true
|
||||
fi
|
||||
fi
|
||||
|
||||
# time elapsed
|
||||
if [ "$ITEM9_DISPLAY_TIMEELAPSED" = "true" ]; then
|
||||
if [ "$(mocp -Q %tl | head -n 1)" != "" ]; then
|
||||
MUSIC_TIMEELAPSED="$(mocp -Q %ct)"
|
||||
fi
|
||||
fi
|
||||
|
||||
# total time
|
||||
if [ "$ITEM9_DISPLAY_TIMETOTAL" = "true" ]; then
|
||||
if [ "$(mocp -Q %tt | head -n 1)" != "" ]; then
|
||||
MUSIC_TIMETOTAL="$(mocp -Q %tt)"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$EXTRASPACE" = "true" ]; then
|
||||
data="$(printf "$ITEM9_FORMAT" | sed "s|@ab|$MUSIC_ALBUM|; s|@t|$MUSIC_SONG |; s|@g||; s|@a|$MUSIC_ARTIST|; s|@tt|$MUSIC_TIMETOTAL|; s|@te|$MUSIC_TIMEELAPSED|; s| ||g")"
|
||||
else
|
||||
data="$(printf "$ITEM9_FORMAT" | sed "s|@ab|$MUSIC_ALBUM|; s|@t|$MUSIC_SONG|; s|@g||; s|@a|$MUSIC_ARTIST|; s|@tt|$MUSIC_TIMETOTAL|; s|@te|$MUSIC_TIMEELAPSED|; s| ||g")"
|
||||
fi
|
||||
|
||||
# actually print it
|
||||
echo "$ITEM9_SEPARATOR $ITEM9_ICON $data"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$ENABLE_ITEM9" = "true" ]; then
|
||||
if [ -e "${BINDIR}cmus-remote" ]; then
|
||||
if [ "$(cmus-remote -C status | head -n 1 | awk '{ print $2 }')" = "playing" ]; then
|
||||
if [ "$ITEM9_DISPLAY_FILE" = "true" ]; then
|
||||
echo "$ITEM9_SEPARATOR $ITEM9_ICON $ITEM9_PRE_FILE$(basename "$(cmus-remote -C status | grep file)"| sed 's|\(.*\)[.].*|\1|')$ITEM9_POST_FILE"
|
||||
else
|
||||
|
||||
# artist
|
||||
if [ "$ITEM9_DISPLAY_ARTIST" = "true" ]; then
|
||||
if [ "$(cmus-remote -C status | grep "tag artist")" != "" ]; then
|
||||
MUSIC_ARTIST="$(cmus-remote -C status | grep "tag artist" | sed "s|\&|stellar_amp|g; s/tag artist //g")"
|
||||
fi
|
||||
fi
|
||||
|
||||
# title
|
||||
if [ "$ITEM9_DISPLAY_TITLE" = "true" ]; then
|
||||
if [ "$(cmus-remote -C status | grep "tag title")" != "" ]; then
|
||||
MUSIC_SONG="$(cmus-remote -C status | grep "tag title" | sed "s|\&|stellar_amp|g; s/tag title //g")"
|
||||
fi
|
||||
fi
|
||||
|
||||
# album
|
||||
if [ "$ITEM9_DISPLAY_ALBUM" = "true" ]; then
|
||||
if [ "$(cmus-remote -C status | grep "tag album")" != "" ]; then
|
||||
MUSIC_ALBUM="$(cmus-remote -C status | grep "tag album " | head -n 1 | sed "s|\&|stellar_amp|g; s/tag album //g")"
|
||||
fi
|
||||
fi
|
||||
|
||||
# genre
|
||||
if [ "$ITEM9_DISPLAY_GENRE" = "true" ]; then
|
||||
if [ "$(cmus-remote -C status | grep "tag genre")" != "" ]; then
|
||||
MUSIC_GENRE="$(cmus-remote -C status | grep "tag genre" | sed "s/tag genre //g")"
|
||||
echo "$MUSIC_ARTIST $MUSIC_SONG $MUSIC_ALBUM" | grep -q stellar_amp && EXTRASPACE=true
|
||||
fi
|
||||
fi
|
||||
|
||||
# time elapsed
|
||||
if [ "$ITEM9_DISPLAY_TIMEELAPSED" = "true" ]; then
|
||||
if [ "$(cmus-remote -Q | grep position | sed "s/position //g")" != "" ]; then
|
||||
MUSIC_TIMEELAPSED="$(cmus-remote -Q | grep position | sed "s/position //g" | awk '{printf "%02d:%02d:%02d",$0/3600,$0%3600/60,$0%60}' | sed "s/00://")"
|
||||
fi
|
||||
fi
|
||||
|
||||
# total time
|
||||
if [ "$ITEM9_DISPLAY_TIMETOTAL" = "true" ]; then
|
||||
if [ "$(cmus-remote -Q | grep duration | sed "s/duration //g")" != "" ]; then
|
||||
MUSIC_TIMETOTAL="$(cmus-remote -Q | grep duration | sed "s/duration //g" | awk '{printf "%02d:%02d:%02d",$0/3600,$0%3600/60,$0%60}' | sed "s/00://")"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$EXTRASPACE" = "true" ]; then
|
||||
data="$(printf "$ITEM9_FORMAT" | sed "s|@ab|$MUSIC_ALBUM |; s|@t|${MUSIC_SONG}|; s|@g|$MUSIC_GENRE|; s|@a|$MUSIC_ARTIST|; s|@tt|$MUSIC_TIMETOTAL|; s|@te|$MUSIC_TIMEELAPSED|; s| ||g; s|() ||g")"
|
||||
else
|
||||
data="$(printf "$ITEM9_FORMAT" | sed "s|@ab|$MUSIC_ALBUM|; s|@t|$MUSIC_SONG|; s|@g|$MUSIC_GENRE|; s|@a|$MUSIC_ARTIST|; s|@tt|$MUSIC_TIMETOTAL|; s|@te|$MUSIC_TIMEELAPSED|; s| ||g; s|() ||g")"
|
||||
fi
|
||||
|
||||
# actually print it
|
||||
if [ "$data" != "" ]; then
|
||||
echo "$ITEM9_SEPARATOR $ITEM9_ICON $data$ITEM9_APPEND"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
[ -z "$data" ] || echo "$ITEM9_SEPARATOR $ITEM9_ICON $data"
|
||||
}
|
||||
|
||||
# argument 1
|
||||
case "$ARG1" in
|
||||
case "$1" in
|
||||
"") CLICK ;;
|
||||
"--print-file") PRINT > /tmp/module_music ;;
|
||||
"--print") PRINT ;;
|
||||
|
|
|
@ -2,92 +2,71 @@
|
|||
# network module for status/stellar
|
||||
|
||||
# load config
|
||||
. $HOME/.config/speedwm/statusrc
|
||||
BINDIR="$(dirname $(command -v speedwm_status))/"
|
||||
module_config
|
||||
[ -e "$HOME/.config/speedwm/statusrc" ] && . $HOME/.config/speedwm/statusrc
|
||||
[ "$ENABLE_ITEM6" = "true" ] || exit
|
||||
|
||||
ARG1="$1"
|
||||
# get stats
|
||||
GETNSTAT() {
|
||||
R1="$(cat /sys/class/net/[ew]*/statistics/rx_bytes || exit)"
|
||||
T1="$(cat /sys/class/net/[ew]*/statistics/tx_bytes || exit)"
|
||||
sleep 0.1
|
||||
R2="$(cat /sys/class/net/[ew]*/statistics/rx_bytes || exit)"
|
||||
T2="$(cat /sys/class/net/[ew]*/statistics/tx_bytes || exit)"
|
||||
TXPMS="$(expr $T2 - $T1)"
|
||||
RXPMS="$(expr $R2 - $R1)"
|
||||
TX="$(expr $TXPMS / 1024 "*" 10)"
|
||||
RX="$(expr $RXPMS / 1024 "*" 10)"
|
||||
printf "$TX\n" > /tmp/module_net_tx
|
||||
printf "$RX\n" > /tmp/module_net_rx
|
||||
}
|
||||
|
||||
# write
|
||||
if [ ! -e "/tmp/module_net_tx" ]; then
|
||||
R1="$(cat /sys/class/net/[ew]*/statistics/rx_bytes)"
|
||||
T1="$(cat /sys/class/net/[ew]*/statistics/tx_bytes)"
|
||||
sleep 0.1
|
||||
R2="$(cat /sys/class/net/[ew]*/statistics/rx_bytes)"
|
||||
T2="$(cat /sys/class/net/[ew]*/statistics/tx_bytes)"
|
||||
TXPMS="$(expr $T2 - $T1)"
|
||||
RXPMS="$(expr $R2 - $R1)"
|
||||
TX="$(expr $TXPMS / 1024 "*" 10)"
|
||||
RX="$(expr $RXPMS / 1024 "*" 10)"
|
||||
printf "$TX" > /tmp/module_net_tx
|
||||
printf "$RX" > /tmp/module_net_rx
|
||||
fi
|
||||
[ ! -e "/tmp/module_net_tx" ] && GETNSTAT
|
||||
|
||||
NETWORK_TRANSMITTED="$(cat /tmp/module_net_tx)"
|
||||
NETWORK_RECEIVED="$(cat /tmp/module_net_rx)"
|
||||
|
||||
# click
|
||||
CLICK() {
|
||||
# values
|
||||
NETWORK_TRANSMITTED="$(cat /tmp/module_net_tx) kb/s"
|
||||
NETWORK_RECEIVED="$(cat /tmp/module_net_rx) kb/s"
|
||||
ICON="$ITEM6_ICON"
|
||||
BUTTON="$(cat /tmp/speedwm-button)"
|
||||
|
||||
case "$TERMINAL" in
|
||||
"") TERMINAL=st
|
||||
esac
|
||||
[ -e "/tmp/speedwm-button" ] && BUTTON="$(cat /tmp/speedwm-button)" || BUTTON="0"
|
||||
[ -z "$TERMINAL" ] && TERMINAL=st
|
||||
[ ! -z "$ICON" ] && ICONSPACING=" " # one character spacing
|
||||
|
||||
# check value of button
|
||||
case "$BUTTON" in
|
||||
"3") $TERMINAL -e bmon ; exit ;;
|
||||
"3") $TERMINAL -e bmon ; return ;;
|
||||
esac
|
||||
|
||||
# no spacing if there's no icon
|
||||
if [ "$ICON" != "" ]; then
|
||||
ICONSPACING=" " # one character spacing
|
||||
fi
|
||||
|
||||
# send the notification
|
||||
SEND_NOTIF() {
|
||||
FULL_NETWORK="${ICON}${ICONSPACING}${NETWORK_TRANSMITTED} transmitted, ${NETWORK_RECEIVED} received."
|
||||
notify-send "$FULL_NETWORK"
|
||||
|
||||
# some information
|
||||
echo "Notification sent successfully!"
|
||||
echo "INFO: $FULL_NETWORK"
|
||||
|
||||
exit 0
|
||||
return
|
||||
}
|
||||
|
||||
command -v notify-send > /dev/null && SEND_NOTIF
|
||||
echo "FATAL: libnotify not installed, can't send notification."
|
||||
|
||||
exit 1
|
||||
command -v notify-send > /dev/null && SEND_NOTIF || echo "FATAL: libnotify not installed, can't send notification."
|
||||
return
|
||||
}
|
||||
|
||||
# information itself
|
||||
PRINT() {
|
||||
if [ "$ENABLE_ITEM6" = "true" ]; then
|
||||
if [ -e "${BINDIR}awk" ]; then
|
||||
NETWORK_TRANSMITTED="$(cat /tmp/module_net_tx)"
|
||||
NETWORK_RECEIVED="$(cat /tmp/module_net_rx)"
|
||||
|
||||
echo "$ITEM6_SEPARATOR $ITEM6_ICON $ITEM6_FORMAT$ITEM6_APPEND" | sed "s|@t|$NETWORK_TRANSMITTED|g; s|@r|$NETWORK_RECEIVED|g"
|
||||
fi
|
||||
fi
|
||||
echo "$ITEM6_SEPARATOR $ITEM6_ICON $ITEM6_FORMAT" | sed "s|@t|$NETWORK_TRANSMITTED|g; s|@r|$NETWORK_RECEIVED|g"
|
||||
}
|
||||
|
||||
# argument 1
|
||||
case "$ARG1" in
|
||||
case "$1" in
|
||||
"") CLICK ;;
|
||||
"--print-file") PRINT > /tmp/module_net ;;
|
||||
"--print") PRINT ;;
|
||||
"--click") CLICK ;;
|
||||
esac
|
||||
|
||||
R1="$(cat /sys/class/net/[ew]*/statistics/rx_bytes)"
|
||||
T1="$(cat /sys/class/net/[ew]*/statistics/tx_bytes)"
|
||||
sleep 0.1
|
||||
R2="$(cat /sys/class/net/[ew]*/statistics/rx_bytes)"
|
||||
T2="$(cat /sys/class/net/[ew]*/statistics/tx_bytes)"
|
||||
TXPMS="$(expr $T2 - $T1)"
|
||||
RXPMS="$(expr $R2 - $R1)"
|
||||
TX="$(expr $TXPMS / 1024 "*" 10)"
|
||||
RX="$(expr $RXPMS / 1024 "*" 10)"
|
||||
printf "$TX" > /tmp/module_net_tx
|
||||
printf "$RX" > /tmp/module_net_rx
|
||||
# gather some stats before exiting
|
||||
GETNSTAT
|
||||
|
|
|
@ -2,69 +2,51 @@
|
|||
# news module for status/stellar
|
||||
|
||||
# load config
|
||||
. $HOME/.config/speedwm/statusrc
|
||||
BINDIR="$(dirname $(command -v speedwm_status))/"
|
||||
|
||||
# argument 1
|
||||
ARG1="$1"
|
||||
module_config
|
||||
[ -e "$HOME/.config/speedwm/statusrc" ] && . $HOME/.config/speedwm/statusrc
|
||||
[ "$ENABLE_ITEM10" = "true" ] || exit
|
||||
command -v newsboat > /dev/null || exit
|
||||
|
||||
NEWS_COUNT="$(newsboat -x print-unread | awk '{ print $1 }' || return)"
|
||||
|
||||
# clicking
|
||||
CLICK() {
|
||||
# values
|
||||
ICON="$ITEM10_ICON"
|
||||
BUTTON="$(cat /tmp/speedwm-button)"
|
||||
NEWS_COUNT="$(newsboat -x print-unread | awk '{ print $1 }')"
|
||||
|
||||
if [ "$NEWS_COUNT" = "Error:" ]; then
|
||||
exit
|
||||
fi
|
||||
[ "$NEWS_COUNT" = "Error:" ] && return
|
||||
[ -e "/tmp/speedwm-button" ] && BUTTON="$(cat /tmp/speedwm-button)" || BUTTON="0"
|
||||
[ -z "$TERMINAL" ] && TERMINAL=st
|
||||
[ ! -z "$ICON" ] && ICONSPACING=" " # one character spacing
|
||||
|
||||
command -v newsboat > /dev/null || exit
|
||||
|
||||
case "$TERMINAL" in
|
||||
"") TERMINAL=st
|
||||
esac
|
||||
|
||||
# check value of button
|
||||
case "$BUTTON" in
|
||||
"3") $TERMINAL newsboat ; exit ;;
|
||||
"3") $TERMINAL newsboat ; return ;;
|
||||
esac
|
||||
|
||||
# no spacing if there's no icon
|
||||
if [ "$ICON" != "" ]; then
|
||||
ICONSPACING=" " # one character spacing
|
||||
fi
|
||||
|
||||
# send the notification
|
||||
SEND_NOTIF() {
|
||||
notify-send "${ICON}${ICONSPACING}$NEWS_COUNT $ITEM10_TEXT"
|
||||
|
||||
# some information
|
||||
echo "Notification sent successfully!"
|
||||
echo "INFO: ${ICON}${ICONSPACING}$NEWS_COUNT $ITEM10_TEXT"
|
||||
|
||||
exit 0
|
||||
return
|
||||
}
|
||||
|
||||
command -v notify-send > /dev/null && SEND_NOTIF
|
||||
echo "FATAL: libnotify not installed, can't send notification."
|
||||
command -v notify-send > /dev/null && SEND_NOTIF || echo "FATAL: libnotify not installed, can't send notification."
|
||||
|
||||
exit 1
|
||||
return
|
||||
}
|
||||
|
||||
# information itself
|
||||
PRINT() {
|
||||
if [ "$ENABLE_ITEM10" = "true" ]; then
|
||||
if [ -e "${BINDIR}newsboat" ]; then
|
||||
newscount="$(newsboat -x print-unread | awk '{ print $1 }')"
|
||||
|
||||
if [ "$newscount" != "Error:" ]; then
|
||||
echo "$ITEM10_SEPARATOR $ITEM10_ICON $newscount $ITEM10_TEXT$ITEM10_APPEND"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
[ "$NEWS_COUNT" = "Error:" ] && return || echo "$ITEM10_SEPARATOR $ITEM10_ICON $NEWS_COUNT $ITEM10_TEXT"
|
||||
}
|
||||
|
||||
# argument 1
|
||||
case "$ARG1" in
|
||||
case "$1" in
|
||||
"") CLICK ;;
|
||||
"--print-file") PRINT > /tmp/module_news ;;
|
||||
"--print") PRINT ;;
|
||||
|
|
|
@ -2,72 +2,57 @@
|
|||
# ram module for status/stellar
|
||||
|
||||
# load config
|
||||
. $HOME/.config/speedwm/statusrc
|
||||
BINDIR="$(dirname $(command -v speedwm_status))/"
|
||||
module_config
|
||||
[ -e "$HOME/.config/speedwm/statusrc" ] && . $HOME/.config/speedwm/statusrc
|
||||
[ "$ENABLE_ITEM1" = "true" ] || exit
|
||||
command -v free > /dev/null || exit
|
||||
|
||||
ARG1="$1"
|
||||
# get status
|
||||
GETSTAT() {
|
||||
RAM_USED="$(echo "$(free -h --giga | awk '/^Mem/ {print $3}')B")"
|
||||
RAM_TOTAL="$(echo "$(free -h --giga | awk '/^Mem/ {print $2}')B")"
|
||||
RAM_LEFT="$(echo "$(free -h --giga | awk '/^Mem/ {print $7}')B")"
|
||||
}
|
||||
|
||||
GETSTAT
|
||||
|
||||
CLICK() {
|
||||
# values
|
||||
RAM_USED="$(echo "$(free -h --giga | awk '/^Mem/ {print $3}')B")"
|
||||
RAM_TOTAL="$(echo "$(free -h --giga | awk '/^Mem/ {print $2}')B")"
|
||||
RAM_LEFT="$(echo "$(free -h --giga | awk '/^Mem/ {print $7}')B")"
|
||||
ICON="$ITEM1_ICON"
|
||||
BUTTON="$(cat /tmp/speedwm-button)"
|
||||
|
||||
case "$TERMINAL" in
|
||||
"") TERMINAL=st
|
||||
esac
|
||||
|
||||
case "$BUTTON" in
|
||||
"2") command -v notify-send > /dev/null && notify-send "$(ps axch -o cmd:12,%mem --sort=%mem | tail -n 10)" ; exit ;;
|
||||
"3") $TERMINAL -e htop ;;
|
||||
esac
|
||||
|
||||
# no spacing if there's no icon
|
||||
if [ "$ICON" != "" ]; then
|
||||
ICONSPACING=" " # one character spacing
|
||||
fi
|
||||
|
||||
# send the notification
|
||||
SEND_NOTIF() {
|
||||
FULL_RAM="$(printf "${ICON}${ICONSPACING}Used: $RAM_USED\nFree: $RAM_LEFT\nTotal: $RAM_TOTAL\n")"
|
||||
notify-send "$FULL_RAM"
|
||||
|
||||
echo "Notification sent successfully!"
|
||||
echo "INFO: $FULL_RAM"
|
||||
|
||||
exit 0
|
||||
}
|
||||
|
||||
command -v notify-send > /dev/null && SEND_NOTIF
|
||||
echo "FATAL: libnotify not installed, can't send notification."
|
||||
|
||||
exit 1
|
||||
# values
|
||||
ICON="$ITEM1_ICON"
|
||||
[ -e "/tmp/speedwm-button" ] && BUTTON="$(cat /tmp/speedwm-button)"
|
||||
[ -z "$TERMINAL" ] && TERMINAL=st
|
||||
[ ! -z "$ICON" ] && ICONSPACING=" " # one character spacing
|
||||
|
||||
# check value of button
|
||||
case "$BUTTON" in
|
||||
"2") command -v notify-send > /dev/null && notify-send "$(ps axch -o cmd:12,%mem --sort=%mem | tail -n 10)" ; exit ;;
|
||||
"3") $TERMINAL -e htop ; exit ;;
|
||||
esac
|
||||
|
||||
# send the notification
|
||||
SEND_NOTIF() {
|
||||
FULL_RAM="$(printf "${ICON}${ICONSPACING}Used: $RAM_USED\nFree: $RAM_LEFT\nTotal: $RAM_TOTAL\n")"
|
||||
notify-send "$FULL_RAM"
|
||||
|
||||
# some information
|
||||
echo "Notification sent successfully!"
|
||||
echo "INFO: $FULL_RAM"
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
command -v notify-send > /dev/null && SEND_NOTIF || echo "FATAL: libnotify not installed, can't send notification."
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
# information itself
|
||||
PRINT() {
|
||||
if [ "$ENABLE_ITEM1" = "true" ]; then
|
||||
# Used RAM
|
||||
if [ -e "${BINDIR}free" ]; then
|
||||
USEDRAM="$(echo "$(free -h --giga | awk '/^Mem/ {print $3}')B")"
|
||||
fi
|
||||
|
||||
# Total RAM
|
||||
if [ -e "${BINDIR}free" ]; then
|
||||
TOTALRAM="$(echo "$(free -h --giga | awk '/^Mem/ {print $2}')B")"
|
||||
fi
|
||||
|
||||
if [ -e "${BINDIR}free" ]; then
|
||||
echo "$ITEM1_SEPARATOR $ITEM1_ICON $ITEM1_FORMAT$ITEM1_APPEND" | sed "s|@u|$USEDRAM|; s|@t|$TOTALRAM|"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "$ITEM1_SEPARATOR $ITEM1_ICON $ITEM1_FORMAT" | sed "s|@u|$RAM_USED|; s|@t|$RAM_TOTAL|; s|@l|$RAM_LEFT|"
|
||||
}
|
||||
|
||||
# argument 1
|
||||
case "$ARG1" in
|
||||
case "$1" in
|
||||
"") CLICK ;;
|
||||
"--print-file") PRINT > /tmp/module_ram ;;
|
||||
"--print") PRINT ;;
|
||||
|
|
|
@ -2,77 +2,50 @@
|
|||
# cpu temp module for status/stellar
|
||||
|
||||
# load config
|
||||
. $HOME/.config/speedwm/statusrc
|
||||
BINDIR="$(dirname $(command -v speedwm_status))/"
|
||||
|
||||
ARG1="$1"
|
||||
module_config
|
||||
[ -e "$HOME/.config/speedwm/statusrc" ] && . $HOME/.config/speedwm/statusrc
|
||||
[ "$ENABLE_ITEM8" != "true" ] && exit
|
||||
command -v sensors > /dev/null || exit
|
||||
|
||||
# click
|
||||
CLICK() {
|
||||
# values
|
||||
ICON="$ITEM8_ICON"
|
||||
BUTTON="$(cat /tmp/speedwm-button)"
|
||||
|
||||
if [ "$ITEM8_FORMAT_CELSIUS" != "true" ]; then
|
||||
FARG="-F"
|
||||
fi
|
||||
|
||||
if [ ! -e "/tmp/iscelsius" ]; then
|
||||
if [ "$FARG" = "" ]; then
|
||||
FARG="-F"
|
||||
fi
|
||||
fi
|
||||
|
||||
TEMP_FULL="$(sensors $FARG)"
|
||||
command -v sensors > /dev/null || exit 1
|
||||
|
||||
case "$TERMINAL" in
|
||||
"") TERMINAL=st
|
||||
esac
|
||||
|
||||
# no spacing if there's no icon
|
||||
if [ "$ICON" != "" ]; then
|
||||
ICONSPACING=" " # one character spacing
|
||||
fi
|
||||
|
||||
# send the notification
|
||||
SEND_NOTIF() {
|
||||
FULL_TEMP="${ICON}${ICONSPACING}$TEMP_FULL"
|
||||
notify-send "$FULL_TEMP"
|
||||
|
||||
echo "Notification sent successfully!"
|
||||
echo "INFO: $FULL_TEMP"
|
||||
|
||||
exit 0
|
||||
}
|
||||
|
||||
command -v notify-send > /dev/null && SEND_NOTIF
|
||||
echo "FATAL: libnotify not installed, can't send notification."
|
||||
|
||||
exit 1
|
||||
# values
|
||||
ICON="$ITEM8_ICON"
|
||||
[ -e "/tmp/speedwm-button" ] && BUTTON="$(cat /tmp/speedwm-button)" || BUTTON="0"
|
||||
|
||||
[ "$ITEM8_FORMAT_CELSIUS" = "true" ] || FARG="-F"
|
||||
[ -z "$TERMINAL" ] && TERMINAL=st
|
||||
[ ! -z "$ICON" ] && ICONSPACING=" " # one character spacing
|
||||
|
||||
TEMP_FULL="$(sensors $FARG)"
|
||||
|
||||
# send the notification
|
||||
SEND_NOTIF() {
|
||||
FULL_TEMP="${ICON}${ICONSPACING}$TEMP_FULL"
|
||||
notify-send "$FULL_TEMP"
|
||||
|
||||
# some information
|
||||
echo "Notification sent successfully!"
|
||||
echo "INFO: $FULL_TEMP"
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
command -v notify-send > /dev/null && SEND_NOTIF || echo "FATAL: libnotify not installed, can't send notification."
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
# information itself
|
||||
PRINT() {
|
||||
if [ "$ENABLE_ITEM8" = "true" ]; then
|
||||
if [ -e "${BINDIR}sensors" ]; then
|
||||
if [ "$ITEM8_FORMAT_CELSIUS" = "true" ]; then
|
||||
sensors | grep temp1 | awk '{ print $2 }' | grep -q "C" && echo "$ITEM8_SEPARATOR $ITEM8_ICON $(sensors | grep temp1 | awk '{ print $2 }')"
|
||||
touch /tmp/iscelsius
|
||||
else
|
||||
sensors | grep temp1 | awk '{ print $2 }' | grep -q "F" && echo "$ITEM8_SEPARATOR $ITEM8_ICON $(sensors -f | grep temp1 | awk '{ print $2 }')"
|
||||
fi
|
||||
[ -z "$ITEM8_APPEND" ] || printf "$ITEM8_APPEND\n"
|
||||
fi
|
||||
fi
|
||||
[ "$ITEM8_FORMAT_CELSIUS" = "true" ] && TEMP="$(sensors | grep temp1 | awk '{ print $2 }')" || TEMP="$(sensors -f | grep temp1 | awk '{ print $2 }')"
|
||||
[ -z "$TEMP" ] || echo "$ITEM8_SEPARATOR $ITEM8_ICON $TEMP"
|
||||
}
|
||||
|
||||
# argument 1
|
||||
case "$ARG1" in
|
||||
case "$1" in
|
||||
"") CLICK ;;
|
||||
"--print-file") PRINT > /tmp/module_temp ;;
|
||||
"--print") PRINT ;;
|
||||
"--click") CLICK ;;
|
||||
esac
|
||||
|
||||
[ -e "/tmp/module_temp" ] && [ "$(cat /tmp/module_temp | wc -c)" -lt "6" ] && rm -f /tmp/module_temp
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
# time module for status/stellar
|
||||
|
||||
# load config
|
||||
. $HOME/.config/speedwm/statusrc
|
||||
BINDIR="$(dirname $(command -v speedwm_status))/"
|
||||
|
||||
ARG1="$1"
|
||||
module_config
|
||||
[ -e "$HOME/.config/speedwm/statusrc" ] && . $HOME/.config/speedwm/statusrc
|
||||
[ "$ENABLE_ITEM2" = "true" ] || exit
|
||||
command -v date > /dev/null || exit
|
||||
|
||||
# click
|
||||
CLICK() {
|
||||
|
@ -16,48 +16,37 @@ CLICK() {
|
|||
TIME_FULL="$(date +%T)"
|
||||
TIME_ZONE="$(date +%Z)"
|
||||
ICON="$ITEM2_ICON"
|
||||
BUTTON="$(cat /tmp/speedwm-button)"
|
||||
|
||||
case "$TERMINAL" in
|
||||
"") TERMINAL=st
|
||||
esac
|
||||
|
||||
# no spacing if there's no icon
|
||||
if [ "$ICON" != "" ]; then
|
||||
ICONSPACING=" " # one character spacing
|
||||
fi
|
||||
[ -e "/tmp/speedwm-button" ] && BUTTON="$(cat /tmp/speedwm-button)" || BUTTON="0"
|
||||
[ -z "$TERMINAL" ] && TERMINAL=st
|
||||
[ ! -z "$ICONSPACING" ] && ICONSPACING=" " # one character spacing
|
||||
|
||||
# send the notification
|
||||
SEND_NOTIF() {
|
||||
FULL_TIME="${ICON}${ICONSPACING}The time is $TIME_FULL $TIME_ZONE."
|
||||
notify-send "$FULL_TIME"
|
||||
|
||||
# some information
|
||||
echo "Notification sent successfully!"
|
||||
echo "INFO: $FULL_TIME"
|
||||
|
||||
exit 0
|
||||
return
|
||||
}
|
||||
|
||||
command -v notify-send > /dev/null && SEND_NOTIF
|
||||
echo "FATAL: libnotify not installed, can't send notification."
|
||||
command -v notify-send > /dev/null && SEND_NOTIF || echo "FATAL: libnotify not installed, can't send notification."
|
||||
|
||||
exit 1
|
||||
return
|
||||
}
|
||||
|
||||
# information itself
|
||||
PRINT() {
|
||||
if [ "$ENABLE_ITEM2" = "true" ]; then
|
||||
if [ -e "${DATEBINDIR}date" ]; then
|
||||
HOURS="$(date +%H)"
|
||||
MINUTES="$(date +%M)"
|
||||
SECONDS="$(date +%S)"
|
||||
echo "$ITEM2_SEPARATOR $ITEM2_ICON $ITEM2_FORMAT$ITEM2_APPEND" | sed "s|@h|$HOURS|; s|@m|$MINUTES|; s|@s|$SECONDS|"
|
||||
fi
|
||||
fi
|
||||
HOURS="$(date +%H)"
|
||||
MINUTES="$(date +%M)"
|
||||
SECONDS="$(date +%S)"
|
||||
echo "$ITEM2_SEPARATOR $ITEM2_ICON $ITEM2_FORMAT" | sed "s|@h|$HOURS|; s|@m|$MINUTES|; s|@s|$SECONDS|"
|
||||
}
|
||||
|
||||
# argument 1
|
||||
case "$ARG1" in
|
||||
case "$1" in
|
||||
"") CLICK ;;
|
||||
"--print-file") PRINT > /tmp/module_time ;;
|
||||
"--print") PRINT ;;
|
||||
|
|
|
@ -1,72 +1,58 @@
|
|||
#!/bin/sh
|
||||
# volume module for status/stellar
|
||||
#
|
||||
# load config
|
||||
. $HOME/.config/speedwm/statusrc
|
||||
BINDIR="$(dirname $(command -v speedwm_status))/"
|
||||
ARG1="$1"
|
||||
|
||||
# load config
|
||||
module_config
|
||||
[ -e "$HOME/.config/speedwm/statusrc" ] && . $HOME/.config/speedwm/statusrc
|
||||
[ "$ENABLE_ITEM4" != "true" ] && exit
|
||||
|
||||
command -v pactl > /dev/null && BACKEND=pactl || BACKEND=amixer
|
||||
command -v awk > /dev/null || exit
|
||||
|
||||
# click
|
||||
CLICK() {
|
||||
command -v speedwm-audioctrl > /dev/null || return
|
||||
|
||||
# values
|
||||
VOL_VOLUME="$(speedwm-audioctrl -getvol)"
|
||||
VOL_ISPULSE="$(speedwm-audioctrl -getbackend)"
|
||||
|
||||
ICON="$ITEM4_ICON"
|
||||
BUTTON="$(cat /tmp/speedwm-button)"
|
||||
|
||||
case "$TERMINAL" in
|
||||
"") TERMINAL=st
|
||||
esac
|
||||
|
||||
[ -e "/tmp/speedwm-button" ] && BUTTON="$(cat /tmp/speedwm-button)" || BUTTON="0"
|
||||
[ -z "$TERMINAL" ] && TERMINAL=st
|
||||
[ ! -z "$ICON" ] && ICONSPACING=" " # one character spacing
|
||||
|
||||
# check value of button
|
||||
case "$BUTTON" in
|
||||
"3") $TERMINAL speedwm-audioctrl -runmixer ; exit ;;
|
||||
esac
|
||||
|
||||
# no spacing if there's no icon
|
||||
if [ "$ICON" != "" ]; then
|
||||
ICONSPACING=" " # one character spacing
|
||||
fi
|
||||
|
||||
# send the notification
|
||||
SEND_NOTIF() {
|
||||
FULL_VOL="${ICON}${ICONSPACING}$VOL_VOLUME"
|
||||
notify-send "$FULL_VOL"
|
||||
|
||||
# some information
|
||||
echo "Notification sent successfully!"
|
||||
echo "INFO: $FULL_VOL"
|
||||
|
||||
exit 0
|
||||
return
|
||||
}
|
||||
|
||||
command -v notify-send > /dev/null && SEND_NOTIF
|
||||
echo "FATAL: libnotify not installed, can't send notification."
|
||||
command -v notify-send > /dev/null && SEND_NOTIF || echo "FATAL: libnotify not installed, can't send notification."
|
||||
|
||||
exit 1
|
||||
return
|
||||
}
|
||||
|
||||
# information itself
|
||||
PRINT() {
|
||||
if [ "$ENABLE_ITEM4" = "true" ]; then
|
||||
if [ -e "${BINDIR}pactl" ]; then
|
||||
echo "$ITEM4_SEPARATOR $ITEM4_ICON $(echo $(pactl get-sink-volume @DEFAULT_SINK@ | awk '{print $5;exit}'))"
|
||||
elif [ -e "${BINDIR}amixer" ]; then
|
||||
echo "$ITEM4_SEPARATOR $ITEM4_ICON $(echo $(amixer -c 0 get Master | tail -n1 | sed -r "s/.*\[(.*)%\].*/\1/")%)"
|
||||
fi
|
||||
|
||||
[ -z "$ITEM4_APPEND" ] || echo "$ITEM4_APPEND"
|
||||
fi
|
||||
|
||||
# get mute
|
||||
if [ "$ITEM4_SHOW_MUTE" = "true" ]; then
|
||||
if [ -e "${BINDIR}pactl" ]; then
|
||||
pactl get-sink-mute @DEFAULT_SINK@ | grep -q yes && echo " $ITEM4_MUTE_TEXT"
|
||||
fi
|
||||
fi
|
||||
[ "$BACKEND" = "pactl" ] && echo "$(echo $ITEM4_SEPARATOR $ITEM4_ICON $(pactl get-sink-volume @DEFAULT_SINK@ | awk '{print $5;exit}'))" || echo "$ITEM4_SEPARATOR $ITEM4_ICON $(amixer -c 0 get Master | tail -n1 | sed -r "s/.*\[(.*)%\].*/\1/")%)"
|
||||
[ "$ITEM4_SHOW_MUTE" = "true" ] && [ "$BACKEND" = "pactl" ] && pactl get-sink-mute @DEFAULT_SINK@ | grep -q yes && echo " $ITEM4_MUTE_TEXT"
|
||||
}
|
||||
|
||||
# argument 1
|
||||
case "$ARG1" in
|
||||
case "$1" in
|
||||
"") CLICK ;;
|
||||
"--print-file") PRINT > /tmp/module_vol ;;
|
||||
"--print") PRINT ;;
|
||||
|
|
|
@ -2,11 +2,13 @@
|
|||
# weather module for status/stellar
|
||||
|
||||
# load config
|
||||
. $HOME/.config/speedwm/statusrc
|
||||
BINDIR="$(dirname $(command -v speedwm_status))/"
|
||||
module_config
|
||||
[ -e "$HOME/.config/speedwm/statusrc" ] && . $HOME/.config/speedwm/statusrc
|
||||
[ "$ENABLE_ITEM5" = "true" ] || exit
|
||||
command -v curl > /dev/null || exit
|
||||
|
||||
# argument 1
|
||||
ARG1="$1"
|
||||
WEATHER_FULL="$(echo "$(curl -s wttr.in/?format="%C" || exit), $(curl -s wttr.in/?format=3 | sed 's/.* //; s/.*\(.....\)/\1/')")"
|
||||
echo "$WEATHER_FULL" | grep -qE "Unknown location|<html>" && exit
|
||||
|
||||
# clicking
|
||||
CLICK() {
|
||||
|
@ -14,78 +16,39 @@ CLICK() {
|
|||
WEATHER_TERM="speedwm-core -curl-weather"
|
||||
ICON="$ITEM5_ICON"
|
||||
BUTTON="$(cat /tmp/speedwm-button)"
|
||||
|
||||
[ -z "$TERMINAL" ] && TERMINAL=st
|
||||
[ ! -z "$ICON" ] && ICONSPACING=" " # one character spacing
|
||||
|
||||
case "$TERMINAL" in
|
||||
"") TERMINAL=st
|
||||
esac
|
||||
|
||||
# check value of button
|
||||
case "$BUTTON" in
|
||||
"3") $TERMINAL speedwm-core -curl-weather ; exit ;;
|
||||
"3") $TERMINAL "clear ; curl -s wttr.in | head -n 38 | tail -n 37 ; read a ; return " ;;
|
||||
esac
|
||||
|
||||
# check if a forecast exists
|
||||
# status script should create this
|
||||
if [ -e "/tmp/wstatus" ]; then
|
||||
FORECAST="$(cat /tmp/wstatus)"
|
||||
else
|
||||
echo "FATAL: No weather status available!"
|
||||
exit
|
||||
fi
|
||||
|
||||
grep -q "Unknown location" /tmp/wstatus && exit
|
||||
|
||||
# no spacing if there's no icon
|
||||
if [ "$ICON" != "" ]; then
|
||||
ICONSPACING=" " # one character spacing
|
||||
fi
|
||||
|
||||
# send the notification
|
||||
SEND_NOTIF() {
|
||||
FULL_WEATHER="${ICON}${ICONSPACING}$FORECAST"
|
||||
FULL_WEATHER="${ICON}${ICONSPACING}$WEATHER_FULL"
|
||||
notify-send "$FULL_WEATHER"
|
||||
|
||||
# some information
|
||||
echo "Notification sent successfully!"
|
||||
echo "INFO: $FULL_WEATHER"
|
||||
|
||||
exit 0
|
||||
return
|
||||
}
|
||||
|
||||
command -v notify-send > /dev/null && SEND_NOTIF
|
||||
echo "FATAL: libnotify not installed, can't send notification."
|
||||
command -v notify-send > /dev/null && SEND_NOTIF || echo "FATAL: libnotify not installed, can't send notification."
|
||||
|
||||
exit 1
|
||||
return
|
||||
}
|
||||
|
||||
# information itself
|
||||
PRINT() {
|
||||
if [ "$ENABLE_ITEM5" = "true" ]; then
|
||||
if [ -e "${BINDIR}curl" ]; then
|
||||
if [ -e "/tmp/itest" ]; then
|
||||
if [ -e "/tmp/wstatus" ]; then
|
||||
grep -q "Unknown location" /tmp/wstatus && exit
|
||||
grep -q "<html>" /tmp/wstatus && exit
|
||||
echo "$ITEM5_SEPARATOR $ITEM5_ICON $(cat /tmp/wstatus)"
|
||||
else
|
||||
echo "$(curl -s wttr.in/?format="%C"), $(curl -s wttr.in/?format=3 | sed 's/.* //; s/.*\(.....\)/\1/')" > /tmp/wstatus
|
||||
echo "$ITEM5_SEPARATOR $ITEM5_ICON $(cat /tmp/wstatus)"
|
||||
fi
|
||||
|
||||
[ -z "$ITEM5_APPEND" ] || echo "$ITEM5_APPEND"
|
||||
else
|
||||
curl -so /tmp/itest wttr.in && hasinternet=true
|
||||
|
||||
if [ "$hasinternet" != "true" ]; then
|
||||
rm -f /tmp/itest
|
||||
rm -f /tmp/wstatus
|
||||
itemcmd5=""
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
echo "$ITEM5_SEPARATOR $ITEM5_ICON $WEATHER_FULL"
|
||||
}
|
||||
|
||||
# argument 1
|
||||
case "$ARG1" in
|
||||
case "$1" in
|
||||
"") CLICK ;;
|
||||
"--print-file") PRINT > /tmp/module_weather ;;
|
||||
"--print") PRINT ;;
|
||||
|
|
|
@ -137,7 +137,7 @@ static int autoresize = 1; /* Allow resizing clients aut
|
|||
static char font[] = "Noto Sans Regular 8";
|
||||
|
||||
/* Status options */
|
||||
static char status[] = "speedwm_status &"; /* Status bar to run on startup. Set this to nothing to run nothing and run your own status bar. */
|
||||
static char status[] = "status &"; /* Status bar to run on startup. Set this to nothing to run nothing and run your own status bar. */
|
||||
static char defaultstatus[] = ""; /* What to print when a status bar is not running */
|
||||
|
||||
/* Alternate bar
|
||||
|
|
|
@ -1,572 +0,0 @@
|
|||
#!/bin/sh
|
||||
# stellar - Status bar for speedwm
|
||||
#
|
||||
# Written by speedie.gq in POSIX sh for https://speedie.gq/speedwm
|
||||
# Licensed under the GNU GPLv3 free software license.
|
||||
#
|
||||
# NOTE: Anything in the DISPLAY function will be printed to your status bar.
|
||||
# This means stdout will be printed regardless.
|
||||
# You can output to /dev/null to silence most commands.
|
||||
#
|
||||
# Once you're done editing, run 'make clean install'.
|
||||
#
|
||||
# CONFIG
|
||||
# This is the configuration for the status bar
|
||||
#
|
||||
# I highly recommend editing ~/.config/speedwm/status/config instead though
|
||||
# All settings can be changed there. Otherwise, carefully edit the file and recompile speedwm!
|
||||
|
||||
cat <<CONFIG > ~/.config/speedwm/statusrc.t
|
||||
# stellar configuration
|
||||
#
|
||||
# This shell script which acts as a configuration file should be configured in /bin/sh compatible syntax. For best compatibility, I suggest that you only use POSIX compliant shell. No bash, no fish and no zsh. Of course if /bin/sh is Bash then you don't strictly NEED to keep it POSIX compliant.
|
||||
#
|
||||
# You can however use if statements, case, variables, shell commands, cat << EOF, etc.
|
||||
#
|
||||
# To apply these changes, run speedwm_status -r (restarts the status bar)
|
||||
|
||||
# General settings
|
||||
REFRESHDELAY=0.4 # How long delay in seconds between each reload (num)
|
||||
DATEBINDIR="/bin/" # Directory where your 'date' binary is. Default should be fine for most people
|
||||
SETMETHOD="speedwm -s" # Method used to set the status bar. speedwm -s will set the status so only change this if you use this status bar with dwm or awesome.
|
||||
SEPARATOR="❰" # Separator to use. Alternative separators: "❰", "<", "|"
|
||||
CLICKABLE=true # Enable clickability (Requires dwm with statuscmd or speedwm) (true/false)
|
||||
ITEM_ORDER="@2@3@11@4@1@6@8@5@9@7@10" # Item order. @1 means item 1, @6 means item 6 and so on. (text)
|
||||
AMP_IS_PANGO=true # Replace '&' with '&'. This is necessary if you use the Pango dwm patch or speedwm. (true/false)
|
||||
|
||||
# Color options
|
||||
BUILTINFG=true # Use built in colors for foreground (true/false)
|
||||
BUILTINBG=true # Use built in colors for background (true/false)
|
||||
COLORFG=true # Color foreground (true/false)
|
||||
COLORBG=false # Color background (true/false)
|
||||
|
||||
# HTML color values
|
||||
# These will be used if BUILTINFG/BUILTINBG is disabled.
|
||||
#
|
||||
# Foreground
|
||||
FCOLOR1="#131210" # Foreground color #1
|
||||
FCOLOR2="#bf616a" # Foreground color #2
|
||||
FCOLOR3="#A16F9D" # Foreground color #3
|
||||
FCOLOR4="#68ABAA" # Foreground color #4
|
||||
FCOLOR5="#A89F93" # Foreground color #5
|
||||
FCOLOR6="#D3A99B" # Foreground color #6
|
||||
FCOLOR7="#AFC9AC" # Foreground color #7
|
||||
FCOLOR8="#eae1cb" # Foreground color #8
|
||||
FCOLOR9="#a39d8e" # Foreground color #9
|
||||
FCOLOR10="#6D5E8E" # Foreground color #10
|
||||
FCOLOR11="#A16F9D" # Foreground color #11
|
||||
FCOLOR12="#D3A99B" # Foreground color #12
|
||||
FCOLOR13="#AFC9AC" # Foreground color #13
|
||||
FCOLOR14="#eae1cb" # Foreground color #14
|
||||
FCOLOR15="#6D5E8E" # Foreground color #15
|
||||
FCOLOR16="#ffffff" # Foreground color #16
|
||||
|
||||
# Background
|
||||
BCOLOR1="#eeeeee" # Background color #1
|
||||
BCOLOR2="\$BCOLOR1" # Background color #2
|
||||
BCOLOR3="\$BCOLOR1" # Background color #3
|
||||
BCOLOR4="\$BCOLOR1" # Background color #4
|
||||
BCOLOR5="\$BCOLOR1" # Background color #5
|
||||
BCOLOR6="\$BCOLOR1" # Background color #6
|
||||
BCOLOR7="\$BCOLOR1" # Background color #7
|
||||
BCOLOR8="\$BCOLOR1" # Background color #8
|
||||
BCOLOR9="\$BCOLOR1" # Background color #9
|
||||
BCOLOR10="\$BCOLOR1" # Background color #10
|
||||
BCOLOR11="\$BCOLOR1" # Background color #11
|
||||
BCOLOR12="\$BCOLOR1" # Background color #12
|
||||
BCOLOR13="\$BCOLOR1" # Background color #13
|
||||
BCOLOR14="\$BCOLOR1" # Background color #14
|
||||
BCOLOR15="\$BCOLOR1" # Background color #15
|
||||
BCOLOR16="\$BCOLOR1" # Background color #16
|
||||
|
||||
# Status bar modules
|
||||
# Set to true/false to enable/disable.
|
||||
# Keep in mind, if the dependencies are not installed, then they will not be used regardless of what the option is set to.
|
||||
ENABLE_ITEM1=true # Enable RAM usage (true/false)
|
||||
ENABLE_ITEM2=true # Enable Time (HH:MM) (true/false)
|
||||
ENABLE_ITEM3=true # Enable Date (DD/MM/YY) (true/false)
|
||||
ENABLE_ITEM4=true # Enable Volume/Mute status (<perc>%) (true/false)
|
||||
ENABLE_ITEM5=true # Enable Weather (true/false)
|
||||
ENABLE_ITEM6=true # Enable Network Traffic (<num> kb/s (true/false)
|
||||
ENABLE_ITEM7=true # Enable dfmpeg status (true/false)
|
||||
ENABLE_ITEM8=true # Enable CPU temp (true/false)
|
||||
ENABLE_ITEM9=true # Enable music status (true/false)
|
||||
ENABLE_ITEM10=false # Enable newsboat unread (true/false)
|
||||
ENABLE_ITEM11=true # Enable battery percentage and charging status (true/false)
|
||||
|
||||
# Status bar module icons
|
||||
# Make sure dwm supports this icon/glyph.
|
||||
ITEM1_ICON=" " # Icon for ITEM1
|
||||
ITEM2_ICON=" " # Icon for ITEM2
|
||||
ITEM3_ICON=" " # Icon for ITEM3
|
||||
ITEM4_ICON=" " # Icon for ITEM4
|
||||
ITEM5_ICON=" " # Icon for ITEM5
|
||||
ITEM6_ICON=" " # Icon for ITEM6
|
||||
ITEM7_ICON=" " # Icon for ITEM7
|
||||
ITEM8_ICON=" " # Icon for ITEM8
|
||||
ITEM9_ICON=" " # Icon for ITEM9
|
||||
ITEM10_ICON=" " # Icon for ITEM10
|
||||
ITEM11_ICON=" " # Icon for ITEM11
|
||||
|
||||
# Status bar module separators
|
||||
ITEM1_SEPARATOR="\$SEPARATOR" # Separator for ITEM1
|
||||
ITEM2_SEPARATOR="\$SEPARATOR" # Separator for ITEM2
|
||||
ITEM3_SEPARATOR="\$SEPARATOR" # Separator for ITEM3
|
||||
ITEM4_SEPARATOR="\$SEPARATOR" # Separator for ITEM4
|
||||
ITEM5_SEPARATOR="\$SEPARATOR" # Separator for ITEM5
|
||||
ITEM6_SEPARATOR="\$SEPARATOR" # Separator for ITEM6
|
||||
ITEM7_SEPARATOR="\$SEPARATOR" # Separator for ITEM7
|
||||
ITEM8_SEPARATOR="\$SEPARATOR" # Separator for ITEM8
|
||||
ITEM9_SEPARATOR="\$SEPARATOR" # Separator for ITEM9
|
||||
ITEM10_SEPARATOR="\$SEPARATOR" # Separator for ITEM10
|
||||
ITEM11_SEPARATOR="\$SEPARATOR" # Separator for ITEM11
|
||||
|
||||
# Status bar module append
|
||||
# You can append extra text here, such as pango markup, status2d text or simply the output of a command.
|
||||
# It will be added to the end of the item.
|
||||
ITEM1_APPEND="" # Append for ITEM1
|
||||
ITEM2_APPEND="" # Append for ITEM2
|
||||
ITEM3_APPEND="" # Append for ITEM3
|
||||
ITEM4_APPEND="" # Append for ITEM4
|
||||
ITEM5_APPEND="" # Append for ITEM5
|
||||
ITEM6_APPEND="" # Append for ITEM6
|
||||
ITEM7_APPEND="" # Append for ITEM7
|
||||
ITEM8_APPEND="" # Append for ITEM8
|
||||
ITEM9_APPEND="" # Append for ITEM9
|
||||
ITEM10_APPEND="" # Append for ITEM10
|
||||
ITEM11_APPEND="" # Append for ITEM11
|
||||
|
||||
# RAM format
|
||||
# Format to display the RAM status in
|
||||
#
|
||||
# @u - Used RAM
|
||||
# @t - Total RAM
|
||||
#
|
||||
# Example: @u/@t
|
||||
ITEM1_FORMAT="@u/@t"
|
||||
|
||||
# Time format
|
||||
# Format to display the time in
|
||||
#
|
||||
# @h - Hour
|
||||
# @m - Minute
|
||||
# @s - Second
|
||||
#
|
||||
# Example: @h:@m
|
||||
ITEM2_FORMAT="@h:@m"
|
||||
|
||||
# Date format
|
||||
# Format to display the date in
|
||||
#
|
||||
# @d - Day
|
||||
# @m - Month
|
||||
# @y - Year
|
||||
#
|
||||
# Example: @d/@m/@y
|
||||
ITEM3_FORMAT="@d/@m/@y"
|
||||
|
||||
ITEM4_SHOW_MUTE="true" # Show mute status (true/false)
|
||||
ITEM4_MUTE_TEXT="(Muted)" # Text to display when muted (text)
|
||||
|
||||
# Net format
|
||||
# Format to display the transmitted/received bytes in
|
||||
#
|
||||
# @t - Transmitted
|
||||
# @r - Received
|
||||
#
|
||||
# Example: @t kb/s
|
||||
ITEM6_FORMAT="@t kb/s"
|
||||
|
||||
ITEM7_RECORDING_TEXT="Recording" # Text to display when recording (text)
|
||||
|
||||
ITEM8_FORMAT_CELSIUS="true" # Format temperature in Celsius (true/false)
|
||||
|
||||
ITEM9_BACKEND="auto" # Backend for the music status (cmus/mocp/auto)
|
||||
ITEM9_DISPLAY_ARTIST="true" # Display artist or not (true/false)
|
||||
ITEM9_DISPLAY_TITLE="true" # Display title or not (true/false)
|
||||
ITEM9_DISPLAY_ALBUM="true" # Display album or not (true/false)
|
||||
ITEM9_DISPLAY_GENRE="true" # Display genre or not (true/false)
|
||||
ITEM9_DISPLAY_TIMEELAPSED="true" # Display time elapsed or not. If you use this, you will probably want the delay set pretty low. (true/false)
|
||||
ITEM9_DISPLAY_TIMETOTAL="true" # Display total time or not (true/false_
|
||||
ITEM9_DISPLAY_FILE="false" # Display filename or not. This option will disable everything else. Path and file extension will be cut. (true/false)
|
||||
|
||||
# Music format
|
||||
# Format to display the music status in
|
||||
#
|
||||
# @a - Artist
|
||||
# @t - Title
|
||||
# @g - Genre
|
||||
# @ab - Album
|
||||
# @tt - Total time
|
||||
# @te - Time elapsed
|
||||
#
|
||||
# Example: @a - @t from @ab (@g) [@te/@tt]
|
||||
ITEM9_FORMAT="@a - @t from @ab (@g) [@te/@tt]"
|
||||
|
||||
ITEM10_TEXT="unread articles!" # Text to display next to unread article count (text)
|
||||
|
||||
ITEM11_SHOW_CHARGING_STATUS=true # Show 'Charging', 'Not charging' or 'Fully charged' status after the percentage. (true/false)
|
||||
ITEM11_DISCHARGING_TEXT="Not charging" # Text when not charging (text)
|
||||
ITEM11_CHARGING_TEXT="Charging" # Text when charging (text)
|
||||
ITEM11_FULL_TEXT="Fully charged" # Text when fully charged (text)
|
||||
CONFIG
|
||||
. "$HOME/.config/speedwm/statusrc.t"
|
||||
if [ ! -e "$HOME/.config/speedwm/statusrc" ]; then
|
||||
mv $HOME/.config/speedwm/statusrc.t $HOME/.config/speedwm/statusrc
|
||||
. $HOME/.config/speedwm/statusrc && echo "Created configuration file"
|
||||
else
|
||||
. $HOME/.config/speedwm/statusrc && echo "Loaded configuration file"
|
||||
fi
|
||||
|
||||
rm -f "$HOME/.config/speedwm/statusrc.t"
|
||||
|
||||
#########################################################################
|
||||
|
||||
# set version
|
||||
if [ -e "/usr/share/speedwm/speedwm-version" ]; then
|
||||
VER="$(cat /usr/share/speedwm/speedwm-version)"
|
||||
else
|
||||
VER="1.3"
|
||||
fi
|
||||
|
||||
# set status
|
||||
setstatus() {
|
||||
pgrep -x speedwm > /dev/null || return
|
||||
$SETMETHOD "$@"
|
||||
return
|
||||
}
|
||||
|
||||
# set loading status
|
||||
setloading() {
|
||||
$SETMETHOD "Loading"
|
||||
return
|
||||
}
|
||||
|
||||
# print data
|
||||
print() {
|
||||
if [ "$AMP_IS_PANGO" = "false" ]; then
|
||||
setstatus "$(printf "$ITEMS_TEXT" | sed "s/stellar_amp/\&/g")"
|
||||
else
|
||||
setstatus "$(printf "$ITEMS_TEXT" | sed "s/stellar_amp/\&\;/g")"
|
||||
fi
|
||||
}
|
||||
|
||||
# set status2d compatible colors
|
||||
setcolors2d() {
|
||||
if [ "$COLORFG" = "true" ] && [ "$BUILTINFG" = "true" ]; then
|
||||
FSETCOLORCMD1="^C0^"
|
||||
FSETCOLORCMD2="^C1^"
|
||||
FSETCOLORCMD3="^C2^"
|
||||
FSETCOLORCMD4="^C3^"
|
||||
FSETCOLORCMD5="^C4^"
|
||||
FSETCOLORCMD6="^C5^"
|
||||
FSETCOLORCMD7="^C6^"
|
||||
FSETCOLORCMD8="^C7^"
|
||||
FSETCOLORCMD9="^C8^"
|
||||
FSETCOLORCMD10="^C9^"
|
||||
FSETCOLORCMD11="^C10^"
|
||||
FSETCOLORCMD12="^C11^"
|
||||
FSETCOLORCMD13="^C12^"
|
||||
FSETCOLORCMD14="^C13^"
|
||||
FSETCOLORCMD15="^C14^"
|
||||
FSETCOLORCMD16="^C15^"
|
||||
fi
|
||||
|
||||
if [ "$COLORBG" = "true" ] && [ "$BUILTINBG" = "true" ]; then
|
||||
BSETCOLORCMD1="^B0^"
|
||||
BSETCOLORCMD2="^B1^"
|
||||
BSETCOLORCMD3="^B2^"
|
||||
BSETCOLORCMD4="^B3^"
|
||||
BSETCOLORCMD5="^B4^"
|
||||
BSETCOLORCMD6="^B5^"
|
||||
BSETCOLORCMD7="^B6^"
|
||||
BSETCOLORCMD8="^B7^"
|
||||
BSETCOLORCMD9="^B8^"
|
||||
BSETCOLORCMD10="^B9^"
|
||||
BSETCOLORCMD11="^B10^"
|
||||
BSETCOLORCMD12="^B11^"
|
||||
BSETCOLORCMD13="^B12^"
|
||||
BSETCOLORCMD14="^B13^"
|
||||
BSETCOLORCMD15="^B14^"
|
||||
BSETCOLORCMD16="^B15^"
|
||||
fi
|
||||
|
||||
if [ "$COLORFG" = "true" ] && [ "$BUILTINFG" = "false" ]; then
|
||||
FSETCOLORCMD1="^c${FCOLOR1}^"
|
||||
FSETCOLORCMD2="^c${FCOLOR2}^"
|
||||
FSETCOLORCMD3="^c${FCOLOR3}^"
|
||||
FSETCOLORCMD4="^c${FCOLOR4}^"
|
||||
FSETCOLORCMD5="^c${FCOLOR5}^"
|
||||
FSETCOLORCMD6="^c${FCOLOR6}^"
|
||||
FSETCOLORCMD7="^c${FCOLOR7}^"
|
||||
FSETCOLORCMD8="^c${FCOLOR8}^"
|
||||
FSETCOLORCMD9="^c${FCOLOR9}^"
|
||||
FSETCOLORCMD10="^c${FCOLOR10}^"
|
||||
FSETCOLORCMD11="^c${FCOLOR11}^"
|
||||
FSETCOLORCMD12="^c${FCOLOR12}^"
|
||||
FSETCOLORCMD13="^c${FCOLOR13}^"
|
||||
FSETCOLORCMD14="^c${FCOLOR14}^"
|
||||
FSETCOLORCMD15="^c${FCOLOR15}^"
|
||||
FSETCOLORCMD16="^c${FCOLOR16}^"
|
||||
fi
|
||||
|
||||
if [ "$COLORBG" = "true" ] && [ "$BUILTINBG" = "false" ]; then
|
||||
BSETCOLORCMD1="^b${BCOLOR1}^"
|
||||
BSETCOLORCMD2="^b${BCOLOR2}^"
|
||||
BSETCOLORCMD3="^b${BCOLOR3}^"
|
||||
BSETCOLORCMD4="^b${BCOLOR4}^"
|
||||
BSETCOLORCMD5="^b${BCOLOR5}^"
|
||||
BSETCOLORCMD6="^b${BCOLOR6}^"
|
||||
BSETCOLORCMD7="^b${BCOLOR7}^"
|
||||
BSETCOLORCMD8="^b${BCOLOR8}^"
|
||||
BSETCOLORCMD9="^b${BCOLOR9}^"
|
||||
BSETCOLORCMD10="^b${BCOLOR10}^"
|
||||
BSETCOLORCMD11="^b${BCOLOR11}^"
|
||||
BSETCOLORCMD12="^b${BCOLOR12}^"
|
||||
BSETCOLORCMD13="^b${BCOLOR13}^"
|
||||
BSETCOLORCMD14="^b${BCOLOR14}^"
|
||||
BSETCOLORCMD15="^b${BCOLOR15}^"
|
||||
BSETCOLORCMD16="^b${BCOLOR16}^"
|
||||
fi
|
||||
}
|
||||
|
||||
# remove old data
|
||||
rm -f /tmp/itest
|
||||
rm -f /tmp/wstatus
|
||||
rm -f /tmp/iscelsius
|
||||
|
||||
mkdir -p $HOME/.config/speedwm
|
||||
|
||||
printf "Loaded $0 $VER\n---\n"
|
||||
|
||||
# Set it to /usr/bin if it was not possible to get it through /usr/share/speedwm-bindir
|
||||
case "$BINDIR" in
|
||||
"") BINDIR="$(dirname $(command -v speedwm_status))/" ;;
|
||||
esac
|
||||
|
||||
# RAM usage
|
||||
ITEM1() {
|
||||
module_ram --print-file
|
||||
|
||||
if [ -e "/tmp/module_ram" ]; then
|
||||
cat /tmp/module_ram
|
||||
fi
|
||||
}
|
||||
|
||||
# Time
|
||||
ITEM2() {
|
||||
module_time --print-file
|
||||
|
||||
if [ -e "/tmp/module_time" ]; then
|
||||
cat /tmp/module_time
|
||||
fi
|
||||
}
|
||||
|
||||
# Date
|
||||
ITEM3() {
|
||||
module_date --print-file
|
||||
|
||||
if [ -e "/tmp/module_date" ]; then
|
||||
cat /tmp/module_date
|
||||
fi
|
||||
}
|
||||
|
||||
# Volume
|
||||
ITEM4() {
|
||||
module_vol --print-file
|
||||
|
||||
if [ -e "/tmp/module_vol" ]; then
|
||||
cat /tmp/module_vol
|
||||
fi
|
||||
}
|
||||
|
||||
# Weather
|
||||
ITEM5() {
|
||||
module_weather --print-file
|
||||
|
||||
if [ -e "/tmp/module_weather" ]; then
|
||||
cat /tmp/module_weather
|
||||
fi
|
||||
}
|
||||
|
||||
# Network traffic
|
||||
ITEM6() {
|
||||
module_net --print-file
|
||||
|
||||
if [ -e "/tmp/module_net" ]; then
|
||||
cat /tmp/module_net
|
||||
fi
|
||||
}
|
||||
|
||||
# Dfmpeg status
|
||||
ITEM7() {
|
||||
module_dfmpeg --print-file
|
||||
|
||||
if [ -e "/tmp/module_dfmpeg" ]; then
|
||||
cat /tmp/module_dfmpeg
|
||||
fi
|
||||
}
|
||||
|
||||
# CPU temp
|
||||
ITEM8() {
|
||||
module_temp --print-file
|
||||
|
||||
if [ -e "/tmp/module_temp" ]; then
|
||||
cat /tmp/module_temp
|
||||
fi
|
||||
}
|
||||
|
||||
# mocp/cmus status
|
||||
ITEM9() {
|
||||
module_music --print-file
|
||||
|
||||
if [ -e "/tmp/module_music" ]; then
|
||||
cat /tmp/module_music
|
||||
fi
|
||||
}
|
||||
|
||||
# Newsboat unreads
|
||||
ITEM10() {
|
||||
module_news --print-file
|
||||
|
||||
if [ -e "/tmp/module_news" ]; then
|
||||
cat /tmp/module_news
|
||||
fi
|
||||
}
|
||||
|
||||
# Battery percentage/charging status
|
||||
ITEM11() {
|
||||
module_bat --print-file
|
||||
|
||||
if [ -e "/tmp/module_bat" ]; then
|
||||
cat /tmp/module_bat
|
||||
fi
|
||||
}
|
||||
|
||||
# Set text variables that we can print later
|
||||
ptext() {
|
||||
# Output of commands
|
||||
# We're doing this so we can manipulate them easily for various reasons.
|
||||
if [ "$ENABLE_ITEM1" = "true" ]; then
|
||||
if [ "$(ITEM1)" != "" ]; then
|
||||
itemcmd1="$(echo "$(ITEM1)" | sed ':a;N;$!ba;s/\n//g')"
|
||||
itemcmd1="$FSETCOLORCMD7$BSETCOLORCMD7 $itemcmd1"
|
||||
else
|
||||
itemcmd1=""
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$ENABLE_ITEM2" = "true" ]; then
|
||||
if [ "$(ITEM2)" != "" ]; then
|
||||
itemcmd2="$(echo "$(ITEM2)" | sed ':a;N;$!ba;s/\n//g')"
|
||||
itemcmd2="$FSETCOLORCMD11$BSETCOLORCMD11 $itemcmd2"
|
||||
else
|
||||
itemcmd2=""
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$ENABLE_ITEM3" = "true" ]; then
|
||||
if [ "$(ITEM3)" != "" ]; then
|
||||
itemcmd3="$(echo "$(ITEM3)" | sed ':a;N;$!ba;s/\n//g')"
|
||||
itemcmd3="$FSETCOLORCMD10$BSETCOLORCMD10 $itemcmd3"
|
||||
else
|
||||
itemcmd3=""
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$ENABLE_ITEM4" = "true" ]; then
|
||||
if [ "$(ITEM4)" != "" ]; then
|
||||
itemcmd4="$(echo "$(ITEM4)" | sed ':a;N;$!ba;s/\n//g')"
|
||||
itemcmd4="$FSETCOLORCMD8$BSETCOLORCMD8 $itemcmd4"
|
||||
else
|
||||
itemcmd4=""
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$ENABLE_ITEM5" = "true" ]; then
|
||||
if [ "$(ITEM5)" != "" ]; then
|
||||
itemcmd5="$(echo "$(ITEM5)" | sed ':a;N;$!ba;s/\n//g')"
|
||||
itemcmd5="$FSETCOLORCMD3$BSETCOLORCMD3 $itemcmd5"
|
||||
else
|
||||
itemcmd5=""
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$ENABLE_ITEM6" = "true" ]; then
|
||||
if [ "$(ITEM6)" != "" ]; then
|
||||
itemcmd6="$(echo "$(ITEM6)" | sed ':a;N;$!ba;s/\n//g')"
|
||||
itemcmd6="$FSETCOLORCMD6$BSETCOLORCMD6 $itemcmd6"
|
||||
else
|
||||
itemcmd6=""
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$ENABLE_ITEM7" = "true" ]; then
|
||||
if [ "$(ITEM7)" != "" ]; then
|
||||
itemcmd7="$(echo "$(ITEM7)" | sed ':a;N;$!ba;s/\n//g')"
|
||||
itemcmd7="$FSETCOLORCMD5$BSETCOLORCMD5 $itemcmd7"
|
||||
else
|
||||
itemcmd7=""
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$ENABLE_ITEM8" = "true" ]; then
|
||||
if [ "$(ITEM8)" != "" ]; then
|
||||
itemcmd8="$(echo "$(ITEM8)" | sed ':a;N;$!ba;s/\n//g')"
|
||||
itemcmd8="$FSETCOLORCMD4$BSETCOLORCMD4 $itemcmd8"
|
||||
else
|
||||
itemcmd8=""
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$ENABLE_ITEM9" = "true" ]; then
|
||||
if [ "$(ITEM9)" != "" ]; then
|
||||
itemcmd9="$(echo "$(ITEM9)" | sed ':a;N;$!ba;s/\n//g')"
|
||||
itemcmd9="$FSETCOLORCMD2$BSETCOLORCMD2 $itemcmd9"
|
||||
else
|
||||
itemcmd9=""
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$ENABLE_ITEM10" = "true" ]; then
|
||||
if [ "$(ITEM10)" != "" ]; then
|
||||
itemcmd10="$(echo "$(ITEM10)" | sed ':a;N;$!ba;s/\n//g')"
|
||||
itemcmd10="$FSETCOLORCMD9$BSETCOLORCMD9 $itemcmd10"
|
||||
else
|
||||
itemcmd10=""
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$ENABLE_ITEM11" = "true" ]; then
|
||||
if [ "$(ITEM11)" != "" ]; then
|
||||
itemcmd11="$(echo "$(ITEM11)" | sed ':a;N;$!ba;s/\n//g')"
|
||||
itemcmd11="$FSETCOLORCMD8$BSETCOLORCMD8 $itemcmd11"
|
||||
else
|
||||
itemcmd11=""
|
||||
fi
|
||||
fi
|
||||
|
||||
# Clickability
|
||||
if [ "$CLICKABLE" = "true" ]; then
|
||||
ITEMS_TEXT="$(echo "$ITEM_ORDER" | sed "s/^[[:space:]]*//g; s|@10|\x10$itemcmd10|; s|@11|\x11$itemcmd11|; s|@1|\x01$itemcmd1|; s|@2|\x02$itemcmd2|; s|@3|\x03$itemcmd3|; s|@4|\x04$itemcmd4|; s|@5|\x05$itemcmd5|; s|@6|\x06$itemcmd6|; s|@7|\x07$itemcmd7|; s|@8|\x08$itemcmd8|; s|@9|\x09$itemcmd9|; s|%|%%|g")"
|
||||
else
|
||||
ITEMS_TEXT="$(echo "$ITEM_ORDER" | sed "s/^[[:space:]]*//g; s|@10|$itemcmd10|; s|@11|$itemcmd11|; s|@1|$itemcmd1|; s|@2|$itemcmd2|; s|@3|$itemcmd3|; s|@4|$itemcmd4|; s|@5|$itemcmd5|; s|@6|$itemcmd6|; s|@7|$itemcmd7|; s|@8|$itemcmd8|; s|@9|$itemcmd9|; s|%|%%|g")"
|
||||
fi
|
||||
|
||||
print
|
||||
}
|
||||
|
||||
# base
|
||||
base() {
|
||||
while true; do
|
||||
ptext
|
||||
sleep $REFRESHDELAY
|
||||
done
|
||||
}
|
||||
|
||||
setloading
|
||||
setcolors2d
|
||||
base
|
||||
|
||||
printf "$0: Stopped printing."
|
||||
exit 0
|
|
@ -1,56 +0,0 @@
|
|||
#!/bin/sh
|
||||
# speedwm_status
|
||||
# status bar manager for speedwm/stellar
|
||||
|
||||
STATUSBAR="speedwm-stellar" # should be stellar
|
||||
IN_ARGS="$@" # arguments
|
||||
LOADTEXT="Loading" # load text
|
||||
|
||||
mkdir -p $HOME/.config/speedwm/
|
||||
|
||||
# run status
|
||||
rstatus() {
|
||||
while true; do
|
||||
$STATUSBAR $IN_ARGS > /tmp/statusbar-log
|
||||
done
|
||||
}
|
||||
|
||||
# run loop
|
||||
statusfunc() {
|
||||
if pgrep -x $STATUSBAR > /dev/null; then
|
||||
clear
|
||||
printf "Status bar is already running, continuing loop."
|
||||
sleep 3
|
||||
else
|
||||
speedwm -s "$LOADTEXT"
|
||||
rstatus
|
||||
fi
|
||||
|
||||
# workaround for status crash when REFRESHDELAY is too low.
|
||||
# this is fine since the status will be restarted anyway, but we don't need a core dump in $HOME.
|
||||
if [ -e "$HOME/core" ]; then
|
||||
rm -f "$HOME/core"
|
||||
fi
|
||||
|
||||
statusfunc
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
"-h")
|
||||
echo "speedwm_status - stellar launcher"
|
||||
echo ""
|
||||
echo "-s Stop stellar"
|
||||
echo "-r Restart stellar"
|
||||
echo "No arguments Run stellar"
|
||||
echo ""
|
||||
echo "See speedwm-help for more information."
|
||||
exit 0
|
||||
;;
|
||||
"-r")
|
||||
pkill "$STATUSBAR" ; sleep 2 ; statusfunc
|
||||
;;
|
||||
"-s") pkill "$STATUSBAR"
|
||||
;;
|
||||
esac
|
||||
|
||||
statusfunc
|
|
@ -3528,7 +3528,7 @@ showhide(Client *c)
|
|||
} else {
|
||||
/* hide clients bottom up */
|
||||
showhide(c->snext);
|
||||
XMoveWindow(dpy, c->win, WIDTH(c) * -2, c->y);
|
||||
XMoveWindow(dpy, c->win, c->mon->wx + c->mon->ww / 2 - WIDTH(c) / 2, - (HEIGHT(c) * 3) / 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5949,8 +5949,9 @@ spawn(const Arg *arg)
|
|||
for (int i = 0; i < LENGTH(statuscmds); i++) {
|
||||
if (statuscmdn == statuscmds[i].id) {
|
||||
statuscmd[2] = statuscmds[i].cmd;
|
||||
|
||||
/* compatibility with dwm bars */
|
||||
setenv("BUTTON", lastbutton, 1);
|
||||
system("rm -f /tmp/speedwm-button");
|
||||
int writestatus = fputs(lastbutton, buttonfile);
|
||||
if (writestatus == EOF) {
|
||||
fprintf(stderr, "speedwm: failed to write statuscmd button.\n");
|
||||
|
|
312
status.c
Normal file
312
status.c
Normal file
|
@ -0,0 +1,312 @@
|
|||
#define _POSIX_C_SOURCE 200112L
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <pthread.h>
|
||||
#include <err.h>
|
||||
#define LENGTH(X) (sizeof(X) / sizeof (X[0]))
|
||||
|
||||
typedef struct {
|
||||
char* icon;
|
||||
char* command;
|
||||
unsigned int interval;
|
||||
unsigned int signal;
|
||||
} Module;
|
||||
typedef struct Thread_ev {
|
||||
const Module *module;
|
||||
size_t idx;
|
||||
} Thread_ev;
|
||||
void sighandler(int num);
|
||||
void replace(char *str, char old, char new);
|
||||
void remove_all(char *str, char to_remove);
|
||||
void getcmds(void);
|
||||
#ifndef __OpenBSD__
|
||||
void getsigcmds(int signal);
|
||||
void setupsignals();
|
||||
void sighandler(int signum);
|
||||
#endif
|
||||
int getstatus(char *str, char *last);
|
||||
void setroot();
|
||||
void statusloop();
|
||||
void termhandler(int signum);
|
||||
|
||||
|
||||
#include "status.h"
|
||||
|
||||
static Display *dpy;
|
||||
static int screen;
|
||||
static Window root;
|
||||
static char statusbar[LENGTH(modules)][1024] = {0};
|
||||
static char statusstr[2][256];
|
||||
static volatile int statusContinue = 1;
|
||||
static pthread_mutex_t write_mut = PTHREAD_MUTEX_INITIALIZER;
|
||||
static void (*writestatus) () = setroot;
|
||||
|
||||
void replace(char *str, char old, char new)
|
||||
{
|
||||
for(char * c = str; *c; c++)
|
||||
if(*c == old)
|
||||
*c = new;
|
||||
}
|
||||
|
||||
void remove_all(char *str, char to_remove) {
|
||||
char *read = str;
|
||||
char *write = str;
|
||||
while (*read) {
|
||||
if (*read != to_remove) {
|
||||
*write++ = *read;
|
||||
}
|
||||
++read;
|
||||
}
|
||||
*write = '\0';
|
||||
}
|
||||
|
||||
void
|
||||
getcmd(const Module *module, char *output)
|
||||
{
|
||||
FILE *cmdf = popen(module->command, "r");
|
||||
if (!cmdf){
|
||||
return;
|
||||
}
|
||||
char tmpstr[1024] = "";
|
||||
char * s;
|
||||
int e;
|
||||
do {
|
||||
errno = 0;
|
||||
s = fgets(tmpstr, 1024-(strlen(separator)+1), cmdf);
|
||||
e = errno;
|
||||
} while (!s && e == EINTR);
|
||||
pclose(cmdf);
|
||||
int i = strlen(module->icon);
|
||||
strcpy(output, module->icon);
|
||||
strcpy(output+i, tmpstr);
|
||||
remove_all(output, '\n');
|
||||
i = strlen(output);
|
||||
if ((i > 0 && module != &modules[LENGTH(modules) - 1])){
|
||||
strcat(output, separator);
|
||||
}
|
||||
i+=strlen(separator);
|
||||
output[i++] = '\0';
|
||||
}
|
||||
|
||||
static void
|
||||
syncwrite(void) {
|
||||
pthread_mutex_lock(&write_mut);
|
||||
writestatus();
|
||||
pthread_mutex_unlock(&write_mut);
|
||||
}
|
||||
|
||||
void
|
||||
threadEvent(union sigval data) {
|
||||
Thread_ev *ev = (Thread_ev*) data.sival_ptr;
|
||||
getcmd(ev->module, statusbar[ev->idx]);
|
||||
syncwrite();
|
||||
}
|
||||
|
||||
void
|
||||
getcmds(void)
|
||||
{
|
||||
const Module* current;
|
||||
for(int i = 0; i < LENGTH(modules); i++)
|
||||
{
|
||||
current = modules + i;
|
||||
getcmd(current,statusbar[i]);
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef __OpenBSD__
|
||||
void
|
||||
getsigcmds(int signal)
|
||||
{
|
||||
const Module *current;
|
||||
for (int i = 0; i < LENGTH(modules); i++)
|
||||
{
|
||||
current = modules + i;
|
||||
if (current->signal == signal){
|
||||
getcmd(current,statusbar[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
setupsignals()
|
||||
{
|
||||
for(int i = SIGRTMIN; i <= SIGRTMAX; i++)
|
||||
signal(i, SIG_IGN);
|
||||
|
||||
for(int i = 0; i < LENGTH(modules); i++)
|
||||
{
|
||||
if (modules[i].signal > 0) {
|
||||
struct sigaction action;
|
||||
sigemptyset(&action.sa_mask);
|
||||
action.sa_flags = 0;
|
||||
action.sa_handler = sighandler;
|
||||
sigaction(SIGRTMIN+modules[i].signal, &action, NULL);
|
||||
}
|
||||
}
|
||||
struct sigaction sigchld_action = {
|
||||
.sa_handler = SIG_DFL,
|
||||
.sa_flags = SA_NOCLDWAIT
|
||||
};
|
||||
sigaction(SIGCHLD, &sigchld_action, NULL);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
getstatus(char *str, char *last)
|
||||
{
|
||||
strcpy(last, str);
|
||||
str[0] = '\0';
|
||||
if (leftpadding[0] != '\0')
|
||||
strcat(str, leftpadding);
|
||||
for(int i = 0; i < LENGTH(modules); i++) {
|
||||
strcat(str, statusbar[i]);
|
||||
if (i == LENGTH(modules) - 1)
|
||||
strcat(str, " ");
|
||||
}
|
||||
str[strlen(str)-1] = '\0';
|
||||
if (rightpadding[0] != '\0')
|
||||
strcat(str, rightpadding);
|
||||
return strcmp(str, last);
|
||||
}
|
||||
|
||||
void setroot()
|
||||
{
|
||||
if (!getstatus(statusstr[0], statusstr[1]))
|
||||
return;
|
||||
Display *d = XOpenDisplay(NULL);
|
||||
if (d) {
|
||||
dpy = d;
|
||||
}
|
||||
screen = DefaultScreen(dpy);
|
||||
root = RootWindow(dpy, screen);
|
||||
XStoreName(dpy, root, statusstr[0]);
|
||||
XCloseDisplay(dpy);
|
||||
}
|
||||
|
||||
void pstdout()
|
||||
{
|
||||
if (!getstatus(statusstr[0], statusstr[1]))
|
||||
return;
|
||||
printf("%s\n",statusstr[0]);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
|
||||
void statusloop()
|
||||
{
|
||||
#ifndef __OpenBSD__
|
||||
setupsignals();
|
||||
#endif
|
||||
setupsignals();
|
||||
getcmds();
|
||||
|
||||
sigset_t moduleed;
|
||||
sigemptyset(&moduleed);
|
||||
|
||||
timer_t timer_ids[LENGTH(modules)];
|
||||
Thread_ev evs[LENGTH(modules)];
|
||||
|
||||
size_t timer_size = 0;
|
||||
size_t ev_size = 0;
|
||||
|
||||
for(size_t i = 0; i < LENGTH(modules); i++) {
|
||||
const Module *current = modules + i;
|
||||
if(current->signal > 0) {
|
||||
sigaddset(&moduleed, current->signal);
|
||||
}
|
||||
}
|
||||
|
||||
sigprocmask(SIG_BLOCK, &moduleed, NULL);
|
||||
|
||||
for(size_t i = 0; i < LENGTH(modules); i++) {
|
||||
const Module *current = modules + i;
|
||||
|
||||
timer_t t_id;
|
||||
Thread_ev ev;
|
||||
|
||||
timer_ids[timer_size] = t_id;
|
||||
evs[ev_size] = ev;
|
||||
|
||||
|
||||
struct sigevent event;
|
||||
|
||||
if(current->signal == 0) {
|
||||
evs[ev_size].module = current;
|
||||
evs[ev_size].idx = i;
|
||||
|
||||
event.sigev_notify = SIGEV_THREAD;
|
||||
event.sigev_value.sival_ptr = &evs[ev_size];
|
||||
event.sigev_notify_function = threadEvent;
|
||||
} else {
|
||||
event.sigev_notify = SIGEV_SIGNAL;
|
||||
event.sigev_signo = current->signal + SIGRTMIN;
|
||||
}
|
||||
|
||||
if(timer_create(CLOCK_REALTIME, &event, &timer_ids[timer_size]) == -1)
|
||||
err(1, "Failed to create timer");
|
||||
|
||||
|
||||
struct itimerspec inter;
|
||||
|
||||
inter.it_value.tv_sec = 1;
|
||||
inter.it_value.tv_nsec = 0;
|
||||
|
||||
inter.it_interval.tv_sec = current->interval;
|
||||
inter.it_interval.tv_nsec = 0;
|
||||
|
||||
if(timer_settime(timer_ids[timer_size], 0, &inter, NULL) == -1) {
|
||||
err(1, "Failed to set timer");
|
||||
}
|
||||
|
||||
timer_size++;
|
||||
ev_size++;
|
||||
}
|
||||
|
||||
sigprocmask(SIG_UNBLOCK, &moduleed, NULL);
|
||||
|
||||
while(statusContinue) {
|
||||
syncwrite();
|
||||
pause();
|
||||
}
|
||||
|
||||
for(size_t idx = 0; idx < timer_size; idx++) {
|
||||
timer_delete(timer_ids[idx]);
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef __OpenBSD__
|
||||
void sighandler(int signum)
|
||||
{
|
||||
getsigcmds(signum-SIGRTMIN);
|
||||
syncwrite();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void termhandler(int signum)
|
||||
{
|
||||
statusContinue = 0;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
for(int i = 0; i < argc; i++)
|
||||
{
|
||||
if (!strcmp("-d",argv[i]))
|
||||
separator = argv[++i];
|
||||
else if(!strcmp("-p",argv[i]))
|
||||
writestatus = pstdout;
|
||||
}
|
||||
signal(SIGTERM, termhandler);
|
||||
signal(SIGINT, termhandler);
|
||||
statusloop();
|
||||
}
|
48
status.h
Normal file
48
status.h
Normal file
|
@ -0,0 +1,48 @@
|
|||
/* status.h
|
||||
*
|
||||
* This header is for configuring the status bar (based on dwmblocks).
|
||||
* It is technically a separate program, but it is compiled and installed alongside speedwm.
|
||||
*
|
||||
* This separate program (status.c, status.h) is licensed under the GNU General Public License version 2.0.
|
||||
*
|
||||
* Prefix: Text that will be printed before each module. This can be Pango/status2d/statuscmd markup or a unicode/ASCII character.
|
||||
* Command: Command that will run. The output of this command will be printed for that module.
|
||||
* Update interval: How often the module will be updated in seconds.
|
||||
* Update signal: What signal reloads the module with force. (using the kill command)
|
||||
*/
|
||||
|
||||
static const Module modules[] = {
|
||||
/* prefix command update interval update signal */
|
||||
{ "\x01^C1^", "module_time --print", 1, 1 },
|
||||
{ "\x02^C2^", "module_date --print", 60, 2 },
|
||||
{ "\x03^C3^", "module_bat --print", 10, 3 },
|
||||
{ "\x04^C4^", "module_vol --print", 1, 4 },
|
||||
{ "\x05^C5^", "module_ram --print", 6, 5 },
|
||||
{ "\x06^C6^", "module_net --print", 10, 6 },
|
||||
{ "\x07^C7^", "module_temp --print", 5, 7 },
|
||||
{ "\x08^C8^", "module_weather --print", 60, 8 },
|
||||
{ "\x09^C9^", "module_music --print", 1, 9 },
|
||||
{ "\x10^C10^", "module_dfmpeg --print", 5, 10 },
|
||||
{ "\x11^C11^", "module_news --print", 30, 11 },
|
||||
};
|
||||
|
||||
static char leftpadding[] = ""; /* Padding on the left side of the status text */
|
||||
static char rightpadding[] = ""; /* Padding on the right side of the status text */
|
||||
static char *separator = ""; /* Delimiter between modules. Note that this will be applied even if a command is empty. */
|
||||
|
||||
/* License:
|
||||
*
|
||||
* 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 2 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, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
|
@ -9,6 +9,10 @@ USEIPC = true # Comment if you don't use IPC
|
|||
YAJLLIBS = -lyajl # Comment if you don't use IPC
|
||||
YAJLINC = /usr/include/yajl # Comment if you don't use IPC
|
||||
|
||||
# Built in status
|
||||
# Whether or not to compile the built in status bar (fork of dwmblocks).
|
||||
USESTATUS = true # Comment if you do not want it.
|
||||
|
||||
# Tag previews and window icons
|
||||
# If you use tag previews or window icons (enabled by default), these must be uncommented.
|
||||
# If you do not use them, disable them in toggle.h and comment these lines.
|
||||
|
|
Loading…
Reference in a new issue