For fun: edit source button
- Vous devez vous identifier ou créer un compte pour écrire des commentaires
So you may be familiar with OLPC's view source button:
https://wiki.laptop.org/go/View_source
I recall reading awhile ago some blog was talking about an edit source button with reference to OLPC, some package manager Google uses in house, and what not. Unfortunately I can't find that blogpost now. Anyways I decided to make one.
=================================================================================
#!/bin/sh
id=$(xprop _NET_WM_PID | sed "s/.*= //g")
package=$(dpkg -S "$(command -v "$(cat /proc/"$id"/comm)")" | sed "s/:.*//g")
if [ ! -d ~/mypackages/ ]; then
mkdir ~/my-packages/
fi
chdir ~/my-packages/
apt source "$package"
if [ ! -f ~/my-packages/build.sh ]; then
printf "#!/bin/sh\ndebuild -us -uc -b" > ~/my-packages/build.sh
chmod +x ~/my-packages/build.sh
fi
if [ ! -f ~/my-packages/install.sh ]; then
printf "#!/bin/sh\nsudo apt-get install ./*.deb" > ~/my-packages/install.sh
chmod +x ~/my-packages/install.sh
fi
=================================================================================
All you do is have this shell script added to a shortcut, press the key, click on any given window, and the script will download the source code of the program and include two shell scripts, build and install, make your changes then press build, then install.
Note: this only works on things installed with dpkg (apt), not guix, flatpaks, or standalone binaries.