change config

This commit is contained in:
zcake 2021-01-03 18:53:48 +08:00
parent 7dd8dae79e
commit 59ce4ce9de
9 changed files with 45 additions and 15 deletions

View File

@ -58,12 +58,11 @@ dist:
install: all
mkdir -p "$(DESTDIR)$(PREFIX)/bin"
cp -f slstatus "$(DESTDIR)$(PREFIX)/bin"
chmod 755 "$(DESTDIR)$(PREFIX)/bin/slstatus"
mkdir -p "$(DESTDIR)$(MANPREFIX)/man1"
cp -f slstatus.1 "$(DESTDIR)$(MANPREFIX)/man1"
chmod 644 "$(DESTDIR)$(MANPREFIX)/man1/slstatus.1"
cp -f slstatus-part "$(DESTDIR)$(PREFIX)/bin"
chmod 755 "$(DESTDIR)$(PREFIX)/bin/slstatus-part"
cp -f part/* "$(DESTDIR)$(PREFIX)/bin"
chmod 755 "$(DESTDIR)$(PREFIX)/bin/"*
uninstall:
rm -f "$(DESTDIR)$(PREFIX)/bin/slstatus"
rm -f "$(DESTDIR)$(MANPREFIX)/man1/slstatus.1"

View File

@ -65,9 +65,13 @@ static const char unknown_str[] = "n/a";
*/
static const struct arg args[] = {
/* function format argument */
{ run_command, "  %s ", "slstatus-part" },
{ separator, "\x02", "%F %T" },
{ separator, " ", "%F %T" },
{ run_command, "%s", "slstatus-weat" },
{ separator, "\x02", "NULLT" },
{ separator, " ", "NULL" },
{ run_command, "  %s ", "slstatus-vol" },
{ separator, "\x03", "NULL" },
{ separator, " ", "NULL" },
{ datetime, " %s ", "%H:%M" },
//padding
{ separator, " ", "%F %T" },
};

1
o Normal file
View File

@ -0,0 +1 @@
☀️+18°C

14
part/slstatus-vol Normal file
View File

@ -0,0 +1,14 @@
#!/bin/bash
tmp='/tmp/vol'
if [ -s $tmp ]
then
cat $tmp
else
if pactl list sinks | grep 'Mute: yes'>/dev/zero
then
echo MUTE > $tmp
else
echo "$(pactl list sinks | awk '$1=="Volume:" {print $5}')" > $tmp
fi
cat $tmp
fi

20
part/slstatus-weat Executable file
View File

@ -0,0 +1,20 @@
#!/bin/bash
tmp='/tmp/Weather'
if [ -s $tmp ]
then
case $(date +%Hi%M) in
07i00)
rm $tmp;;
12i00)
rm $tmp;;
18i00)
rm $tmp;;
esac
fi
if [ -s $tmp ]
then
cat $tmp
else
curl wttr.in/?format="+%c%t" |sed 's/+//g' 1> $tmp
cat $tmp
fi

BIN
slstatus

Binary file not shown.

View File

@ -1,8 +0,0 @@
#!/bin/bash
if [ -s ~/.cache/vol ]
then
cat ~/.cache/vol
else
echo "$(pactl list sinks | awk '$1=="Volume:" {print $5}')" > ~/.cache/vol
cat ~/.cache/vol
fi

View File

@ -86,7 +86,7 @@ main(int argc, char *argv[])
die("clock_gettime:");
}
status[0] = '\n';
status[0] = '\0';
for (i = len = 0; i < LEN(args); i++) {
if (!(res = args[i].func(args[i].args))) {
res = unknown_str;

Binary file not shown.