AlynxZhou / showmethekey

Show keys you typed on screen.
https://showmethekey.alynx.one/
Apache License 2.0
329 stars 26 forks source link

/usr/local #27

Closed DuckDuckWhale closed 1 year ago

DuckDuckWhale commented 1 year ago

It would be great if there is a build option to install into /usr/local instead of /usr, as mentioned in https://unix.stackexchange.com/questions/8656/usr-bin-vs-usr-local-bin-on-linux:

/usr/local/bin is for normal user programs not managed by the distribution package manager, e.g. locally compiled packages. You should not install them into /usr/bin because future distribution upgrades may modify or delete them without warning.

Here's the commands that I came up with, but somehow when I click the toggle button to turn it on, it snaps back and the window flashes.

sudo cp build/showmethekey-cli /usr/local/bin/ -i
sudo cp build/showmethekey-gtk /usr/local/bin/ -i
mkdir -p /usr/loal/share/locale/zh_CN/LC_MESSAGES
sudo cp showmethekey-gtk/po/zh_CN/LC_MESSAGES/showmethekey.mo \
    /usr/local/share/locale/zh_CN/LC_MESSAGES
sudo mkdir -p /usr/local/share/licenses/showmethekey/
sudo cp LICENSE to /usr/local/share/licenses/showmethekey/
sudo mkdir /usr/local/share/icons/hicolor/128x128/apps -p
sudo cp dists/icons/128x128/one.alynx.showmethekey.png /usr/local/share/icons/hicolor/128x128/apps
sudo mkdir /usr/local/share/icons/hicolor/64x64/apps -p
sudo cp dists/icons/64x64/one.alynx.showmethekey.png /usr/local/share/icons/hicolor/64x64/apps
sudo mkdir -p /usr/local/share/icons/hicolor/scalable/apps
sudo mkdir -p /usr/local/share/glib-2.0/schemas
sudo cp dists/one.alynx.showmethekey.gschema.xml /usr/local/share/glib-2.0/schemas
sudo cp dists/one.alynx.showmethekey.metainfo.xml /usr/local/share/metainfo
sudo mkdir -p /usr/local/share/applications
sudo cp build/one.alynx.showmethekey.desktop /usr/local/share/applications
sudo cp build/one.alynx.showmethekey.policy /usr/share/polkit-1/actions
sudo sed -i 's|/usr/bin/|/usr/local/bin/|' \
    /usr/local/share/applications/one.alynx.showmethekey.desktop \
    /usr/share/polkit-1/actions/one.alynx.showmethekey.policy
sudo /usr/bin/glib-compile-schemas /usr/local/share/glib-2.0/schemas
sudo /usr/bin/gtk4-update-icon-cache -f -t /usr/local/share/icons/hicolor
sudo update-desktop-database /usr/local/share/applications

By the way, providing a list of dependency names could really help building from source. Here's the packages that I installed on Ubuntu 23.04:

apt install -y git meson pkg-config libevdev-dev libudev-dev libinput-dev libgtk-4-dev \
    libadwaita-1-dev libjson-glib-dev libxkbregistry-dev gettext
AlynxZhou commented 1 year ago

Nothing prevents you from using /usr/local or other dirs as prefix, and I think Meson already uses it as default, I prefer /usr because I typically package programs for distros.

Please read Meson's doc about how to control installing prefix.

By the way, providing a list of dependency names could really help building from source.

Isn't it already here? https://github.com/AlynxZhou/showmethekey#dependencies.

Obviously it is general name for projects, because different distros have different names for those package. If you mean you want a detailed list for a distro like Ubuntu, I am afraid that have a list for every distro is too hard to maintain, I am not a Ubuntu user, maybe you should find whether there is already a package for Ubuntu by other people.

David-Else commented 1 year ago

@DuckDuckWhale Hi, I just tried to install on Debian 12 and am having problems. I am a total newb to installing from source, could you offer any advice on my issue https://github.com/AlynxZhou/showmethekey/issues/31? I am pretty sure I have all the dependencies, but I don't know what I am doing. Cheers!