Discussion
Loading...

Discussion

Log in
  • Sign up
  • About
  • Code of conduct
  • Privacy
  • Users
  • Instances
  • About Bonfire
blinry
blinry
@blinry@chaos.social  ·  activity timestamp 3 days ago

Remember the "One Laptop Per Child" project, that developed a low-cost computer for children in developing countries? I was always amazed by a certain feature: The "View Source" button.

When you pressed it, the source code for the currently running application would open. This was supposed to encourage tinkering with the software on your device! <3

I've been pondering what it would take to build that button on modern machines. Has anyone seen something like that?

(Prototype in next toot.)

2 media
A white-and-green laptop with funny antennae, that looks a mix of a toy/handheld console and a small laptop.
A white-and-green laptop with funny antennae, that looks a mix of a toy/handheld console and a small laptop.
A white-and-green laptop with funny antennae, that looks a mix of a toy/handheld console and a small laptop.
Screenshot of the "View source" feature. A window showing Python source files has opened.
Screenshot of the "View source" feature. A window showing Python source files has opened.
Screenshot of the "View source" feature. A window showing Python source files has opened.
  • Copy link
  • Flag this post
  • Block
Aral Balkan
Aral Balkan
@aral@mastodon.ar.al replied  ·  activity timestamp 3 days ago

@blinry @enkiv2 Well there’s one at the bottom of every web site we make and all it takes is a link to a git remote somewhere :)

e.g. see footer of https://kitten.small-web.org/

Might be harder on native/proprietary platforms but I’d love to see this become a pattern that’s embraced on the web.

  • Copy link
  • Flag this comment
  • Block
blinry
blinry
@blinry@chaos.social replied  ·  activity timestamp 3 days ago

You'd roughly need to:

- Figure out which program is currently focused
- Figure out the Git repo of this software
- Clone it into a temporary directory
- Set up the required tools to start hacking on it and compile it

As a quick prototype, I wrote a li'l Bash script that does some of these things. It makes heavy use of #nix and #nixpkgs:

https://codeberg.org/blinry/view-source-button

I enters a "dev shell" with the required tools already in the PATH, and even sets up a Git remote to start contributing. :D

Codeberg.org

view-source-button

A script that allows you to start tinkering with software
  • Copy link
  • Flag this comment
  • Block
blinry
blinry
@blinry@chaos.social replied  ·  activity timestamp 3 days ago

So if you've been wondering why I'm into obscure bugs this week like:

- Figuring out why I'm missing icons in pavucontrol https://chaos.social/@blinry/116081436255395069

- Improving the man page of a Nix CLI helper https://github.com/nix-community/nh/pull/568

- Reporting broken shortcuts in the Firefox DevTools https://bugzilla.mozilla.org/show_bug.cgi?id=2017113

… it was testcases for tying out this "View Source Button". :P

2017113 - Breadcrumbs bar doesn't react to left/right keyboard shortcuts

ASSIGNED (nchevobbe) in DevTools - Inspector. Last updated 2026-02-18.
  • Copy link
  • Flag this comment
  • Block
blinry
blinry
@blinry@chaos.social replied  ·  activity timestamp 3 days ago

It's been fun, it feels like a new superpower to "quickly fix something and send a PR". It's also a super dangerous rabbit hole generator, because now that it's easy to fix stuff, it's very tempting to do so… 🐇

My prototype has some rough edges:

It clones the latest commit, which doesn't always compile using the #nixpkgs setup (but it seems reasonable to check whether the bug is still there).

And invoking the phases of the nixpkgs stdenv manually can be tricky. https://nixos.org/manual/nixpkgs/stable/#sec-building-stdenv-package-in-nix-shell

Nixpkgs Reference Manual

  • Copy link
  • Flag this comment
  • Block
blinry
blinry
@blinry@chaos.social replied  ·  activity timestamp 3 days ago

For myself, ideally, the script would set up a #Nix flake with all dependencies in it, and activate it using direnv. Which would probably mean transforming the nixpkgs package into a flake?

The script could also give you some aliases to run the nixpkgs phases like configure, patch, or build, from your current shell – I like using the fish shell, but the stdenv assumes bash. I haven't found a reasonable way to invoke the phases "in a subshell"… Getting errors like this: https://github.com/NixOS/nix/issues/15282

  • Copy link
  • Flag this comment
  • Block

Bonfire social

This is a bonfire demo instance for testing purposes

Bonfire social: About · Code of conduct · Privacy · Users · Instances
Bonfire social · 1.0.1 no JS en
Automatic federation enabled
Log in Create account
  • Explore
  • About
  • Members
  • Code of Conduct