Re: [dev] [st] wide characters getting cropped

2021-10-26 Thread Ian Liu Rodrigues
On Tuesday, October 26th, 2021 at 17:27, Страхиња Радић  
wrote:
> For me, this patch fixed the glyph truncation:
>
> https://github.com/LukeSmithxyz/st/pull/224
>
> Perhaps someone could add this to the official patches?


Thanks! I will try applying that patch.



Re: [dev] [st] wide characters getting cropped

2021-10-26 Thread NRK
On Tue, Oct 26, 2021 at 07:51:52PM +, Ian Liu Rodrigues wrote:
> I've noticed that in some situations wide characters are being cropped
> on my terminal. The following script, which uses a wide character from
> the "Nerd Font Symbol"[1], shows a test case:
> 
> 
> echo -e '\e[31m \e[0m c'
> echo -e '\e[31m  \e[0mc'
> 

Hi Liu,

I remember having the same problem in ST, however it works fine now.
Looking at my git log I haven't applied any patches for it and even the
upstream branch works fine for me.

This might be related to terminfo (5). I won't be delving any deeper
into this as I've moved over to XTerm long ago due to input latency
reasons. You might want to check FAQ provided in the ST repo.

P.S echo is non-portable. Use printf.
https://wiki.bash-hackers.org/commands/builtin/echo#portability_considerations

- NRK



[dev] [st] wide characters getting cropped

2021-10-26 Thread Ian Liu Rodrigues
Dear all,

This is my first post here after two failed attempts, I think because
of the email being sent as HTML. Lets hope this one goes alright.

I've noticed that in some situations wide characters are being cropped
on my terminal. The following script, which uses a wide character from
the "Nerd Font Symbol"[1], shows a test case:


echo -e '\e[31m \e[0m c'
echo -e '\e[31m  \e[0mc'


Here is a screenshot of the script's output: https://qu.ax/3SBs.png

The only difference between the two echo's is the position where
the foreground color resets: the first resets right after the wide
character, whereas the second resets after the space.

I've hacked a little bit in the source code but couldn't figure out how
st paints the characters. I see in function xdrawglyphfontspecs[2] that
it calls this:

/* Clean up the region we want to draw to. */
XftDrawRect(xw.draw, bg, winx, winy, width, win.ch);

which seems to clear the character rectangle unconditionally, but then
shouldn't the second echo also crop?

Kind regards,
Ian L. Rodrigues

[1]: 
https://raw.githubusercontent.com/ryanoasis/nerd-fonts/d0bf73a19c3459aab39734a05159e2694911d7d6/src/glyphs/Symbols-2048-em%20Nerd%20Font%20Complete.ttf

[2]: https://git.suckless.org/st/file/x.c.html#l1453




Re: [dev] Whether a css selector applies to given html surf code

2021-10-26 Thread Sagar Acharya



> On 21/10/26 04:48, Sagar Acharya wrote:
>
>> That's a bit more primitive. It can go a bit more vibrant wrt fonts, colors,
>> break points for mobile, tablet which would still be minimal in my view. I'm
>> approaching such simplicity from the other complex end which most people
>> prefer, unfortunately.
>>
>
> These are the web pages of some of the giants of computing:
>
> https://www-cs-faculty.stanford.edu/~knuth/
> https://www.w3.org/People/Berners-Lee/
> https://www.bell-labs.com/usr/dmr/www/
> http://www.wall.org/~larry/
> https://www.cs.helsinki.fi/u/torvalds/
> https://stallman.org/
>
> Notice anything they have in common?
>
> Modern web is a perversion of what it once was - a simple environment to
> represent hypertext. Years of cruft and overengineering have lead to a bloated
> mess we have today. Things like Gemini
>
> https://gemini.circumlunar.space/
>
> have risen recently precisely to address this problem.
>
I don't think protocol is the problem. I think complexity of html, css, 
javascript is. I read DOM and I found it to be just a bit too complex.

> Suckless movement is not about conformism, about "going with the flow" of what
> "most people prefer". On the contrary, it is about shaking up the core values 
> of
> mainstream computing.
>
> Take dmenu as an example. Its most well known use is to launch programs from 
> the
> script dmenu_run. Its counterpart in the traditional GUI would be eye candy
> icons or shortcut buttons on some panel. When first confronted with such
> concept, "most people" will find it "primitive" and even outlandish. However, 
> if
> some thought is given to understanding why it is made that way, one inevitably
> starts to see the genius of the concept and why it is much better than 
> clicking
> an icon or a button with a mouse.
>
> Surf is a necessary evil to be able to access the modern web. For new websites
> however, anyone who finds value in the suckless principles should actively 
> work
> on reverting the web to a sane state it was in some 20+ years ago.
>
> I suggest starting by making websites one creates viewable and readable in:
>
> - NetSurf
> - links
>
People like what they feel. Majority of people out there aren't coders. 
Majority of coders just code to earn and would gladly just accept what their 
company pushes to them. These people just like convenience. As much as we'd 
like them to accept a bit of pain for minimalist and simple code, I don't think 
they'd go beyond a certain point.

I'm using dwm, st, dmenu, surf since quite some time. However, I don't think we 
should ever expect a majority to shift towards window managers. They will use 
desktop environments. Most people would never even know in their lifetimes what 
processes are and won't appreciate the beauty of having less than 20 processes 
running with 150MB of RAM on a lean OS.

I myself am a dev at Hyperbola OS which I think is the purest today. I use 
above suckless softwares. Recently, I bought PinePhone and tried out sxmo which 
I'm sure y'all must be excited about. I use mobian with phosh (gnome DE fork 
for pinephone) which is still pretty difficult to use relative to Android. I 
use Pixelfed and am off Instagram, WhatsApp, Facebook. I host my website on 
OSHW Olimex Lime2 with just Free software. But sadly, this purity ain't working 
folks. There are not a lot of people whom I've been able to bring on my side. 
It's too difficult for them! I ask them to chat with me on Telegram and out of 
ego, they don't!

I don't comply with everything but the direction is to incentivize most people 
towards simplicity. 20 years ago, sites were ugly. Today sites are beautiful, 
but as you said too complex. Some fools even import html and css with 
javascript! :D . Choosing js free sites, creating js free sites as alternatives 
for js sites, without compromising much with looks, UX and animation is what 
must be done in my view. I think CSS is harmless. JS has some very bad 
fingerprinting characteristics.

Somethings work different to the way we want them to work. And the sad reality 
is, majority people are never gonna accept simplicity as a trade off for 
convenience. I think keeping convenience the same while making things simple is 
the way forward. I love suckless but this is where I differ a bit.

Thanking you
Sagar Acharya
https://designman.org




Re: [dev] [st] wide characters getting cropped

2021-10-26 Thread Страхиња Радић
n 21/10/26 07:51, Ian Liu Rodrigues wrote:
> echo -e '\e[31m \e[0m c'
> echo -e '\e[31m  \e[0mc'
>
>
> Here is a screenshot of the script's output: https://qu.ax/3SBs.png

For me, this patch fixed the glyph truncation:

https://github.com/LukeSmithxyz/st/pull/224

Perhaps someone could add this to the official patches?


signature.asc
Description: PGP signature


Re: [dev] Whether a css selector applies to given html surf code

2021-10-26 Thread Sagar Acharya



> On Tue, Oct 26, 2021 at 07:35:01AM +0200, Sagar Acharya wrote:
>
>> I assume you mean writing css straight into html file itself. Kamitkami is 
>> not meant for css that we write. One can use if one uses 1 single style file 
>> which turns gigantic when used across many html files.
>> It's meant for using css frameworks like cirrus. I use cirrus by stanley lim 
>> and it's gigantic. I don't want most elements in the css which I include.
>> Thanking you
>> Sagar Acharya
>> https://designman.org
>>
>> Oct 26, 2021, 04:56 by n...@disroot.org:
>>
>> > On Mon, Oct 25, 2021 at 08:36:31PM +0200, Sagar Acharya wrote:
>> >
>> >> I'm making this software called kamitkami. It's a python script which 
>> >> takes 2 inputs foo.html and bar.css and outputs a css file named 
>> >> bar_foo.css which contains only the css which applies to the particular 
>> >> html page . This will make css extremely minimal and page loading faster.
>> >>
>> >
>> > Wouldn't it make more sense to just inline the css into the html
>> > instead? I think Dylan was doing that for K1SS.
>> > https://archive.md/dFqxv
>> >
>> > - NRK
>> >
>>
>
> Hi,
>
> One solution can be not using CSS frameworks and just write it by hand. It is
> not hard to do, creates cleaner files and improves understanding of CSS.
>
It's very hard to implement layout, break points, etc. Flexboxes are a bit 
difficult to handle.

> Many years ago I wrote a small snippet:
> https://www.codemadness.org/query-unused-css-rules-on-current-document-state.html
>
Nice. Today, js code would be much simpler  
document.querySelector(selector_string)   in JS. I don't know how to run js 
code and make both communicate.

> There are also options for it in the inspectors in the browsers now.
>
> Note that in the ugly web world for example it could need some ugly event and
> execute Javascript and insert some ugly DOM element which is used in the CSS
> (so you need to manually test for that). Otherwise it would be marked as not
> used.
>
Yes, that would be very difficult. I will definitely not target that right now.

> -- 
> Kind regards,
> Hiltjo
>
Thanks folks.

Страхиња Радић , 
That's a bit more primitive. It can go a bit more vibrant wrt fonts, colors, 
break points for mobile, tablet which would still be minimal in my view. I'm 
approaching such simplicity from the other complex end which most people 
prefer, unfortunately.

Teodoro,
I typically approach suckless community with anything minimal. I get the best 
suggestions here. As I point out above, it can be done in 1 line in JS. I used 
BeautifulSoup4 and the code is complete. However, the selector detection isn't 
implemented well in bs4 so I'll have to improve. I checked python-gobject, js 
implementations like requests-html.

Thanks everyone
Sagar Acharya
https://designman.org

P.S. Kamitkami alpha is out! :D



Re: [dev] Whether a css selector applies to given html surf code

2021-10-26 Thread Страхиња Радић
On 21/10/26 08:32, Sagar Acharya wrote:
> People like what they feel. Majority of people out there aren't coders.
> Majority of coders just code to earn and would gladly just accept what their
> company pushes to them. These people just like convenience. As much as we'd
> like them to accept a bit of pain for minimalist and simple code, I don't
> think they'd go beyond a certain point.
[...]
> Somethings work different to the way we want them to work. And the sad reality
> is, majority people are never gonna accept simplicity as a trade off for
> convenience. I think keeping convenience the same while making things simple
> is the way forward. I love suckless but this is where I differ a bit.

I believe we already had a similar conversation back in August and April. Here's
my reply from August:

==

On 21/08/07 02:54, Sagar Acharya wrote:
> This is where I diverge from suckless, suckless goes for hardcore minimalistic
> software at cost of user experience. 

Wrong. I'd argue that the "user experience" in most programs that suck is worse
than the "user experience" using suckless programs. That's one of the reasons we
call them like that - "programs that suck" and "suckless programs".

I believe we already discussed this about four months back.


>Addicted to almost all software out
> there like WhatsApp, Facebook, and many more things, most are never gonna use
> stuff like dwm. And things like Windows would keep them there. I myself
> use dwm, hyperbola OS, but suggesting it to common people wouldn't be
> wise. They'll switch back to Windows, and this time maybe forever.

And?

This sense of urgency and worry about the size of the userbase seems to be tied
to "software development" inside (big tech) corporations. They add (or remove)
features to software guided by statistical analysis of the target audience with
the aim of supporting what is perceived to generate the most profit, not by the
program's purpose or any other reason. Suckless movement is not a corporation.
It is a gathering of programmers writing software for themselves and others who
value the principles of simplicity and quality in software.

If anyone wants to use other software, by all means they should. There's nothing
wrong with that, but on the other side, that shouldn't influence suckless
programs.


signature.asc
Description: PGP signature


Re: [dev] Whether a css selector applies to given html surf code

2021-10-26 Thread Страхиња Радић
On 21/10/26 05:22, Nick wrote:
> Quoth Страхиња Радић:
> > This is what a web page should be:
> > 
> > http://motherfuckingwebsite.com/
> 
> When I load that in tor browser with js disabled (my default setup 
> these days), I get a 20741 byte page with the title "Captcha" and no 
> content except an eternally rotating image.
> 
> The web is beyond saving.

Yeah, it seems it sadly includes Gogole Analytics JS at the end after all:



Re: [dev] Whether a css selector applies to given html surf code

2021-10-26 Thread Страхиња Радић
On 21/10/26 04:48, Sagar Acharya wrote:
> That's a bit more primitive. It can go a bit more vibrant wrt fonts, colors,
> break points for mobile, tablet which would still be minimal in my view. I'm
> approaching such simplicity from the other complex end which most people
> prefer, unfortunately.

These are the web pages of some of the giants of computing:

https://www-cs-faculty.stanford.edu/~knuth/
https://www.w3.org/People/Berners-Lee/
https://www.bell-labs.com/usr/dmr/www/
http://www.wall.org/~larry/
https://www.cs.helsinki.fi/u/torvalds/
https://stallman.org/

Notice anything they have in common?

Modern web is a perversion of what it once was - a simple environment to
represent hypertext. Years of cruft and overengineering have lead to a bloated
mess we have today. Things like Gemini

https://gemini.circumlunar.space/

have risen recently precisely to address this problem.

Suckless movement is not about conformism, about "going with the flow" of what
"most people prefer". On the contrary, it is about shaking up the core values of
mainstream computing.

Take dmenu as an example. Its most well known use is to launch programs from the
script dmenu_run. Its counterpart in the traditional GUI would be eye candy
icons or shortcut buttons on some panel. When first confronted with such
concept, "most people" will find it "primitive" and even outlandish. However, if
some thought is given to understanding why it is made that way, one inevitably
starts to see the genius of the concept and why it is much better than clicking
an icon or a button with a mouse.

Surf is a necessary evil to be able to access the modern web. For new websites
however, anyone who finds value in the suckless principles should actively work
on reverting the web to a sane state it was in some 20+ years ago.

I suggest starting by making websites one creates viewable and readable in:

- NetSurf
- links


signature.asc
Description: PGP signature


Re: [dev] Whether a css selector applies to given html surf code

2021-10-26 Thread Nick
Quoth Страхиња Радић:
> This is what a web page should be:
> 
> http://motherfuckingwebsite.com/

When I load that in tor browser with js disabled (my default setup 
these days), I get a 20741 byte page with the title "Captcha" and no 
content except an eternally rotating image.

The web is beyond saving.



Re: [dev] Whether a css selector applies to given html surf code

2021-10-26 Thread Teodoro Santoni
2021-10-25 20:36 GMT+02:00, Sagar Acharya :
> Hello,
>
> I'm making this software called kamitkami. It's a python script which takes
> 2 inputs foo.html and bar.css and outputs a css file named bar_foo.css which
> contains only the css which applies to the particular html page . This will
> make css extremely minimal and page loading faster.
>
> This code is incomplete yet and I need someone help from surf developers. I
> have the css selectors in a python list, corresponding blocks in another
> list. I also have the html as a string. I think surf must detect whether a
> particular css selector applies to an html string or not. If someone can
> help me on how to do it (what code applies?), or contribute to kamitkami on
> the link below, I'd be grateful.
>
> I'm thinking along the lines of submitting list and html as input to some
> subpart of compiled surf code with os module of python and getting back a
> list of only css selector which applies.
> Thanking you
> Sagar Acharya

This is not suckless, this is webshit.
Any browser with js can do that, I was thinking of a solution but on
stackoverflow is already provided, it seems [0].
To automate the part where you feed your pieces to a browser, you can
contribute a patch for running surf in headless mode.
You're developing in python already so for the time being can probably
succeed with Splash[1] or kicking raw strings to playwright.

[0] https://stackoverflow.com/a/22638396
[1] https://github.com/scrapinghub/splash



Re: [dev] Whether a css selector applies to given html surf code

2021-10-26 Thread Страхиња Радић
This is what a web page should be:

http://motherfuckingwebsite.com/

This is less minimal, more readable, but still not plagued by "frameworks" and
"web coding" (uggh!). This is as far as web should go, ideally:

http://bettermotherfuckingwebsite.com/

There is nothing to gain from "minifying" CSS, just lose on readability by a
human.


signature.asc
Description: PGP signature


Re: [dev] Whether a css selector applies to given html surf code

2021-10-26 Thread Sagar Acharya
I assume you mean writing css straight into html file itself. Kamitkami is not 
meant for css that we write. One can use if one uses 1 single style file which 
turns gigantic when used across many html files.
It's meant for using css frameworks like cirrus. I use cirrus by stanley lim 
and it's gigantic. I don't want most elements in the css which I include.
Thanking you
Sagar Acharya
https://designman.org

Oct 26, 2021, 04:56 by n...@disroot.org:

> On Mon, Oct 25, 2021 at 08:36:31PM +0200, Sagar Acharya wrote:
>
>> I'm making this software called kamitkami. It's a python script which takes 
>> 2 inputs foo.html and bar.css and outputs a css file named bar_foo.css which 
>> contains only the css which applies to the particular html page . This will 
>> make css extremely minimal and page loading faster.
>>
>
> Wouldn't it make more sense to just inline the css into the html
> instead? I think Dylan was doing that for K1SS.
> https://archive.md/dFqxv
>
> - NRK
>




Re: [dev] Whether a css selector applies to given html surf code

2021-10-26 Thread Hiltjo Posthuma
On Tue, Oct 26, 2021 at 07:35:01AM +0200, Sagar Acharya wrote:
> I assume you mean writing css straight into html file itself. Kamitkami is 
> not meant for css that we write. One can use if one uses 1 single style file 
> which turns gigantic when used across many html files.
> It's meant for using css frameworks like cirrus. I use cirrus by stanley lim 
> and it's gigantic. I don't want most elements in the css which I include.
> Thanking you
> Sagar Acharya
> https://designman.org
> 
> Oct 26, 2021, 04:56 by n...@disroot.org:
> 
> > On Mon, Oct 25, 2021 at 08:36:31PM +0200, Sagar Acharya wrote:
> >
> >> I'm making this software called kamitkami. It's a python script which 
> >> takes 2 inputs foo.html and bar.css and outputs a css file named 
> >> bar_foo.css which contains only the css which applies to the particular 
> >> html page . This will make css extremely minimal and page loading faster.
> >>
> >
> > Wouldn't it make more sense to just inline the css into the html
> > instead? I think Dylan was doing that for K1SS.
> > https://archive.md/dFqxv
> >
> > - NRK
> >
> 
> 

Hi,

One solution can be not using CSS frameworks and just write it by hand. It is
not hard to do, creates cleaner files and improves understanding of CSS.

Many years ago I wrote a small snippet:
https://www.codemadness.org/query-unused-css-rules-on-current-document-state.html

There are also options for it in the inspectors in the browsers now.

Note that in the ugly web world for example it could need some ugly event and
execute Javascript and insert some ugly DOM element which is used in the CSS
(so you need to manually test for that). Otherwise it would be marked as not
used.

-- 
Kind regards,
Hiltjo