1
Fork 0

Compare commits

..

No commits in common. "4984001bf1a1f3999d3c3f37c31681f192e320ea" and "0a32e075d437d39281ee9967e054c6dbe0263153" have entirely different histories.

3 changed files with 13 additions and 29 deletions

View File

@ -1,5 +1,5 @@
import { Command } from "./dependencies.ts"; import { Command } from "./dependencies.ts";
import { pathExists } from "./utilities.ts"; import { pathExists, runCommand } from "./utilities.ts";
const hiddenApi = "http://127.0.0.1:7813"; const hiddenApi = "http://127.0.0.1:7813";
const remoteApi = "http://127.0.0.1:7814/api1"; const remoteApi = "http://127.0.0.1:7814/api1";
@ -8,7 +8,7 @@ async function main(): Promise<void> {
const { options } = await new Command() const { options } = await new Command()
.name("tauon-controls") .name("tauon-controls")
.description("Small remote control CLI for Tauon Music Box!") .description("Small remote control CLI for Tauon Music Box!")
.option("--current-song", "Get the currently playing song.") .option("--current-song", "Send a notification with the current song.")
.option("--next-song", "Play the next song.") .option("--next-song", "Play the next song.")
.option("--play-pause", "Toggle play or pause.") .option("--play-pause", "Toggle play or pause.")
.option("--previous-song", "Play the previous song.") .option("--previous-song", "Play the previous song.")
@ -21,7 +21,7 @@ async function main(): Promise<void> {
.parse(Deno.args); .parse(Deno.args);
if (options.currentSong) { if (options.currentSong) {
await getCurrentSong(); await notifyCurrentSong();
} }
if (options.nextSong) { if (options.nextSong) {
@ -85,7 +85,6 @@ type Status = {
artist: string; artist: string;
id: number; id: number;
progress: number; progress: number;
status: "playing" | "paused";
title: string; title: string;
track: { track: {
duration: number; duration: number;
@ -97,14 +96,12 @@ async function getStatus(): Promise<Status> {
return await (await fetch(`${remoteApi}/status`)).json(); return await (await fetch(`${remoteApi}/status`)).json();
} }
/** Print the current song's artist and title. */ /** Run a `notify-send` with the current song's artist and title. */
async function getCurrentSong(): Promise<void> { async function notifyCurrentSong(): Promise<void> {
const status = await getStatus(); const status = await getStatus();
if (status.status === "paused") { await runCommand("notify-send", {
return; args: [status.title, status.artist],
} });
console.log(`${status.artist} - ${status.title}`);
} }
if (import.meta.main) { if (import.meta.main) {

View File

@ -56,7 +56,7 @@ bar {
i3bar_command i3bar --transparency i3bar_command i3bar --transparency
output primary output primary
position bottom position bottom
separator_symbol "" separator_symbol "/"
status_command i3status-rs status_command i3status-rs
tray_output primary tray_output primary
} }

View File

@ -1,15 +1,5 @@
[icons.overrides] [icons]
bear = "🐻" icons = "emoji"
bell = "🔔"
bunny = "🐇"
music = "▶️"
[[block]]
block = "custom"
command = "tauon-controls --current-song"
format = "^icon_music $text.pango-str()"
interval = 15
hide_when_empty = true
[[block]] [[block]]
block = "custom" block = "custom"
@ -17,18 +7,15 @@ command = "miniflux-unread-entries"
format = "^icon_bell <span color='#D2B83A'>$text.pango-str()</span>" format = "^icon_bell <span color='#D2B83A'>$text.pango-str()</span>"
interval = 600 interval = 600
hide_when_empty = true hide_when_empty = true
[[block.click]]
button = "left"
cmd = "xdg-open https://rss.azedia.lan"
[[block]] [[block]]
block = "time" block = "time"
format = "^icon_bunny $timestamp.datetime(f:'%H:%M')" format = "$timestamp.datetime(f:'%H:%M')"
interval = 5 interval = 5
timezone = "US/Central" timezone = "US/Central"
[[block]] [[block]]
block = "time" block = "time"
format = "^icon_bear $timestamp.datetime(f:'%H:%M')" format = "$timestamp.datetime(f:'%H:%M')"
interval = 5 interval = 5
timezone = "Europe/Brussels" timezone = "Europe/Brussels"