Skip to content

Commit

Permalink
Pop OS 19.10 fixes (#24)
Browse files Browse the repository at this point in the history
* Fix issue with main display not being :0

* Fix the deb with keyboard-colors.json

* Update the changelog

* Might as well make this an officialish release

* Update the readme

* Add manual.tgz to makefile

* typo

* wtf, learn to type rob

* Add manual.tgz to github actions

* Fix contact address

* Fix deb a little bit

* Update version file
  • Loading branch information
withinboredom authored Jan 24, 2020
1 parent 434151d commit 6358ce7
Show file tree
Hide file tree
Showing 22 changed files with 161 additions and 782 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,25 @@ jobs:
with:
name: keyboard-color
path: release

manual-install:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.0.101
- name: apt update
run: sudo apt-get update
- name: install deps
run: sudo apt-get install -y build-essential devscripts lintian debhelper dh-systemd
- name: Build Unsigned Deb
run: make manual.tgz
- name: Save manual.tgz as artifact
uses: actions/upload-artifact@v1
with:
name: manual.tgz
path: manual.tgz
698 changes: 24 additions & 674 deletions LICENSE

Large diffs are not rendered by default.

27 changes: 17 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,50 +1,57 @@
.PHONY: clean

SERVICE = keyboard-color
BIN = ${DESTDIR}/usr/bin/keyboard-color
UNIT = ${DESTDIR}/lib/systemd/system/keyboard-colors.service
CONFIG = ${DESTDIR}/etc/keyboard-color.json
CONFIG = ${DESTDIR}/etc/keyboard-colors.json
COPYRIGHT = ${DESTDIR}/usr/share/doc/s76-keyboard-colors/copyright

release: csharp/keyboards/*.cs csharp/keyboards/*/*.cs csharp/keyboards/keyboards.csproj version
./version
${MAKE} ${SERVICE}
mv ${SERVICE} release

${SERVICE}: csharp/keyboards/*.cs csharp/keyboards/*/*.cs csharp/keyboards/keyboards.csproj
$(SERVICE): csharp/keyboards/*.cs csharp/keyboards/*/*.cs csharp/keyboards/keyboards.csproj
cd csharp/keyboards && dotnet publish -r linux-x64 -c Release -o ${SERVICE}
mv csharp/keyboards/${SERVICE}/${SERVICE} ${SERVICE}

${BIN}: release
$(BIN): release
mkdir -p ${shell dirname ${BIN}}
cp release ${BIN}

${UNIT}: keyboard-colors.service
$(UNIT): keyboard-colors.service
mkdir -p ${shell dirname ${UNIT}}
cp keyboard-colors.service ${UNIT}

${CONFIG}: csharp/keyboards/settings.release.json
$(CONFIG): csharp/keyboards/settings.release.json
mkdir -p ${shell dirname ${CONFIG}}
cp csharp/keyboards/settings.release.json ${CONFIG}

${COPYRIGHT}: LICENSE
$(COPYRIGHT): LICENSE
mkdir -p ${shell dirname ${COPYRIGHT}}
cp LICENSE ${COPYRIGHT}

../s76-keyboard-colors_1.0_amd64.deb: csharp/keyboards/*.cs csharp/keyboards/*/*.cs csharp/keyboards/keyboards.csproj debian/* csharp/keyboards/settings.release.json keyboard-colors.service
debuild -b -us -uc

package.deb: ../s76-keyboard-colors_1.0_amd64.deb
cp ../s76-keyboard-colors_1.0_amd64.deb package.deb
cp ../s76-keyboard-colors_1.1.0_amd64.deb package.deb

manual.tgz: release keyboard-colors.service csharp/keyboards/settings.release.json
mkdir -p manual
cp -f release manual/
cp -f keyboard-colors.service manual/
cp -f csharp/keyboards/settings.release.json manual/
tar -cvzf manual.tgz manual

clean:
cd csharp/keyboards && dotnet clean
cd csharp/version && dotnet clean
cd csharp/UnitTests && dotnet clean
rm -rf ${SERVICE} release version package.deb
.PHONY: clean

version: csharp/version/*.cs csharp/version/version.csproj
cd csharp/version && dotnet publish -r linux-x64 -c Release -o version
mv csharp/version/version/version version

install: debian/control debian/changelog debian/rules ${COPYRIGHT} ${CONFIG} ${UNIT} ${BIN}
install: debian/control debian/changelog debian/rules $(COPYRIGHT) $(CONFIG) $(UNIT) $(BIN)
.PHONY: install
41 changes: 12 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,22 @@

Create a floating rainbow effect that moves across your keyboard!

# Installation
# Installation (for debian/pop-os/ubuntu)

1. Download the [latest and greatest](https://github.com/withinboredom/system-76-keyboards/releases)
1. Make it executable: `chmod +x ./keyboard-color`
1. Take it on a test drive: `sudo ./keyboard-color rainbow`
1. Get some help: `sudo ./keyboard-color help`
1. Once you've got it how you like it, run it with `--install`, like `sudo ./keyboard-color rainbow --install`
1. Download the [latest and greatest deb file](https://github.com/withinboredom/system-76-keyboards/releases)
1. Install the deb file
1. Configure it `sudo nano /etc/keyboard-colors.json`
1. Start it up `sudo systemctl restart keyboard-colors`
1. Profit!

## Changing modes
# Installation (other distributions)

- `keyboard-color rainbow`: Show a pretty rainbow that moves across the keyboard
- `keyboard-color monitor`: Show cpu usage
- `keyboard-color solidcolor --color FFAAFF`: Set the color to whatever hex color you want

## Filters

- `keyboard-color MODE --filter WashedOut`: Get a washed out look
- `keyboard-color MODE --filter BlackWhite`: A terrible attempt at black and white
- `keyboard-color MODE --filter Hearbeat`: Dim and brighten the keyboard based on cpu usage

## Setting FPS

The default is 10 frames per second, but you may find that it causes considerable CPU usage on your machine (it's about
5% on my machine with `monitor` mode), you can change it with the `--fps` option.
1. Download the `manual.tgz` file from [the releases](https://github.com/withinboredom/system-76-keyboards/releases)
1. Copy the `keyboard-colors.service` to systemd
1. Copy `settings.json` to `/etc/keyboard-colors.json`
1. Copy `keyboard-colors` to `/usr/bin/keyboard-color`
1. Start it up `sudo systemctl restart keyboard-colors`
1. Profit!

## Colors for `monitor`

Expand All @@ -43,14 +34,6 @@ The default is 10 frames per second, but you may find that it causes considerabl

Same as installation, should be smooth.

# Uninstall

```sh
sudo systemctl stop keyboard-color
sudo systemctl disable keyboard-color
sudo rm -f /usr/local/bin/keyboard-color /etc/systemd/system/keyboard-colors.service
```

# Contributing

The service is written in CSharp. You can do the following:
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.0-beta.5
1.1.0
4 changes: 2 additions & 2 deletions csharp/ColorPicker/App.razor
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<Router AppAssembly="@typeof(Program).Assembly">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)"/>
</Found>
<NotFound>
<LayoutView Layout="@typeof(MainLayout)">
<p>Sorry, there's nothing at this address.</p>
</LayoutView>
</NotFound>
</Router>
</Router>
2 changes: 1 addition & 1 deletion csharp/ColorPicker/Data/WeatherForecastService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace ColorPicker.Data
{
public class WeatherForecastService
{
private static readonly string[] Summaries = new[]
private static readonly string[] Summaries =
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};
Expand Down
5 changes: 3 additions & 2 deletions csharp/ColorPicker/Pages/Counter.razor
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>

@code {
int currentCount = 0;
int currentCount;

void IncrementCount()
{
currentCount++;
}
}

}
38 changes: 20 additions & 18 deletions csharp/ColorPicker/Pages/FetchData.razor
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@page "/fetchdata"

@using ColorPicker.Data
@inject WeatherForecastService ForecastService

Expand All @@ -9,29 +8,31 @@

@if (forecasts == null)
{
<p><em>Loading...</em></p>
<p>
<em>Loading...</em>
</p>
}
else
{
<table class="table">
<thead>
<tr>
<th>Date</th>
<th>Temp. (C)</th>
<th>Temp. (F)</th>
<th>Summary</th>
</tr>
<tr>
<th>Date</th>
<th>Temp. (C)</th>
<th>Temp. (F)</th>
<th>Summary</th>
</tr>
</thead>
<tbody>
@foreach (var forecast in forecasts)
{
<tr>
<td>@forecast.Date.ToShortDateString()</td>
<td>@forecast.TemperatureC</td>
<td>@forecast.TemperatureF</td>
<td>@forecast.Summary</td>
</tr>
}
@foreach (var forecast in forecasts)
{
<tr>
<td>@forecast.Date.ToShortDateString()</td>
<td>@forecast.TemperatureC</td>
<td>@forecast.TemperatureF</td>
<td>@forecast.Summary</td>
</tr>
}
</tbody>
</table>
}
Expand All @@ -43,4 +44,5 @@ else
{
forecasts = await ForecastService.GetForecastAsync(DateTime.Now);
}
}

}
13 changes: 6 additions & 7 deletions csharp/ColorPicker/Pages/Index.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
@using keyboards
@using keyboards.ColorSpace
@using keyboards.Filters

@functions
{
IFile _left
Expand All @@ -25,14 +26,11 @@
}
}

IFile _right
{
get { return LedProvider.GetLedFor(new ControlContainer(), LedProvider.Location.Right); }
}
IFile _right => LedProvider.GetLedFor(new ControlContainer(), LedProvider.Location.Right);

private void SetColor(string color)
{
var sidel = new keyboards.Sides.Solid(keyboards.ColorSpace.Rgb.FromHex(color))
var sidel = new Solid(Rgb.FromHex(color))
{
Led = _left
};
Expand All @@ -45,8 +43,9 @@
sidec.Commit(new List<IFilter>());
sider.Commit(new List<IFilter>());
}

private string _leftColor = "#FFFFAA";

protected string LeftColor
{
get => _leftColor;
Expand All @@ -63,4 +62,4 @@

Welcome to your new app.

<input type="color" @bind="LeftColor" @oninput="@((c) => LeftColor = c.Value.ToString())" />
<input type="color" @bind="LeftColor" @oninput="@(c => LeftColor = c.Value.ToString())"/>
20 changes: 10 additions & 10 deletions csharp/ColorPicker/Pages/_Host.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>ColorPicker</title>
<base href="~/" />
<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
<link href="css/site.css" rel="stylesheet" />
<base href="~/"/>
<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css"/>
<link href="css/site.css" rel="stylesheet"/>
</head>
<body>
<app>
@(await Html.RenderComponentAsync<App>(RenderMode.ServerPrerendered))
</app>
<app>
@(await Html.RenderComponentAsync<App>(RenderMode.ServerPrerendered))
</app>

<script src="_framework/blazor.server.js"></script>
<script src="_framework/blazor.server.js"></script>
</body>
</html>
</html>
14 changes: 4 additions & 10 deletions csharp/ColorPicker/Program.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;

namespace ColorPicker
{
Expand All @@ -18,8 +10,10 @@ public static void Main(string[] args)
CreateHostBuilder(args).Build().Run();
}

public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
public static IHostBuilder CreateHostBuilder(string[] args)
{
return Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup<Startup>(); });
}
}
}
4 changes: 2 additions & 2 deletions csharp/ColorPicker/Shared/MainLayout.razor
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@inherits LayoutComponentBase

<div class="sidebar">
<NavMenu />
<NavMenu/>
</div>

<div class="main">
Expand All @@ -12,4 +12,4 @@
<div class="content px-4">
@Body
</div>
</div>
</div>
3 changes: 2 additions & 1 deletion csharp/ColorPicker/Shared/NavMenu.razor
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@
{
collapseNavMenu = !collapseNavMenu;
}
}

}
Loading

0 comments on commit 6358ce7

Please sign in to comment.