Skip to content

Allow our package to coexist with the official 'github-desktop' package #13

Closed

Description

@pol-rivero

The feature request

We should allow .deb and .rpm users to install this fork alongside the upstream's 'official' app.

Proposed solution

Rename our package from 'github-desktop' to 'github-desktop-plus' and change the installation directories.

Additional context

This is currently a work in progress, it will require some testing to make sure the app still works as expected.

This is a breaking change that will require users to uninstall and reinstall the app.

Activity

  1. Bryan2333 commented on Aug 9, 2025

    @Bryan2333

    I use the PKGBUILD from github-desktop, but modify its source URL to github-desktop-plus in order to build from source, and the package works quite well.

    I'm wondering if this will break the setup on Arch Linux.

    Here are the PKGBUILD I modified and some patches to build for myself.

    PKGBUILD

    Details
    # Maintainer: Caleb Maclennan <[email protected]>
    # Contributor: Ian MacKay <[email protected]>
    # Contributor: Mikel Pintado <[email protected]>
    # Contributor: Igor Petrov <[email protected]>
    # Contributor: Jiawen Geng
    
    pkgname=github-desktop
    pkgver=3.5.2
    pkgrel=2
    pkgdesc='GUI for managing Git and GitHub'
    arch=(x86_64)
    url='https://desktop.github.com'
    license=(MIT)
    depends=(alsa-lib
             at-spi2-core
             curl
             expat
             fontconfig
             git
             glib2
             gtk3
             hicolor-icon-theme
             libcups
             libcurl-gnutls
             libsecret
             libx11
             libxcb
             libxcomposite
             libxdamage
             libxext
             libxfixes
             libxkbcommon
             libxrandr
             libxss
             nspr
             nss
             org.freedesktop.secrets
             perl
             unzip
             zlib)
    optdepends=('github-cli: CLI interface for GitHub'
                'hub: CLI interface for GitHub')
    makedepends=(python-setuptools
                 nodejs-lts-jod
                 npm
                 yarn
                 jq
                 libxcrypt-compat)
    DLAGENTS=("http::/usr/bin/git clone --branch $_gitname --single-branch %u")
    source=("$pkgname::git+https://github.com/pol-rivero/github-desktop-plus.git#tag=v$pkgver"
            'git+https://github.com/github/gemoji.git'
            'git+https://github.com/github/gitignore.git'
            'git+https://github.com/github/choosealicense.com.git')
    sha256sums=('SKIP'
                'SKIP'
                'SKIP'
                'SKIP')
    source+=("launch-github-desktop"
             "build-pacman-package.patch")
    sha256sums+=("146375364f5ccc5ab53b43840a04c765b6bb03ca4c4fb0114fc4a872394ebba8"
                 "fc1c9eebe6bf3ef9076c034a189ba4fa0ce6c31809f4e92baa525615bbc88dbe")
    options=(!debug)
    
    prepare() {
        cd "$pkgname"
        git submodule init
        git config submodule."gemoji".url "$srcdir/gemoji"
        git config submodule."app/static/common/gitignore".url "$srcdir/gitignore"
        git config submodule."app/static/common/choosealicense.com".url "$srcdir/choosealicense.com"
        git -c protocol.file.allow=always submodule update
        # https://github.com/shiftkey/desktop/issues/809#issuecomment-1348815685
        sed -e '/compile:prod/s/4096/4096 --openssl-legacy-provider/' -i package.json
        # apply fix wayland icon patch
        echo "$(jq '. + {"desktopName": "github-desktop"}' app/package.json)" > app/package.json
        # build pacman file
        patch -Np1 < "${srcdir}/build-pacman-package.patch"
    }
    
    build() {
        cd "$pkgname"
        # https://github.com/nodejs/node/issues/48444
        export UV_USE_IO_URING=0
        find . -type f -name "yarn.lock" -exec sed -i "s/registry.yarnpkg.com/mirrors.cloud.tencent.com\/npm/g" {} +
        yarn install --frozen-lockfile
        yarn build:prod
        yarn package
    }
    
    package() {
        bsdtar -xf "${srcdir}/${pkgname}/dist/"*.pacman -C "${pkgdir}"
    
        mv "${pkgdir}/opt/GitHub Desktop" "${pkgdir}/opt/${pkgname}"
    
        chmod 755 "${pkgdir}/opt/${pkgname}"
    
        sed -i \
            -e "s|Exec=.*|Exec=/usr/bin/github-desktop %u|" \
            -e "s|Categories=.*|Categories=Development;|" \
            -e '/^StartupWMClass/d' \
            "${pkgdir}/usr/share/applications/github-desktop.desktop"
    
        install -Dm755 "${srcdir}/launch-github-desktop" "${pkgdir}/usr/bin/${pkgname}"
        install -Dm644 "${pkgdir}/opt/github-desktop/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
    
        rm "${pkgdir}"/.{PKGINFO,INSTALL,MTREE}
    }

    build-pacman-package.patch

    Details
    diff --git a/script/electron-builder-linux.yml b/script/electron-builder-linux.yml
    index 77203eb0b4..24ea442320 100644
    --- a/script/electron-builder-linux.yml
    +++ b/script/electron-builder-linux.yml
    @@ -1,4 +1,5 @@
     artifactName: 'GitHubDesktop-${os}-${arch}-${version}.${ext}'
    +compression: store
     linux:
       category: 'GNOME;GTK;Development'
       packageCategory: 'GNOME;GTK;Development'
    @@ -11,5 +12,5 @@ linux:
         # see https://github.com/shiftkey/desktop/issues/72 for more details
         - x-scheme-handler/x-github-desktop-dev-auth
       target:
    -    - AppImage
    +    - pacman
       maintainer: 'Brendan Forster<[email protected]>'
    diff --git a/script/package-electron-builder.ts b/script/package-electron-builder.ts
    index 2f56e73fba..395b9730e7 100644
    --- a/script/package-electron-builder.ts
    +++ b/script/package-electron-builder.ts
    @@ -50,7 +50,7 @@ export async function packageElectronBuilder(): Promise<Array<string>> {
         return Promise.reject(error)
       }
     
    -  const appImageInstaller = `${distRoot}/GitHubDesktop-linux-*.AppImage`
    +  const appImageInstaller = `${distRoot}/GitHubDesktop-linux-*.pacman`
     
       const files = await globPromise(appImageInstaller)
       if (files.length !== 1) {
    diff --git a/script/package.ts b/script/package.ts
    index 5c6085d4c0..2a6d6d3197 100644
    --- a/script/package.ts
    +++ b/script/package.ts
    @@ -31,8 +31,6 @@ import { join } from 'path'
     import { assertNonNullable } from '../app/src/lib/fatal-error'
     
     import { packageElectronBuilder } from './package-electron-builder'
    -import { packageDebian } from './package-debian'
    -import { packageRedhat } from './package-redhat'
     
     const distPath = getDistPath()
     const productName = getProductName()
    @@ -223,10 +221,8 @@ async function packageLinux() {
       }
       try {
         const files = await packageElectronBuilder()
    -    const debianPackage = await packageDebian()
    -    const redhatPackage = await packageRedhat()
     
    -    const installers = [...files, debianPackage, redhatPackage]
    +    const installers = [...files]
     
         console.log(`Installers created:`)
         for (const installer of installers) {

    launch-github-desktop

    Details
    #!/bin/bash
    
    set -euo pipefail
    
    flags_file="${XDG_CONFIG_HOME:-$HOME/.config}/github-desktop-flags.conf"
    fallback_file="${XDG_CONFIG_HOME:-$HOME/.config}/electron-flags.conf"
    
    lines=()
    if [[ -f "${flags_file}" ]]; then
        mapfile -t lines < "${flags_file}"
    elif [[ -f "${fallback_file}" ]]; then
        mapfile -t lines < "${fallback_file}"
    fi
    
    flags=()
    for line in "${lines[@]}"; do
        if [[ ! "${line}" =~ ^[[:space:]]*#.* ]] && [[ -n "${line}" ]]; then
            flags+=("${line}")
        fi
    done
    
    exec /opt/github-desktop/github-desktop "${flags[@]}" "$@"
  2. pol-rivero commented on Aug 9, 2025

    @pol-rivero
    MemberAuthor

    @Bryan2333 You are correct, the github-desktop PKGBUILD would probably stop working after this change.
    When I have some free time, I'll prepare and test our own github-desktop-plus and github-desktop-plus-git AUR packages.

    As a side note, why do you want to build the app from source? The github-desktop-plus-bin package (currently, our only AUR package) is more convenient and much faster to install.

  3. pol-rivero commented on Aug 10, 2025

    @pol-rivero
    MemberAuthor

    @Bryan2333 Your PKGBUILD is very different from the github-desktop AUR package. Could you explain why did you make all those changes? This is a lot more than just "modifying its source URL".
    I'll probably base mine on the existing AUR package and add some small tweaks from yours if needed.

  4. Bryan2333 commented on Aug 11, 2025

    @Bryan2333

    @pol-rivero Sorry for the confusion — you’re right, this involves more than just changing the source URL.

    I made these changes to improve the packaging process and add missing dependencies.

    First, instead of manually copying the build output as in the original PKGBUILD, I extract the .pacman package produced by yarn package. This keeps the file structure consistent with upstream and reduces maintenance.

    Second, the original PKGBUILD listed only minimal dependencies. I added libraries commonly required by Electron apps (GTK, X11, audio, fonts, etc.) to ensure it runs on minimal systems without missing libraries.

    Lastly, I add the flag file support for the package like visual-studio-code-bin AUR package, which make it more convenient to pass some arguments to the executable.

  5. pol-rivero commented on Aug 11, 2025

    @pol-rivero
    MemberAuthor

    First, instead of manually copying the build output as in the original PKGBUILD, I extract the .pacman package produced by yarn package. This keeps the file structure consistent with upstream and reduces maintenance.

    In which way does this keep the structure consistent with upstream? Wouldn't it be "more consistent" to just keep our PKGBUILD as similar as possible to the upstream?

    Second, the original PKGBUILD listed only minimal dependencies. I added libraries commonly required by Electron apps (GTK, X11, audio, fonts, etc.) to ensure it runs on minimal systems without missing libraries.

    • GTK: I agree, I'll add it to the list of dependencies.
    • X11: Not a dependency at all. The app runs perfectly on wayland.
    • Audio: This app has no audio, why would you want this?
    • Fonts: Already a transitive dependency of GTK, so not needed.

    Lastly, I add the flag file support for the package like visual-studio-code-bin AUR package, which make it more convenient to pass some arguments to the executable.

    I agree with this one and will add it to our version. I'll name it github-desktop-plus-flags.conf instead of github-desktop-flags.conf, for consistency. Thanks for the suggestion!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions