Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 66 additions & 46 deletions .github/workflows/blank.yml
Original file line number Diff line number Diff line change
@@ -1,57 +1,77 @@
name: Polybar AppImage
name: Appimage
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true

on:
schedule:
- cron: "0 16 1/20 * *"
workflow_dispatch:
- cron: "0 7 1/21 * *"
workflow_dispatch: {}

jobs:
build:
runs-on: ubuntu-24.04
name: "${{ matrix.name }} (${{ matrix.arch }})"
runs-on: ${{ matrix.runs-on }}
strategy:
matrix:
include:
- runs-on: ubuntu-latest
name: Build AppImage
arch: x86_64
- runs-on: ubuntu-24.04-arm
name: Build AppImage
arch: aarch64
container: ghcr.io/pkgforge-dev/archlinux:latest
steps:
- uses: actions/checkout@v4

- name: build
run: |
sudo apt update
sudo apt install libfuse2 gcc xsltproc meson autopoint libcairo2-dev xcb-proto libnl-genl-3-dev \
libxcb-composite0-dev libxcb-xrm-dev libxcb1-dev libasound2-dev libiw-dev libuv1-dev pkg-config \
libxcb-cursor-dev libxcb-util-dev python3-pip libxcb-randr0-dev libxcb-util0-dev libcurlpp-dev \
libcurl4-openssl-dev libxcb-ewmh2 python3-sphinx libxcb-xkb-dev i3-wm libjsoncpp-dev \
libxcb-image0-dev libmpdclient-dev libxcb-icccm4-dev libalsaplayer-dev libalsaplayer0 \
libncursesw5-dev autotools-dev autoconf automake build-essential ninja-build \
libxcb-ewmh-dev python3-xcbgen libpulse-dev libmpdclient2 desktop-file-utils zsync

chmod +x ./*-appimage.sh && ./*-appimage.sh
mkdir dist
mv *.AppImage* dist/

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: Polybar.AppImage
path: 'dist'

- uses: actions/checkout@v4

- name: Get dependencies
run: chmod +x ./get-dependencies.sh && ./get-dependencies.sh

- name: Make AppImage
run: chmod +x ./*-appimage.sh && ./*-appimage.sh

- name: Upload artifact
uses: actions/upload-artifact@v4.6.2
with:
name: AppImage-${{ matrix.arch }}
path: dist

release:
needs: [build]
permissions: write-all
runs-on: ubuntu-latest

steps:
- uses: actions/download-artifact@v4
with:
name: Polybar.AppImage

- name: release
uses: marvinpinto/action-automatic-releases@latest
with:
title: Continuous build
automatic_release_tag: continuous
prerelease: false
draft: false
files: |
*.AppImage*
repo_token: ${{ secrets.GITHUB_TOKEN }}
if: ${{ github.ref_name == 'main' }}
needs: [build]
permissions: write-all
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4.3.0
with:
pattern: AppImage-*
merge-multiple: true

- name: Read version and Get date
run: |
cat ./version
echo "VERSION=$(cat ./version)" >> "${GITHUB_ENV}"
echo "DATE=$(date +'%Y-%m-%d_%s')" >> "${GITHUB_ENV}"

- name: Release Artifacts
uses: softprops/action-gh-release@v2.2.2
with:
name: "polybar: ${{ env.VERSION }}"
tag_name: "${{ env.VERSION }}@${{ env.DATE }}"
prerelease: false
draft: false
generate_release_notes: false
make_latest: true
files: |
*.AppImage*

- uses: actions/checkout@v4
- name: Update LATEST_VERSION
run: |
echo "${{ env.VERSION }}" > ./LATEST_VERSION
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add ./LATEST_VERSION
git commit --allow-empty -m 'bump `LATEST_VERSION` [skip ci]'
git push
Binary file added AppDir/.DirIcon
Binary file not shown.
Binary file added AppDir/polybar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 25 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,32 @@
# polybar-AppImage
Unofficial AppImage of polybar: https://github.com/polybar/polybar
# polybar-AppImage 🐧

[![GitHub Downloads](https://img.shields.io/github/downloads/pkgforge-dev/polybar-AppImage/total?logo=github&label=GitHub%20Downloads)](https://github.com/pkgforge-dev/polybar-AppImage/releases/latest)
[![CI Build Status](https://github.com//pkgforge-dev/polybar-AppImage/actions/workflows/blank.yml/badge.svg)](https://github.com/pkgforge-dev/polybar-AppImage/releases/latest)

* [Latest Stable Release](https://github.com/pkgforge-dev/polybar-AppImage/releases/latest)

---

AppImage made using [sharun](https://github.com/VHSgunzo/sharun), which makes it extremely easy to turn any binary into a portable package without using containers or similar tricks.

**This AppImage bundles everything and should work on any linux distro, even on musl based ones.**

Works like the regular polybar, by default running the appimage does the same as running the regular `polybar` binary.
If you want to use the `polybar-msg` binary, then you would need to pass the arg `msg` to the appimage, for example:
It is possible that this appimage may fail to work with appimagelauncher, I recommend these alternatives instead:

* [AM](https://github.com/ivan-hc/AM) `am -i polybar` or `appman -i polybar`

* [dbin](https://github.com/xplshn/dbin) `dbin install polybar.appimage`

* [soar](https://github.com/pkgforge/soar) `soar install polybar`

`polybar-msg cmd restart` would be `nameofappimage msg cmd restart` instead.
This appimage works without fuse2 as it can use fuse3 instead, it can also work without fuse at all thanks to the [uruntime](https://github.com/VHSgunzo/uruntime)

You can also symlink the appimage to `PATH` with the name `polybar-msg` and that way it automatically detects and launches `polybar-msg` without extra arguments.
<details>
<summary><b><i>raison d'être</i></b></summary>
<img src="https://github.com/user-attachments/assets/d40067a6-37d2-4784-927c-2c7f7cc6104b" alt="Inspiration Image">
</a>
</details>

It is possible that this appimage may fail to work with appimagelauncher, I recommend this alternative instead: https://github.com/ivan-hc/AM
---

This appimage works without fuse2 as it can use fuse3 instead.
More at: [AnyLinux-AppImages](https://pkgforge-dev.github.io/Anylinux-AppImages/)
48 changes: 48 additions & 0 deletions get-dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/sh

set -ex
EXTRA_PACKAGES="https://raw.githubusercontent.com/pkgforge-dev/Anylinux-AppImages/refs/heads/main/useful-tools/get-debloated-pkgs.sh"

echo "Installing build dependencies..."
echo "---------------------------------------------------------------"
pacman -Syu --noconfirm \
base-devel \
cmake \
curl \
git \
hicolor-icon-theme \
i3-wm \
libpulse \
libx11 \
libxrandr \
libxss \
pulseaudio \
pulseaudio-alsa \
wget \
xorg-server-xvfb \
zsync

echo "Installing debloated packages..."
echo "---------------------------------------------------------------"
wget --retry-connrefused --tries=30 "$EXTRA_PACKAGES" -O ./get-debloated-pkgs.sh
chmod +x ./get-debloated-pkgs.sh
./get-debloated-pkgs.sh libxml2-mini opus-mini

echo "Building polybar..."
echo "---------------------------------------------------------------"
sed -i -e 's|EUID == 0|EUID == 69|g' /usr/bin/makepkg
sed -i \
-e 's|-O2|-O3|' \
-e 's|MAKEFLAGS=.*|MAKEFLAGS="-j$(nproc)"|' \
-e 's|#MAKEFLAGS|MAKEFLAGS|' \
/etc/makepkg.conf
cat /etc/makepkg.conf

git clone https://aur.archlinux.org/polybar-git.git ./polybar && (
cd ./polybar
makepkg -fs --noconfirm --skippgpcheck
ls -la .
pacman --noconfirm -U ./*.pkg.tar.*
)

pacman -Q polybar-git | awk '{print $2; exit}' > ~/version
124 changes: 21 additions & 103 deletions polybar-appimage.sh
Original file line number Diff line number Diff line change
@@ -1,112 +1,30 @@
#!/bin/sh

set -eu
set -eux

export ARCH="$(uname -m)"
export APPIMAGE_EXTRACT_AND_RUN=1
ARCH="$(uname -m)"
URUNTIME="https://raw.githubusercontent.com/pkgforge-dev/Anylinux-AppImages/refs/heads/main/useful-tools/uruntime2appimage.sh"
SHARUN="https://raw.githubusercontent.com/pkgforge-dev/Anylinux-AppImages/refs/heads/main/useful-tools/quick-sharun.sh"
VERSION="$(cat ~/version)"

APP=polybar
REPO="https://github.com/polybar/polybar"
ICON="https://user-images.githubusercontent.com/36028424/39958898-230ddeec-563c-11e8-8318-d658c63ddf22.png"
export DESKTOP=DUMMY
export UPINFO="gh-releases-zsync|${GITHUB_REPOSITORY%/*}|${GITHUB_REPOSITORY#*/}|latest|*$ARCH.AppImage.zsync"
export OUTNAME=polybar-"$VERSION"-anylinux-"$ARCH".AppImage
export PATH_MAPPING='/etc/polybar:${SHARUN_DIR}/etc/polybar'

UPINFO="gh-releases-zsync|$(echo $GITHUB_REPOSITORY | tr '/' '|')|latest|*$ARCH.AppImage.zsync"
APPIMAGETOOL="https://github.com/pkgforge-dev/appimagetool-uruntime/releases/download/continuous/appimagetool-$ARCH.AppImage"
LIB4BN="https://raw.githubusercontent.com/VHSgunzo/sharun/refs/heads/main/lib4bin"
# Deploy dependencies
wget --retry-connrefused --tries=30 "$SHARUN" -O ./quick-sharun
chmod +x ./quick-sharun
./quick-sharun /usr/bin/polybar*
cp -rv /etc/polybar ./AppDir/etc

# CREATE DIRECTORIES
mkdir -p ./"$APP"/AppDir
cd ./"$APP"/AppDir
# MAKE APPIMAGE WITH URUNTIME
wget --retry-connrefused --tries=30 "$URUNTIME" -O ./uruntime2appimage
chmod +x ./uruntime2appimage
./uruntime2appimage

# DOWNLOAD AND BUILD POLYBAR
CURRENTDIR="$(readlink -f "$(dirname "$0")")" # DO NOT MOVE THIS
CXXFLAGS='-O3'
mkdir -p ./dist
mv -v ./*.AppImage* ./dist
mv -v ~/version ./dist

git clone --recursive "$REPO" polybar
( cd polybar
mkdir build
cd build
cmake -DENABLE_ALSA=ON ..
make -j$(nproc)
make install DESTDIR="$CURRENTDIR"
)
rm -rf ./polybar

# ADD LIBRARIES
mkdir ./usr/lib
mv ./usr ./shared
wget "$LIB4BN" -O ./lib4bin
chmod +x ./lib4bin
./lib4bin -p -v -r -s ./shared/bin/*
rm -f ./lib4bin

# Patch polybar binary so that it finds its default "/etc" config in the AppDir
sed -i 's|/etc|././|g' ./shared/bin/polybar
ln -s ./etc/polybar ./polybar

# AppRun
cat >> ./AppRun << 'EOF'
#!/usr/bin/env sh
CURRENTDIR="$(dirname "$(readlink -f "$0")")"
export PATH="$CURRENTDIR/bin:$PATH"
BIN="${ARGV0#./}"
unset ARGV0
[ -z "$APPIMAGE" ] && APPIMAGE="$0"
[ ! -f "$CURRENTDIR/bin/$BIN" ] && BIN=polybar

# we patched a relative path in polybar, so we cd here
cd "$CURRENTDIR"

if [ "$1" = "--bars" ]; then
shift
for bar in "$@"; do
exec "$CURRENTDIR/bin/polybar" "$bar" &
done
elif [ "$1" = '--msg' ]; then
shift
exec "$CURRENTDIR"/bin/polybar-msg "$@"
else
exec "$CURRENTDIR/bin/$BIN" "$@"
echo "AppImage commands:"
echo " \"$APPIMAGE --msg\" Launches polybar-msg"
echo " \"$APPIMAGE --bars bar1 bar2 bar3\" Launches multiple bars"
echo ""
echo "You can also symlink the appimage with the name polybar-msg"
echo "and by launching that symlink it will automatically run"
echo "polybar-msg without having to pass any extra arguments"
echo "AppImage also supports the \"--bars\" flag which lets you"
echo "run multiple polybar instances with a single command"
fi
EOF
chmod +x ./AppRun
./sharun -g
VERSION="$(./bin/polybar --version | awk 'FNR==1 {print $2}')"

# Desktop
cat >> ./"$APP.desktop" << 'EOF'
[Desktop Entry]
Type=Application
Name=polybar
Icon=polybar
Exec=polybar
Categories=System
Hidden=true
EOF

# Icon
wget "$ICON" -O ./polybar.png || touch ./polybar.png
ln -s polybar.png ./.DirIcon

# MAKE APPIMAGE USING FUSE3 COMPATIBLE APPIMAGETOOL
cd ..
wget -q "$APPIMAGETOOL" -O ./appimagetool
chmod +x ./appimagetool

echo "Making appimage..."
./appimagetool --comp zstd \
--mksquashfs-opt -Xcompression-level --mksquashfs-opt 22 \
-n -u "$UPINFO" "$PWD"/AppDir "$PWD"/"$APP"-"$VERSION"-anylinux-"$ARCH".AppImage

mv ./*.AppImage* ..
cd ..
rm -rf ./"$APP"
echo "All Done!"