diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..0f3c990 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,16 @@ +FROM mono +# Install additional OS packages. +RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ + && apt-get -y install --no-install-recommends \ + ssh \ + git \ + sudo + +# Add the vscode user. +ARG USERNAME=vscode +ARG USER_UID=1000 +ARG USER_GID=$USER_UID +RUN groupadd --gid $USER_GID $USERNAME \ + && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME -s /bin/bash \ + && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ + && chmod 0440 /etc/sudoers.d/$USERNAME diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..4356da7 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,11 @@ +{ + "name": "Mono (.NET)", + "build": { + "dockerfile": "Dockerfile" + }, + "extensions": [ + "ms-dotnettools.csharp", + "redhat.vscode-yaml" + ], + "remoteUser": "vscode" +} \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..a6682a7 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,37 @@ +name: CI + +on: [push] + +jobs: + windows-build: + runs-on: windows-latest + steps: + - name: Checkout + uses: actions/checkout@master + - name: Setup MSBuild.exe + uses: microsoft/setup-msbuild@v1.0.2 + - name: MSBuild + working-directory: percentage + run: msbuild percentage.sln /property:Configuration=Release + # - name: Artifact upload + # uses: actions/upload-artifact@master + # with: + # name: percentage + # path: percentage\percentage\bin\Release\percentage.exe + linux-build: + runs-on: ubuntu-latest + container: + image: mono + steps: + - name: Prerequisites + run: apt update && apt install -y --no-install-recommends ssh git + - name: Checkout + uses: actions/checkout@master + - name: MSBuild + working-directory: percentage + run: msbuild percentage.sln -p:Configuration=Release + # - name: Artifact upload + # uses: actions/upload-artifact@master + # with: + # name: percentage + # path: percentage\percentage\bin\Release\percentage.exe diff --git a/.markdownlint.yaml b/.markdownlint.yaml new file mode 100644 index 0000000..491bda1 --- /dev/null +++ b/.markdownlint.yaml @@ -0,0 +1,16 @@ +--- +MD007: + indent: 4 +MD013: + line_length: 80 + tables: false + code_blocks: false +MD030: + ul_single: 3 + ol_single: 2 + ul_multi: 3 + ol_multi: 2 +MD033: + allowed_elements: + - pre + - br diff --git a/README.md b/README.md index 8edcc97..93eeb71 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,16 @@ # percentage -![](https://raw.githubusercontent.com/kas/percentage/master/percentage.png) +![CI](https://github.com/kas/percentage/workflows/CI/badge.svg) -See your battery percentage in the Windows 10 system tray +![Screenshot](percentage.png) + +See your battery percentage in the Windows 10 system tray. ## Installing -1. [Download the latest release](https://github.com/kas/percentage/releases) -1. Put percentage.exe in your startup folder - 1. To get to your startup folder, press Windows+R, type "shell:startup", then press enter +- [Download the latest release](https://github.com/kas/percentage/releases). +- Put `percentage.exe` in your startup folder (to get to your startup folder, + press `Windows + R`, type `shell:startup`, and press enter). ## Compiling @@ -16,11 +18,24 @@ This project was compiled with Visual Studio Community 2019. Select ".NET desktop development" when setting up Visual Studio. -To build the project -1. Open the percentage/percentage.sln file with Visual Studio -1. Click "Build > Build Solution" -1. percentage.exe can be found at percentage\percentage\percentage\bin\Debug\percentage.exe +To compile using a Windows Docker image with this pre-installed, first install +Docker Desktop and configure it to run Windows containers, then change to the +root directory of the repository and run the following: + +```powershell +docker run -v "$(pwd)\:C:\Build\" nugardt/msbuild:15.5 msbuild \ + C:\Build\percentage\percentage.sln /property:Configuration=Release +``` + +Alternatively, simply open the project in the provided devcontainer and run: + +```sh +msbuild percentage/percentage.sln -p:Configuration=Release +``` + +The output binary is in `percentage/percentage/bin/release`. ## Contributions -My goal for this project is to keep it as simple as possible. I welcome suggestions, but for complicated features I'd recommend forking the project. +My goal for this project is to keep it as simple as possible. I welcome +suggestions, but for complicated features I'd recommend forking the project. diff --git a/percentage/percentage/percentage.csproj b/percentage/percentage/percentage.csproj index 04f99f4..3e4e228 100644 --- a/percentage/percentage/percentage.csproj +++ b/percentage/percentage/percentage.csproj @@ -55,7 +55,7 @@ percentage_TemporaryKey.pfx - true + false false