diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md
index dd7059e..d76d9c9 100644
--- a/CHANGELOG.en-US.md
+++ b/CHANGELOG.en-US.md
@@ -15,6 +15,15 @@ English (US) release notes, mirroring CHANGELOG.md (Brazilian Portuguese). Befor
- **One interface, with a guided tour**: Console Mode now has only the Console interface, which also works with the mouse and the keyboard (click the tabs, Page Up / Page Down, Enter and Esc). The Desktop interface and the Interface option are gone; what only it had moved to the System tab: the FPS counter (style, size, position, colour and items), the custom app's arguments and process to watch, the diagnostics report and the app's version. Under the list, the System tab shows what the setting in focus does. On the Session tab, the screens are drawn again like in Windows' display settings: each one where it sits on the desk and at its real proportions (a screen standing up shows standing up), the ones that are off dashed. The first time you open it, a tour highlights the tabs, the launchers, the play button, the screens, the quick settings, the settings and the controller shortcuts (A goes on, B skips); to see it again, System → App → Tutorial. (#184)
- **Opening**: when it opens, the Console Mode logo "powers on" in the dark: the power light on the base comes on and pulses, the screen draws itself and lights up green, the >_ is typed with a blinking cursor and the name appears, with an entrance sound, while the app loads (about 3 s); then it fades into the interface. Any button, click or key skips it. The official opening is Console Mode's own, but now and then (about 1 in 8) the app opens with one inspired by the Xbox 360 (green ribbons spinning into an orb of light) or the PS4 (waves of light over blue) as a surprise, each with that console's startup sound. System → App picks the **opening style** (picking any, Console Mode's own included, keeps it and ends the surprises), plays the opening right away, picks **None** for the app to open straight away with no opening, or turns just the sound off. It doesn't show when the app starts hidden (with Windows or in the tray). (#184)
+- Notices on the game screen (how to open the session menu, low battery): they slide in from the screen's right edge, show a thin bar with the time left and slide back out the same way; their size follows the screen, like the rest of the interface. (#185)
+- **Session menu outside console mode**: with Console Mode open (even just in the tray), the menu shortcut opens the Session menu without starting any launcher or game, to use the PC from the couch: open windows, volume, screen, audio, HDR, ControlFS, JoyChromium and, now outside a session too, hiding the pointer and driving the mouse with the controller. It is no longer a preview; turn it off in System → Controller → **Session menu outside console mode** (on by default). (#185)
+- Console scale: the interface and the Session menu are laid out for a screen 1080 tall and always take the same share of the screen, like a console. With Windows at 125 %, 150 % or 200 %, or on a 4K TV, they look the same as on a 1080p monitor at 100 %, nothing oversized or cut off. (#185)
+- Home: the apps' icons on the tiles (Steam, Playnite, Xbox, custom apps) no longer have jagged edges; Console Mode shrinks each icon to the screen's exact size with smooth edges, also on screens scaled to 125 % or 150 % and on the focused tile. (#185)
+- System and the session menu: the list of options fades into the background at the top and bottom edges while there are more rows that way, instead of ending in a hard cut, and a thin bar on the right shows where you are when the list is longer than the screen. Opening the tab or switching categories shows the edge already faded, never the cut first. (#185)
+- System → More apps from the developer now lists ControlFS (alpha), Tako Launcher (closed alpha) and JoyChromium (beta) as cards, like the games on a console: the app's art on top, its name, its stage and a line on what it is; WakeOn and Next Boost are off the list. (#185)
+- **Several custom apps**: every `.exe` you add becomes a tile on Home, with the program's icon and name; the **+ Add app** tile at the end of the row (or System → When entering console mode → Add a custom app) picks the file. System changes the selected app's `.exe`, arguments and process to watch, or removes it. The custom app you already had becomes the first in the list. (#185)
+- Custom app: when the `.exe` you open is only a launcher that starts the real program and quits (common with emulators and launchers), Console Mode follows the program it started by itself, takes its window to the game screen and ends the session when it closes. **Process to watch** is no longer needed for those; when filled in, it still decides. (#185)
+
### Fixes
- Custom app: Console Mode moves only the program's largest window to the game screen, instead of every window Windows reports as its main one; a tooltip is no longer stretched over the TV. (#175)
- If the app closes or the PC shuts down in the middle of a session, the next time Console Mode opens it restores everything the session changed (displays, audio, RTSS, desktop icons and pointer) and says so. Before, the displays stayed as the session left them until you fixed them by hand. (#178)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2d4bc06..3322f9a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,15 @@ Notas em português do Brasil; a versão em inglês (Estados Unidos) fica em `CH
- **Uma interface só, com tour guiado**: o Console Mode passa a ter apenas a interface Console, que também funciona com mouse e teclado (clique nas abas, Page Up / Page Down, Enter e Esc). A interface Desktop e a opção Interface saíram; o que só existia nela foi para a aba Sistema: o contador de FPS (estilo, tamanho, posição, cor e itens), os argumentos e o processo a acompanhar do aplicativo personalizado, o relatório de diagnóstico e a versão do app. Embaixo da lista, a aba Sistema mostra o que faz o ajuste em foco. Na aba Sessão, as telas voltam a aparecer como nas configurações de vídeo do Windows: cada uma onde fica na mesa e na proporção real (um monitor em pé aparece em pé), e as desligadas tracejadas. Na primeira vez que você abre, um tour destaca as abas, os iniciadores, o botão de jogar, as telas, os ajustes rápidos, as configurações e os atalhos do controle (A avança, B pula); para ver de novo, Sistema → App → Tutorial. (#184)
- **Abertura**: ao abrir, o logo do Console Mode "liga" no escuro: a luz de energia da base acende e pulsa, a tela se desenha e acende verde, o >_ é digitado com o cursor piscando e o nome aparece, com um som de entrada, enquanto o app carrega (uns 3 s); depois passa para a interface com um fade. Qualquer botão, clique ou tecla pula. A abertura oficial é a do Console Mode, mas de vez em quando (cerca de 1 em cada 8) o app abre de surpresa com uma inspirada no Xbox 360 (faixas verdes girando até um orbe de luz) ou no PS4 (ondas de luz sobre o azul), cada uma com o som de inicialização do console. Em Sistema → App dá para escolher o **estilo da abertura** (escolher qualquer um, até o do Console Mode, fixa o estilo e acaba com as surpresas), ver a abertura na hora, escolher **Nenhuma** para o app abrir direto, sem abertura, ou desligar só o som. Não aparece quando o app inicia escondido (com o Windows ou pela bandeja). (#184)
+- Avisos na tela de jogo (como abrir o menu da sessão, bateria fraca): entram deslizando da borda direita da tela, ficam com uma barrinha que mostra quanto tempo falta e saem deslizando pelo mesmo lado; o tamanho acompanha a tela, como o resto da interface. (#185)
+- **Menu da sessão fora do modo console**: com o Console Mode aberto (mesmo só na bandeja), o atalho do menu abre o Menu da sessão sem iniciar nenhum launcher ou jogo, para usar o PC do sofá: janelas abertas, volume, tela, áudio, HDR, ControlFS, JoyChromium e, agora também fora da sessão, esconder o cursor e controlar o mouse com o controle. Deixou de ser uma prévia; desliga em Sistema → Controle → **Menu da sessão fora do modo console** (ligado por padrão). (#185)
+- Escala de console: a interface e o Menu da sessão são desenhados para uma tela de 1080 de altura e ocupam sempre a mesma proporção da tela, como num console. Com o Windows em 125 %, 150 % ou 200 %, ou numa TV 4K, ficam com a mesma cara que num monitor 1080p em 100 %, sem nada grande demais ou cortado. (#185)
+- Início: os ícones dos apps nos tiles (Steam, Playnite, Xbox, apps personalizados) não ficam mais serrilhados; o Console Mode reduz cada ícone ao tamanho exato da tela, com bordas suaves, inclusive em telas com escala de 125 % ou 150 % e no tile com foco. (#185)
+- Sistema e menu da sessão: a lista de opções esmaece no fundo nas bordas de cima e de baixo quando há mais itens para aquele lado, em vez de terminar cortada, e uma barra fina à direita mostra onde você está na lista quando ela é maior que a tela. Ao abrir a aba ou trocar de categoria, a borda já aparece esmaecida, sem mostrar o corte antes. (#185)
+- Sistema → Outros apps do desenvolvedor agora mostra o ControlFS (alpha), o Tako Launcher (alpha fechado) e o JoyChromium (beta) em cards, como os jogos de um console: a arte do app em cima, o nome, a fase e uma linha sobre o que é; o WakeOn e o Next Boost saíram da lista. (#185)
+- **Vários aplicativos personalizados**: cada `.exe` que você adicionar vira um bloco no Início, com o ícone e o nome do programa; o bloco **+ Adicionar app** no fim da fileira (ou Sistema → Ao entrar no modo console → Adicionar aplicativo personalizado) escolhe o arquivo. Em Sistema dá para trocar o `.exe`, os argumentos e o processo a acompanhar do app selecionado, ou removê-lo. O app personalizado que você já tinha vira o primeiro da lista. (#185)
+- Aplicativo personalizado: quando o `.exe` aberto é só um iniciador que abre o programa de verdade e fecha (comum em emuladores e lançadores), o Console Mode passa a acompanhar sozinho o programa que ele abriu, leva a janela dele para a tela de jogo e encerra a sessão quando ele fecha. Não é mais preciso preencher **Processo a acompanhar** nesses casos; quem preencher continua mandando. (#185)
+
### Correções
- Aplicativo personalizado: o Console Mode leva para a tela de jogo só a maior janela do programa, em vez de todas as que o Windows aponta como principal; uma dica de ferramenta não é mais esticada sobre a TV. (#175)
- Se o app fechar ou o PC desligar no meio de uma sessão, a próxima abertura do Console Mode restaura tudo o que a sessão mudou (telas, áudio, RTSS, ícones da área de trabalho e ponteiro) e avisa. Antes, as telas ficavam como a sessão deixou até você arrumar à mão. (#178)
diff --git a/docs/GUIDE.de-DE.md b/docs/GUIDE.de-DE.md
index dfa76c6..0de318b 100644
--- a/docs/GUIDE.de-DE.md
+++ b/docs/GUIDE.de-DE.md
@@ -19,6 +19,8 @@ Du kannst auch jederzeit über den Infobereich wiederherstellen (*Konfiguration
Das Sitzungsmenü bietet zwei Wege hinaus. **Zurück zum PC** beendet die Sitzung und setzt Bildschirme, Auflösung, HDR, Ton und die FPS-Begrenzung auf den vorherigen Stand zurück; die App bleibt im Infobereich. **Console Mode beenden** macht dasselbe und schließt danach die App, sodass die Controller-Tastenkombinationen nicht mehr reagieren, bis du sie wieder öffnest. Beim ersten Öffnen bietet das Menü eine Führung an, die jede Option erklärt. Um sie später anzusehen, drücke im Menü **Y** (△ bei PlayStation) oder **F1**, oder verwende **System → App → Führung durch das Sitzungsmenü**.
+Das Menü funktioniert auch **außerhalb des Konsolenmodus**, um den PC vom Sofa aus zu bedienen, ohne etwas zu starten: Solange Console Mode geöffnet ist (auch nur im Infobereich), öffnen es die Menü-Tastenkombination, das Symbol im Infobereich oder `consolemode://menu` auf dem Spielbildschirm, wenn er eingeschaltet ist, sonst auf dem Hauptbildschirm. Dort kannst du Fenster wechseln, Lautstärke, Auflösung, Audioausgabe und HDR ändern, ControlFS und JoyChromium öffnen, den Mauszeiger ausblenden und die Maus mit dem Controller steuern. Was du änderst, bleibt so, bis du es wieder änderst, denn es gibt keine Sitzung zum Rückgängigmachen; FPS-Begrenzung und FPS-Anzeige erscheinen nur in einer Sitzung. Stört die Tastenkombination in einem Spiel, schalte **System → Controller → Sitzungsmenü außerhalb des Konsolenmodus** aus (über den Infobereich öffnet sich das Menü weiterhin).
+
## Die Oberfläche
Console Mode hat eine einzige Oberfläche, gestaltet wie die einer Konsole: Sie füllt den Bildschirm und funktioniert mit einem Xbox- oder PlayStation-Controller, der Maus oder der Tastatur (klicke auf eine Registerkarte oder nutze Bild auf / Bild ab; Eingabe und Esc wirken wie A und B). Beim ersten Öffnen führt dich eine Tour durch die Registerkarten, die Launcher, die Spielen-Schaltfläche, die Bildschirme, die Schnelleinstellungen und die Controller-Tastenkombinationen; **A** geht weiter, **B** überspringt sie. Um sie erneut zu sehen: **System → App → Tutorial**. Während die App lädt, zeigt sie ein Intro mit dem Logo und einem Startsound; jede Taste überspringt es, ab und zu kommt als Überraschung eines im Stil der Xbox 360 oder der PS4 mit dem Sound der Konsole; unter **System → App** wählst du einen Stil (damit enden die Überraschungen), siehst es sofort an und schaltest das Intro oder nur seinen Sound aus.
diff --git a/docs/GUIDE.es-ES.md b/docs/GUIDE.es-ES.md
index ec77147..2d12647 100644
--- a/docs/GUIDE.es-ES.md
+++ b/docs/GUIDE.es-ES.md
@@ -19,6 +19,8 @@ También puedes restaurar en cualquier momento desde la bandeja (*Restaurar pant
El menú de la sesión tiene dos salidas. **Volver al PC** termina la sesión y devuelve pantallas, resolución, HDR, audio y límite de FPS a como estaban; la aplicación sigue en la bandeja. **Salir de Console Mode** hace lo mismo y además cierra la aplicación, así que los atajos del mando dejan de funcionar hasta que la vuelvas a abrir. La primera vez que se abre el menú, ofrece un recorrido que explica cada opción; para verlo más tarde, pulsa **Y** (△ en PlayStation) o **F1** en el menú, o usa **Sistema → Aplicación → Recorrido del menú de sesión**.
+El menú también funciona **fuera del modo consola**, para usar el PC desde el sofá sin iniciar nada: con Console Mode abierto (aunque sea solo en la bandeja), el atajo del menú, el icono de la bandeja o `consolemode://menu` lo abren en la pantalla de juego, si está encendida, o en la principal. Ahí puedes cambiar de ventana, ajustar el volumen, la resolución, la salida de audio y el HDR, abrir ControlFS y JoyChromium, ocultar el cursor y mover el ratón con el mando. Lo que cambies queda así hasta que lo cambies de nuevo, porque no hay sesión que deshacer; el límite y el contador de FPS solo aparecen en una sesión. Si el atajo molesta en algún juego, desactiva **Sistema → Mando → Menú de la sesión fuera del modo consola** (la bandeja sigue abriendo el menú).
+
## La interfaz
Console Mode tiene una sola interfaz, hecha como la de una consola: ocupa toda la pantalla y funciona con un mando de Xbox o PlayStation, el ratón o el teclado (haz clic en una pestaña o usa Re Pág / Av Pág; Intro y Esc hacen de A y B). La primera vez que la abres, un recorrido guiado pasa por las pestañas, los lanzadores, el botón de jugar, las pantallas, los ajustes rápidos y los atajos del mando; **A** avanza y **B** lo salta. Para volver a verlo: **Sistema → Aplicación → Tutorial**. Mientras carga, la aplicación muestra una apertura con el logotipo y un sonido de entrada; cualquier botón la salta, de vez en cuando, por sorpresa, es una inspirada en la Xbox 360 o en la PS4, con el sonido de la consola; **Sistema → Aplicación** elige un estilo (lo que acaba con las sorpresas), la muestra al momento y desactiva la apertura o solo su sonido.
diff --git a/docs/GUIDE.fr-FR.md b/docs/GUIDE.fr-FR.md
index 8664678..f3264a2 100644
--- a/docs/GUIDE.fr-FR.md
+++ b/docs/GUIDE.fr-FR.md
@@ -19,6 +19,8 @@ Vous pouvez aussi restaurer à tout moment depuis la zone de notification (*Rest
Le menu de session propose deux sorties. **Retour au PC** termine la session et remet les écrans, la résolution, le HDR, le son et la limite de FPS comme avant ; l'application reste dans la zone de notification. **Quitter Console Mode** fait la même chose puis ferme l'application : les raccourcis manette ne fonctionnent plus jusqu'à ce que vous la rouvriez. À la première ouverture, le menu propose une visite qui explique chaque option ; pour la revoir plus tard, appuyez sur **Y** (△ sur PlayStation) ou **F1** dans le menu, ou utilisez **Système → Application → Visite du menu de session**.
+Le menu fonctionne aussi **hors du mode console**, pour utiliser le PC depuis le canapé sans rien lancer : tant que Console Mode est ouvert (même seulement dans la zone de notification), le raccourci du menu, l'icône de la zone de notification ou `consolemode://menu` l'ouvrent sur l'écran de jeu s'il est allumé, sinon sur l'écran principal. Vous pouvez y changer de fenêtre, régler le volume, la résolution, la sortie audio et le HDR, ouvrir ControlFS et JoyChromium, masquer le pointeur et piloter la souris à la manette. Ce que vous changez reste ainsi jusqu'à ce que vous le changiez de nouveau, car il n'y a pas de session à annuler ; la limite et le compteur de FPS n'apparaissent que pendant une session. Si le raccourci gêne dans un jeu, désactivez **Système → Manette → Menu de session hors du mode console** (l'icône de la zone de notification ouvre toujours le menu).
+
## L'interface
Console Mode a une seule interface, conçue comme celle d'une console : elle occupe tout l'écran et marche avec une manette Xbox ou PlayStation, la souris ou le clavier (cliquez sur un onglet ou utilisez Page précédente / Page suivante ; Entrée et Échap font office de A et B). À la première ouverture, une visite guidée passe par les onglets, les lanceurs, le bouton Jouer, les écrans, les réglages rapides et les raccourcis manette ; **A** avance, **B** la passe. Pour la revoir : **Système → Application → Tutoriel**. Pendant le chargement, l'application affiche une ouverture avec son logo et un son d'entrée ; n'importe quel bouton la passe, de temps en temps, par surprise, c'est une inspirée de la Xbox 360 ou de la PS4, avec le son de la console ; **Système → Application** choisit un style (ce qui met fin aux surprises), la montre tout de suite et désactive l'ouverture ou seulement son son.
diff --git a/docs/GUIDE.md b/docs/GUIDE.md
index d8be9c5..bbc250a 100644
--- a/docs/GUIDE.md
+++ b/docs/GUIDE.md
@@ -15,7 +15,7 @@ English · [Português (Brasil)](GUIDE.pt-BR.md) · [Español](GUIDE.es-ES.md)
If the app closes or the PC shuts down in the middle of a session, the next time Console Mode opens (also at Windows sign-in, if it starts with Windows) it restores everything the session changed: displays, audio, RTSS, desktop icons and the pointer, and says so.
-**Custom app** opens any `.exe` you pick (RetroArch, another launcher…) from its own folder, with optional arguments, and moves its window to the game screen. The session ends a few seconds after that process closes. If the exe only starts another program and exits (a launcher stub), type the real program's process name in **Process to watch**. If the watched process never shows up, the session stays until you end it (hold Start + Select, the session menu or the tray).
+**Custom app** opens any `.exe` you pick (RetroArch, another launcher…) from its own folder, with optional arguments, and moves its window to the game screen. The session ends a few seconds after that process closes. You can add as many as you like: each one is a tile on Home with its program's icon (**+ Add app** at the end of the row), and System changes or removes the selected one. If the exe only starts another program and exits (a launcher stub), Console Mode follows that program by itself; **Process to watch** is only needed when it guesses wrong (type the real program's process name there). If the watched process never shows up, the session stays until you end it (hold Start + Select, the session menu or the tray).
**Browser (JoyChromium)** is pinned in the session menu, right under the ControlFS file explorer: [JoyChromium](https://github.com/lippdev/joychromium), the team's TV browser driven with a controller, opens full screen over the game on the session screen. If it isn't installed, the first press downloads its newest release (checked against GitHub's SHA-256) and installs it, and the next press opens it. Going back to the PC while it's still open takes it out of full screen and leaves it as a window, tabs and all.
@@ -23,6 +23,8 @@ You can also restore anytime from the tray (*Restore setup* / *Show window*). Wi
The session menu has two ways out. **Back to the PC** ends the session and puts screens, resolution, HDR, audio and the FPS limit back as they were; the app stays in the tray. **Exit Console Mode** does the same and then closes the app, so the controller shortcuts stop until you open it again. The first time the menu opens, it offers a tour that explains each option; to see it later, press **Y** (△ on PlayStation) or **F1** in the menu, or use **System → App → Session menu tour**.
+The menu also works **outside console mode**, to use the PC from the couch without starting anything: with Console Mode open (even just in the tray), the menu shortcut, the tray icon or `consolemode://menu` opens it on the game screen, if it is on, or on the primary one. There you can switch windows, change the volume, resolution, audio output and HDR, open ControlFS and JoyChromium, hide the pointer and drive the mouse with the controller. What you change stays that way until changed again, since there is no session to undo; the FPS limit and counter only show in a session. If the shortcut gets in the way in a game, turn off **System → Controller → Session menu outside console mode** (the tray still opens the menu).
+
## The interface
Console Mode has one interface, made like a console's: it fills the screen and works with an Xbox or PlayStation controller, the mouse or the keyboard (click a tab or use Page Up / Page Down; Enter and Esc work as A and B). The first time you open it, a guided tour walks through the tabs, the launchers, the play button, the screens, the quick settings and the controller shortcuts; **A** goes on, **B** skips it. To see it again: **System → App → Tutorial**. While the app loads it shows an opening with its logo and an entrance sound; any button skips it, now and then it is, as a surprise, one inspired by the Xbox 360 or the PS4, with that console's sound; **System → App** picks a style (which ends the surprises), plays it right away, and turns it off, or just its sound.
diff --git a/docs/GUIDE.pt-BR.md b/docs/GUIDE.pt-BR.md
index b011cc1..e9cf61b 100644
--- a/docs/GUIDE.pt-BR.md
+++ b/docs/GUIDE.pt-BR.md
@@ -15,7 +15,7 @@ Detalhes que não cabem no [README](../README.pt-BR.md).
Se o app fechar ou o PC desligar no meio de uma sessão, na próxima vez que o Console Mode abrir (também ao entrar no Windows, se ele inicia com o Windows) ele restaura tudo o que a sessão mudou: telas, áudio, RTSS, ícones da área de trabalho e o ponteiro, e avisa.
-**Aplicativo personalizado** abre qualquer `.exe` que você escolher (RetroArch, outro launcher…) a partir da própria pasta, com argumentos opcionais, e move a janela dele para a tela de jogo. A sessão termina alguns segundos depois que esse processo fecha. Se o exe só abre outro programa e fecha (um launcher intermediário), digite o nome do processo do programa de verdade em **Processo a acompanhar**. Se o processo acompanhado nunca aparecer, a sessão continua até você encerrá-la (segurar Start + Select, o menu da sessão ou a bandeja).
+**Aplicativo personalizado** abre qualquer `.exe` que você escolher (RetroArch, outro launcher…) a partir da própria pasta, com argumentos opcionais, e move a janela dele para a tela de jogo. A sessão termina alguns segundos depois que esse processo fecha. Dá para adicionar quantos quiser: cada um vira um bloco no Início com o ícone do programa (**+ Adicionar app** no fim da fileira), e em Sistema dá para trocar ou remover o selecionado. Se o exe só abre outro programa e fecha (um launcher intermediário), o Console Mode passa a acompanhar esse programa sozinho; **Processo a acompanhar** só é preciso quando ele errar (digite ali o nome do processo do programa de verdade). Se o processo acompanhado nunca aparecer, a sessão continua até você encerrá-la (segurar Start + Select, o menu da sessão ou a bandeja).
**Navegador (JoyChromium)** fica fixo no menu da sessão, logo abaixo do explorador de arquivos ControlFS: o [JoyChromium](https://github.com/lippdev/joychromium), o navegador para a TV que se usa com o controle, abre em tela cheia por cima do jogo, na tela da sessão. Se ele não estiver instalado, o primeiro clique baixa a versão mais recente (conferida pelo SHA-256 do GitHub) e instala, e o próximo abre. Voltar ao PC com ele ainda aberto o tira da tela cheia e o deixa como janela, com as abas.
@@ -23,6 +23,8 @@ Também dá para restaurar a qualquer momento pela bandeja (*Restaurar setup* /
No menu da sessão há duas saídas. **Voltar ao PC** encerra a sessão e devolve telas, resolução, HDR, áudio e limite de FPS ao que eram; o app continua na bandeja. **Sair do Console Mode** faz o mesmo e depois fecha o app, então os atalhos do controle param até você abri-lo de novo. Na primeira vez que o menu abre, ele oferece um tour que explica cada opção; para vê-lo depois, aperte **Y** (△ no PlayStation) ou **F1** no menu, ou use **Sistema → App → Tour do menu da sessão**.
+O menu também funciona **fora do modo console**, para usar o PC do sofá sem iniciar nada: com o Console Mode aberto (mesmo só na bandeja), o atalho do menu, o ícone da bandeja ou `consolemode://menu` o abrem na tela de jogo, se ela estiver ligada, ou na principal. Ali dá para trocar de janela, mexer no volume, na resolução, na saída de áudio e no HDR, abrir o ControlFS e o JoyChromium, esconder o cursor e controlar o mouse com o controle. O que você muda fica assim até ser trocado de novo, já que não há sessão para desfazer; o limite e o contador de FPS só aparecem numa sessão. Se o atalho atrapalhar algum jogo, desligue **Sistema → Controle → Menu da sessão fora do modo console** (a bandeja continua abrindo o menu).
+
## A interface
O Console Mode tem uma interface só, feita como a de um console: ocupa a tela toda e funciona com controle Xbox ou PlayStation, mouse ou teclado (clique numa aba ou use Page Up / Page Down; Enter e Esc fazem o papel de A e B). Na primeira vez que você abre, um tour guiado passa pelas abas, pelos iniciadores, pelo botão de jogar, pelas telas, pelos ajustes rápidos e pelos atalhos do controle; **A** avança e **B** pula. Para ver de novo: **Sistema → App → Tutorial**. Enquanto carrega, o app mostra uma abertura com o logo e um som de entrada; qualquer botão pula, de vez em quando, de surpresa, vem uma inspirada no Xbox 360 ou no PS4, com o som do console; **Sistema → App** escolhe um estilo (o que acaba com as surpresas), mostra a abertura na hora e desliga a abertura ou só o som.
diff --git a/docs/GUIDE.ru-RU.md b/docs/GUIDE.ru-RU.md
index bb73d9f..1f24acb 100644
--- a/docs/GUIDE.ru-RU.md
+++ b/docs/GUIDE.ru-RU.md
@@ -19,6 +19,8 @@
Из меню сеанса есть два выхода. **«Вернуться к ПК»** завершает сеанс и возвращает экраны, разрешение, HDR, звук и ограничение FPS в прежнее состояние; приложение остаётся в области уведомлений. **«Выйти из Console Mode»** делает то же самое, а затем закрывает приложение, поэтому сочетания на геймпаде не работают, пока вы не откроете его снова. При первом открытии меню предлагает обзор, который объясняет каждый пункт; чтобы посмотреть его позже, нажмите в меню **Y** (△ на PlayStation) или **F1** либо используйте **«Система» → «Приложение» → «Обзор меню сеанса»**.
+Меню работает и **вне режима консоли** — чтобы пользоваться ПК с дивана, ничего не запуская: пока Console Mode запущен (даже только в трее), сочетание для меню, значок в трее или `consolemode://menu` открывают его на игровом экране, если он включён, иначе на основном. Там можно переключать окна, менять громкость, разрешение, аудиовыход и HDR, открывать ControlFS и JoyChromium, скрывать указатель и управлять мышью с геймпада. Изменённое остаётся таким, пока вы не поменяете его снова, ведь сеанса, который можно отменить, нет; ограничение и счётчик FPS появляются только в сеансе. Если сочетание мешает в какой-нибудь игре, выключите **Система → Геймпад → Меню сеанса вне режима консоли** (значок в трее по-прежнему открывает меню).
+
## Интерфейс
У Console Mode один интерфейс, устроенный как у консоли: он занимает весь экран и работает с геймпадом Xbox или PlayStation, мышью или клавиатурой (щёлкните по вкладке или используйте Page Up / Page Down; Enter и Esc работают как A и B). При первом запуске обзор проводит по вкладкам, лаунчерам, кнопке «Играть», экранам, быстрым настройкам и сочетаниям геймпада; **A** — дальше, **B** — пропустить. Чтобы посмотреть его снова: **«Система» → «Приложение» → «Обучение»**. Пока приложение загружается, показывается заставка с логотипом и звуком; любая кнопка её пропускает, иногда для сюрприза показывается заставка в духе Xbox 360 или PS4 со звуком консоли; в **«Система» → «Приложение»** можно выбрать стиль (после этого сюрпризов не будет), сразу посмотреть её и выключить заставку или только её звук.
diff --git a/docs/PRD.md b/docs/PRD.md
index c9af7bd..07197e8 100644
--- a/docs/PRD.md
+++ b/docs/PRD.md
@@ -93,6 +93,7 @@ refeita e sem caminho de volta perdido.
| D-20 | **Perfis por jogo com o Tako:** quando a sessão vem do Tako, quem aplica resolução e áudio do jogo é o Tako (D-16); os perfis do Console Mode (#170) valem só nas sessões que não vêm dele. | A decidir com o Tako (CMI) |
| D-21 | **Estacionar o ponteiro** no canto da tela de jogo quando o launcher aparece vem **ligado por padrão** e devolve o ponteiro para onde estava ao voltar. | Decidido (resposta à issue #172; implementação no INPUT-014) |
| D-22 | **Restauração durável:** tudo o que a sessão muda (telas, áudio, ícones, ponteiro, comandos de fim) é gravado em disco antes da mudança e desfeito no próximo início se o app cair. | Decidido e implementado no CORE-012 (#178). Antes dele, depois de uma queda nada era restaurado sozinho: os backups ficavam no disco, mas o "Restaurar agora" não os usava sem uma sessão ativa. |
+| D-25 | **Escala de console:** a interface e o Menu da sessão são desenhados para uma tela de 1080 de altura e ocupam sempre a mesma proporção da janela, qualquer que seja a escala do Windows (125 %, 150 %, 200 %) ou a resolução (1080p, 1440p, 4K). Escolhido entre "proporcional à tela" e "sempre em 100 %". | Decidido pelo dono em 01/11/2026; UI-018. |
| D-24 | **Sons oficiais de console, por conta e risco:** o dono pode usar sons da Microsoft e da Sony (como os das aberturas inspiradas no Xbox 360 e no PS4), registrados no THIRD_PARTY_NOTICES e trocados se o dono dos direitos pedir. A parte visual imita só o clima, sem logos nem nomes dos consoles. | Decidido pelo dono em 31/10/2026 |
| D-23 | **Uma interface só:** a partir da 1.7.0 o app tem apenas a interface Console, que também funciona com mouse e teclado. A interface Desktop e a escolha de interface saem; o que só existia nela vai para a aba Sistema, e a primeira abertura ganha um tour guiado. | Decidido pelo dono em 31/10/2026; UI-012 e UI-013. |
@@ -357,6 +358,7 @@ Legenda: **P0** = necessário para a 1.7.0; **P1** = próxima versão; **P2** =
- [ ] **LAUNCH-007 (P0) —** Logos oficiais dos lançadores nos tiles da Início, lidos dos apps instalados. (#169)
- [ ] **LAUNCH-010 (P1) — Tako Launcher.** Tile na Início com logo, abrir o Tako em tela cheia na tela de jogo (`tako --console-session`), restaurar quando o Tako avisar o fim pela API (API-002), detectar a instalação. Aceite: entrar, jogar e voltar ao PC sem mouse, com o Tako. Depende de CMI-004 do Tako.
- [x] **LAUNCH-011 — JoyChromium.** Auxiliar do menu da sessão, como o ControlFS (decisão do mantenedor em 29/10: não é iniciador nem aparece na Início): linha fixa abaixo do ControlFS, abre em tela cheia (`--tv`) na tela da sessão, instala pelo próprio menu se faltar (SHA-256 do GitHub, NSIS `/S` por usuário) e, ao voltar ao PC, o deixa em janela (`--window`). (#175, #181, 1.7.0)
+- [x] **LAUNCH-017 —** Vários aplicativos personalizados, cada um um bloco no Início com o ícone do .exe (+ Adicionar app), editáveis e removíveis em Sistema; e o fim da sessão segue sozinho o programa aberto por um iniciador (árvore de processos), sem precisar de "Processo a acompanhar". (1.7.0)
- [ ] **LAUNCH-012 (P2) —** Scripts próprios ao entrar e ao voltar (comando, `.bat` ou PowerShell), com tempo-limite e o comando de fim gravado em disco (CORE-012). Vem do #173, em PR próprio.
- [ ] **LAUNCH-013 (P2) — Hydra Launcher.** Detectar a instalação, abrir em tela cheia na tela de jogo, restaurar ao fechar, logo oficial (D-19). _A definir: caminho, processo real e modo tela cheia._
- [ ] **LAUNCH-014 (P2) — AnyFSE.** Ferramenta que põe qualquer app como tela inicial da experiência de tela cheia do modo Xbox. Níveis: (a) detectar e conviver, sem briga com o modo Xbox do Console Mode; (b) mostrar o estado e abrir a configuração; (c) configurar o app de destino (Tako, Hydra, Playnite). Aceite mínimo: com o AnyFSE ativo, entrar e sair restaura a mesa. O Tako já tem o lado dele (PLAT-007 do Tako).
@@ -397,6 +399,8 @@ Legenda: **P0** = necessário para a 1.7.0; **P1** = próxima versão; **P2** =
- [x] **UI-015 —** Abertura ao abrir o app: o logo com som de entrada enquanto carrega, com fade para a interface; pula com qualquer botão; "Nenhuma" no estilo abre direto, e o som se desliga à parte, em Sistema → App. (1.7.0)
- [x] **UI-016 —** Estilos de abertura em Sistema → App: a do Console Mode (a oficial; sem estilo escolhido, de vez em quando sai de surpresa uma das inspiradas, até a pessoa escolher um estilo), "Inspirada no Xbox 360" e "Inspirada no PS4" (só o clima visual, com o nosso logo; sons oficiais por escolha do dono, D-24), e "Ver a abertura". (1.7.0)
- [x] **UI-017 —** A nossa abertura, "Liga o PC" (escolhida entre três protótipos originais): o logo redesenhado em vetor liga no escuro, peça por peça, com o som do Selene; é a do Console Mode, a oficial. (1.7.0)
+- [x] **UI-019 —** Menu da sessão fora do modo console: o atalho do menu o abre sem sessão (deixa de ser prévia), com esconder o cursor e controle como mouse também ali (voltam a desligado ao começar ou terminar uma sessão); limite e contador de FPS só na sessão. Opção em Sistema → Controle, ligada por padrão. (1.7.0)
+- [x] **UI-018 —** Escala de console (D-25): a interface e o Menu da sessão ficam com a mesma cara em qualquer escala do Windows e resolução; numa janela estreita, encolhem até caber 1280 de largura. Os ícones da Início são reduzidos para os pixels reais da tela. (1.7.0)
- [x] **UI-014 —** A aba Sistema mostra, embaixo da lista, o que faz a linha em foco: as descrições que a interface Desktop tinha. (1.7.0)
- [ ] **UI-010 (P2) —** Acessibilidade: leitor de tela, alto contraste na interface Console, tamanho do texto, redução de animações própria.
- [ ] **UI-011 (P2) —** Polimento contínuo: legibilidade em TV com sobrevarredura, escala do texto, consistência de foco e hover entre a interface e o menu.
@@ -484,7 +488,7 @@ Legenda: **P0** = necessário para a 1.7.0; **P1** = próxima versão; **P2** =
### Épico DIAG — Diagnóstico e suporte
- [x] **DIAG-001 —** Botão de feedback com issue pré-preenchida. (#25, 1.5.0)
-- [x] **DIAG-002 —** "Mais apps do desenvolvedor" (WakeOn, Next Boost). (#63, 1.5.0)
+- [x] **DIAG-002 —** "Mais apps do desenvolvedor": WakeOn e Next Boost (#63, 1.5.0); na 1.7, ControlFS (alpha), Tako Launcher (alpha fechado) e JoyChromium (beta), com fase e descrição (#185).
- [x] **DIAG-003 —** Diagnóstico com relatório copiável, sem dados pessoais. (#159, 1.7.0-alpha.1)
- [ ] **DIAG-004 (contínuo) —** Coletar setups que funcionam ou quebram (issue #15) e levar os casos ao Diagnóstico.
diff --git a/docs/TESTING.md b/docs/TESTING.md
index 9cdacfa..2daf479 100644
--- a/docs/TESTING.md
+++ b/docs/TESTING.md
@@ -660,6 +660,29 @@ Pré-condições: um `config.json` sem `consoleTourDone` (vale para quem atualiz
- [ ] "Ver a abertura" toca o estilo escolhido na hora, por cima da interface, e some sozinha (ou com qualquer botão). Resultado: ______
- [ ] Iniciar com o Windows / `--start` / bandeja: nenhuma abertura nem som com a janela escondida. Com as animações do Windows desligadas, o logo aparece parado e some sem fade. Resultado: ______
+### Lista de Sistema e outros apps
+
+- [ ] Aviso de início de sessão (com o atalho do menu definido) e de bateria fraca: entra deslizando da borda direita da TV, sem aparecer em outra tela ao lado; o fundo em volta do card é transparente (sem retângulo preto); a barrinha verde esvazia e o aviso sai deslizando para a direita. O jogo não perde o foco em nenhum momento. Resultado: ______
+
+- [ ] Menu fora do modo console: com o atalho do menu definido e o Console Mode só na bandeja, segurar o atalho abre o Menu da sessão na tela de jogo (ou na principal, com a TV desligada), com o selo "Fora da sessão" e sem limite/contador de FPS. Resultado: ______
+- [ ] Fora da sessão, **Controlar o mouse com o controle** move o ponteiro e clica; com a janela do Console Mode em primeiro plano o controle volta a navegar a interface (o mouse espera); com o menu aberto, também. **Ocultar o cursor** some com a seta. Começar uma sessão desliga os dois; fechar o Console Mode traz o cursor de volta. Resultado: ______
+- [ ] Sistema → Controle → **Menu da sessão fora do modo console** desligado: o atalho não abre o menu fora da sessão (abre numa sessão), o ícone da bandeja continua abrindo; desligar com o mouse do controle ligado o desliga. Resultado: ______
+
+- [ ] Escala de console: com o Windows em 100 %, 125 %, 150 % e 200 % (Configurações → Sistema → Tela → Escala), a Início, a Sessão, o Sistema e o Menu da sessão ocupam a mesma proporção da tela, sem nada cortado ou gigante. Na TV 4K, igual a uma TV 1080p. Com a janela restaurada e redimensionada, a interface encolhe junto, sem cortar. Resultado: ______
+
+- [ ] Início: os ícones dos tiles (Steam, Playnite, Xbox e um app personalizado) têm bordas lisas, sem serrilhado, com o tile parado e com foco; repetir com a tela em 150 % de escala e arrastando a janela para uma tela de escala diferente. Resultado: ______
+
+- [ ] Sistema, numa categoria longa (App, Extras opcionais): a borda de baixo esmaece no fundo enquanto há linhas abaixo, e a de cima quando já rolou; no fim e no começo da lista, a borda fica limpa. A barra fina à direita aparece só quando a lista rola e acompanha a posição (controle, roda do mouse e teclado). Ao entrar na aba Sistema e ao trocar de categoria (de uma curta, como Tela de jogo, para App), a borda de baixo já aparece esmaecida, sem mostrar a lista cortada por um instante. No menu da sessão, a lista do painel lateral faz o mesmo (com o "Fechar menu" fora da tela, a borda de baixo esmaece e a barra aparece). Resultado: ______
+- [ ] Sistema → Outros apps do desenvolvedor: ControlFS (Alpha), Tako Launcher (Alpha fechado) e JoyChromium (Beta) em três cards lado a lado, com a arte em cima e nome, fase e descrição embaixo; o card com foco cresce sem ser cortado nas bordas, e esquerda/direita passam de um para outro; A abre a página do GitHub de cada um. Não há mais WakeOn nem Next Boost. Resultado: ______
+
+### Vários aplicativos personalizados
+
+- [ ] Início: depois dos lançadores aparece o bloco **+ Adicionar app**; A (ou clique) nele abre o seletor de arquivo; escolher um `.exe` cria um bloco com o ícone e o nome do programa (a descrição do exe), já selecionado. Passar o foco pelo "+" não troca o lançador. Resultado: ______
+- [ ] Adicionar dois ou três apps: cada um tem o seu bloco; selecionar um mostra em Sistema → Ao entrar no modo console o .exe, os argumentos e o processo a acompanhar **dele**, e editar muda só ele (confira trocando de bloco e voltando). Resultado: ______
+- [ ] "Remover este aplicativo" tira o bloco e o Steam Big Picture passa a abrir; os outros apps continuam. Reabrir o app mantém a lista, o selecionado e os campos de cada um. Resultado: ______
+- [ ] Config antiga com um app personalizado: ele aparece como o primeiro bloco, selecionado se era o lançador. Resultado: ______
+- [ ] Sessão com um app que é só um iniciador (abre outro programa e fecha), com "Processo a acompanhar" vazio: o log mostra "X abriu Y e fechou; a sessão passa a acompanhar Y", a janela de Y vai para a tela de jogo e a sessão termina uns 8 s depois que Y fecha. Com "Processo a acompanhar" preenchido, vale o processo escrito. Resultado: ______
+
### Tour guiado
- [ ] Primeira abertura: o tour abre sozinho em "Bem-vindo ao Console Mode", 1 de 9, com o cartão no meio da tela e o fundo escurecido. Resultado: ______
diff --git a/src/ConsoleMode/App.xaml.cs b/src/ConsoleMode/App.xaml.cs
index 51dd2c2..154d837 100644
--- a/src/ConsoleMode/App.xaml.cs
+++ b/src/ConsoleMode/App.xaml.cs
@@ -168,7 +168,7 @@ private async Task HandleStartRequestAsync()
///
/// The shortcuts the user picked (Settings, or the first-run setup); none is set until then.
/// Home, from the tray: enter console mode (a hold, or a press once Game Bar's shortcut is
- /// off). Menu and Exit, in a session: the menu over the game, and back to the PC.
+ /// off). Menu: the Session menu, in a session and (unless turned off) outside one. Exit, in a session: back to the PC.
///
private void WatchGuideButton()
{
@@ -205,7 +205,7 @@ private void WatchGuideButton()
private void OnViewModelChangedForGuide(object? sender, PropertyChangedEventArgs e)
{
if (e.PropertyName is MainViewModel.ShortcutsProperty or nameof(MainViewModel.HomeButtonShortPress)
- or nameof(MainViewModel.IsConsoleActive))
+ or nameof(MainViewModel.IsConsoleActive) or nameof(MainViewModel.MenuOutsideSession))
RefreshGuideWatch();
if (e.PropertyName == nameof(MainViewModel.IsConsoleActive) && ViewModel?.IsConsoleActive == false)
_connect?.QuietFor(ControllerConnectPolicy.RestoreGrace);
@@ -223,8 +223,8 @@ private void RefreshGuideWatch()
// that isn't set never runs, and the three do not depend on each other.
var idle = !ViewModel.IsCapturingShortcut;
Apply(_guide, idle && _guide.Mask != 0 && !ViewModel.IsConsoleActive);
- // The menu also opens outside a session in this alpha (a preview, to try it without console mode).
- Apply(_menuChord, idle && _menuChord.Mask != 0);
+ // Outside a session too, unless turned off in System → Controller (a game may use the same buttons).
+ Apply(_menuChord, idle && _menuChord.Mask != 0 && (ViewModel.IsConsoleActive || ViewModel.MenuOutsideSession));
Apply(_exitChord, idle && _exitChord.Mask != 0 && ViewModel.IsConsoleActive);
}
diff --git a/src/ConsoleMode/Assets/OtherApps/joychromium.png b/src/ConsoleMode/Assets/OtherApps/joychromium.png
new file mode 100644
index 0000000..5ddc2aa
Binary files /dev/null and b/src/ConsoleMode/Assets/OtherApps/joychromium.png differ
diff --git a/src/ConsoleMode/Assets/OtherApps/nextboost.png b/src/ConsoleMode/Assets/OtherApps/nextboost.png
deleted file mode 100644
index fe1b143..0000000
Binary files a/src/ConsoleMode/Assets/OtherApps/nextboost.png and /dev/null differ
diff --git a/src/ConsoleMode/Assets/OtherApps/tako.png b/src/ConsoleMode/Assets/OtherApps/tako.png
new file mode 100644
index 0000000..49ab565
Binary files /dev/null and b/src/ConsoleMode/Assets/OtherApps/tako.png differ
diff --git a/src/ConsoleMode/Assets/OtherApps/wakeon.png b/src/ConsoleMode/Assets/OtherApps/wakeon.png
deleted file mode 100644
index aaba7dd..0000000
Binary files a/src/ConsoleMode/Assets/OtherApps/wakeon.png and /dev/null differ
diff --git a/src/ConsoleMode/Controls/ScrollEdges.cs b/src/ConsoleMode/Controls/ScrollEdges.cs
new file mode 100644
index 0000000..2cb749e
--- /dev/null
+++ b/src/ConsoleMode/Controls/ScrollEdges.cs
@@ -0,0 +1,73 @@
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+
+namespace ConsoleMode.Controls;
+
+///
+/// A scrolling list's edges and where it is: each edge fades into the background while there is more past it
+/// (instead of a hard cut), and a thin thumb beside it shows the position, only when the list is longer than
+/// its space. The fades follow the scrolling with a short transition, but land at once when the list appears,
+/// changes or is resized: animating then showed the hard cut for a moment before the fade came in.
+///
+public sealed class ScrollEdges
+{
+ private readonly ScrollViewer _scroller;
+ private readonly UIElement _fadeTop;
+ private readonly UIElement _fadeBottom;
+ private readonly FrameworkElement _track;
+ private readonly FrameworkElement _thumb;
+ private long _snapUntil;
+
+ public ScrollEdges(ScrollViewer scroller, UIElement fadeTop, UIElement fadeBottom, FrameworkElement track, FrameworkElement thumb)
+ {
+ (_scroller, _fadeTop, _fadeBottom, _track, _thumb) = (scroller, fadeTop, fadeBottom, track, thumb);
+ // Only a scroll the person makes animates; the rest is layout, which must look right on its first frame.
+ scroller.ViewChanged += (_, _) => Update(animate: Environment.TickCount64 > _snapUntil);
+ scroller.SizeChanged += (_, _) => Update(animate: false);
+ scroller.Loaded += (_, _) => Snap();
+ track.SizeChanged += (_, _) => Update(animate: false);
+ if (scroller.Content is FrameworkElement content) content.SizeChanged += (_, _) => Update(animate: false);
+ Snap();
+ }
+
+ ///
+ /// The list was just shown or switched (a tab, a category): the edges land at once, including the scroll back to
+ /// the top that usually follows.
+ ///
+ public void Snap()
+ {
+ _snapUntil = Environment.TickCount64 + 400;
+ Update(animate: false);
+ }
+
+ private void Update(bool animate)
+ {
+ var scrollable = _scroller.ScrollableHeight > 1;
+ var offset = _scroller.VerticalOffset;
+ Show(_fadeTop, scrollable && offset > 1, animate);
+ Show(_fadeBottom, scrollable && offset < _scroller.ScrollableHeight - 1, animate);
+ Show(_track, scrollable, animate);
+ if (!scrollable || _scroller.ExtentHeight <= 0) return;
+ var track = _track.ActualHeight;
+ if (track <= 0) return;
+ var thumb = Math.Max(36, track * _scroller.ViewportHeight / _scroller.ExtentHeight);
+ _thumb.Height = thumb;
+ _thumb.Margin = new Thickness(0, (track - thumb) * Math.Clamp(offset / _scroller.ScrollableHeight, 0, 1), 0, 0);
+ }
+
+ /// Its opacity to on or off; without the transition when it must land at once.
+ private static void Show(UIElement element, bool on, bool animate)
+ {
+ var value = on ? 1 : 0;
+ if (element.Opacity == value) return;
+ if (animate)
+ {
+ element.Opacity = value;
+ return;
+ }
+ var transition = element.OpacityTransition;
+ element.OpacityTransition = null;
+ element.Opacity = value;
+ element.OpacityTransition = transition;
+ }
+}
diff --git a/src/ConsoleMode/Controls/UiScaleHost.cs b/src/ConsoleMode/Controls/UiScaleHost.cs
new file mode 100644
index 0000000..a886905
--- /dev/null
+++ b/src/ConsoleMode/Controls/UiScaleHost.cs
@@ -0,0 +1,35 @@
+using ConsoleMode.Services;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+
+namespace ConsoleMode.Controls;
+
+///
+/// Draws a window's interface in proportion to the window, like a console (see ): the content is
+/// laid out at a size 1080 tall and the grows or shrinks it to fill .
+///
+public static class UiScaleHost
+{
+ ///
+ /// Keeps (the Viewbox's child) at the layout size for , and tells
+ /// the screen pixels per layout pixel (for images drawn to the pixel).
+ ///
+ public static void Attach(FrameworkElement area, Viewbox box, FrameworkElement content, Action? changed = null)
+ {
+ box.Stretch = Microsoft.UI.Xaml.Media.Stretch.Uniform;
+ void Update()
+ {
+ if (area.ActualWidth <= 0 || area.ActualHeight <= 0) return;
+ var (width, height) = UiScale.LayoutSize(area.ActualWidth, area.ActualHeight);
+ content.Width = width;
+ content.Height = height;
+ changed?.Invoke(UiScale.For(area.ActualWidth, area.ActualHeight) * (area.XamlRoot?.RasterizationScale ?? 1));
+ }
+ area.SizeChanged += (_, _) => Update();
+ area.Loaded += (_, _) =>
+ {
+ Update();
+ if (area.XamlRoot is { } root) root.Changed += (_, _) => Update();
+ };
+ }
+}
diff --git a/src/ConsoleMode/MainWindow.xaml b/src/ConsoleMode/MainWindow.xaml
index 2d2432b..7b533b8 100644
--- a/src/ConsoleMode/MainWindow.xaml
+++ b/src/ConsoleMode/MainWindow.xaml
@@ -14,7 +14,10 @@
-
+
+
+
+
diff --git a/src/ConsoleMode/MainWindow.xaml.cs b/src/ConsoleMode/MainWindow.xaml.cs
index cf04e38..e5baba7 100644
--- a/src/ConsoleMode/MainWindow.xaml.cs
+++ b/src/ConsoleMode/MainWindow.xaml.cs
@@ -20,6 +20,8 @@ public MainWindow(MainViewModel viewModel)
SystemBackdrop = new MicaBackdrop();
ExtendsContentIntoTitleBar = true;
SetTitleBar(AppTitleBar);
+ // The Home logos are shrunk to the screen's own pixels, which now also follow the interface's scale.
+ Controls.UiScaleHost.Attach(RootGrid, UiScaleBox, HomeView, ViewModel.SetLogoScale);
var hwnd = WindowNative.GetWindowHandle(this);
var appWindow = AppWindow.GetFromWindowId(Win32Interop.GetWindowIdFromWindow(hwnd));
@@ -50,6 +52,9 @@ public MainWindow(MainViewModel viewModel)
if (appWindow.Presenter is OverlappedPresenter p) p.Maximize();
};
+ // With the window in front the pad drives the interface; the controller mouse waits meanwhile.
+ Activated += (_, e) => ViewModel.IsMainWindowActive = e.WindowActivationState != WindowActivationState.Deactivated;
+
appWindow.Closing += (_, e) =>
{
if (!ViewModel.TryCloseToTray()) return;
diff --git a/src/ConsoleMode/Models/Models.cs b/src/ConsoleMode/Models/Models.cs
index 87bffd3..3be745d 100644
--- a/src/ConsoleMode/Models/Models.cs
+++ b/src/ConsoleMode/Models/Models.cs
@@ -18,10 +18,15 @@ public sealed class AppConfig
public string PlaynitePath { get; set; } = "";
/// "customApp" mode: the exe to launch, its optional arguments, and an optional process to
- /// watch instead of it (for launcher stubs that hand off to another process).
+ /// watch instead of it (for launcher stubs that hand off to another process). Always the custom app
+ /// selected in CustomApps (kept here for the engine and for older versions reading this file).
public string CustomAppPath { get; set; } = "";
public string CustomAppArguments { get; set; } = "";
public string CustomAppWatchProcess { get; set; } = "";
+
+ /// Every custom app, each a tile on Home; CustomAppId is the selected one (CustomApp.Selected).
+ public List CustomApps { get; set; } = [];
+ public string CustomAppId { get; set; } = "";
public string AudioDeviceId { get; set; } = "";
public string AudioDeviceName { get; set; } = "";
public bool AudioAutoSwitch { get; set; }
@@ -105,6 +110,9 @@ public sealed class AppConfig
/// Minimizing the main window hides it in the tray instead of leaving it on the taskbar.
public bool MinimizeToTray { get; set; }
+ /// The menu shortcut also opens the Session menu outside console mode (the tray and consolemode://menu always do).
+ public bool MenuOutsideSession { get; set; } = true;
+
/// Console background: "auto" (the built-in wallpaper), "covers" (of the installed Steam games), "gradient" or "image".
public string ConsoleBackground { get; set; } = "auto";
@@ -396,6 +404,11 @@ public sealed class ConsoleRuntimeState
public string CustomAppWatchName { get; set; } = "";
public DateTime? CustomAppGoneSince { get; set; }
public bool CustomAppTimeoutLogged { get; set; }
+ /// The process started for the custom app, so a launcher that hands off to a child can be followed.
+ public int? CustomAppLaunchPid { get; set; }
+ /// Nobody named a process to watch: the app may follow the launched exe's child (CustomApp.HandOffTarget).
+ public bool CustomAppFollowChildren { get; set; }
+ public bool CustomAppHandedOff { get; set; }
public nint CachedXboxHandle { get; set; }
public bool BigPictureWatchActive { get; set; }
public bool AudioWatchComplete { get; set; }
@@ -451,3 +464,12 @@ public sealed class MonitorRestoreContext
public List HideMonitors { get; set; } = [];
public string HideStrategy { get; set; } = "disconnect";
}
+
+/// One custom app ("customApp" launch mode): any .exe, with its arguments and the process that marks its end.
+public sealed class CustomAppEntry
+{
+ public string Id { get; set; } = "";
+ public string Path { get; set; } = "";
+ public string Arguments { get; set; } = "";
+ public string WatchProcess { get; set; } = "";
+}
diff --git a/src/ConsoleMode/Native/ProcessTree.cs b/src/ConsoleMode/Native/ProcessTree.cs
new file mode 100644
index 0000000..e773bac
--- /dev/null
+++ b/src/ConsoleMode/Native/ProcessTree.cs
@@ -0,0 +1,59 @@
+using System.Runtime.InteropServices;
+
+namespace ConsoleMode.Native;
+
+///
+/// Every running process with its parent's id (a Toolhelp snapshot): a process keeps the id of the one that started it
+/// even after that one has exited, which is how a launcher's hand-off is followed (CustomApp.HandOffTarget).
+///
+public static class ProcessTree
+{
+ private const uint SnapProcess = 0x00000002;
+
+ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
+ private struct ProcessEntry32
+ {
+ public uint dwSize;
+ public uint cntUsage;
+ public uint th32ProcessID;
+ public nint th32DefaultHeapID;
+ public uint th32ModuleID;
+ public uint cntThreads;
+ public uint th32ParentProcessID;
+ public int pcPriClassBase;
+ public uint dwFlags;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] public string szExeFile;
+ }
+
+ [DllImport("kernel32.dll", SetLastError = true)]
+ private static extern nint CreateToolhelp32Snapshot(uint flags, uint processId);
+
+ [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
+ private static extern bool Process32FirstW(nint snapshot, ref ProcessEntry32 entry);
+
+ [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
+ private static extern bool Process32NextW(nint snapshot, ref ProcessEntry32 entry);
+
+ [DllImport("kernel32.dll")]
+ private static extern bool CloseHandle(nint handle);
+
+ /// (id, parent id, exe name) of every process; empty if the snapshot can't be taken.
+ public static List<(int Pid, int ParentPid, string Name)> Snapshot()
+ {
+ var list = new List<(int, int, string)>();
+ var snapshot = CreateToolhelp32Snapshot(SnapProcess, 0);
+ if (snapshot == -1 || snapshot == 0) return list;
+ try
+ {
+ var entry = new ProcessEntry32 { dwSize = (uint)Marshal.SizeOf() };
+ if (!Process32FirstW(snapshot, ref entry)) return list;
+ do list.Add(((int)entry.th32ProcessID, (int)entry.th32ParentProcessID, entry.szExeFile ?? ""));
+ while (Process32NextW(snapshot, ref entry));
+ }
+ finally
+ {
+ CloseHandle(snapshot);
+ }
+ return list;
+ }
+}
diff --git a/src/ConsoleMode/Native/TransparentBackdrop.cs b/src/ConsoleMode/Native/TransparentBackdrop.cs
new file mode 100644
index 0000000..4b63008
--- /dev/null
+++ b/src/ConsoleMode/Native/TransparentBackdrop.cs
@@ -0,0 +1,55 @@
+using System.Runtime.InteropServices;
+using Microsoft.UI.Composition;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Media;
+
+namespace ConsoleMode.Native;
+
+///
+/// A window backdrop with nothing in it: where the window's content is transparent, what is behind the window shows
+/// through. The toast uses it to slide in from the screen's edge inside a window that already reaches it.
+/// The backdrop takes a brush of the system compositor (Windows.UI.Composition), which needs a Windows dispatcher
+/// queue on the thread; WinUI's UI thread only has its own, so one is created the first time.
+///
+public sealed class TransparentBackdrop : SystemBackdrop
+{
+ private static Windows.UI.Composition.Compositor? _compositor;
+ private static nint _queueController;
+
+ protected override void OnTargetConnected(ICompositionSupportsSystemBackdrop connectedTarget, XamlRoot xamlRoot)
+ {
+ base.OnTargetConnected(connectedTarget, xamlRoot);
+ EnsureDispatcherQueue();
+ _compositor ??= new Windows.UI.Composition.Compositor();
+ connectedTarget.SystemBackdrop = _compositor.CreateColorBrush(Windows.UI.Color.FromArgb(0, 0, 0, 0));
+ }
+
+ protected override void OnTargetDisconnected(ICompositionSupportsSystemBackdrop disconnectedTarget)
+ {
+ base.OnTargetDisconnected(disconnectedTarget);
+ disconnectedTarget.SystemBackdrop = null;
+ }
+
+ private static void EnsureDispatcherQueue()
+ {
+ if (Windows.System.DispatcherQueue.GetForCurrentThread() is not null || _queueController != 0) return;
+ var options = new DispatcherQueueOptions
+ {
+ Size = Marshal.SizeOf(),
+ ThreadType = 2, // DQTYPE_THREAD_CURRENT
+ ApartmentType = 2 // DQTAT_COM_STA
+ };
+ Marshal.ThrowExceptionForHR(CreateDispatcherQueueController(options, out _queueController));
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ private struct DispatcherQueueOptions
+ {
+ public int Size;
+ public int ThreadType;
+ public int ApartmentType;
+ }
+
+ [DllImport("CoreMessaging.dll")]
+ private static extern int CreateDispatcherQueueController(DispatcherQueueOptions options, out nint controller);
+}
diff --git a/src/ConsoleMode/Resources/Strings.de-DE.json b/src/ConsoleMode/Resources/Strings.de-DE.json
index c85c89a..f77d92a 100644
--- a/src/ConsoleMode/Resources/Strings.de-DE.json
+++ b/src/ConsoleMode/Resources/Strings.de-DE.json
@@ -78,7 +78,7 @@
"SwitcherCloseConfirmTitle": "Dieses Fenster schließen?",
"SwitcherCloseConfirmBody": "Wenn Änderungen nicht gespeichert wurden, fragt die App möglicherweise trotzdem, ob du sie speichern möchtest.",
"SwitcherCloseConfirmAction": "Fenster schließen",
- "SessionPreviewBadge": "Vorschau · außerhalb einer Sitzung",
+ "SessionPreviewBadge": "Außerhalb einer Sitzung",
"ConsoleActiveHint": "Oder halte {0} am Controller 1 Sekunde lang gedrückt.",
"ChooseRoleFor": "Was soll der Bildschirm {0} tun?",
"HomeButtonCard": "Controller-Tastenkombination zum Öffnen von Console Mode",
@@ -125,7 +125,7 @@
"GameProfileHdrOff": "HDR aus",
"GameProfileNothing": "Ändert nichts",
"HideCursorCard": "Mauszeiger ausblenden",
- "HideCursorDescription": "Bleibt ausgeblendet, bis du diese Option deaktivierst oder zum PC zurückkehrst. Praktisch für Emulatoren und Spiele, bei denen der Zeiger mitten auf dem Bildschirm stehen bleibt.",
+ "HideCursorDescription": "Bleibt ausgeblendet, bis du diese Option deaktivierst; er kommt von selbst zurück, wenn eine Sitzung beginnt oder endet und wenn Console Mode geschlossen wird. Praktisch für Emulatoren und Spiele, bei denen der Zeiger mitten auf dem Bildschirm stehen bleibt.",
"ControllerMouseRow": "Maus mit dem Controller steuern",
"ControllerMouseHint": "Linker Stick bewegt · {0} klickt · {0} zweimal: Rechtsklick · rechter Stick scrollt",
"AutoStartControllerCard": "Beim Verbinden eines Controllers starten",
@@ -151,6 +151,8 @@
"StartupDescription": "Wird beim Start des PCs im Infobereich geöffnet und ist bereit für die Verknüpfung mit einem Klick.",
"MinimizeToTrayCard": "In den Infobereich minimieren",
"MinimizeToTrayDescription": "Beim Minimieren verschwindet das Fenster aus der Taskleiste und Console Mode bleibt bei den ausgeblendeten Symbolen. Klicke auf das Symbol, um es wieder zu öffnen.",
+ "MenuOutsideSessionCard": "Sitzungsmenü außerhalb des Konsolenmodus",
+ "MenuOutsideSessionDescription": "Die Menü-Tastenkombination öffnet das Sitzungsmenü auch außerhalb des Konsolenmodus, mit den offenen Fenstern, der Lautstärke, dem Bildschirm und dem Controller als Maus, solange Console Mode geöffnet ist (auch nur im Infobereich). Schalte es aus, wenn die Kombination in einem Spiel stört.",
"CheckNow": "Jetzt suchen",
"NotifyUpdatesCard": "Bei einer neuen Version benachrichtigen",
"NotifyUpdatesDescription": "Prüft beim Start der App die GitHub-Releases.",
@@ -159,8 +161,6 @@
"BetaUpdatesWarning": "Testversionen können auf manchen Systemen Probleme verursachen. Wenn etwas nicht mehr funktioniert, lade die stabile Version von der Releases-Seite herunter und sende uns über die Feedback-Schaltfläche eine Rückmeldung.",
"HelpDataSection": "Tastenkombination, Hilfe und Daten",
"OtherAppsSection": "Weitere Apps des Entwicklers",
- "WakeOnDescription": "Automatisierung mit Wake-on-LAN",
- "NextBoostDescription": "Windows-Optimierung",
"TvConfirmationCard": "TV-Bestätigung",
"TvConfirmationDescription": "Wenn du einen neuen Gaming-Bildschirm zum ersten Mal verwendest, bittet dich der Fernseher zu bestätigen, dass du das Bild sehen kannst. Bestätige mit Maus, Tastatur oder Controller (Xbox: A/B · PlayStation: ✕/○). Du kannst dies hier testen, ohne deine Bildschirme zu ändern.",
"TvSection": "Fernseher",
@@ -425,5 +425,16 @@
"IntroStylePs4": "Im Stil der PS4",
"IntroStyleNone": "Keins (startet sofort)",
"IntroPreviewCard": "Intro ansehen",
- "IntroPreviewDescription": "Zeigt das gewählte Intro jetzt, mit Sound."
+ "IntroPreviewDescription": "Zeigt das gewählte Intro jetzt, mit Sound.",
+ "AddCustomAppTile": "App hinzufügen",
+ "AddCustomAppCard": "Eigene App hinzufügen",
+ "AddCustomAppDescription": "Wähle eine .exe: Sie wird zur Kachel auf der Startseite, mit Symbol und Namen des Programms.",
+ "RemoveCustomAppCard": "Diese App entfernen",
+ "RemoveCustomAppDescription": "Entfernt die Kachel dieser App von der Startseite; stattdessen öffnet sich Steam Big Picture.",
+ "OtherAppsControlFsDescription": "Ein Dateimanager für den Controller, mit sicherem ZIP-Entpacker.",
+ "OtherAppsTakoDescription": "Deine Spielebibliothek in einem Launcher für Fernseher und Controller.",
+ "OtherAppsJoyChromiumDescription": "Ein Webbrowser für den Fernseher, mit dem Controller vom Sofa aus bedient.",
+ "OtherAppsStageAlpha": "Alpha",
+ "OtherAppsStageClosedAlpha": "Geschlossene Alpha",
+ "OtherAppsStageBeta": "Beta"
}
diff --git a/src/ConsoleMode/Resources/Strings.en-US.json b/src/ConsoleMode/Resources/Strings.en-US.json
index 45f99d1..cef1b95 100644
--- a/src/ConsoleMode/Resources/Strings.en-US.json
+++ b/src/ConsoleMode/Resources/Strings.en-US.json
@@ -78,7 +78,7 @@
"SwitcherCloseConfirmTitle": "Close this window?",
"SwitcherCloseConfirmBody": "If there are unsaved changes, the app may still ask you to save them.",
"SwitcherCloseConfirmAction": "Close window",
- "SessionPreviewBadge": "Preview · outside a session",
+ "SessionPreviewBadge": "Outside a session",
"ConsoleActiveHint": "Or hold {0} on the controller for 1 second.",
"ChooseRoleFor": "What does the {0} screen do?",
"HomeButtonCard": "Controller shortcut to open Console Mode",
@@ -125,7 +125,7 @@
"GameProfileHdrOff": "HDR off",
"GameProfileNothing": "Changes nothing",
"HideCursorCard": "Hide the mouse pointer",
- "HideCursorDescription": "Stays hidden until you turn this off or go back to the PC. Handy for emulators and games that leave it in the middle of the screen.",
+ "HideCursorDescription": "Stays hidden until you turn this off; it comes back by itself when a session starts or ends and when Console Mode closes. Handy for emulators and games that leave it in the middle of the screen.",
"ControllerMouseRow": "Control the mouse with the controller",
"ControllerMouseHint": "Left stick moves · {0} clicks · {0} twice: right click · right stick scrolls",
"AutoStartControllerCard": "Enter when a controller connects",
@@ -151,6 +151,8 @@
"StartupDescription": "Opens in the system tray when your PC starts, ready for the one-click shortcut.",
"MinimizeToTrayCard": "Minimize to the system tray",
"MinimizeToTrayDescription": "Minimizing hides the window from the taskbar and keeps Console Mode in the hidden icons. Click the icon to open it again.",
+ "MenuOutsideSessionCard": "Session menu outside console mode",
+ "MenuOutsideSessionDescription": "The menu shortcut also opens the Session menu when you're not in console mode, with the open windows, the volume, the screen and the controller as a mouse, as long as Console Mode is open (even just in the tray). Turn it off if the shortcut gets in the way in a game.",
"CheckNow": "Check now",
"NotifyUpdatesCard": "Notify me when a new version is available",
"NotifyUpdatesDescription": "Checks GitHub releases when the app starts.",
@@ -159,8 +161,6 @@
"BetaUpdatesWarning": "Test versions can fail on some setups. If something breaks, download the stable version from the releases page and tell us with the feedback button.",
"HelpDataSection": "Shortcut, help, and data",
"OtherAppsSection": "More apps from the developer",
- "WakeOnDescription": "Automation with Wake-on-LAN",
- "NextBoostDescription": "Windows optimization",
"TvConfirmationCard": "TV confirmation",
"TvConfirmationDescription": "The first time you use a new gaming display, the TV asks you to confirm that you can see the image. Respond with a mouse, keyboard, or controller (Xbox: A/B · PlayStation: ✕/○). Test it here without changing your displays.",
"TvSection": "TV",
@@ -425,5 +425,16 @@
"IntroStylePs4": "Inspired by the PS4",
"IntroStyleNone": "None (opens straight away)",
"IntroPreviewCard": "See the opening",
- "IntroPreviewDescription": "Shows the chosen opening now, with its sound."
+ "IntroPreviewDescription": "Shows the chosen opening now, with its sound.",
+ "AddCustomAppTile": "Add app",
+ "AddCustomAppCard": "Add a custom app",
+ "AddCustomAppDescription": "Pick an .exe: it becomes a tile on Home, with the program's icon and name.",
+ "RemoveCustomAppCard": "Remove this app",
+ "RemoveCustomAppDescription": "Takes this app's tile off Home; Steam Big Picture opens instead.",
+ "OtherAppsControlFsDescription": "A controller-first file manager, with a safe ZIP extractor.",
+ "OtherAppsTakoDescription": "Your game library in a launcher made for the TV and the controller.",
+ "OtherAppsJoyChromiumDescription": "A web browser for the TV, driven with a controller from the couch.",
+ "OtherAppsStageAlpha": "Alpha",
+ "OtherAppsStageClosedAlpha": "Closed alpha",
+ "OtherAppsStageBeta": "Beta"
}
diff --git a/src/ConsoleMode/Resources/Strings.es-ES.json b/src/ConsoleMode/Resources/Strings.es-ES.json
index 2acc281..c45898b 100644
--- a/src/ConsoleMode/Resources/Strings.es-ES.json
+++ b/src/ConsoleMode/Resources/Strings.es-ES.json
@@ -78,7 +78,7 @@
"SwitcherCloseConfirmTitle": "¿Cerrar esta ventana?",
"SwitcherCloseConfirmBody": "Si hay cambios sin guardar, la aplicación todavía puede pedirte que los guardes.",
"SwitcherCloseConfirmAction": "Cerrar ventana",
- "SessionPreviewBadge": "Vista previa · fuera de la sesión",
+ "SessionPreviewBadge": "Fuera de la sesión",
"ConsoleActiveHint": "O mantén {0} en el mando durante 1 segundo.",
"ChooseRoleFor": "¿Qué hace la pantalla {0}?",
"HomeButtonCard": "Atajo del mando para abrir Console Mode",
@@ -125,7 +125,7 @@
"GameProfileHdrOff": "HDR desactivado",
"GameProfileNothing": "No cambia nada",
"HideCursorCard": "Ocultar el cursor del ratón",
- "HideCursorDescription": "Queda oculto hasta que lo desactives aquí o vuelvas al PC. Útil en emuladores y juegos que lo dejan en el centro de la pantalla.",
+ "HideCursorDescription": "Queda oculto hasta que lo desactives aquí; vuelve solo al empezar o terminar una sesión y al cerrar Console Mode. Útil en emuladores y juegos que lo dejan en el centro de la pantalla.",
"ControllerMouseRow": "Controlar el ratón con el mando",
"ControllerMouseHint": "Stick izquierdo mueve · {0} hace clic · {0} dos veces: clic derecho · stick derecho desplaza",
"AutoStartControllerCard": "Entrar al conectar un mando",
@@ -151,6 +151,8 @@
"StartupDescription": "Se abre en la bandeja del sistema al encender el PC, listo para el acceso directo de 1 clic.",
"MinimizeToTrayCard": "Minimizar a la bandeja",
"MinimizeToTrayDescription": "Al minimizar, la ventana sale de la barra de tareas y queda en los iconos ocultos. Haz clic en el icono para abrirla de nuevo.",
+ "MenuOutsideSessionCard": "Menú de la sesión fuera del modo consola",
+ "MenuOutsideSessionDescription": "El atajo del menú también abre el Menú de la sesión cuando no estás en el modo consola, con las ventanas abiertas, el volumen, la pantalla y el mando como ratón, siempre que Console Mode esté abierto (aunque sea solo en la bandeja). Desactívalo si el atajo molesta en algún juego.",
"CheckNow": "Buscar ahora",
"NotifyUpdatesCard": "Avisarme cuando haya una versión nueva",
"NotifyUpdatesDescription": "Consulta las versiones de GitHub al abrir la aplicación.",
@@ -159,8 +161,6 @@
"BetaUpdatesWarning": "Las versiones de prueba pueden fallar en algunas configuraciones. Si algo sale mal, descarga la versión estable en la página de versiones y cuéntanoslo con el botón de comentarios.",
"HelpDataSection": "Acceso directo, ayuda y datos",
"OtherAppsSection": "Más apps del desarrollador",
- "WakeOnDescription": "Automatización con Wake-on-LAN",
- "NextBoostDescription": "Optimización de Windows",
"TvConfirmationCard": "Confirmación en la TV",
"TvConfirmationDescription": "La primera vez con una pantalla de juego nueva, la TV pide que confirmes que ves la imagen. Responde con ratón, teclado o mando (Xbox: A/B · PlayStation: ✕/○). Pruébalo aquí sin cambiar tus pantallas.",
"TvSection": "TV",
@@ -425,5 +425,16 @@
"IntroStylePs4": "Inspirada en la PS4",
"IntroStyleNone": "Ninguna (abre directamente)",
"IntroPreviewCard": "Ver la apertura",
- "IntroPreviewDescription": "Muestra ahora la apertura elegida, con su sonido."
+ "IntroPreviewDescription": "Muestra ahora la apertura elegida, con su sonido.",
+ "AddCustomAppTile": "Añadir app",
+ "AddCustomAppCard": "Añadir una aplicación personalizada",
+ "AddCustomAppDescription": "Elige un .exe: se convierte en un bloque en Inicio, con el icono y el nombre del programa.",
+ "RemoveCustomAppCard": "Quitar esta aplicación",
+ "RemoveCustomAppDescription": "Quita el bloque de esta aplicación de Inicio; en su lugar se abre Steam Big Picture.",
+ "OtherAppsControlFsDescription": "Explorador de archivos pensado para el mando, con extractor de ZIP seguro.",
+ "OtherAppsTakoDescription": "Tu biblioteca de juegos en un lanzador hecho para la TV y el mando.",
+ "OtherAppsJoyChromiumDescription": "Navegador para la TV que se usa con el mando, desde el sofá.",
+ "OtherAppsStageAlpha": "Alfa",
+ "OtherAppsStageClosedAlpha": "Alfa cerrada",
+ "OtherAppsStageBeta": "Beta"
}
diff --git a/src/ConsoleMode/Resources/Strings.fr-FR.json b/src/ConsoleMode/Resources/Strings.fr-FR.json
index dda2217..f844e63 100644
--- a/src/ConsoleMode/Resources/Strings.fr-FR.json
+++ b/src/ConsoleMode/Resources/Strings.fr-FR.json
@@ -78,7 +78,7 @@
"SwitcherCloseConfirmTitle": "Fermer cette fenêtre ?",
"SwitcherCloseConfirmBody": "S'il y a des modifications non enregistrées, l'application peut encore vous demander de les enregistrer.",
"SwitcherCloseConfirmAction": "Fermer la fenêtre",
- "SessionPreviewBadge": "Aperçu · hors session",
+ "SessionPreviewBadge": "Hors session",
"ConsoleActiveHint": "Ou maintenez {0} sur la manette pendant 1 seconde.",
"ChooseRoleFor": "Que fait l'écran {0} ?",
"HomeButtonCard": "Raccourci manette pour ouvrir Console Mode",
@@ -125,7 +125,7 @@
"GameProfileHdrOff": "HDR désactivé",
"GameProfileNothing": "Ne change rien",
"HideCursorCard": "Masquer le pointeur de la souris",
- "HideCursorDescription": "Reste masqué jusqu'à ce que vous désactiviez cette option ou reveniez au PC. Pratique pour les émulateurs et les jeux qui le laissent au milieu de l'écran.",
+ "HideCursorDescription": "Reste masqué jusqu'à ce que vous désactiviez cette option ; il revient tout seul au début ou à la fin d'une session et à la fermeture de Console Mode. Pratique pour les émulateurs et les jeux qui le laissent au milieu de l'écran.",
"ControllerMouseRow": "Contrôler la souris avec la manette",
"ControllerMouseHint": "Stick gauche : déplacer · {0} : clic · {0} deux fois : clic droit · stick droit : défiler",
"AutoStartControllerCard": "Entrer à la connexion d'une manette",
@@ -151,6 +151,8 @@
"StartupDescription": "S'ouvre dans la zone de notification au démarrage du PC, prêt pour le raccourci en un clic.",
"MinimizeToTrayCard": "Réduire dans la zone de notification",
"MinimizeToTrayDescription": "La réduction retire la fenêtre de la barre des tâches et garde Console Mode dans les icônes cachées. Cliquez sur l'icône pour la rouvrir.",
+ "MenuOutsideSessionCard": "Menu de session hors du mode console",
+ "MenuOutsideSessionDescription": "Le raccourci du menu ouvre aussi le menu de session hors du mode console, avec les fenêtres ouvertes, le volume, l'écran et la manette comme souris, tant que Console Mode est ouvert (même seulement dans la zone de notification). Désactivez-le si le raccourci gêne dans un jeu.",
"CheckNow": "Vérifier maintenant",
"NotifyUpdatesCard": "M'avertir quand une nouvelle version est disponible",
"NotifyUpdatesDescription": "Vérifie les versions publiées sur GitHub au démarrage de l'application.",
@@ -159,8 +161,6 @@
"BetaUpdatesWarning": "Les versions de test peuvent échouer sur certaines configurations. En cas de problème, téléchargez la version stable sur la page des versions et signalez-le-nous avec le bouton de commentaires.",
"HelpDataSection": "Raccourci, aide et données",
"OtherAppsSection": "Autres applications du développeur",
- "WakeOnDescription": "Automatisation avec Wake-on-LAN",
- "NextBoostDescription": "Optimisation de Windows",
"TvConfirmationCard": "Confirmation sur la TV",
"TvConfirmationDescription": "La première fois que vous utilisez un nouvel écran de jeu, la TV vous demande de confirmer que vous voyez l'image. Répondez avec la souris, le clavier ou la manette (Xbox : A/B · PlayStation : ✕/○). Testez-la ici sans modifier vos écrans.",
"TvSection": "TV",
@@ -425,5 +425,16 @@
"IntroStylePs4": "Inspirée de la PS4",
"IntroStyleNone": "Aucune (ouverture directe)",
"IntroPreviewCard": "Voir l'ouverture",
- "IntroPreviewDescription": "Affiche maintenant l'ouverture choisie, avec son son."
+ "IntroPreviewDescription": "Affiche maintenant l'ouverture choisie, avec son son.",
+ "AddCustomAppTile": "Ajouter une app",
+ "AddCustomAppCard": "Ajouter une application personnalisée",
+ "AddCustomAppDescription": "Choisissez un .exe : il devient une tuile de l'Accueil, avec l'icône et le nom du programme.",
+ "RemoveCustomAppCard": "Retirer cette application",
+ "RemoveCustomAppDescription": "Retire la tuile de cette application de l'Accueil ; Steam Big Picture s'ouvre à la place.",
+ "OtherAppsControlFsDescription": "Un gestionnaire de fichiers pensé pour la manette, avec un extracteur ZIP sûr.",
+ "OtherAppsTakoDescription": "Votre bibliothèque de jeux dans un lanceur fait pour la TV et la manette.",
+ "OtherAppsJoyChromiumDescription": "Un navigateur pour la TV, piloté à la manette depuis le canapé.",
+ "OtherAppsStageAlpha": "Alpha",
+ "OtherAppsStageClosedAlpha": "Alpha fermée",
+ "OtherAppsStageBeta": "Bêta"
}
diff --git a/src/ConsoleMode/Resources/Strings.pt-BR.json b/src/ConsoleMode/Resources/Strings.pt-BR.json
index 46c2c8c..4f3f580 100644
--- a/src/ConsoleMode/Resources/Strings.pt-BR.json
+++ b/src/ConsoleMode/Resources/Strings.pt-BR.json
@@ -78,7 +78,7 @@
"SwitcherCloseConfirmTitle": "Fechar esta janela?",
"SwitcherCloseConfirmBody": "Se houver alterações sem salvar, o aplicativo ainda poderá pedir que você as salve.",
"SwitcherCloseConfirmAction": "Fechar janela",
- "SessionPreviewBadge": "Prévia · fora da sessão",
+ "SessionPreviewBadge": "Fora da sessão",
"ConsoleActiveHint": "Ou segure {0} no controle por 1 segundo.",
"ChooseRoleFor": "O que a tela {0} faz?",
"HomeButtonCard": "Atalho do controle para abrir o Console Mode",
@@ -125,7 +125,7 @@
"GameProfileHdrOff": "HDR desligado",
"GameProfileNothing": "Não muda nada",
"HideCursorCard": "Ocultar o cursor do mouse",
- "HideCursorDescription": "Fica oculto até você desligar aqui ou voltar ao PC. Útil em emuladores e jogos que deixam o cursor no meio da tela.",
+ "HideCursorDescription": "Fica oculto até você desligar aqui; volta sozinho ao começar ou terminar uma sessão e ao fechar o Console Mode. Útil em emuladores e jogos que deixam o cursor no meio da tela.",
"ControllerMouseRow": "Controlar o mouse com o controle",
"ControllerMouseHint": "Analógico esquerdo move · {0} clica · {0} duas vezes: botão direito · analógico direito rola",
"AutoStartControllerCard": "Entrar ao conectar um controle",
@@ -151,6 +151,8 @@
"StartupDescription": "Abre direto na bandeja ao ligar o PC, pronto para o atalho de 1 clique.",
"MinimizeToTrayCard": "Minimizar para a bandeja",
"MinimizeToTrayDescription": "Ao minimizar, a janela sai da barra de tarefas e fica nos ícones ocultos. Clique no ícone para abrir de novo.",
+ "MenuOutsideSessionCard": "Menu da sessão fora do modo console",
+ "MenuOutsideSessionDescription": "O atalho do menu também abre o Menu da sessão quando você não está no modo console, com as janelas abertas, o volume, a tela e o controle como mouse, desde que o Console Mode esteja aberto (mesmo só na bandeja). Desligue se o atalho atrapalhar algum jogo.",
"CheckNow": "Procurar agora",
"NotifyUpdatesCard": "Avisar quando sair versão nova",
"NotifyUpdatesDescription": "Consulta as releases no GitHub ao abrir o app.",
@@ -159,8 +161,6 @@
"BetaUpdatesWarning": "Versões de teste podem falhar em alguns setups. Se algo der errado, baixe a versão estável na página de releases e conte pelo botão de feedback.",
"HelpDataSection": "Atalho, ajuda e dados",
"OtherAppsSection": "Outros apps do desenvolvedor",
- "WakeOnDescription": "Automação com Wake-on-LAN",
- "NextBoostDescription": "Otimização do Windows",
"TvConfirmationCard": "Confirmação na TV",
"TvConfirmationDescription": "Na primeira vez com uma tela de jogo nova, a TV pergunta se você está vendo a imagem. Responda com mouse, teclado ou controle (Xbox: A/B · PlayStation: ✕/○). Teste aqui sem mexer nas telas.",
"TvSection": "TV",
@@ -425,5 +425,16 @@
"IntroStylePs4": "Inspirada no PS4",
"IntroStyleNone": "Nenhuma (abre direto)",
"IntroPreviewCard": "Ver a abertura",
- "IntroPreviewDescription": "Mostra agora a abertura escolhida, com o som."
+ "IntroPreviewDescription": "Mostra agora a abertura escolhida, com o som.",
+ "AddCustomAppTile": "Adicionar app",
+ "AddCustomAppCard": "Adicionar aplicativo personalizado",
+ "AddCustomAppDescription": "Escolha um .exe: ele vira um bloco no Início, com o ícone e o nome do programa.",
+ "RemoveCustomAppCard": "Remover este aplicativo",
+ "RemoveCustomAppDescription": "Tira o bloco deste aplicativo do Início; o Steam Big Picture passa a abrir no lugar.",
+ "OtherAppsControlFsDescription": "Explorador de arquivos feito para o controle, com extrator de ZIP seguro.",
+ "OtherAppsTakoDescription": "Sua biblioteca de jogos num launcher feito para a TV e o controle.",
+ "OtherAppsJoyChromiumDescription": "Navegador para a TV que se usa com o controle, do sofá.",
+ "OtherAppsStageAlpha": "Alpha",
+ "OtherAppsStageClosedAlpha": "Alpha fechado",
+ "OtherAppsStageBeta": "Beta"
}
diff --git a/src/ConsoleMode/Resources/Strings.ru-RU.json b/src/ConsoleMode/Resources/Strings.ru-RU.json
index 859dcb4..ec67c3c 100644
--- a/src/ConsoleMode/Resources/Strings.ru-RU.json
+++ b/src/ConsoleMode/Resources/Strings.ru-RU.json
@@ -78,7 +78,7 @@
"SwitcherCloseConfirmTitle": "Закрыть это окно?",
"SwitcherCloseConfirmBody": "Если есть несохранённые изменения, приложение может предложить их сохранить.",
"SwitcherCloseConfirmAction": "Закрыть окно",
- "SessionPreviewBadge": "Предпросмотр · вне сеанса",
+ "SessionPreviewBadge": "Вне сеанса",
"ConsoleActiveHint": "Или удерживайте {0} на геймпаде 1 секунду.",
"ChooseRoleFor": "Что делает экран {0}?",
"HomeButtonCard": "Сочетание на геймпаде для открытия Console Mode",
@@ -125,7 +125,7 @@
"GameProfileHdrOff": "HDR выкл.",
"GameProfileNothing": "Ничего не меняет",
"HideCursorCard": "Скрыть указатель мыши",
- "HideCursorDescription": "Остаётся скрытым, пока вы не выключите этот параметр или не вернётесь к ПК. Удобно для эмуляторов и игр, которые оставляют его посреди экрана.",
+ "HideCursorDescription": "Остаётся скрытым, пока вы не выключите этот параметр; возвращается сам, когда сеанс начинается или заканчивается и когда Console Mode закрывается. Удобно для эмуляторов и игр, которые оставляют его посреди экрана.",
"ControllerMouseRow": "Управлять мышью с геймпада",
"ControllerMouseHint": "Левый стик — перемещение · {0} — щелчок · {0} дважды — правый щелчок · правый стик — прокрутка",
"AutoStartControllerCard": "Входить при подключении геймпада",
@@ -151,6 +151,8 @@
"StartupDescription": "При включении ПК открывается в области уведомлений и готово к запуску в один клик.",
"MinimizeToTrayCard": "Сворачивать в область уведомлений",
"MinimizeToTrayDescription": "При сворачивании окно исчезает с панели задач, а Console Mode остаётся среди скрытых значков. Нажмите на значок, чтобы открыть его снова.",
+ "MenuOutsideSessionCard": "Меню сеанса вне режима консоли",
+ "MenuOutsideSessionDescription": "Сочетание для меню открывает меню сеанса и вне режима консоли — с открытыми окнами, громкостью, экраном и геймпадом вместо мыши, пока Console Mode запущен (даже только в трее). Отключите, если сочетание мешает в какой-нибудь игре.",
"CheckNow": "Проверить",
"NotifyUpdatesCard": "Сообщать о выходе новой версии",
"NotifyUpdatesDescription": "Проверяет релизы на GitHub при запуске приложения.",
@@ -159,8 +161,6 @@
"BetaUpdatesWarning": "Тестовые версии могут не работать на некоторых конфигурациях. Если что-то сломалось, скачайте стабильную версию со страницы релизов и сообщите нам через кнопку отзыва.",
"HelpDataSection": "Ярлык, справка и данные",
"OtherAppsSection": "Другие приложения разработчика",
- "WakeOnDescription": "Автоматизация с Wake-on-LAN",
- "NextBoostDescription": "Оптимизация Windows",
"TvConfirmationCard": "Подтверждение на телевизоре",
"TvConfirmationDescription": "При первом использовании нового игрового экрана телевизор просит подтвердить, что изображение видно. Ответьте мышью, клавиатурой или геймпадом (Xbox: A/B · PlayStation: ✕/○). Проверьте здесь, не меняя настройки экранов.",
"TvSection": "Телевизор",
@@ -425,5 +425,16 @@
"IntroStylePs4": "В духе PS4",
"IntroStyleNone": "Без заставки (сразу)",
"IntroPreviewCard": "Показать заставку",
- "IntroPreviewDescription": "Показывает выбранную заставку прямо сейчас, со звуком."
+ "IntroPreviewDescription": "Показывает выбранную заставку прямо сейчас, со звуком.",
+ "AddCustomAppTile": "Добавить",
+ "AddCustomAppCard": "Добавить своё приложение",
+ "AddCustomAppDescription": "Выберите .exe: он станет плиткой на Главной со значком и названием программы.",
+ "RemoveCustomAppCard": "Удалить это приложение",
+ "RemoveCustomAppDescription": "Убирает плитку этого приложения с Главной; вместо него откроется Steam Big Picture.",
+ "OtherAppsControlFsDescription": "Файловый менеджер для геймпада с безопасной распаковкой ZIP.",
+ "OtherAppsTakoDescription": "Ваша библиотека игр в лаунчере для телевизора и геймпада.",
+ "OtherAppsJoyChromiumDescription": "Браузер для телевизора, которым управляют геймпадом с дивана.",
+ "OtherAppsStageAlpha": "Альфа",
+ "OtherAppsStageClosedAlpha": "Закрытая альфа",
+ "OtherAppsStageBeta": "Бета"
}
diff --git a/src/ConsoleMode/Services/ConsoleEngine.cs b/src/ConsoleMode/Services/ConsoleEngine.cs
index 4ed0cc6..9c502ac 100644
--- a/src/ConsoleMode/Services/ConsoleEngine.cs
+++ b/src/ConsoleMode/Services/ConsoleEngine.cs
@@ -65,6 +65,9 @@ public void Start(AppConfig config, MonitorInfo? focusInfo, Func
+ /// The launched exe is gone, but it may only have been a launcher (a stub, a script) that started the real program
+ /// and quit: then that program is what the session follows, its window goes to the game screen, and nobody had to
+ /// name it in "Process to watch". Once per session, and only when no process was named.
+ ///
+ private bool FollowHandOff()
+ {
+ if (!State.CustomAppFollowChildren || State.CustomAppHandedOff || State.CustomAppLaunchPid is not { } pid) return false;
+ string? target;
+ try { target = CustomApp.HandOffTarget(ProcessTree.Snapshot(), pid); }
+ catch (Exception ex) { AppLog.Write($"Loop: árvore de processos: {ex.Message}"); return false; }
+ if (target is null || target.Equals(State.CustomAppWatchName, StringComparison.OrdinalIgnoreCase)) return false;
+ AppLog.Write($"Loop: {State.CustomAppWatchName} abriu {target} e fechou; a sessão passa a acompanhar {target}");
+ State.CustomAppHandedOff = true;
+ State.CustomAppWatchName = target;
+ State.CustomAppGoneSince = null;
+ State.HasAppeared = false;
+ State.SteamMoved = false;
+ State.MoveCount = 0;
+ return true;
+ }
+
/// Once its main window shows: moves it to the game screen (a few tries) and brings it to the front.
private void PlaceCustomAppWindow(string name)
{
diff --git a/src/ConsoleMode/Services/CustomApp.cs b/src/ConsoleMode/Services/CustomApp.cs
index 2d810ef..4356958 100644
--- a/src/ConsoleMode/Services/CustomApp.cs
+++ b/src/ConsoleMode/Services/CustomApp.cs
@@ -1,3 +1,5 @@
+using ConsoleMode.Models;
+
namespace ConsoleMode.Services;
///
@@ -8,6 +10,64 @@ public static class CustomApp
{
public const string Mode = "customApp";
+ /// A launcher value for one custom app (Home tiles, the launcher picker): "customApp:<id>".
+ public static string EntryMode(string id) => Mode + ":" + id;
+
+ public static bool IsEntryMode(string? value) => value?.StartsWith(Mode + ":", StringComparison.Ordinal) == true;
+
+ /// The custom app's id in a launcher value, or null for anything else.
+ public static string? EntryId(string? value) => IsEntryMode(value) ? value![(Mode.Length + 1)..] : null;
+
+ /// The smallest positive number not in use, as the new custom app's id.
+ public static string NextId(IEnumerable ids)
+ {
+ var used = ids.ToHashSet(StringComparer.Ordinal);
+ var next = 1;
+ while (used.Contains(next.ToString())) next++;
+ return next.ToString();
+ }
+
+ ///
+ /// The custom apps of a config: its list, or (a config from before the list) the one custom app it had, as id "1".
+ /// Entries without an exe are dropped.
+ ///
+ public static List Entries(AppConfig config)
+ {
+ var list = (config.CustomApps ?? []).Where(e => CleanPath(e.Path).Length > 0 && e.Id.Length > 0).ToList();
+ if (list.Count == 0 && CleanPath(config.CustomAppPath).Length > 0)
+ list.Add(new CustomAppEntry { Id = "1", Path = CleanPath(config.CustomAppPath), Arguments = config.CustomAppArguments ?? "", WatchProcess = config.CustomAppWatchProcess ?? "" });
+ return list;
+ }
+
+ /// The selected custom app: the one named by CustomAppId, else the first.
+ public static CustomAppEntry? Selected(IReadOnlyList entries, string? id) =>
+ entries.FirstOrDefault(e => e.Id == id) ?? entries.FirstOrDefault();
+
+ ///
+ /// A launched exe that is gone after handing off to another program (a launcher stub, a script): the program it
+ /// started that is still running, followed from parent to child. Console helpers that come with any program
+ /// don't count. Null when it started nothing that still runs.
+ ///
+ public static string? HandOffTarget(IEnumerable<(int Pid, int ParentPid, string Name)> processes, int launchedPid)
+ {
+ var all = processes.ToList();
+ var frontier = new Queue([launchedPid]);
+ var seen = new HashSet { launchedPid };
+ while (frontier.Count > 0)
+ {
+ var parent = frontier.Dequeue();
+ foreach (var child in all.Where(p => p.ParentPid == parent && p.Pid != parent && seen.Add(p.Pid)))
+ {
+ var name = NormalizeProcessName(child.Name);
+ if (!Helpers.Contains(name)) return name;
+ frontier.Enqueue(child.Pid);
+ }
+ }
+ return null;
+ }
+
+ private static readonly HashSet Helpers = new(StringComparer.OrdinalIgnoreCase) { "conhost", "cmd", "WerFault" };
+
/// How long the watched process may be gone before the session ends (covers restarts and hand-offs).
public static readonly TimeSpan ExitGrace = TimeSpan.FromSeconds(8);
diff --git a/src/ConsoleMode/Services/IconPixels.cs b/src/ConsoleMode/Services/IconPixels.cs
index 9acf1f6..e9a7fbf 100644
--- a/src/ConsoleMode/Services/IconPixels.cs
+++ b/src/ConsoleMode/Services/IconPixels.cs
@@ -40,4 +40,63 @@ public static bool IsBlank(byte[] pixels)
if (pixels[i] != 0) return false;
return true;
}
+
+ ///
+ /// The size an icon of × takes inside a square of
+ /// pixels, keeping its shape; never larger than it is (enlarging is left to the screen).
+ ///
+ public static (int Width, int Height) FitInside(int width, int height, int box)
+ {
+ if (width <= 0 || height <= 0 || box <= 0) return (0, 0);
+ var scale = Math.Min(1.0, (double)box / Math.Max(width, height));
+ return (Math.Max(1, (int)Math.Round(width * scale)), Math.Max(1, (int)Math.Round(height * scale)));
+ }
+
+ ///
+ /// Shrinks premultiplied BGRA by averaging every source pixel each new one covers (a box filter, partial
+ /// pixels weighted by how much they cover). Drawing a 256-pixel logo at 64 lets the screen sample only a few
+ /// of them, which leaves jagged edges; averaging them all keeps the edges smooth.
+ ///
+ public static byte[] Shrink(byte[] pixels, int width, int height, int newWidth, int newHeight)
+ {
+ if (newWidth >= width && newHeight >= height) return pixels;
+ // Across first (each row to the new width), then down (each column to the new height).
+ newWidth = Math.Min(newWidth, width);
+ newHeight = Math.Min(newHeight, height);
+ var across = new double[newWidth * height * 4];
+ for (var y = 0; y < height; y++)
+ for (var x = 0; x < newWidth; x++)
+ {
+ var (first, last, start, end) = Covered(x, width, newWidth);
+ for (var i = first; i <= last; i++)
+ {
+ var weight = Math.Min(end, i + 1) - Math.Max(start, i);
+ for (var c = 0; c < 4; c++) across[(y * newWidth + x) * 4 + c] += weight * pixels[(y * width + i) * 4 + c];
+ }
+ for (var c = 0; c < 4; c++) across[(y * newWidth + x) * 4 + c] /= end - start;
+ }
+ var result = new byte[newWidth * newHeight * 4];
+ for (var y = 0; y < newHeight; y++)
+ {
+ var (first, last, start, end) = Covered(y, height, newHeight);
+ for (var x = 0; x < newWidth; x++)
+ for (var c = 0; c < 4; c++)
+ {
+ var sum = 0.0;
+ for (var i = first; i <= last; i++)
+ sum += (Math.Min(end, i + 1) - Math.Max(start, i)) * across[(i * newWidth + x) * 4 + c];
+ result[(y * newWidth + x) * 4 + c] = (byte)Math.Clamp(Math.Round(sum / (end - start)), 0, 255);
+ }
+ }
+ return result;
+ }
+
+ /// The source pixels new pixel covers, shrinking to .
+ private static (int First, int Last, double Start, double End) Covered(int index, int from, int to)
+ {
+ var step = (double)from / to;
+ var start = index * step;
+ var end = Math.Min(from, start + step);
+ return ((int)start, Math.Min(from - 1, (int)Math.Ceiling(end) - 1), start, end);
+ }
}
diff --git a/src/ConsoleMode/Services/LaunchArt.cs b/src/ConsoleMode/Services/LaunchArt.cs
index 8cbec13..6620115 100644
--- a/src/ConsoleMode/Services/LaunchArt.cs
+++ b/src/ConsoleMode/Services/LaunchArt.cs
@@ -13,8 +13,14 @@ public static class LaunchArt
/// The Xbox app, whose logo stands for the Xbox mode (the glyph shows if it is not installed).
public const string XboxAppId = "Microsoft.GamingApp_8wekyb3d8bbwe!Microsoft.Xbox.App";
+ /// The last tile of the Home row: adds a custom app (a picked exe) instead of opening anything.
+ public const string AddCustomApp = "addCustomApp";
+
public static Art For(string? mode) => mode switch
{
+ AddCustomApp => new("\uE710", 0x33FFFFFF, 0x14FFFFFF),
+ // Each custom app ("customApp:") shows its exe's icon over this tile.
+ _ when mode?.StartsWith("customApp:", StringComparison.Ordinal) == true => new("\uE756", 0xFF3A4250, 0xFF1A1E25),
"bigPicture" => new("", 0xFF2A475E, 0xFF15202C),
"playnite" => new("", 0xFF4A3470, 0xFF1D1530),
"xboxMode" => new("", 0xFF178A17, 0xFF0A440A),
diff --git a/src/ConsoleMode/Services/LaunchService.cs b/src/ConsoleMode/Services/LaunchService.cs
index 7699721..6e78bac 100644
--- a/src/ConsoleMode/Services/LaunchService.cs
+++ b/src/ConsoleMode/Services/LaunchService.cs
@@ -23,16 +23,19 @@ public void StartPlaynite()
}
/// "customApp": starts the exe from its own folder (emulators look for their files there).
- public void StartCustomApp(string exePath, string? arguments)
+ /// The started process's id, to follow a hand-off from it; null if Windows didn't say.
+ public int? StartCustomApp(string exePath, string? arguments)
{
var exe = CustomApp.CleanPath(exePath);
- Process.Start(new ProcessStartInfo
+ using var process = Process.Start(new ProcessStartInfo
{
FileName = exe,
Arguments = arguments?.Trim() ?? "",
WorkingDirectory = Path.GetDirectoryName(exe) ?? "",
UseShellExecute = true
- })?.Dispose();
+ });
+ try { return process?.Id; }
+ catch (InvalidOperationException) { return null; }
}
///
diff --git a/src/ConsoleMode/Services/LocalizationService.cs b/src/ConsoleMode/Services/LocalizationService.cs
index 8e66d59..552f685 100644
--- a/src/ConsoleMode/Services/LocalizationService.cs
+++ b/src/ConsoleMode/Services/LocalizationService.cs
@@ -135,6 +135,10 @@ internal void NotifyAll()
public string CustomAppArgumentsDescription => LocalizationService.Get(nameof(CustomAppArgumentsDescription));
public string CustomAppWatchCard => LocalizationService.Get(nameof(CustomAppWatchCard));
public string CustomAppWatchDescription => LocalizationService.Get(nameof(CustomAppWatchDescription));
+ public string AddCustomAppCard => LocalizationService.Get(nameof(AddCustomAppCard));
+ public string AddCustomAppDescription => LocalizationService.Get(nameof(AddCustomAppDescription));
+ public string RemoveCustomAppCard => LocalizationService.Get(nameof(RemoveCustomAppCard));
+ public string RemoveCustomAppDescription => LocalizationService.Get(nameof(RemoveCustomAppDescription));
public string AudioOutputCard => LocalizationService.Get(nameof(AudioOutputCard));
public string OptionalExtrasSection => LocalizationService.Get(nameof(OptionalExtrasSection));
public string HdrCard => LocalizationService.Get(nameof(HdrCard));
@@ -168,6 +172,8 @@ internal void NotifyAll()
public string StartupDescription => LocalizationService.Get(nameof(StartupDescription));
public string MinimizeToTrayCard => LocalizationService.Get(nameof(MinimizeToTrayCard));
public string MinimizeToTrayDescription => LocalizationService.Get(nameof(MinimizeToTrayDescription));
+ public string MenuOutsideSessionCard => LocalizationService.Get(nameof(MenuOutsideSessionCard));
+ public string MenuOutsideSessionDescription => LocalizationService.Get(nameof(MenuOutsideSessionDescription));
public string CheckNow => LocalizationService.Get(nameof(CheckNow));
public string SessionMenuTitle => LocalizationService.Get(nameof(SessionMenuTitle));
public string BackToGame => LocalizationService.Get(nameof(BackToGame));
@@ -259,8 +265,12 @@ internal void NotifyAll()
public string BetaUpdatesDescription => LocalizationService.Get(nameof(BetaUpdatesDescription));
public string HelpDataSection => LocalizationService.Get(nameof(HelpDataSection));
public string OtherAppsSection => LocalizationService.Get(nameof(OtherAppsSection));
- public string WakeOnDescription => LocalizationService.Get(nameof(WakeOnDescription));
- public string NextBoostDescription => LocalizationService.Get(nameof(NextBoostDescription));
+ public string OtherAppsControlFsDescription => LocalizationService.Get(nameof(OtherAppsControlFsDescription));
+ public string OtherAppsTakoDescription => LocalizationService.Get(nameof(OtherAppsTakoDescription));
+ public string OtherAppsJoyChromiumDescription => LocalizationService.Get(nameof(OtherAppsJoyChromiumDescription));
+ public string OtherAppsStageAlpha => LocalizationService.Get(nameof(OtherAppsStageAlpha));
+ public string OtherAppsStageClosedAlpha => LocalizationService.Get(nameof(OtherAppsStageClosedAlpha));
+ public string OtherAppsStageBeta => LocalizationService.Get(nameof(OtherAppsStageBeta));
public string TvConfirmationCard => LocalizationService.Get(nameof(TvConfirmationCard));
public string TvConfirmationDescription => LocalizationService.Get(nameof(TvConfirmationDescription));
public string TvSection => LocalizationService.Get(nameof(TvSection));
diff --git a/src/ConsoleMode/Services/UiScale.cs b/src/ConsoleMode/Services/UiScale.cs
new file mode 100644
index 0000000..6853cdc
--- /dev/null
+++ b/src/ConsoleMode/Services/UiScale.cs
@@ -0,0 +1,33 @@
+namespace ConsoleMode.Services;
+
+///
+/// The interface's size, like a console's: it is laid out for a screen 1080 tall and drawn in proportion to the
+/// window, so it looks the same on a 1080p monitor, a 1440p one or a 4K TV, whatever scale Windows is set to.
+/// Kept apart so it is tested.
+///
+public static class UiScale
+{
+ /// The height the interface is laid out for (in its own pixels).
+ public const double DesignHeight = 1080;
+
+ /// The narrowest it is laid out for: on a narrow window it shrinks to this width instead of cutting.
+ public const double MinimumWidth = 1280;
+
+ ///
+ /// How much the interface is grown (or shrunk) in a window of ×
+ /// (in Windows' own units): the window's height over 1080, or less when the window is too narrow for the layout.
+ /// Windows' scale needs no part here: its units already grow with it, and this divides it back out.
+ ///
+ public static double For(double width, double height)
+ {
+ if (width <= 0 || height <= 0) return 1;
+ return Math.Min(height / DesignHeight, width / MinimumWidth);
+ }
+
+ /// The size the interface is laid out at to fill that window once grown by .
+ public static (double Width, double Height) LayoutSize(double width, double height)
+ {
+ var scale = For(width, height);
+ return (width / scale, height / scale);
+ }
+}
diff --git a/src/ConsoleMode/SessionHintWindow.cs b/src/ConsoleMode/SessionHintWindow.cs
index 6083286..d1856b1 100644
--- a/src/ConsoleMode/SessionHintWindow.cs
+++ b/src/ConsoleMode/SessionHintWindow.cs
@@ -1,11 +1,14 @@
+using System.Numerics;
using System.Runtime.InteropServices;
using ConsoleMode.Models;
using ConsoleMode.Native;
using ConsoleMode.Services;
using Microsoft.UI;
+using Microsoft.UI.Composition;
using Microsoft.UI.Windowing;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Hosting;
using Microsoft.UI.Xaml.Media;
using WinRT.Interop;
@@ -15,40 +18,101 @@ namespace ConsoleMode;
/// A toast in the top-right corner of the game screen, shown once when the session starts:
/// "hold Select + Y to open the panel". It never takes the focus from the game (shown without
/// activation, WS_EX_NOACTIVATE) and closes by itself. Also used for the low-battery notice.
+/// It slides in from the screen's right edge, stays while a thin bar runs out, and slides back out the same way:
+/// the window reaches the edge and is transparent around the card, so the card comes from behind the edge
+/// (and never shows on a screen next to it). Sized like the rest of the interface, in proportion to the screen.
///
public sealed class SessionHintWindow : Window
{
- private const double WidthDip = 470;
- private const double HeightDip = 96;
- private const double MarginDip = 28;
+ // In the interface's own units (UiScale: a screen 1080 tall).
+ private const double CardWidth = 470;
+ private const double CardHeight = 96;
+ private const double Margin = 28;
+
+ private static readonly TimeSpan EnterTime = TimeSpan.FromMilliseconds(560);
+ private static readonly TimeSpan LeaveTime = TimeSpan.FromMilliseconds(420);
// Nobody holds the window after "new": without this the GC can collect it and its timer
// before they fire, and the toast then stays on screen and never closes.
private static readonly HashSet Live = [];
private readonly Microsoft.UI.Dispatching.DispatcherQueueTimer _timer;
+ private readonly Border _card;
+ private readonly Border _bar;
+ private readonly TimeSpan _duration;
+ /// The card slides (the window is transparent around it); without a transparent window it only fades.
+ private readonly bool _slides;
+ private bool _leaving;
+
+ private float Travel => _slides ? (float)(CardWidth + Margin) : 0;
public SessionHintWindow(string title, string body, ScreenRect? target, TimeSpan duration, string? glyph = null)
{
- var icon = new FontIcon { Glyph = glyph ?? "\uE7FC", FontSize = 30, VerticalAlignment = VerticalAlignment.Center };
+ _duration = duration;
+ try
+ {
+ SystemBackdrop = new TransparentBackdrop();
+ _slides = true;
+ }
+ catch (Exception ex)
+ {
+ AppLog.Write($"Aviso: sem janela transparente, só esmaece: {ex.Message}");
+ }
+
+ var icon = new FontIcon { Glyph = glyph ?? "", FontSize = 30, VerticalAlignment = VerticalAlignment.Center };
var text = new StackPanel { Spacing = 2, VerticalAlignment = VerticalAlignment.Center };
text.Children.Add(new TextBlock { Text = title, FontSize = 17, FontWeight = Microsoft.UI.Text.FontWeights.SemiBold });
- text.Children.Add(new TextBlock { Text = body, FontSize = 15, TextWrapping = TextWrapping.Wrap, Opacity = 0.85 });
+ text.Children.Add(new TextBlock { Text = body, FontSize = 15, TextWrapping = TextWrapping.Wrap, MaxLines = 2, TextTrimming = TextTrimming.CharacterEllipsis, Opacity = 0.85 });
var row = new Grid { ColumnSpacing = 16 };
row.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });
row.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });
Grid.SetColumn(text, 1);
row.Children.Add(icon);
row.Children.Add(text);
- Content = new Border
+
+ // How long it stays: a thin bar in the accent colour that runs out, under the text.
+ var accent = Application.Current.Resources.TryGetValue("AccentFillColorDefaultBrush", out var brush) && brush is Brush b
+ ? b : new SolidColorBrush(ColorHelper.FromArgb(0xFF, 0x6E, 0xE0, 0xB8));
+ _bar = new Border
+ {
+ Height = 3,
+ CornerRadius = new CornerRadius(1.5),
+ Background = accent,
+ VerticalAlignment = VerticalAlignment.Bottom,
+ Margin = new Thickness(0, 0, 0, -8)
+ };
+ var inside = new Grid();
+ inside.Children.Add(row);
+ inside.Children.Add(_bar);
+
+ _card = new Border
{
- Background = new SolidColorBrush(ColorHelper.FromArgb(0xF2, 0x0F, 0x14, 0x18)),
+ Width = CardWidth,
+ Height = CardHeight,
+ HorizontalAlignment = HorizontalAlignment.Left,
+ CornerRadius = new CornerRadius(_slides ? 14 : 0),
+ Background = new SolidColorBrush(ColorHelper.FromArgb(0xFF, 0x0F, 0x14, 0x18)),
BorderBrush = new SolidColorBrush(ColorHelper.FromArgb(0x40, 0xFF, 0xFF, 0xFF)),
BorderThickness = new Thickness(1),
Padding = new Thickness(20, 12, 20, 12),
- RequestedTheme = ElementTheme.Dark,
- Child = row
+ Child = inside
};
+ // The window reaches the screen's edge: the card, then the margin it slides through.
+ var stage = new Grid
+ {
+ Width = _slides ? CardWidth + Margin : CardWidth,
+ Height = CardHeight,
+ Background = new SolidColorBrush(Colors.Transparent),
+ RequestedTheme = ElementTheme.Dark
+ };
+ stage.Children.Add(_card);
+ Content = new Viewbox { Stretch = Stretch.Uniform, Child = stage };
+
+ // Off-screen (or see-through) until the first frame, so it never flashes in place before sliding in.
+ var visual = ElementCompositionPreview.GetElementVisual(_card);
+ ElementCompositionPreview.SetIsTranslationEnabled(_card, true);
+ visual.Properties.InsertVector3("Translation", new Vector3(Travel, 0, 0));
+ visual.Opacity = 0;
var hwnd = WindowNative.GetWindowHandle(this);
// Tool window (no taskbar button) that never activates.
@@ -63,7 +127,9 @@ public SessionHintWindow(string title, string body, ScreenRect? target, TimeSpan
presenter.SetBorderAndTitleBar(false, false);
}
WindowChrome.Strip(hwnd);
- WindowPlacement.TopRightOn(appWindow, target, WidthDip, HeightDip, MarginDip);
+ SquareAndBorderless(hwnd);
+ if (_slides) SeeThrough(hwnd);
+ Place(appWindow, target);
appWindow.Show(activateWindow: false);
Live.Add(this);
@@ -74,17 +140,148 @@ public SessionHintWindow(string title, string body, ScreenRect? target, TimeSpan
};
_timer = DispatcherQueue.CreateTimer();
- _timer.Interval = duration;
+ _timer.Interval = EnterTime + duration;
_timer.IsRepeating = false;
_timer.Tick += (_, _) =>
{
_timer.Stop();
- try { Close(); }
- catch (Exception ex) { AppLog.Write($"Menu da sessão: aviso não fechou: {ex.Message}"); }
+ Leave();
};
+ _card.Loaded += (_, _) => Enter();
_timer.Start();
}
+ ///
+ /// Top-right of the screen, in proportion to it like the interface (UiScale); with the slide, flush with the
+ /// right edge so the card comes from behind it.
+ ///
+ private void Place(AppWindow appWindow, ScreenRect? target)
+ {
+ var screen = target is { Width: > 0, Height: > 0 }
+ ? new Windows.Graphics.RectInt32(target.X, target.Y, target.Width, target.Height)
+ : DisplayArea.Primary.OuterBounds;
+ var scale = UiScale.For(screen.Width, screen.Height);
+ var width = (int)Math.Round((_slides ? CardWidth + Margin : CardWidth) * scale);
+ var height = (int)Math.Round(CardHeight * scale);
+ var margin = (int)Math.Round(Margin * scale);
+ var left = screen.X + screen.Width - width - (_slides ? 0 : margin);
+ appWindow.MoveAndResize(new Windows.Graphics.RectInt32(left, screen.Y + margin, width, height));
+ }
+
+ /// In from the right, easing out, while it fades in; then the bar starts running out.
+ private void Enter()
+ {
+ var visual = ElementCompositionPreview.GetElementVisual(_card);
+ var compositor = visual.Compositor;
+ var easeOut = compositor.CreateCubicBezierEasingFunction(new Vector2(0.16f, 1f), new Vector2(0.3f, 1f));
+
+ var slide = compositor.CreateScalarKeyFrameAnimation();
+ slide.InsertKeyFrame(0, Travel);
+ slide.InsertKeyFrame(1, 0, easeOut);
+ slide.Duration = EnterTime;
+ visual.StartAnimation("Translation.X", slide);
+
+ var fade = compositor.CreateScalarKeyFrameAnimation();
+ fade.InsertKeyFrame(0, 0);
+ fade.InsertKeyFrame(1, 1, compositor.CreateLinearEasingFunction());
+ fade.Duration = TimeSpan.FromMilliseconds(EnterTime.TotalMilliseconds * 0.6);
+ visual.StartAnimation("Opacity", fade);
+
+ var bar = ElementCompositionPreview.GetElementVisual(_bar);
+ bar.CenterPoint = new Vector3(0, 0, 0);
+ var runOut = compositor.CreateScalarKeyFrameAnimation();
+ runOut.InsertKeyFrame(0, 1);
+ runOut.InsertKeyFrame(1, 0, compositor.CreateLinearEasingFunction());
+ runOut.Duration = _duration;
+ runOut.DelayTime = EnterTime;
+ runOut.DelayBehavior = AnimationDelayBehavior.SetInitialValueBeforeDelay;
+ bar.StartAnimation("Scale.X", runOut);
+ }
+
+ /// Back out to the right, the way it came, easing in; closes once it is gone.
+ private void Leave()
+ {
+ if (_leaving) return;
+ _leaving = true;
+ try
+ {
+ var visual = ElementCompositionPreview.GetElementVisual(_card);
+ var compositor = visual.Compositor;
+ var easeIn = compositor.CreateCubicBezierEasingFunction(new Vector2(0.7f, 0f), new Vector2(0.84f, 0f));
+ var batch = compositor.CreateScopedBatch(CompositionBatchTypes.Animation);
+
+ var slide = compositor.CreateScalarKeyFrameAnimation();
+ slide.InsertKeyFrame(0, 0);
+ slide.InsertKeyFrame(1, Travel, easeIn);
+ slide.Duration = LeaveTime;
+ visual.StartAnimation("Translation.X", slide);
+
+ var fade = compositor.CreateScalarKeyFrameAnimation();
+ fade.InsertKeyFrame(0, 1);
+ // Sliding, it stays solid until it is mostly behind the edge; without the slide, the fade is the exit.
+ if (_slides) fade.InsertKeyFrame(0.6f, 1);
+ fade.InsertKeyFrame(1, 0);
+ fade.Duration = LeaveTime;
+ visual.StartAnimation("Opacity", fade);
+
+ batch.End();
+ batch.Completed += (_, _) => CloseQuietly();
+ }
+ catch (Exception ex)
+ {
+ AppLog.Write($"Aviso: animação de saída: {ex.Message}");
+ CloseQuietly();
+ }
+ }
+
+ private void CloseQuietly()
+ {
+ try { Close(); }
+ catch (Exception ex) { AppLog.Write($"Menu da sessão: aviso não fechou: {ex.Message}"); }
+ }
+
+ /// No rounded window corners and no 1 px Windows outline: only the card is drawn.
+ private static void SquareAndBorderless(nint hwnd)
+ {
+ try
+ {
+ var square = 1; // DWMWCP_DONOTROUND
+ DwmSetWindowAttribute(hwnd, 33 /* DWMWA_WINDOW_CORNER_PREFERENCE */, ref square, sizeof(int));
+ var none = unchecked((int)0xFFFFFFFE); // DWMWA_COLOR_NONE
+ DwmSetWindowAttribute(hwnd, 34 /* DWMWA_BORDER_COLOR */, ref none, sizeof(int));
+ }
+ catch (Exception ex)
+ {
+ AppLog.Write($"Aviso: cantos: {ex.Message}");
+ }
+ }
+
+ ///
+ /// The frame extended over the whole window: Windows then lets what is behind show through where nothing is drawn,
+ /// instead of the black of the window's own surface (the transparent backdrop alone leaves that black).
+ ///
+ private static void SeeThrough(nint hwnd)
+ {
+ try
+ {
+ var margins = new Margins { Left = -1, Right = -1, Top = -1, Bottom = -1 };
+ Marshal.ThrowExceptionForHR(DwmExtendFrameIntoClientArea(hwnd, ref margins));
+ }
+ catch (Exception ex)
+ {
+ AppLog.Write($"Aviso: transparência: {ex.Message}");
+ }
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ private struct Margins
+ {
+ public int Left, Right, Top, Bottom;
+ }
+
+ [DllImport("dwmapi.dll")]
+ private static extern int DwmExtendFrameIntoClientArea(nint hwnd, ref Margins margins);
+
private const int GwlExStyle = -20;
private const nint WsExNoActivate = 0x08000000;
private const nint WsExToolWindow = 0x00000080;
@@ -94,4 +291,7 @@ public SessionHintWindow(string title, string body, ScreenRect? target, TimeSpan
[DllImport("user32.dll", EntryPoint = "SetWindowLongPtrW")]
private static extern nint SetWindowLongPtr(nint hwnd, int index, nint value);
+
+ [DllImport("dwmapi.dll")]
+ private static extern int DwmSetWindowAttribute(nint hwnd, int attribute, ref int value, int size);
}
diff --git a/src/ConsoleMode/SessionMenuWindow.xaml b/src/ConsoleMode/SessionMenuWindow.xaml
index 42ab87d..76e040c 100644
--- a/src/ConsoleMode/SessionMenuWindow.xaml
+++ b/src/ConsoleMode/SessionMenuWindow.xaml
@@ -11,6 +11,9 @@
+
+
+
@@ -126,7 +129,7 @@
-
+
-
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -557,4 +585,6 @@
+
+
diff --git a/src/ConsoleMode/SessionMenuWindow.xaml.cs b/src/ConsoleMode/SessionMenuWindow.xaml.cs
index 562aa64..b9c3f9d 100644
--- a/src/ConsoleMode/SessionMenuWindow.xaml.cs
+++ b/src/ConsoleMode/SessionMenuWindow.xaml.cs
@@ -31,6 +31,8 @@ public sealed partial class SessionMenuWindow : Window
private static readonly UISettings Ui = new();
private readonly nint _hwnd;
+ // Kept: its handlers keep the list's edges and thumb in line with the scrolling.
+ private readonly Controls.ScrollEdges _rowsEdges;
private readonly GamepadNavigator _navigator;
private bool _editingVolume;
private bool _closing;
@@ -47,6 +49,8 @@ public SessionMenuWindow(MainViewModel viewModel, ScreenRect? target)
{
ViewModel = viewModel;
InitializeComponent();
+ Controls.UiScaleHost.Attach(ScaleArea, UiScaleBox, Root);
+ _rowsEdges = new Controls.ScrollEdges(RowsScroller, RowsFadeTop, RowsFadeBottom, RowsScrollTrack, RowsScrollThumb);
_hwnd = WindowNative.GetWindowHandle(this);
var appWindow = AppWindow.GetFromWindowId(Microsoft.UI.Win32Interop.GetWindowIdFromWindow(_hwnd));
@@ -271,6 +275,18 @@ private void ApplyMaterial()
}
Root.Background = new SolidColorBrush(glass ? Windows.UI.Color.FromArgb(0x99, 0x07, 0x0A, 0x0E) : Windows.UI.Color.FromArgb(0xF7, 0x07, 0x0A, 0x0E));
SidebarPanel.Background = new SolidColorBrush(glass ? Windows.UI.Color.FromArgb(0xB3, 0x11, 0x18, 0x20) : Windows.UI.Color.FromArgb(0xFF, 0x13, 0x1A, 0x22));
+ // The list's edges fade into the panel: the same colour, solid at the edge.
+ var panel = glass ? Windows.UI.Color.FromArgb(0xFF, 0x11, 0x18, 0x20) : Windows.UI.Color.FromArgb(0xFF, 0x13, 0x1A, 0x22);
+ RowsFadeTop.Fill = EdgeFade(panel, fromTop: true);
+ RowsFadeBottom.Fill = EdgeFade(panel, fromTop: false);
+ }
+
+ private static LinearGradientBrush EdgeFade(Windows.UI.Color color, bool fromTop)
+ {
+ var brush = new LinearGradientBrush { StartPoint = new Windows.Foundation.Point(0, fromTop ? 0 : 1), EndPoint = new Windows.Foundation.Point(0, fromTop ? 1 : 0) };
+ brush.GradientStops.Add(new GradientStop { Color = color, Offset = 0 });
+ brush.GradientStops.Add(new GradientStop { Color = Windows.UI.Color.FromArgb(0, color.R, color.G, color.B), Offset = 1 });
+ return brush;
}
private void OnColorValuesChanged(UISettings sender, object args) => DispatcherQueue.TryEnqueue(ApplyMaterial);
diff --git a/src/ConsoleMode/ViewModels/MainViewModel.ConsoleUi.cs b/src/ConsoleMode/ViewModels/MainViewModel.ConsoleUi.cs
index f3f6be1..5a91a3a 100644
--- a/src/ConsoleMode/ViewModels/MainViewModel.ConsoleUi.cs
+++ b/src/ConsoleMode/ViewModels/MainViewModel.ConsoleUi.cs
@@ -175,6 +175,7 @@ private void CycleSetting(string spec)
case "backgroundimage": PickBackgroundImage(); break;
case "startup": StartWithWindows = !StartWithWindows; break;
case "minimizetray": MinimizeToTray = !MinimizeToTray; break;
+ case "menuoutside": MenuOutsideSession = !MenuOutsideSession; break;
case "updates": CheckUpdates = !CheckUpdates; break;
case "betas": BetaUpdates = !BetaUpdates; break;
case "closest": CloseSteamOnRestore = !CloseSteamOnRestore; break;
diff --git a/src/ConsoleMode/ViewModels/MainViewModel.CustomApp.cs b/src/ConsoleMode/ViewModels/MainViewModel.CustomApp.cs
index 54d7de5..e1a9475 100644
--- a/src/ConsoleMode/ViewModels/MainViewModel.CustomApp.cs
+++ b/src/ConsoleMode/ViewModels/MainViewModel.CustomApp.cs
@@ -1,19 +1,28 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
+using ConsoleMode.Models;
using ConsoleMode.Services;
using Microsoft.UI.Xaml.Controls;
using Windows.Storage.Pickers;
namespace ConsoleMode.ViewModels;
-// "Custom app" launch mode: any .exe as the console launcher (issue #111).
+// "Custom app" launch mode: any .exe as the console launcher (issue #111), as many as you like, each a tile on Home
+// with its exe's icon and name. The three properties below are the selected one's, edited in System.
public partial class MainViewModel
{
[ObservableProperty] private string _customAppPath = "";
[ObservableProperty] private string _customAppArguments = "";
[ObservableProperty] private string _customAppWatchProcess = "";
- public bool IsCustomApp => SelectedLaunch?.Value == CustomApp.Mode;
+ private List _customApps = [];
+ private string _customAppId = "";
+ /// Showing another app's values: they are not edits to save.
+ private bool _showingCustomApp;
+
+ public bool IsCustomApp => CustomApp.IsEntryMode(SelectedLaunch?.Value);
+
+ private CustomAppEntry? SelectedCustomApp => _customApps.FirstOrDefault(a => a.Id == _customAppId);
/// The exe's description or file name, shown in summaries.
public string CustomAppName => CustomApp.Validate(CustomAppPath) == CustomApp.Problem.None
@@ -27,19 +36,106 @@ public partial class MainViewModel
? CustomAppName
: SelectedLaunch?.Text ?? LocalizationService.Get("LaunchSteam");
+ /// The config's custom apps (an older config's one app becomes the first) and the one in use.
+ private void LoadCustomApps(AppConfig config)
+ {
+ _customApps = CustomApp.Entries(config);
+ _customAppId = CustomApp.Selected(_customApps, config.CustomAppId)?.Id ?? "";
+ ShowSelectedCustomApp();
+ }
+
+ /// The launcher value a config's mode stands for: a custom app's own value for "customApp".
+ private string LaunchValueOf(AppConfig config) =>
+ config.FullscreenMode == CustomApp.Mode && _customAppId.Length > 0 ? CustomApp.EntryMode(_customAppId) : config.FullscreenMode;
+
+ private void ShowSelectedCustomApp()
+ {
+ var app = SelectedCustomApp;
+ _showingCustomApp = true;
+ try
+ {
+ CustomAppPath = app?.Path ?? "";
+ CustomAppArguments = app?.Arguments ?? "";
+ CustomAppWatchProcess = app?.WatchProcess ?? "";
+ }
+ finally
+ {
+ _showingCustomApp = false;
+ }
+ OnPropertyChanged(nameof(CustomAppName));
+ OnPropertyChanged(nameof(CustomAppPathText));
+ }
+
+ /// A custom app's tile was picked as the launcher: System shows and edits that one.
+ private void OnCustomAppPicked(string? launchValue)
+ {
+ if (CustomApp.EntryId(launchValue) is not { } id || id == _customAppId) return;
+ _customAppId = id;
+ ShowSelectedCustomApp();
+ }
+
partial void OnCustomAppPathChanged(string value)
{
OnPropertyChanged(nameof(CustomAppName));
OnPropertyChanged(nameof(CustomAppPathText));
- RefreshLaunchLogo(CustomApp.Mode);
+ if (_showingCustomApp || SelectedCustomApp is not { } app) return;
+ app.Path = CustomApp.CleanPath(value);
+ // Its tile takes the new exe's name and icon.
+ RebuildLaunchOptions();
SettingChanged();
}
- partial void OnCustomAppArgumentsChanged(string value) => SaveQuietly();
- partial void OnCustomAppWatchProcessChanged(string value) => SaveQuietly();
+ partial void OnCustomAppArgumentsChanged(string value)
+ {
+ if (_showingCustomApp || SelectedCustomApp is not { } app) return;
+ app.Arguments = value;
+ SaveQuietly();
+ }
+
+ partial void OnCustomAppWatchProcessChanged(string value)
+ {
+ if (_showingCustomApp || SelectedCustomApp is not { } app) return;
+ app.WatchProcess = value;
+ SaveQuietly();
+ }
+
+ /// The "+" tile on Home and System → Add a custom app: pick an exe, it becomes a tile and the launcher.
+ [RelayCommand]
+ private async Task AddCustomAppAsync()
+ {
+ if (IsConsoleActive || await PickExeAsync() is not { } path) return;
+ var app = new CustomAppEntry { Id = CustomApp.NextId(_customApps.Select(a => a.Id)), Path = path };
+ _customApps.Add(app);
+ _customAppId = app.Id;
+ ShowSelectedCustomApp();
+ RebuildLaunchOptions();
+ SelectedLaunch = LaunchOptions.FirstOrDefault(o => o.Value == CustomApp.EntryMode(app.Id)) ?? SelectedLaunch;
+ AppLog.Write($"Aplicativo personalizado: adicionado {path}");
+ SettingChanged();
+ }
+ /// System → the custom app's exe: another exe for the selected app (or a new app when there is none).
[RelayCommand]
private async Task PickCustomAppPathAsync()
+ {
+ if (SelectedCustomApp is null) { await AddCustomAppAsync(); return; }
+ if (await PickExeAsync() is { } path) CustomAppPath = path;
+ }
+
+ /// System → Remove this app: its tile goes, and Steam Big Picture opens instead.
+ [RelayCommand]
+ private void RemoveCustomApp()
+ {
+ if (IsConsoleActive || SelectedCustomApp is not { } app) return;
+ _customApps.Remove(app);
+ _customAppId = _customApps.FirstOrDefault()?.Id ?? "";
+ ShowSelectedCustomApp();
+ RebuildLaunchOptions("bigPicture");
+ AppLog.Write($"Aplicativo personalizado: removido {app.Path}");
+ SettingChanged();
+ }
+
+ private async Task PickExeAsync()
{
try
{
@@ -48,13 +144,17 @@ private async Task PickCustomAppPathAsync()
if (App.MainWindowInstance is { } window)
WinRT.Interop.InitializeWithWindow.Initialize(picker, WinRT.Interop.WindowNative.GetWindowHandle(window));
var file = await picker.PickSingleFileAsync();
- if (file is null) return;
- CustomAppPath = file.Path;
+ return file?.Path;
}
catch (Exception ex)
{
AppLog.Write($"Aplicativo personalizado: {ex}");
SetStatus(LocalizationService.Get("PlaynitePathPickError", ex.Message), InfoBarSeverity.Error);
+ return null;
}
}
+
+ /// The custom apps as saved: copies, so later edits don't change a config already handed to the engine.
+ private List CustomAppsToSave() =>
+ _customApps.Select(a => new CustomAppEntry { Id = a.Id, Path = CustomApp.CleanPath(a.Path), Arguments = a.Arguments.Trim(), WatchProcess = a.WatchProcess.Trim() }).ToList();
}
diff --git a/src/ConsoleMode/ViewModels/MainViewModel.LaunchTiles.cs b/src/ConsoleMode/ViewModels/MainViewModel.LaunchTiles.cs
index 8ffbffb..b197011 100644
--- a/src/ConsoleMode/ViewModels/MainViewModel.LaunchTiles.cs
+++ b/src/ConsoleMode/ViewModels/MainViewModel.LaunchTiles.cs
@@ -14,6 +14,8 @@ namespace ConsoleMode.ViewModels;
public sealed partial class LaunchTile : ObservableObject
{
public required ComboOption Option { get; init; }
+ /// The "+" tile after the launchers: A on it adds a custom app; the focus on it picks nothing.
+ public bool IsAdd { get; init; }
public string Text => Option.Text;
public string Glyph { get; init; } = "";
public Brush Background { get; init; } = null!;
@@ -51,15 +53,71 @@ private void RebuildLaunchTiles()
IsSelected = ReferenceEquals(option, SelectedLaunch)
});
}
- foreach (var tile in LaunchTiles) _ = LoadLaunchLogoAsync(tile);
+ var add = LaunchArt.For(LaunchArt.AddCustomApp);
+ LaunchTiles.Add(new LaunchTile
+ {
+ Option = new ComboOption { Text = LocalizationService.Get("AddCustomAppTile"), Value = LaunchArt.AddCustomApp },
+ Glyph = add.Glyph,
+ Background = TileGradient(add.From, add.To),
+ IsAdd = true
+ });
+ foreach (var tile in LaunchTiles.Where(t => !t.IsAdd)) _ = LoadLaunchLogoAsync(tile);
}
- /// Asked in pixels: the tile draws it at 64, so this stays sharp on a 4K TV.
+ /// Read at this size (pixels), enough for a 4K TV; each tile then gets it shrunk to what it draws.
private const int LaunchLogoSize = 256;
+ /// The logo's size on a tile (ConsoleHomeView.xaml), grown by the focused tile's 1.14 (ConsoleHomeView.ScaleTile).
+ private const double LaunchLogoShown = 64 * 1.14;
+
+ /// The screen's pixels per interface pixel (Windows' scale times the interface's, UiScaleHost), from the window.
+ private double _logoScale = 1;
+
// The logos are read once per app: the tiles are rebuilt on every language switch.
- // A Store app's logo is a file of its package; a program's, the icon pixels of its exe.
- private readonly Dictionary _launchLogos = new(StringComparer.OrdinalIgnoreCase);
+ // A Store app's logo is a file of its package; a program's, the icon pixels of its exe. Both end up as pixels.
+ private readonly Dictionary _launchLogos = new(StringComparer.OrdinalIgnoreCase);
+
+ /// The window moved to a screen with another scale: the logos are shrunk again for it.
+ public void SetLogoScale(double scale)
+ {
+ if (scale <= 0 || Math.Abs(scale - _logoScale) < 0.01) return;
+ _logoScale = scale;
+ foreach (var tile in LaunchTiles)
+ if (tile.LogoKey is { } key && _launchLogos.TryGetValue(key, out var logo) && logo is not null) ShowLaunchLogo(tile, logo);
+ }
+
+ ///
+ /// The logo shrunk here, averaging every pixel, to the pixels the tile shows: left to the screen, a 256-pixel
+ /// logo drawn at 64 comes out with jagged edges.
+ ///
+ private void ShowLaunchLogo(LaunchTile tile, IconBitmap logo)
+ {
+ var (width, height) = IconPixels.FitInside(logo.Width, logo.Height, (int)Math.Ceiling(LaunchLogoShown * _logoScale));
+ var pixels = IconPixels.Shrink(logo.Pixels, logo.Width, logo.Height, width, height);
+ var image = new WriteableBitmap(width, height);
+ using (var stream = image.PixelBuffer.AsStream()) stream.Write(pixels);
+ tile.Logo = image;
+ }
+
+ /// A package's logo file as premultiplied BGRA, no larger than .
+ private static async Task ReadLogoFileAsync(string file)
+ {
+ var storage = await Windows.Storage.StorageFile.GetFileFromPathAsync(file);
+ using var stream = await storage.OpenReadAsync();
+ var decoder = await Windows.Graphics.Imaging.BitmapDecoder.CreateAsync(stream);
+ var (width, height) = IconPixels.FitInside((int)decoder.PixelWidth, (int)decoder.PixelHeight, LaunchLogoSize);
+ var transform = new Windows.Graphics.Imaging.BitmapTransform
+ {
+ ScaledWidth = (uint)width,
+ ScaledHeight = (uint)height,
+ InterpolationMode = Windows.Graphics.Imaging.BitmapInterpolationMode.Fant
+ };
+ var data = await decoder.GetPixelDataAsync(Windows.Graphics.Imaging.BitmapPixelFormat.Bgra8,
+ Windows.Graphics.Imaging.BitmapAlphaMode.Premultiplied, transform,
+ Windows.Graphics.Imaging.ExifOrientationMode.IgnoreExifOrientation,
+ Windows.Graphics.Imaging.ColorManagementMode.DoNotColorManage);
+ return new IconBitmap(width, height, data.DetachPixelData());
+ }
/// A launcher's path changed: its tile shows the new app's logo (or the glyph).
private void RefreshLaunchLogo(string mode)
@@ -73,40 +131,31 @@ private void RefreshLaunchLogo(string mode)
private async Task LoadLaunchLogoAsync(LaunchTile tile)
{
+ var custom = CustomApp.EntryId(tile.Option.Value) is { } id ? _customApps.FirstOrDefault(a => a.Id == id) : null;
var (exe, appId) = tile.Option.Value switch
{
"bigPicture" => (SteamSession.FindSteamExe(), (string?)null),
"playnite" => (Engine.Launch.GetPlaynitePath(), null),
"xboxMode" => (null, LaunchArt.XboxAppId),
- CustomApp.Mode => (CustomApp.CleanPath(CustomAppPath), null),
+ _ when custom is not null => (CustomApp.CleanPath(custom.Path), null),
_ => (null, null)
};
var key = appId ?? exe;
// The app this tile now waits for: a slower load for a previous path must not land after this one.
tile.LogoKey = key;
if (string.IsNullOrWhiteSpace(key)) return;
- if (!_launchLogos.TryGetValue(key, out var logo))
- {
- logo = await Task.Run(() =>
- {
- var file = appId is null ? null : PackageLogos.Find(appId);
- return (file, file is null ? WindowIcons.ForApp(exe, appId, LaunchLogoSize) : null);
- });
- _launchLogos[key] = logo;
- }
- if (!string.Equals(tile.LogoKey, key, StringComparison.OrdinalIgnoreCase)) return;
try
{
- if (logo.File is not null)
- {
- tile.Logo = new BitmapImage(new Uri(logo.File)) { DecodePixelWidth = LaunchLogoSize };
- }
- else if (logo.Pixels is { } bitmap)
+ if (!_launchLogos.TryGetValue(key, out var logo))
{
- var image = new WriteableBitmap(bitmap.Width, bitmap.Height);
- using (var stream = image.PixelBuffer.AsStream()) stream.Write(bitmap.Pixels);
- tile.Logo = image;
+ var file = appId is null ? null : await Task.Run(() => PackageLogos.Find(appId));
+ logo = file is not null
+ ? await Task.Run(() => ReadLogoFileAsync(file))
+ : await Task.Run(() => WindowIcons.ForApp(exe, appId, LaunchLogoSize));
+ _launchLogos[key] = logo;
}
+ if (!string.Equals(tile.LogoKey, key, StringComparison.OrdinalIgnoreCase) || logo is null) return;
+ ShowLaunchLogo(tile, logo);
}
catch (Exception ex)
{
@@ -116,19 +165,20 @@ private async Task LoadLaunchLogoAsync(LaunchTile tile)
private void SyncLaunchTiles()
{
- foreach (var tile in LaunchTiles) tile.IsSelected = ReferenceEquals(tile.Option, SelectedLaunch);
+ foreach (var tile in LaunchTiles) tile.IsSelected = !tile.IsAdd && ReferenceEquals(tile.Option, SelectedLaunch);
}
[RelayCommand]
private void SelectLaunchTile(LaunchTile? tile)
{
- if (tile is not null && !ReferenceEquals(SelectedLaunch, tile.Option)) SelectedLaunch = tile.Option;
+ if (tile is not null && !tile.IsAdd && !ReferenceEquals(SelectedLaunch, tile.Option)) SelectedLaunch = tile.Option;
}
- /// A (or a click) on a tile: that launcher, and play it if the setup allows.
+ /// A (or a click) on a tile: that launcher, and play it if the setup allows; on "+", add a custom app.
[RelayCommand]
private async Task PlayLaunchTile(LaunchTile? tile)
{
+ if (tile?.IsAdd == true) { await AddCustomAppAsync(); return; }
SelectLaunchTile(tile);
if (CanStart) await StartAsync();
}
diff --git a/src/ConsoleMode/ViewModels/MainViewModel.OtherApps.cs b/src/ConsoleMode/ViewModels/MainViewModel.OtherApps.cs
index 97e824d..9e119a4 100644
--- a/src/ConsoleMode/ViewModels/MainViewModel.OtherApps.cs
+++ b/src/ConsoleMode/ViewModels/MainViewModel.OtherApps.cs
@@ -7,18 +7,18 @@
namespace ConsoleMode.ViewModels;
-// "More apps from the developer" in Settings: WakeOn and Next Boost, logos taken from their sites.
-// Links: https://wake.nextestudios.com and https://nextboost.pro (in the views).
+// "More apps from the developer" in Settings: ControlFS, Tako Launcher and JoyChromium, logos from their repos.
+// Links (in the views): their GitHub pages.
public partial class MainViewModel
{
- private ImageSource? _wakeOnLogo;
- private ImageSource? _nextBoostLogo;
private ImageSource? _controlFsLogo;
+ private ImageSource? _takoLogo;
+ private ImageSource? _joyChromiumBrandLogo;
- public ImageSource? WakeOnLogo => _wakeOnLogo ??= LoadLogo("wakeon.png");
- public ImageSource? NextBoostLogo => _nextBoostLogo ??= LoadLogo("nextboost.png");
public ImageSource? ControlFsLogo => _controlFsLogo ??= LoadLogo("controlfs.png");
-
+ public ImageSource? TakoLogo => _takoLogo ??= LoadLogo("tako.png");
+ /// JoyChromium's own logo (the session menu's row shows the installed exe's icon instead).
+ public ImageSource? JoyChromiumBrandLogo => _joyChromiumBrandLogo ??= LoadLogo("joychromium.png");
/// Embedded, so the installed and portable builds need no loose files.
private static BitmapImage? LoadLogo(string file)
{
diff --git a/src/ConsoleMode/ViewModels/MainViewModel.Pointer.cs b/src/ConsoleMode/ViewModels/MainViewModel.Pointer.cs
index 54636ad..b4c70bf 100644
--- a/src/ConsoleMode/ViewModels/MainViewModel.Pointer.cs
+++ b/src/ConsoleMode/ViewModels/MainViewModel.Pointer.cs
@@ -4,19 +4,33 @@
namespace ConsoleMode.ViewModels;
-// The mouse pointer in a session, both from the session menu and per session (off when it ends):
-// "Hide the mouse pointer" hides it until turned off, nothing automatic; "Control the mouse" lets
-// the controller drive it. One excludes the other: an invisible pointer can't be steered.
+// The mouse pointer, from the session menu, in a session or outside one (both go back to off when a
+// session starts or ends): "Hide the mouse pointer" hides it until turned off, nothing automatic;
+// "Control the mouse" lets the controller drive it. One excludes the other: an invisible pointer
+// can't be steered.
public partial class MainViewModel
{
private readonly ControllerMouse _controllerMouse = new();
- /// Session menu: the pointer is hidden until this is turned off or the session ends. Never saved.
+ /// Session menu: the pointer is hidden until this is turned off or a session starts or ends. Never saved.
[ObservableProperty] private bool _isCursorHidden;
/// Session menu: the sticks and A drive the mouse. Never saved; every session starts with it off.
[ObservableProperty] private bool _isControllerMouseOn;
+ /// The main window has the focus: the pad drives its interface then, not the mouse (set by the window).
+ [ObservableProperty] private bool _isMainWindowActive;
+
+ partial void OnIsMainWindowActiveChanged(bool value) => UpdateSessionPointer();
+
+ /// A session started or ended: what the menu turned on for the pointer goes back to off.
+ private void ResetSessionPointer()
+ {
+ IsControllerMouseOn = false;
+ IsCursorHidden = false;
+ UpdateSessionPointer();
+ }
+
/// The help line under the menu row, with the confirm button of the pad in use (A or ✕).
public string ControllerMouseHint => LocalizationService.Get("ControllerMouseHint", HintConfirm);
@@ -44,23 +58,15 @@ partial void OnIsSessionMenuOpenChanged(bool value)
[RelayCommand]
private void ToggleControllerMouse() => IsControllerMouseOn = !IsControllerMouseOn;
- /// Brings the pointer and the controller mouse in line with the session, the menu and the choices.
+ /// Brings the pointer and the controller mouse in line with the menu and the choices.
private void UpdateSessionPointer()
{
- if (!IsConsoleActive && (IsControllerMouseOn || IsCursorHidden))
- {
- // The session ended: both go back to off (re-enters here).
- IsControllerMouseOn = false;
- IsCursorHidden = false;
- return;
- }
-
- CursorHider.SetHidden(IsConsoleActive && IsCursorHidden);
+ CursorHider.SetHidden(IsCursorHidden);
- // While the menu is open the pad drives the menu, not the mouse.
- _controllerMouse.Paused = IsSessionMenuOpen;
- if (IsConsoleActive && IsControllerMouseOn)
- _controllerMouse.Start(Engine.State.FocusMonitorRect?.Height ?? 1080);
+ // While the menu or the main window is up the pad drives it, not the mouse.
+ _controllerMouse.Paused = IsSessionMenuOpen || IsMainWindowActive;
+ if (IsControllerMouseOn)
+ _controllerMouse.Start((IsConsoleActive ? Engine.State.FocusMonitorRect : Engine.Monitors.GetMonitorRect(SessionMonitorName, Engine.State))?.Height ?? 1080);
else
_controllerMouse.Stop();
}
diff --git a/src/ConsoleMode/ViewModels/MainViewModel.SessionMenu.cs b/src/ConsoleMode/ViewModels/MainViewModel.SessionMenu.cs
index 8e6f4fc..0d6fa03 100644
--- a/src/ConsoleMode/ViewModels/MainViewModel.SessionMenu.cs
+++ b/src/ConsoleMode/ViewModels/MainViewModel.SessionMenu.cs
@@ -10,9 +10,10 @@
namespace ConsoleMode.ViewModels;
// The in-session menu (Select + Y): a window over the game with volume, resolution, audio,
-// FPS, HDR and the two ways out. In this alpha it also opens outside a session ("preview"), on the
-// game screen or the primary one, so it can be tried without entering console mode: nothing that
-// needs a restore afterwards (the FPS limit) is offered there.
+// FPS, HDR and the two ways out. It also opens outside a session (IsSessionMenuPreview), on the
+// game screen or the primary one, to use the PC from the couch without console mode (System →
+// Controller can turn that off for the shortcut): nothing that needs a restore afterwards (the FPS
+// limit and counter) is offered there.
public partial class MainViewModel
{
private SessionMenuWindow? _sessionMenu;
@@ -28,7 +29,10 @@ public partial class MainViewModel
[ObservableProperty] private bool _isSessionMenuOpen;
[ObservableProperty] private bool _isSessionMenuBusy;
+ /// The menu is open outside a session (the property name is from when that was an alpha preview).
[ObservableProperty] private bool _isSessionMenuPreview;
+ /// System → Controller: the menu shortcut also works outside console mode. On by default.
+ [ObservableProperty] private bool _menuOutsideSession = true;
[ObservableProperty] private bool _isSessionPickerOpen;
[ObservableProperty] private string _sessionPickerTitle = "";
[ObservableProperty] private string _sessionClock = "";
@@ -57,6 +61,13 @@ public partial class MainViewModel
// The chosen game screen is often the TV, which is off until a session starts: use a live one.
: (Monitors.FirstOrDefault(m => m.Monitor.IsPrimary && m.Monitor.IsActive) ?? Monitors.FirstOrDefault(m => m.Monitor.IsActive))?.Monitor.Name ?? "";
+ partial void OnMenuOutsideSessionChanged(bool value)
+ {
+ SaveQuietly();
+ // Turned off from the couch: what the menu turned on outside a session goes back to off.
+ if (!value && !IsConsoleActive) { IsControllerMouseOn = false; IsCursorHidden = false; }
+ }
+
partial void OnIsSessionMenuPreviewChanged(bool value)
{
OnPropertyChanged(nameof(IsFpsMenuAvailable));
diff --git a/src/ConsoleMode/ViewModels/MainViewModel.cs b/src/ConsoleMode/ViewModels/MainViewModel.cs
index 3634a28..794cc17 100644
--- a/src/ConsoleMode/ViewModels/MainViewModel.cs
+++ b/src/ConsoleMode/ViewModels/MainViewModel.cs
@@ -81,7 +81,7 @@ public partial class MainViewModel : ObservableObject
{
"playnite" => LocalizationService.Get("LaunchPlayniteDescription"),
"xboxMode" => LocalizationService.Get("LaunchXboxDescription"),
- CustomApp.Mode => LocalizationService.Get("LaunchCustomAppDescription"),
+ var custom when CustomApp.IsEntryMode(custom) => LocalizationService.Get("LaunchCustomAppDescription"),
_ => LocalizationService.Get("LaunchSteamDescription")
};
public string FocusModeDescription => FocusRow is null
@@ -95,7 +95,7 @@ partial void OnIsConsoleActiveChanged(bool value)
{
OnPropertyChanged(nameof(IsIdle));
NotifyStartState();
- UpdateSessionPointer();
+ ResetSessionPointer();
if (value) _ = ShowSessionHintAsync();
}
partial void OnFocusRowChanged(MonitorRowViewModel? value)
@@ -178,14 +178,7 @@ private void BuildLocalizedOptions()
HideStrategies.Add(new ComboOption { Text = LocalizationService.Get("StrategyTurnOff"), Value = "turnOff" });
SelectedHideStrategy = HideStrategies.FirstOrDefault(x => x.Value == hideValue) ?? HideStrategies[0];
- LaunchOptions.Clear();
- LaunchOptions.Add(new ComboOption { Text = LocalizationService.Get("LaunchSteam"), Value = "bigPicture" });
- if (IsPlayniteAvailable)
- LaunchOptions.Add(new ComboOption { Text = LocalizationService.Get("LaunchPlaynite"), Value = "playnite" });
- LaunchOptions.Add(new ComboOption { Text = LocalizationService.Get("LaunchXbox"), Value = "xboxMode" });
- LaunchOptions.Add(new ComboOption { Text = LocalizationService.Get("LaunchCustomApp"), Value = CustomApp.Mode });
- SelectedLaunch = LaunchOptions.FirstOrDefault(x => x.Value == launchValue) ?? LaunchOptions[0];
- RebuildLaunchTiles();
+ RebuildLaunchOptions(launchValue);
FpsOptions.Clear();
FpsOptions.Add(new ComboOption { Text = LocalizationService.Get("FpsNoLimit"), Value = "0" });
@@ -214,6 +207,35 @@ private void BuildLocalizedOptions()
}
}
+ ///
+ /// The launchers: Steam, Playnite (when installed), Xbox and each custom app by its exe's name; then the Home tiles.
+ /// Keeps the one in use, or picks the given one.
+ ///
+ private void RebuildLaunchOptions(string? select = null)
+ {
+ var value = select ?? SelectedLaunch?.Value ?? "bigPicture";
+ var wasApplying = _applying;
+ _applying = true;
+ try
+ {
+ LaunchOptions.Clear();
+ LaunchOptions.Add(new ComboOption { Text = LocalizationService.Get("LaunchSteam"), Value = "bigPicture" });
+ if (IsPlayniteAvailable)
+ LaunchOptions.Add(new ComboOption { Text = LocalizationService.Get("LaunchPlaynite"), Value = "playnite" });
+ LaunchOptions.Add(new ComboOption { Text = LocalizationService.Get("LaunchXbox"), Value = "xboxMode" });
+ foreach (var app in _customApps)
+ LaunchOptions.Add(new ComboOption { Text = LaunchService.GetCustomAppName(app.Path), Value = CustomApp.EntryMode(app.Id) });
+ SelectedLaunch = LaunchOptions.FirstOrDefault(x => x.Value == value) ?? LaunchOptions[0];
+ RebuildLaunchTiles();
+ }
+ finally
+ {
+ _applying = wasApplying;
+ }
+ OnPropertyChanged(nameof(IsCustomApp));
+ OnPropertyChanged(nameof(LaunchDescription));
+ }
+
private void BuildAudioOptions(string selectedValue)
{
AudioOptions.Clear();
@@ -310,12 +332,10 @@ private void Apply(LoadResult data)
SelectedHideStrategy = HideStrategies.FirstOrDefault(s => s.Value == config.HideStrategy) ?? HideStrategies[0];
PlaynitePath = config.PlaynitePath ?? "";
- CustomAppPath = config.CustomAppPath ?? "";
- CustomAppArguments = config.CustomAppArguments ?? "";
- CustomAppWatchProcess = config.CustomAppWatchProcess ?? "";
+ LoadCustomApps(config);
IsPlayniteAvailable = Engine.Launch.IsPlayniteAvailable();
BuildLocalizedOptions();
- SelectedLaunch = LaunchOptions.FirstOrDefault(o => o.Value == config.FullscreenMode) ?? LaunchOptions[0];
+ SelectedLaunch = LaunchOptions.FirstOrDefault(o => o.Value == LaunchValueOf(config)) ?? LaunchOptions[0];
ApplyTv(config.Tv);
HdrEnable = config.HdrEnable;
VrrEnable = config.VrrEnable;
@@ -331,6 +351,7 @@ private void Apply(LoadResult data)
// Turning the opening off (before "None" was in the picker too) was a choice as well.
_introStyleChosen = !string.IsNullOrWhiteSpace(config.IntroStyle) || !config.IntroAnimation;
MinimizeToTray = config.MinimizeToTray;
+ MenuOutsideSession = config.MenuOutsideSession;
ConsoleBackgroundMode = ConsoleBackgroundService.NormalizeMode(config.ConsoleBackground);
ConsoleBackgroundImage = config.ConsoleBackgroundImage ?? "";
CloseSteamOnRestore = config.CloseSteamOnRestore;
@@ -558,6 +579,7 @@ partial void OnSelectedLanguageChanged(ComboOption? value)
partial void OnVrrEnableChanged(bool value) { SettingChanged(); OnPropertyChanged(nameof(VrrText)); }
partial void OnSelectedLaunchChanged(ComboOption? value)
{
+ OnCustomAppPicked(value?.Value);
OnPropertyChanged(nameof(LaunchDescription));
SyncLaunchTiles();
OnPropertyChanged(nameof(IsCustomApp));
@@ -857,7 +879,10 @@ private AppConfig BuildConfig()
HideMonitors = [.. _loadedConfig.HideMonitors],
MonitorModes = new Dictionary(_loadedConfig.MonitorModes, StringComparer.OrdinalIgnoreCase),
HideStrategy = SelectedHideStrategy?.Value ?? "disconnect",
- FullscreenMode = SelectedLaunch?.Value ?? "bigPicture",
+ // The engine knows one "customApp" mode: the selected app's values go in the CustomApp* fields.
+ FullscreenMode = CustomApp.IsEntryMode(SelectedLaunch?.Value) ? CustomApp.Mode : SelectedLaunch?.Value ?? "bigPicture",
+ CustomApps = CustomAppsToSave(),
+ CustomAppId = _customAppId,
PlaynitePath = PlaynitePath,
CustomAppPath = CustomApp.CleanPath(CustomAppPath),
CustomAppArguments = CustomAppArguments.Trim(),
@@ -886,6 +911,7 @@ private AppConfig BuildConfig()
IntroSound = IntroSound,
IntroStyle = IntroStyleToSave,
MinimizeToTray = MinimizeToTray,
+ MenuOutsideSession = MenuOutsideSession,
ConsoleBackground = ConsoleBackgroundMode,
ConsoleBackgroundImage = ConsoleBackgroundImage,
CloseSteamOnRestore = CloseSteamOnRestore,
diff --git a/src/ConsoleMode/Views/ConsoleHomeView.xaml b/src/ConsoleMode/Views/ConsoleHomeView.xaml
index 213b64d..3fe64b3 100644
--- a/src/ConsoleMode/Views/ConsoleHomeView.xaml
+++ b/src/ConsoleMode/Views/ConsoleHomeView.xaml
@@ -621,6 +621,12 @@
+
+
+
+
+
+
@@ -689,6 +695,12 @@
+
+
+
+
+
+
@@ -956,24 +968,101 @@
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/ConsoleMode/Views/ConsoleHomeView.xaml.cs b/src/ConsoleMode/Views/ConsoleHomeView.xaml.cs
index b8b7040..4e9d9e8 100644
--- a/src/ConsoleMode/Views/ConsoleHomeView.xaml.cs
+++ b/src/ConsoleMode/Views/ConsoleHomeView.xaml.cs
@@ -23,6 +23,7 @@ public sealed partial class ConsoleHomeView : UserControl
private static Style? _cardStyle;
private static Style? _launchTileStyle;
private Control? _lastSettingsRow;
+ private readonly ScrollEdges _rowsEdges;
/// When a category was last pressed with the mouse / touch: that click picks it, A goes into its options.
private long _railPointerPressedAt = long.MinValue / 2;
private int _shownTab;
@@ -51,6 +52,8 @@ public ConsoleHomeView()
RowHelp.Text = Microsoft.UI.Xaml.Automation.AutomationProperties.GetHelpText(row);
};
CategoryRail.GotFocus += (_, _) => RowHelp.Text = "";
+ // The list's edges and its scroll thumb follow the scrolling, the window's size and the category shown.
+ _rowsEdges = new ScrollEdges(SettingsRows, RowsFadeTop, RowsFadeBottom, RowsScrollTrack, RowsScrollThumb);
CategoryRail.GettingFocus += OnRailGettingFocus;
CategoryRail.AddHandler(UIElement.PointerPressedEvent, new PointerEventHandler((_, _) => _railPointerPressedAt = Environment.TickCount64), true);
// The sounds are the pad's (GamepadNavigator, LB / RB): mouse clicks stay silent.
@@ -129,6 +132,10 @@ private void OnViewModelChanged(object? sender, PropertyChangedEventArgs e)
{
switch (e.PropertyName)
{
+ case nameof(MainViewModel.IsSystemTab) when ViewModel.IsSystemTab:
+ // Entering System: the list's edges land with it, never a hard cut that then fades.
+ _rowsEdges.Snap();
+ break;
case nameof(MainViewModel.IsConsoleActive):
RefreshNavigator();
DispatcherQueue.TryEnqueue(FocusDefault);
@@ -346,7 +353,7 @@ private void FocusShortcutEditorRow()
private Button CategoryButton(int index) => (Button)CategoryRail.Children[Math.Clamp(index, 0, CategoryRail.Children.Count - 1)];
- private StackPanel SystemSection(int index) => index switch
+ private Panel SystemSection(int index) => index switch
{
0 => SystemSection0,
1 => SystemSection1,
@@ -879,6 +886,7 @@ private void OnCategoryFocused(object sender, RoutedEventArgs e)
if (sender is not FrameworkElement { Tag: string tag } || !int.TryParse(tag, out var index) || index == ViewModel.SystemCategory) return;
ViewModel.SystemCategory = index;
_lastSettingsRow = null;
+ _rowsEdges.Snap();
SettingsRows.ChangeView(null, 0, null, true);
}
diff --git a/tests/ConsoleMode.Tests/ConsoleMode.Tests.csproj b/tests/ConsoleMode.Tests/ConsoleMode.Tests.csproj
index 2fdb2c3..ed604a6 100644
--- a/tests/ConsoleMode.Tests/ConsoleMode.Tests.csproj
+++ b/tests/ConsoleMode.Tests/ConsoleMode.Tests.csproj
@@ -49,6 +49,7 @@
+
diff --git a/tests/ConsoleMode.Tests/CustomAppListTests.cs b/tests/ConsoleMode.Tests/CustomAppListTests.cs
new file mode 100644
index 0000000..ddfa73e
--- /dev/null
+++ b/tests/ConsoleMode.Tests/CustomAppListTests.cs
@@ -0,0 +1,89 @@
+using ConsoleMode.Models;
+using ConsoleMode.Services;
+
+namespace ConsoleMode.Tests;
+
+public class CustomAppListTests
+{
+ [Fact]
+ public void Each_custom_app_has_its_own_launcher_value()
+ {
+ Assert.Equal("customApp:3", CustomApp.EntryMode("3"));
+ Assert.True(CustomApp.IsEntryMode("customApp:3"));
+ Assert.Equal("3", CustomApp.EntryId("customApp:3"));
+ Assert.False(CustomApp.IsEntryMode(CustomApp.Mode));
+ Assert.Null(CustomApp.EntryId("bigPicture"));
+ Assert.Null(CustomApp.EntryId(null));
+ }
+
+ [Theory]
+ [InlineData(new string[0], "1")]
+ [InlineData(new[] { "1", "2" }, "3")]
+ [InlineData(new[] { "2", "3" }, "1")]
+ [InlineData(new[] { "1", "3" }, "2")]
+ public void A_new_app_takes_the_smallest_free_id(string[] ids, string expected) =>
+ Assert.Equal(expected, CustomApp.NextId(ids));
+
+ [Fact]
+ public void A_config_from_before_the_list_keeps_its_one_custom_app()
+ {
+ var config = new AppConfig { CustomAppPath = "\"C:\\Emu\\retroarch.exe\"", CustomAppArguments = "-f", CustomAppWatchProcess = "retroarch" };
+ var app = Assert.Single(CustomApp.Entries(config));
+ Assert.Equal("1", app.Id);
+ Assert.Equal("C:\\Emu\\retroarch.exe", app.Path);
+ Assert.Equal("-f", app.Arguments);
+ Assert.Equal("retroarch", app.WatchProcess);
+ }
+
+ [Fact]
+ public void The_list_wins_and_apps_without_an_exe_are_dropped()
+ {
+ var config = new AppConfig
+ {
+ CustomAppPath = "C:\\old.exe",
+ CustomApps = [new() { Id = "2", Path = "C:\\a.exe" }, new() { Id = "4", Path = " " }, new() { Id = "5", Path = "C:\\b.exe" }]
+ };
+ Assert.Equal(["2", "5"], CustomApp.Entries(config).Select(a => a.Id));
+ Assert.Empty(CustomApp.Entries(new AppConfig()));
+ }
+
+ [Fact]
+ public void The_selected_app_is_the_one_named_else_the_first()
+ {
+ List apps = [new() { Id = "1" }, new() { Id = "2" }];
+ Assert.Equal("2", CustomApp.Selected(apps, "2")!.Id);
+ Assert.Equal("1", CustomApp.Selected(apps, "9")!.Id);
+ Assert.Null(CustomApp.Selected([], "1"));
+ }
+
+ [Fact]
+ public void A_launcher_that_quits_hands_off_to_the_program_it_started()
+ {
+ (int, int, string)[] processes = [(4, 0, "System"), (100, 50, "explorer.exe"), (300, 200, "Game.exe"), (301, 200, "conhost.exe")];
+ // 200 (the launcher) is gone; its child is still there, with 200 as its parent.
+ Assert.Equal("Game", CustomApp.HandOffTarget(processes, 200));
+ }
+
+ [Fact]
+ public void Console_helpers_are_passed_through_to_what_they_started()
+ {
+ (int, int, string)[] processes = [(300, 200, "cmd.exe"), (301, 300, "conhost.exe"), (302, 300, "emulator.exe")];
+ Assert.Equal("emulator", CustomApp.HandOffTarget(processes, 200));
+ }
+
+ [Fact]
+ public void Nothing_left_running_means_no_hand_off()
+ {
+ (int, int, string)[] processes = [(300, 200, "conhost.exe"), (100, 50, "explorer.exe")];
+ Assert.Null(CustomApp.HandOffTarget(processes, 200));
+ Assert.Null(CustomApp.HandOffTarget([], 200));
+ }
+
+ [Fact]
+ public void The_add_tile_and_every_custom_app_have_their_own_look()
+ {
+ Assert.NotEqual(LaunchArt.Neutral, LaunchArt.For(LaunchArt.AddCustomApp));
+ Assert.NotEqual(LaunchArt.Neutral, LaunchArt.For(CustomApp.EntryMode("7")));
+ Assert.Equal(LaunchArt.For(CustomApp.EntryMode("1")), LaunchArt.For(CustomApp.EntryMode("2")));
+ }
+}
diff --git a/tests/ConsoleMode.Tests/IconShrinkTests.cs b/tests/ConsoleMode.Tests/IconShrinkTests.cs
new file mode 100644
index 0000000..b05bfed
--- /dev/null
+++ b/tests/ConsoleMode.Tests/IconShrinkTests.cs
@@ -0,0 +1,59 @@
+using ConsoleMode.Services;
+using Xunit;
+
+namespace ConsoleMode.Tests;
+
+public class IconShrinkTests
+{
+ private static byte[] Solid(int width, int height, byte b, byte g, byte r, byte a)
+ {
+ var pixels = new byte[width * height * 4];
+ for (var i = 0; i < pixels.Length; i += 4) (pixels[i], pixels[i + 1], pixels[i + 2], pixels[i + 3]) = (b, g, r, a);
+ return pixels;
+ }
+
+ [Fact]
+ public void FitInside_KeepsTheShapeAndNeverEnlarges()
+ {
+ Assert.Equal((73, 73), IconPixels.FitInside(256, 256, 73));
+ Assert.Equal((96, 48), IconPixels.FitInside(256, 128, 96));
+ Assert.Equal((32, 32), IconPixels.FitInside(32, 32, 110));
+ Assert.Equal((0, 0), IconPixels.FitInside(0, 10, 64));
+ }
+
+ [Fact]
+ public void Shrink_KeepsASolidColour()
+ {
+ var shrunk = IconPixels.Shrink(Solid(256, 256, 10, 20, 30, 255), 256, 256, 73, 73);
+ Assert.Equal(73 * 73 * 4, shrunk.Length);
+ for (var i = 0; i < shrunk.Length; i += 4)
+ Assert.Equal(new byte[] { 10, 20, 30, 255 }, shrunk[i..(i + 4)]);
+ }
+
+ [Fact]
+ public void Shrink_AveragesEveryPixelItCovers()
+ {
+ // A 4×1 line, black-white-black-white, halved: each new pixel is half of each, so grey.
+ var line = new byte[] { 0, 0, 0, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255 };
+ var shrunk = IconPixels.Shrink(line, 4, 1, 2, 1);
+ Assert.Equal(new byte[] { 128, 128, 128, 255, 128, 128, 128, 255 }, shrunk);
+ }
+
+ [Fact]
+ public void Shrink_EdgeComesOutSoft()
+ {
+ // A hard edge falling inside a new pixel (3 opaque of 4 across) gives a partly covered pixel, not a step.
+ var pixels = new byte[8 * 1 * 4];
+ for (var x = 0; x < 3; x++) pixels[x * 4 + 3] = 255;
+ var shrunk = IconPixels.Shrink(pixels, 8, 1, 2, 1);
+ Assert.Equal(191, shrunk[3]);
+ Assert.Equal(0, shrunk[7]);
+ }
+
+ [Fact]
+ public void Shrink_LeavesSmallerIconsAsTheyAre()
+ {
+ var pixels = Solid(32, 32, 1, 2, 3, 4);
+ Assert.Same(pixels, IconPixels.Shrink(pixels, 32, 32, 73, 73));
+ }
+}
diff --git a/tests/ConsoleMode.Tests/UiScaleTests.cs b/tests/ConsoleMode.Tests/UiScaleTests.cs
new file mode 100644
index 0000000..f6d5dff
--- /dev/null
+++ b/tests/ConsoleMode.Tests/UiScaleTests.cs
@@ -0,0 +1,39 @@
+using ConsoleMode.Services;
+using Xunit;
+
+namespace ConsoleMode.Tests;
+
+public class UiScaleTests
+{
+ [Theory]
+ // A 1080p screen at 100 %: as laid out.
+ [InlineData(1920, 1080, 1)]
+ // The same screen at 150 %: Windows gives 1280 × 720 units, the interface shrinks them back to the same pixels.
+ [InlineData(1280, 720, 1280.0 / 1920)]
+ // A 4K TV at 100 %: twice as big, the same share of the screen.
+ [InlineData(3840, 2160, 2)]
+ // A 1440p monitor at 125 %.
+ [InlineData(2048, 1152, 1152.0 / 1080)]
+ public void GrowsWithTheWindowsHeight(double width, double height, double expected) =>
+ Assert.Equal(expected, UiScale.For(width, height), 6);
+
+ [Fact]
+ public void SameLayoutWhateverWindowsScale()
+ {
+ // A 4K TV at 100 %, 150 % and 200 %: the interface is laid out at the same size every time.
+ Assert.Equal((1920, 1080), UiScale.LayoutSize(3840, 2160));
+ Assert.Equal((1920, 1080), UiScale.LayoutSize(2560, 1440));
+ Assert.Equal((1920, 1080), UiScale.LayoutSize(1920, 1080));
+ }
+
+ [Fact]
+ public void ANarrowWindowShrinksToTheMinimumWidth()
+ {
+ var (width, height) = UiScale.LayoutSize(960, 1000);
+ Assert.Equal(UiScale.MinimumWidth, width, 6);
+ Assert.True(height > UiScale.DesignHeight);
+ }
+
+ [Fact]
+ public void NoSizeYetLeavesItAlone() => Assert.Equal(1, UiScale.For(0, 0));
+}