Commit Graph

259 Commits

Author SHA1 Message Date
Přemysl Eric Janouch 1c37b15253
X11: improve rendering of denormalized text
Xft is dumb.
2022-08-23 10:35:28 +02:00
Přemysl Eric Janouch 2803a8153b
X11: clean up after Xft on exit 2022-08-23 09:00:20 +02:00
Přemysl Eric Janouch f1ab0e2d8a
X11: use input methods, abandon xkbcommon
And fix a redundant XCreatePixmap() call leaking resources.
2022-08-23 08:42:38 +02:00
Přemysl Eric Janouch 830a744a11
Add an X11 user interface
This is meant to exactly mimic the terminal UI, just without
the restriction to ugly monospace fonts.

The Curses implementation has been reworked, and may have become
more computationally expensive.  In general, though, the codebase
has been significantly cleaned up.
2022-08-23 02:50:24 +02:00
Přemysl Eric Janouch 8260842aef
Fix event processing with PulseAudio integration 2022-08-19 23:48:33 +02:00
Přemysl Eric Janouch fe017b4daa
Mark an invalid assumption 2022-08-18 19:56:47 +02:00
Přemysl Eric Janouch f3c4cec24a
Add and bind an action to center the cursor
"z" stands for VIM's "zz".
2021-12-23 20:36:00 +01:00
Přemysl Eric Janouch 410136a647
Fix up coding style inconsistency 2021-12-21 06:26:53 +01:00
Přemysl Eric Janouch 48482ef2e5
Make incremental search more useful
Make it unanchored, as well as case-insensitive.
2021-12-21 05:46:22 +01:00
Přemysl Eric Janouch a14a907b18
Indicate that a stream download is in progress 2021-12-08 18:58:03 +01:00
Přemysl Eric Janouch 333049de01
Do not run cURL fully synchronously
The improvement is very minor in character.
2021-12-08 18:23:30 +01:00
Přemysl Eric Janouch 4e3596db35
Add rudimentary incremental search facility 2021-12-08 17:23:25 +01:00
Přemysl Eric Janouch 5aa07fd8af
Clean up mpd_process_info() better 2021-12-07 20:38:02 +01:00
Přemysl Eric Janouch 2060da4a8e
Do not jump to beginning after unqueueing
Instead, assume that the whole previously selected range
has been removed, and try to go after or before it accordingly.
2021-12-07 20:34:32 +01:00
Přemysl Eric Janouch f5b5cec340
Clean up unreadable code 2021-12-07 20:10:35 +01:00
Přemysl Eric Janouch 227b8e0fa2
Do not show both volumes if unnecessary
Also, make it apparent which value comes from where.
2021-11-16 04:48:52 +01:00
Přemysl Eric Janouch 32203f8117
Fix the comment for settings.pulseaudio 2021-11-08 07:23:08 +01:00
Přemysl Eric Janouch 4598c45d2f
Generate actions from a text file
Mostly because I wanted to nest preprocessing.

This makes the build more complex and slightly less portable,
but the code itself is much cleaner.
2021-11-08 06:07:04 +01:00
Přemysl Eric Janouch 7165a8eb02
Add ability to control PulseAudio volume
I know, son, it might be hard to accept,
but you're imported.  Your true parents are wmstatus
and paswitch, from the desktop-tools family.

Also, fix unnecessary linking of optional dependencies.
2021-11-07 23:07:55 +01:00
Přemysl Eric Janouch 87b57bb24c
Add a comment about the music directory 2021-11-07 13:29:13 +01:00
Přemysl Eric Janouch 6de940fe96
Do not beep on focus changes 2021-11-04 13:24:15 +01:00
Přemysl Eric Janouch 6bd8c1db2f
CMakeLists.txt: fix macOS build 2021-11-02 17:17:32 +01:00
Přemysl Eric Janouch bd0ee66c19
Add clang-format configuration 2021-10-30 03:02:00 +02:00
Přemysl Eric Janouch 53fbb3dec1
Fix the line editor/spectrum analyser interaction
The updater assumed the terminal cursor was invisible.
2021-10-21 09:13:07 +02:00
Přemysl Eric Janouch 267598643a
Add program arguments to MPD's current playlist
I was tired of using `mpv --no-video`, this is a bit better.

It's all rather quirky, but very little code is involved.

I've added a few related TODO entries.
2021-09-07 06:35:24 +02:00
Přemysl Eric Janouch fba1210e9f
Clean up connection initialisation
Also, do not set up the spectrum visualiser before a password is sent.

It would look a bit weird to have it run but display "Disconnected",
even though technically, it would probably work.
2021-09-06 21:48:27 +02:00
Přemysl Eric Janouch 30777e8fd3
Improve terminal initialisation
Don't just abort() on failures, print a proper error message.

Also, set up ncurses as late as possible.  This should be alright wrt.
signal handlers according to ncurses code, as well as XSI:

> Curses implementations may provide for special handling of
> the SIGINT, SIGQUIT and SIGTSTP signals if their disposition
> is SIG_DFL at the time initscr is called ...

termo blocks job control, so SIGTSTP is not a concern at all.
2021-09-06 21:30:03 +02:00
Přemysl Eric Janouch 353174ee3c
Spetrum analyser: expand my favourite comment 2021-07-09 20:08:53 +02:00
Přemysl Eric Janouch 2d641d087f
Spectrum analyser: add some useful comments 2021-07-09 06:25:48 +02:00
Přemysl Eric Janouch 20c8385f2e
Spectrum analyser: optimise the x:16:2 case
nncmpp CPU usage went from 2 to 1.7 percent, a 15% improvement.

Sort of worth it, given that it's a constant load.

The assembly certainly looks nicer.
2021-07-08 19:14:26 +02:00
Přemysl Eric Janouch fa4443a3ce
Rectify an obsolete comment 2021-07-08 04:33:03 +02:00
Přemysl Eric Janouch 14ba637d4b
Expand the last comment once again 2021-07-08 04:32:53 +02:00
Přemysl Eric Janouch 66bc3f1c2c
Expand the comment on spectrum frequency filtering 2021-07-05 23:42:51 +02:00
Přemysl Eric Janouch 0646cea126
Silence a compiler warning
The statement can be eliminated, then it suggests braces.
2021-07-05 01:26:16 +02:00
Přemysl Eric Janouch a439a56ee9
Add an optional spectrum visualiser
This is really more of a demo.  It's doable, just rather ugly.

It would deserve some further tuning, if anyone cared enough.
2021-07-05 01:10:46 +02:00
Přemysl Eric Janouch 120a11ca1b
Update a comment about mouse modes
We might even depend on termo now more than is stated.
2021-07-04 10:23:37 +02:00
Přemysl Eric Janouch 7e531e95c5
Process focus events
Should help prevent accidents in other windows.
2021-06-29 05:28:54 +02:00
Přemysl Eric Janouch ba122b7672
Minor clarifications 2020-11-05 01:47:05 +01:00
Přemysl Eric Janouch e86f4b6908
Comment the "poll_elapsed_time" option 2020-10-24 15:44:12 +02:00
Přemysl Eric Janouch 26b6b1f902
Show song duration in the library
Ideally we'd make columns configurable, which isn't trivial.

This brings the "Current" and "Library" tabs closer together.

Closes #2
2020-10-24 14:58:53 +02:00
Přemysl Eric Janouch 8121046be6
Skip playlists in lsinfo responses
Instead of merging the fields into other items.
2020-10-24 14:58:48 +02:00
Přemysl Eric Janouch 0dc29a3e2d
Refactor the library tab, track duration
The `struct strv` was clunky, it's better to store items
directly in the format we use for all processing.
The additional memory cost is negligible.
2020-10-24 14:55:25 +02:00
Přemysl Eric Janouch 791c000791
Use '-' instead of '?' for unknown duration
It is less distracting.

Also use mpd_read_time() and load "duration" as well.
This value isn't rounded to whole seconds, so we load
it before "time" as a fail-safe measure.
2020-10-24 14:54:17 +02:00
Přemysl Eric Janouch c0119027b1
Improve the MPD time parser
- reject negative values, which strtoul() happily accepts
 - deal with an arbitrary number of decimal digits
 - don't return milliseconds when we fail to parse seconds
2020-10-24 14:54:12 +02:00
Přemysl Eric Janouch 3934d9b1f9
Bind M-Up to the "up" action
Taken from Windows Explorer, which abandoned the Backspace binding.
2020-10-23 03:33:26 +02:00
Přemysl Eric Janouch 2d3909fdd1
Cleanup
No functional change.
2020-10-23 02:57:34 +02:00
Přemysl Eric Janouch b6ce8a0913
Avoid jumping around in polling mode
While still avoiding busy loops.

It works well enough to enable this by default.

Closes #1
2020-10-23 02:42:18 +02:00
Přemysl Eric Janouch 9928eca274
Add a comment and update another one 2020-10-18 21:09:03 +02:00
Přemysl Eric Janouch 6c2ae2f6bb
Give up and implement elapsed time polling
Playback may sometimes stall but it won't produce any events.

This popular workaround likes to jump around, though.
It might be a good idea to use some kind of hybrid approach.

Therefore this is disabled by default so far.

Updates #1
2020-10-18 07:28:14 +02:00
Přemysl Eric Janouch b3579d1128
Explain the ticking mechanism
Took time to read.  Also fix an invalid comment.
2020-10-18 05:57:44 +02:00
Přemysl Eric Janouch 525e952753
Bump liberty and termo 2020-10-10 21:31:31 +02:00
Přemysl Eric Janouch 8707b38c48
Make direct SHOUTcast streams work again
Might be an issue specific to my bbc-on-ice, since we're not asking
for SHOUTcast by including "Icy-MetaData: 1" in request headers
but the proxy always outputs an "ICY 200 OK" header.
2020-10-10 14:48:22 +02:00
Přemysl Eric Janouch 7af041ac01
Remove unnecessary quotes from macro definitions
The behaviour is defined by the standard.
2020-09-20 13:18:07 +02:00
Přemysl Eric Janouch e21699ab47
Support iterating tabs with C-PgUp/Down and C-Left/Right 2020-09-07 18:15:39 +02:00
Přemysl Eric Janouch d124f43cf6
Support vi-like scrolling with C-y and C-e 2020-08-01 14:06:17 +02:00
Přemysl Eric Janouch 0e2a050c4f
Name change 2020-08-01 14:04:10 +02:00
Přemysl Eric Janouch 6c1546e919
Workaround cURL bug 2019-02-24 01:41:15 +01:00
Přemysl Eric Janouch cdb86652b9
Fix unmarking behaviour, cleanup 2018-10-29 15:04:22 +01:00
Přemysl Eric Janouch cbdec0552d
Allow moving multiple items in the Current tab 2018-10-29 14:45:25 +01:00
Přemysl Eric Janouch 2cd100af7a
Remove an outdated comment 2018-10-29 13:44:43 +01:00
Přemysl Eric Janouch 44ebc3591e
Make holding Shift+Up/Down behave better 2018-10-29 13:42:39 +01:00
Přemysl Eric Janouch 0691c533b4
Update selection on playlist changes 2018-10-29 13:22:56 +01:00
Přemysl Eric Janouch 6298235e22
Add actions for repeat/random/single/consume
Now the user can at least toggle them from the help tab,
or even bind them as necessary.
2018-10-29 09:58:43 +01:00
Přemysl Eric Janouch 841e2f79c0
Make help tab items actionable 2018-10-29 09:46:45 +01:00
Přemysl Eric Janouch 5ade0f082e
Show unbound actions in help 2018-10-29 09:19:34 +01:00
Přemysl Eric Janouch a6543a796d
Implement multiselect for deletion in Current tab 2018-10-21 05:11:20 +02:00
Přemysl Eric Janouch 1349e39941
Add keyboard shortcut d for deletion
As in vi(1).
2018-10-21 05:10:04 +02:00
Přemysl Eric Janouch f7e4d8d3d3
Add keyboard shortcuts g/G for goto top/bottom
As in less(1).
2018-10-21 04:20:06 +02:00
Přemysl Eric Janouch 8f362e787b
Add a search feature for Library tab 2018-10-21 04:17:05 +02:00
Přemysl Eric Janouch 609ddfab22
Cleanup 2018-10-20 22:22:26 +02:00
Přemysl Eric Janouch 804f051d66
Implement sequential multiselect for Library tab 2018-10-20 22:22:26 +02:00
Přemysl Eric Janouch 3c09a16a02
Fix input handling
When app_process_termo_event() returns false, it always means to beep,
not to quit the application.
2018-10-20 22:13:33 +02:00
Přemysl Eric Janouch 9c16ab4136
Mark an issue for later 2018-10-20 22:13:32 +02:00
Přemysl Eric Janouch f241a7016a
Move the line editor into its own file
Trying to make it reusable in other projects.
2018-10-20 22:13:32 +02:00
Přemysl Eric Janouch e957bba771
Use a common algorithm for scrollbars
Let's have reasonable behaviour with Unicode one as well.
2018-10-20 04:27:35 +02:00
Přemysl Eric Janouch 3fd88d593c
Improve fallback scrollbar behaviour 2018-10-20 02:51:09 +02:00
Přemysl Eric Janouch caba65b2bc
Bind the </> keys to previous/next
As in mpv.
2018-09-26 04:02:35 +02:00
Přemysl Eric Janouch 9b38c4c74f
Fix undefined behaviour 2018-07-21 23:36:13 +02:00
Přemysl Eric Janouch 7f8ad9430f
Relicense to 0BSD, update mail address
I've come to the conclusion that copyright mostly just stands in the way
of software development.  In my jurisdiction I cannot give up my own
copyright and 0BSD seems to be the closest thing to public domain.

The updated mail address, also used in my author/committer lines,
is shorter and looks nicer.  People rarely interact anyway.
2018-06-24 04:29:24 +02:00
Přemysl Eric Janouch 0f350f88b3
Cleanup 2017-06-27 04:35:02 +02:00
Přemysl Eric Janouch a1831a3ab8
Reorganize actions 2017-06-27 04:31:08 +02:00
Přemysl Eric Janouch 021bc214a3
Improve the Help tab
There are now up to three bindings per action by default, so grouping
is desirable.  We can even follow the more or less logical order given
by enumeration values.

It should be much easier to find what you need.
2017-06-27 04:31:08 +02:00
Přemysl Eric Janouch 23efe3bfdf
Cleanup 2017-06-27 04:31:08 +02:00
Přemysl Eric Janouch 4bb9b11fed
Customizable key bindings 2017-06-27 04:31:04 +02:00
Přemysl Eric Janouch 2375e0dd3e
Make Del/Bksp eat whole graphemes
Tested on some zalgo text.
2017-06-26 04:54:56 +02:00
Přemysl Eric Janouch 7d414c7647
Make left/right skip non-spacing characters 2017-06-26 04:19:42 +02:00
Přemysl Eric Janouch 33f5ba0b60
Allow running arbitrary MPD commands 2017-06-26 03:51:53 +02:00
Přemysl Eric Janouch 4261c81468
Teach the line editor to scroll + prompt 2017-06-26 03:50:29 +02:00
Přemysl Eric Janouch 6b2def7531
Clean up the line editor 2017-06-26 01:59:55 +02:00
Přemysl Eric Janouch 9fc690c4c9
Cache widths in the line editor 2017-06-26 01:48:38 +02:00
Přemysl Eric Janouch ba3302982e
Basic implementation of a line editor
Not yet used anywhere.
2017-06-26 00:01:24 +02:00
Přemysl Eric Janouch f71eee66bd
Rename item_list_{init,make}() 2017-06-23 00:20:08 +02:00
Přemysl Eric Janouch 3ff7867e30
Bump liberty 2017-06-23 00:20:08 +02:00
Přemysl Eric Janouch 99f35a509c
Handle weird playlists better 2017-06-22 21:25:52 +02:00
Přemysl Eric Janouch 88455f03bf
Cleanup 2017-06-13 17:06:31 +02:00
Přemysl Eric Janouch d0c0af0e38
Allow modifying playlist order 2017-06-05 22:19:39 +02:00
Přemysl Eric Janouch c5fcc1c8c1
More beeping 2017-06-05 22:19:12 +02:00
Přemysl Eric Janouch 7f66f801f4
Give up on freeing tab resources 2017-06-05 21:34:50 +02:00
Přemysl Eric Janouch 1dbece753e
Auto-resume playback on replace 2017-06-05 21:20:31 +02:00
Přemysl Eric Janouch 19605f9b7b
Use song IDs when available 2017-06-05 20:54:50 +02:00