suckless/slstatus.git
7 years agoAdd pscanf()
Laslo Hunhold [Sun, 13 Aug 2017 22:34:00 +0000 (00:34 +0200)]
Add pscanf()

This reduces a lot of equivalent code to one function call.

7 years agoRefactor main()
Laslo Hunhold [Sun, 13 Aug 2017 21:21:23 +0000 (23:21 +0200)]
Refactor main()

We remove the hack with the sleep and global "delay"-variable and use a
monotonic clock to derive the desired monotonic properties of the tool.
Inside each function that demands a personal delay we can then just do a
nanosleep() and be done with it.
It's a shame that timespec is so ugly to work with, but there's really
no way to make it more beautiful. However, at this cost though we
finally can set the interval times in milliseconds and not only just
seconds.

We remove setlocale(), because nothing good ever came out of this
function.

Besides that we have some more code refactoring, especially in the
argument loop which saves us a bit of complexity.

7 years agoSimplify signal handling a bit
Laslo Hunhold [Sun, 13 Aug 2017 18:33:44 +0000 (20:33 +0200)]
Simplify signal handling a bit

7 years agoRemove unnecessary prototypes
Laslo Hunhold [Sun, 13 Aug 2017 18:21:49 +0000 (20:21 +0200)]
Remove unnecessary prototypes

7 years agoRemove unnecessary blank lines after license-notice
Laslo Hunhold [Sun, 13 Aug 2017 18:21:04 +0000 (20:21 +0200)]
Remove unnecessary blank lines after license-notice

7 years agoFix man page .Os field
Aaron Marcher [Sun, 13 Aug 2017 21:25:44 +0000 (23:25 +0200)]
Fix man page .Os field

7 years agoAdded Makefile target for distribution tarballs.
Aaron Marcher [Sun, 13 Aug 2017 21:05:22 +0000 (23:05 +0200)]
Added Makefile target for distribution tarballs.

7 years agoFixed man page path
Aaron Marcher [Sun, 13 Aug 2017 20:56:14 +0000 (22:56 +0200)]
Fixed man page path

According to the FHS, /usr/local/share/man is the correct man page path
in this projects's case. Set this to default in config.mk.

7 years agoslstatus != dmenu lol
Aaron Marcher [Sat, 12 Aug 2017 11:37:12 +0000 (13:37 +0200)]
slstatus != dmenu lol

7 years agoRemoved #define for unknown_str
Aaron Marcher [Sat, 12 Aug 2017 11:27:30 +0000 (13:27 +0200)]
Removed #define for unknown_str

Debugging #define is very difficult. The performance overhead of static const
char is negligible.

7 years agoRemoved #define for update interval
Aaron Marcher [Sat, 12 Aug 2017 11:06:24 +0000 (13:06 +0200)]
Removed #define for update interval

Debugging #define, especially in mathematical constructs is very
difficult. The performance overhead of static const int is negligible.

7 years agoUpdated LICENSE
Aaron Marcher [Sat, 12 Aug 2017 10:55:53 +0000 (12:55 +0200)]
Updated LICENSE

Extended Ali H. Fardan contribution dates

7 years agokeyboard_indicators: fix segfault when -s is specified
Ali H. Fardan [Sat, 12 Aug 2017 04:01:13 +0000 (07:01 +0300)]
keyboard_indicators: fix segfault when -s is specified

7 years agoFixed possible NULL-deref and removed unnecessary XOpenDisplay()
Aaron Marcher [Fri, 11 Aug 2017 12:33:02 +0000 (14:33 +0200)]
Fixed possible NULL-deref and removed unnecessary XOpenDisplay()

- Added a check for the return value of XOpenDisplay() in main().
  This fixes a possible NULL-deref.
- Removed unnsecessary XOpenDisplay and XCloseDisplay from
  keyboard_indicators(). The ones in main() are sufficent.

7 years agoAdd and use LEN() macro
Laslo Hunhold [Fri, 11 Aug 2017 11:39:19 +0000 (13:39 +0200)]
Add and use LEN() macro

7 years agoRefactor battery_state()
Laslo Hunhold [Thu, 10 Aug 2017 22:17:49 +0000 (00:17 +0200)]
Refactor battery_state()

7 years agoReformatted LICENSE to fit 75 character width
Aaron Marcher [Thu, 10 Aug 2017 20:43:56 +0000 (22:43 +0200)]
Reformatted LICENSE to fit 75 character width

7 years agoPrint usage() when we are left with arguments
Laslo Hunhold [Thu, 10 Aug 2017 20:23:55 +0000 (22:23 +0200)]
Print usage() when we are left with arguments

7 years agoReduce -o | -n to -s
Laslo Hunhold [Thu, 10 Aug 2017 20:22:39 +0000 (22:22 +0200)]
Reduce -o | -n to -s

What we really want is to either output to WM_NAME or stdout. If we want
just one single line, we do slstatus | head -n 1.

7 years agoRemove d- and v-flags
Laslo Hunhold [Thu, 10 Aug 2017 19:56:06 +0000 (21:56 +0200)]
Remove d- and v-flags

d-flag: There's no need for that, use the &-operator or fork+exec in a
        non-shell-context. In the latter case you get the PID for free.
v-flag: If you want to find out which version of a package is installed,
        consult your package manager. That's his job.

7 years agoConvert slstatus.1 to mandoc, simplify it and remove -h
Laslo Hunhold [Thu, 10 Aug 2017 19:36:29 +0000 (21:36 +0200)]
Convert slstatus.1 to mandoc, simplify it and remove -h

We also change the semantics of -v to only return the version
information.
There is now no need for usage() to exit with anything other than 1.

7 years agoRefactor build system
Laslo Hunhold [Thu, 10 Aug 2017 19:32:10 +0000 (21:32 +0200)]
Refactor build system

7 years agoNew README in plain text
Aaron Marcher [Thu, 10 Aug 2017 19:49:37 +0000 (21:49 +0200)]
New README in plain text

7 years agoRemoved TODO.md
Aaron Marcher [Thu, 10 Aug 2017 19:10:17 +0000 (21:10 +0200)]
Removed TODO.md

7 years agoRemoved CONTRIBUTING.md
Aaron Marcher [Thu, 10 Aug 2017 19:08:53 +0000 (21:08 +0200)]
Removed CONTRIBUTING.md

7 years agoMoved contributors to LICENSE
Aaron Marcher [Thu, 10 Aug 2017 19:06:48 +0000 (21:06 +0200)]
Moved contributors to LICENSE

7 years agoCopyright sign (C) is not required in LICENSE
Aaron Marcher [Thu, 10 Aug 2017 18:32:14 +0000 (20:32 +0200)]
Copyright sign (C) is not required in LICENSE

According to https://opensource.org/licenses/ISC

7 years agoRemoved .gitignore from repository
Aaron Marcher [Thu, 10 Aug 2017 18:30:52 +0000 (20:30 +0200)]
Removed .gitignore from repository

A file outside the repository (.git/info/exclude) can replace this and
suits better for this usecase.

7 years agonew arg.h version by frign
Aaron Marcher [Thu, 10 Aug 2017 09:31:57 +0000 (11:31 +0200)]
new arg.h version by frign

7 years agoadd num_files() function for maildirs ;)
aaron marcher [Sun, 6 Aug 2017 13:02:16 +0000 (15:02 +0200)]
add num_files() function for maildirs ;)

7 years agoupdated readme
Aaron Marcher [Mon, 12 Jun 2017 22:11:35 +0000 (00:11 +0200)]
updated readme

7 years agocheck for fgets/fscanf return values
Aaron Marcher [Mon, 12 Jun 2017 22:06:56 +0000 (00:06 +0200)]
check for fgets/fscanf return values

7 years agouse a static buffer instead of dynamic memory
Aaron Marcher [Mon, 12 Jun 2017 22:06:04 +0000 (00:06 +0200)]
use a static buffer instead of dynamic memory

7 years agoremove format characters from stat functions
Aaron Marcher [Mon, 12 Jun 2017 21:59:21 +0000 (23:59 +0200)]
remove format characters from stat functions

7 years agoadd cpu_freq function
Aaron Marcher [Mon, 12 Jun 2017 21:56:21 +0000 (23:56 +0200)]
add cpu_freq function

7 years agoadd battery_power function
Aaron Marcher [Mon, 12 Jun 2017 21:55:27 +0000 (23:55 +0200)]
add battery_power function

7 years agoadded option to output only once and exit afterwards
Aaron Marcher [Thu, 11 May 2017 17:06:45 +0000 (19:06 +0200)]
added option to output only once and exit afterwards

7 years agoenable stack protector and compile to position independent executable
Aaron Marcher [Thu, 20 Apr 2017 20:33:10 +0000 (22:33 +0200)]
enable stack protector and compile to position independent executable

7 years agosimplified and improved vol_perc()
Aaron Marcher [Thu, 20 Apr 2017 20:30:04 +0000 (22:30 +0200)]
simplified and improved vol_perc()

7 years agofix overflow in run_command()
Aaron Marcher [Thu, 20 Apr 2017 20:20:19 +0000 (22:20 +0200)]
fix overflow in run_command()

7 years agousername(): get rid of unneeded uid variable
Aaron Marcher [Thu, 20 Apr 2017 20:18:24 +0000 (22:18 +0200)]
username(): get rid of unneeded uid variable

7 years agoMerge pull request #39 from stoeckmann/fgets
Aaron Marcher [Thu, 20 Apr 2017 20:14:56 +0000 (22:14 +0200)]
Merge pull request #39 from stoeckmann/fgets

On success, fgets always terminates the result.

7 years agoOn success, fgets always terminates the result.
Tobias Stoeckmann [Tue, 4 Apr 2017 19:27:31 +0000 (21:27 +0200)]
On success, fgets always terminates the result.

If fgets succeeds, then the resulting char array is always
terminated by a '\0'. No need to keep extra space, therefore
sizeof(buf) is the correct argument.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
7 years agoMerge pull request #38 from stoeckmann/terminating-nul
Aaron Marcher [Sun, 2 Apr 2017 13:27:09 +0000 (15:27 +0200)]
Merge pull request #38 from stoeckmann/terminating-nul

Fixed out of boundary write on long lines.

7 years agoFixed out of boundary write on long lines.
Tobias Stoeckmann [Sun, 2 Apr 2017 11:12:03 +0000 (13:12 +0200)]
Fixed out of boundary write on long lines.

The terminating nul character ('\0') could be written outside the boundary of
the buffer which is used to read characters. If "sizeof(buffer)" characters
are read, the resulting value must not be used as index, because that's an off
by one.

Read sizeof(buffer)-1 bytes instead.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
7 years agoloading thresholds state
Aaron Marcher [Thu, 30 Mar 2017 15:32:20 +0000 (17:32 +0200)]
loading thresholds state

7 years agoFixed XCloseDisplay() which is not reached in keyboard_indicators()
Aaron Marcher [Mon, 23 Jan 2017 20:01:41 +0000 (21:01 +0100)]
Fixed XCloseDisplay() which is not reached in keyboard_indicators()

7 years agoAdded keyboard_indicators (Fixes #31)
Aaron Marcher [Mon, 16 Jan 2017 11:10:56 +0000 (12:10 +0100)]
Added keyboard_indicators (Fixes #31)

7 years agoMakefile fix and vol_perc fix for mute
Aaron Marcher [Mon, 9 Jan 2017 11:05:29 +0000 (12:05 +0100)]
Makefile fix and vol_perc fix for mute

7 years agosimplified Makefile
Aaron Marcher [Mon, 9 Jan 2017 08:29:58 +0000 (09:29 +0100)]
simplified Makefile

7 years agosmall Makefile tweak
Aaron Marcher [Mon, 9 Jan 2017 08:23:17 +0000 (09:23 +0100)]
small Makefile tweak

7 years agoMakefile: Added back config.h handling in Makefile
Aaron Marcher [Mon, 9 Jan 2017 08:21:18 +0000 (09:21 +0100)]
Makefile: Added back config.h handling in Makefile

7 years agoMakefile: Fixes #35
Aaron Marcher [Mon, 9 Jan 2017 07:24:26 +0000 (08:24 +0100)]
Makefile: Fixes #35

7 years agotodo
Aaron Marcher [Sat, 7 Jan 2017 21:34:45 +0000 (22:34 +0100)]
todo

7 years agoremoved ./extern/
Aaron Marcher [Sat, 7 Jan 2017 21:33:28 +0000 (22:33 +0100)]
removed ./extern/

7 years agoremoved strlcat dependency (was used only once)
Aaron Marcher [Sat, 7 Jan 2017 21:31:46 +0000 (22:31 +0100)]
removed strlcat dependency (was used only once)

7 years agogot rid of concat.h
Aaron Marcher [Sat, 7 Jan 2017 21:01:49 +0000 (22:01 +0100)]
got rid of concat.h

7 years agosaner makefile: cleaner, simpler, suckless
Aaron Marcher [Sat, 7 Jan 2017 20:49:10 +0000 (21:49 +0100)]
saner makefile: cleaner, simpler, suckless

7 years agohappy new year!
Aaron Marcher [Sat, 7 Jan 2017 20:28:22 +0000 (21:28 +0100)]
happy new year!

7 years agorun_command: strlen() will not function if string is not null terminated
Aaron Marcher [Sat, 7 Jan 2017 20:19:40 +0000 (21:19 +0100)]
run_command: strlen() will not function if string is not null terminated

7 years agoconsistent coding style: usage() declaration, eval is a constant
Aaron Marcher [Fri, 30 Dec 2016 22:13:21 +0000 (23:13 +0100)]
consistent coding style: usage() declaration, eval is a constant

7 years agoMerge pull request #34 from parazyd/master
Aaron Marcher [Fri, 30 Dec 2016 22:01:14 +0000 (23:01 +0100)]
Merge pull request #34 from parazyd/master

refactor vol_perc to not depend on alsa libraries

7 years agoMerge branch 'master' into master
parazyd [Fri, 30 Dec 2016 13:21:19 +0000 (14:21 +0100)]
Merge branch 'master' into master

7 years agoadd vol_perc notes, add braces to singleline statements
parazyd [Fri, 30 Dec 2016 11:16:07 +0000 (12:16 +0100)]
add vol_perc notes, add braces to singleline statements

7 years agowhy releases for such a small project? useless and overhead!
Aaron Marcher [Thu, 29 Dec 2016 22:36:05 +0000 (23:36 +0100)]
why releases for such a small project? useless and overhead!

7 years ago#undef strlcpy not needed anymore
Aaron Marcher [Thu, 29 Dec 2016 22:30:53 +0000 (23:30 +0100)]
#undef strlcpy not needed anymore

7 years agotested wifi
Aaron Marcher [Thu, 29 Dec 2016 22:30:17 +0000 (23:30 +0100)]
tested wifi

7 years agoMerge pull request #32 from R41z/master
Aaron Marcher [Thu, 29 Dec 2016 22:27:57 +0000 (23:27 +0100)]
Merge pull request #32 from R41z/master

several bugfixes and general improvements, see commits below.

7 years agoMerge branch 'master' into master
Aaron Marcher [Thu, 29 Dec 2016 22:27:44 +0000 (23:27 +0100)]
Merge branch 'master' into master

7 years agofix TODO markdown syntax && update
raiz [Thu, 29 Dec 2016 12:37:17 +0000 (15:37 +0300)]
fix TODO markdown syntax && update

7 years agoadd braces to single statements so drkhsh doesn't be upset
raiz [Thu, 29 Dec 2016 09:40:43 +0000 (12:40 +0300)]
add braces to single statements so drkhsh doesn't be upset

7 years agokernel_release() coding style and position in code fix
Aaron Marcher [Wed, 28 Dec 2016 22:59:19 +0000 (23:59 +0100)]
kernel_release() coding style and position in code fix

7 years agorefactor vol_perc to not depend on alsa libraries
parazyd [Tue, 27 Dec 2016 23:41:51 +0000 (00:41 +0100)]
refactor vol_perc to not depend on alsa libraries

7 years agousage(): return success if -h is called && print more appropriate usage, opts can...
raiz [Tue, 27 Dec 2016 17:41:40 +0000 (20:41 +0300)]
usage(): return success if -h is called && print more appropriate usage, opts can't be all called at the same time, that's why a separator is required

7 years agoanother TODO update
raiz [Tue, 27 Dec 2016 17:33:28 +0000 (20:33 +0300)]
another TODO update

7 years agoTODO update
raiz [Tue, 27 Dec 2016 17:32:22 +0000 (20:32 +0300)]
TODO update

7 years agohomepage update
raiz [Tue, 27 Dec 2016 17:20:45 +0000 (20:20 +0300)]
homepage update

7 years agoextern/concat.h: don't segfault if count == 0
raiz [Tue, 27 Dec 2016 17:18:33 +0000 (20:18 +0300)]
extern/concat.h: don't segfault if count == 0

7 years agowhhops, my bad
raiz [Tue, 27 Dec 2016 17:18:09 +0000 (20:18 +0300)]
whhops, my bad

7 years agowifi_essid: add boundary check && prevent the use of direct string literal as a forma...
raiz [Tue, 27 Dec 2016 17:14:45 +0000 (20:14 +0300)]
wifi_essid: add boundary check && prevent the use of direct string literal as a format string in snprintf()

7 years agodon't allow the use of perc if uninitialized
raiz [Tue, 27 Dec 2016 17:09:07 +0000 (20:09 +0300)]
don't allow the use of perc if uninitialized

7 years agoremove misleading comment
raiz [Tue, 27 Dec 2016 16:57:16 +0000 (19:57 +0300)]
remove misleading comment

7 years agoget rid of set_status() since it's only used once
raiz [Tue, 27 Dec 2016 16:56:11 +0000 (19:56 +0300)]
get rid of set_status() since it's only used once

7 years agoallow the use of %* symbols in UNKNOWN_STR
raiz [Tue, 27 Dec 2016 16:53:46 +0000 (19:53 +0300)]
allow the use of %* symbols in UNKNOWN_STR

7 years agoadd extra error tests to swap_*() && fix bytes_read bug
raiz [Tue, 27 Dec 2016 16:49:31 +0000 (19:49 +0300)]
add extra error tests to swap_*() && fix bytes_read bug

7 years agoswap_*(): add more error tests
raiz [Tue, 27 Dec 2016 16:26:04 +0000 (19:26 +0300)]
swap_*(): add more error tests

7 years agofix delay in a cleaner way
raiz [Tue, 27 Dec 2016 16:12:39 +0000 (19:12 +0300)]
fix delay in a cleaner way

7 years agoremove newlines from warn() in swap_*(), those functions already print a newline...
raiz [Tue, 27 Dec 2016 16:07:19 +0000 (19:07 +0300)]
remove newlines from warn() in swap_*(), those functions already print a newline after printing string stderr

7 years agoinititalize run_command()'s buf to UNKNOWN_STR by default
raiz [Tue, 27 Dec 2016 15:58:31 +0000 (18:58 +0300)]
inititalize run_command()'s buf to UNKNOWN_STR by default

7 years agoremove newline character from run_command() output accurately
raiz [Tue, 27 Dec 2016 15:57:27 +0000 (18:57 +0300)]
remove newline character from run_command() output accurately

7 years agostrtok() has no effect on buf && fgets() should have the full buffer length
raiz [Tue, 27 Dec 2016 15:54:16 +0000 (18:54 +0300)]
strtok() has no effect on buf && fgets() should have the full buffer length

7 years agowhhops
raiz [Sun, 18 Dec 2016 07:36:01 +0000 (10:36 +0300)]
whhops

7 years agoremove unused strlcpy() and reduce the size of output buffer
raiz [Sun, 18 Dec 2016 07:35:36 +0000 (10:35 +0300)]
remove unused strlcpy() and reduce the size of output buffer

7 years agoMerge pull request #30 from TheMRod/master
Aaron Marcher [Wed, 16 Nov 2016 20:20:26 +0000 (21:20 +0100)]
Merge pull request #30 from TheMRod/master

Add a "uname -r" feature to see which kernel is running

7 years agoAdd "uname -r" functionality
Mike Coddington [Thu, 3 Nov 2016 16:49:09 +0000 (11:49 -0500)]
Add "uname -r" functionality

7 years agoMerge pull request #25 from jodizzle/dev/swap
Aaron Marcher [Fri, 28 Oct 2016 14:27:19 +0000 (16:27 +0200)]
Merge pull request #25 from jodizzle/dev/swap

Add functions for measuring swap

8 years agoswap: Print UNKNOWN_STR if no swap is allocated
Jody Leonard [Sat, 15 Oct 2016 23:50:02 +0000 (19:50 -0400)]
swap: Print UNKNOWN_STR if no swap is allocated

8 years agoUpdate README.md
Jody Leonard [Sat, 15 Oct 2016 10:49:33 +0000 (06:49 -0400)]
Update README.md

8 years agoEdit config.def.h function descriptions
Jody Leonard [Sat, 15 Oct 2016 10:36:21 +0000 (06:36 -0400)]
Edit config.def.h function descriptions

8 years agoAdd functions for measuring swap
Jody Leonard [Fri, 14 Oct 2016 09:44:46 +0000 (05:44 -0400)]
Add functions for measuring swap