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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Todos los cambios importantes de FocusWShell. Cada versión tiene sus notas en [
## Unreleased / Sin publicar

- Fixed: Store apps whose window does not give its app ID (WhatsApp) showed an internal name ("WhatsApp.Root") and a generic icon. They now take the name and icon of the Start menu. / Corregido: las apps de la Store cuya ventana no da su id de app (WhatsApp) salían con un nombre interno («WhatsApp.Root») y un icono genérico. Ahora toman el nombre y el icono del menú Inicio.
- The deck now shows the apps that run as administrator (SADP, for example), in Free, dimmed and with 🛡: FocusWShell can't move them, but tapping one brings it to the front. Borderless apps with a minimize button (Qt) are no longer ignored. / El deck ahora muestra las apps que corren como administrador (SADP, por ejemplo), en Libres, atenuadas y con 🛡: FocusWShell no puede moverlas, pero tocarlas las trae al frente. Las apps sin marco con botón de minimizar (Qt) ya no se ignoran.

## 0.5.0-alpha

Expand Down
2 changes: 1 addition & 1 deletion site/es/limitaciones.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ El soporte completo (un foco y unas apps por escritorio, y pestañas de escritor

## Apps que no se pueden organizar

- **Las apps que se ejecutan como administrador** no las puede mover FocusWShell, que corre sin elevación. Aparecen con el motivo y se quedan donde están.
- **Las apps que se ejecutan como administrador** no las puede mover FocusWShell, que corre sin elevación: Windows no lo deja. Salen en Libres del deck, atenuadas y con 🛡, y tocarlas las trae al frente; en la ventana principal aparecen con el motivo. Si una app no necesita ser administrador (en sus propiedades, Compatibilidad → «Ejecutar este programa como administrador»), quítalo y FocusWShell la organiza como a las demás.
- **Juegos y presentaciones en pantalla completa:** cuando una app se pone en pantalla completa por sí misma (F11, un juego), FocusWShell deja ese monitor en paz hasta que sale. Se ha probado con navegadores; con juegos y presentaciones, todavía poco.
- Algunas apps tienen **tamaño fijo** o un tamaño mínimo grande. FocusWShell lo aprende y les hace sitio, o las deja fuera del layout con una nota.

Expand Down
2 changes: 1 addition & 1 deletion site/limitations.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Full support (a focus and apps per desktop, and desktop tabs in the deck) is pla

## Apps that cannot be organized

- **Apps running as administrator** cannot be moved by FocusWShell, which runs without elevation. They are listed with the reason, and stay where they are.
- **Apps running as administrator** cannot be moved by FocusWShell, which runs without elevation: Windows doesn't allow it. They show in Free in the deck, dimmed and with 🛡, and tapping one brings it to the front; the main window lists them with the reason. If an app doesn't need to be administrator (in its properties, Compatibility → "Run this program as an administrator"), turn that off and FocusWShell organizes it like the rest.
- **Fullscreen games and presentations:** when an app goes fullscreen by itself (F11, a game), FocusWShell leaves that monitor alone until it exits. This has been tested with browsers; games and presentations have not been tested much yet.
- Some apps have a **fixed size** or a large minimum size. FocusWShell learns it and makes room, or leaves them out of the layout with a note.

Expand Down
38 changes: 34 additions & 4 deletions src/FocusWShell.App/DeckWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1519,7 +1519,7 @@ private List<DeckApp> Visible(IEnumerable<DeckApp> apps) =>
/// No está aquí: cerrada, en la bandeja o en otro escritorio (ADR 0016). Se ve apagada, no se mueve ni se
/// cierra, y tocarla la abre (la de la bandeja se muestra ella misma) o lleva a su escritorio.
/// </summary>
private static bool Away(DeckApp app) => app.State is ListItemState.Closed or ListItemState.InTray or ListItemState.OtherDesktop;
private static bool Away(DeckApp app) => app.State is ListItemState.Closed or ListItemState.InTray or ListItemState.OtherDesktop or ListItemState.Unmovable;

/// <summary>
/// Modo cerrar: la app que se toque se cierra como con su X (si tiene algo sin guardar, ella pregunta) y
Expand Down Expand Up @@ -2029,6 +2029,7 @@ private Button AppTile(DeckApp app)
ListItemState.Detached => " ↗",
ListItemState.OtherDesktop => " ⧉",
ListItemState.InTray => " ▴",
ListItemState.Unmovable => " 🛡",
_ => "",
},
Foreground = Away(app) ? DimBrush : TextBrush,
Expand Down Expand Up @@ -2067,12 +2068,21 @@ private Button AppTile(DeckApp app)
Cursor = Cursors.Hand,
ToolTip = app.State == ListItemState.OtherDesktop ? Core.Text.F(Strings.Deck_OtherDesktopTip, app.Name)
: app.State == ListItemState.InTray ? Core.Text.F(Strings.Deck_InTrayTip, app.Name)
: app.State == ListItemState.Unmovable ? Core.Text.F(Strings.Deck_UnmovableTip, app.Name)
: string.IsNullOrEmpty(app.Title) ? app.Name : $"{app.Name} · {app.Title}",
};
System.Windows.Automation.AutomationProperties.SetName(tile, $"Deck: {app.Name} ({app.State})");
// Modo mover (borde = se puede tocar; amarillo = mover): primero todas las que se pueden mover; ya
// elegida, sólo ella conserva el borde hasta que se mueve o se cancela.
if (_pinning)
if (app.State == ListItemState.Unmovable)
{
// Como administrador: ningún modo la toca (no se mueve, ni se ancla, ni se cierra desde aquí).
if (InMode)
{
tile.Opacity = 0.4;
}
}
else if (_pinning)
{
// Borde = se puede tocar; índigo = anclar. Sólido: anclada; tenue: se puede anclar.
if (CanPin(app))
Expand Down Expand Up @@ -2151,8 +2161,12 @@ private Button AppTile(DeckApp app)

await TapApp(app);
};
StartDragFrom(tile, app);
tile.ContextMenu = MenuFor(app);
if (app.State != ListItemState.Unmovable)
{
StartDragFrom(tile, app);
tile.ContextMenu = MenuFor(app);
}

return tile;
}

Expand Down Expand Up @@ -2352,6 +2366,22 @@ private static Button NavButton(string text, string name, Func<Task> click)
/// <summary>Tocar una app: en modo mover, elegirla; si no, llevarla al foco (o abrirla).</summary>
private async Task TapApp(DeckApp app)
{
// Como administrador: sólo se puede traer al frente (eso Windows sí lo deja); en un modo, nada.
if (app.State == ListItemState.Unmovable)
{
if (!InMode && app.Handle is { } elevated)
{
if (!Docked)
{
_actions.Hide();
}

await _actions.BringToFront(elevated);
}

return;
}

if (_closing)
{
if (app.Handle is { } h)
Expand Down
6 changes: 6 additions & 0 deletions src/FocusWShell.App/ListPanels.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ public enum ListItemState
/// <summary>En otro escritorio virtual (ADR 0016): no está aquí; tocarla lleva a su escritorio.</summary>
OtherDesktop,

/// <summary>
/// Abierta pero no se puede mover: corre como administrador (o del sistema) y Windows no deja que FocusWShell
/// la mueva. Sale en LIBRES, atenuada; tocarla sólo la trae al frente.
/// </summary>
Unmovable,

/// <summary>Cerrada: está en el catálogo y su último panel es éste. Tocarla la abre.</summary>
Closed,

Expand Down
22 changes: 22 additions & 0 deletions src/FocusWShell.App/ShellController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,25 @@ string Where(Panel p) => p.Display is null
.OrderBy(a => a.Name, StringComparer.CurrentCultureIgnoreCase)
.ToList();

// Las que corren como administrador: se ven y se traen al frente, pero no se mueven. Al final de LIBRES.
// No están en el catálogo (no se organizan): su nombre y su icono salen de su ejecutable.
DeckApp Unmovable(WindowSnapshot s)
{
var key = MinSizeCatalog.KeyFor(s);
if (!_unmovableNames.TryGetValue(key, out var name))
{
name = AppLauncher.FriendlyName(s.ProcessPath, s.AppUserModelId) ?? Path.GetFileNameWithoutExtension(s.ProcessName);
_unmovableNames[key] = name;
}

var app = _catalog.Find(key) ?? new CatalogApp(key, name, s.ProcessPath, s.AppUserModelId, null, false, DateTimeOffset.Now, DateTimeOffset.Now);
return new DeckApp(_catalog.Find(key)?.Name ?? name, key, s.Handle, ListItemState.Unmovable, s.Title, null, app);
}

free.AddRange(_unmanageable
.Select(u => Unmovable(u.Window))
.OrderBy(a => a.Name, StringComparer.CurrentCultureIgnoreCase));

// La del foco en otro escritorio no está aquí: el foco de este escritorio se ve vacío (ADR 0016).
var focused = _workspace.Focused is { } f && !_elsewhere.ContainsKey(f.Handle) && _snapshots.TryGetValue(f.Handle, out var fs) ? Managed(f, fs) : null;
var current = focused?.Handle;
Expand Down Expand Up @@ -696,6 +715,9 @@ private sealed record TrayWindow(string AppKey, string Label, string PanelId, st
/// </summary>
private readonly Dictionary<nint, TrayWindow> _inTray = [];

/// <summary>Nombre de las apps que corren como administrador (no están en el catálogo), por clave: leerlo cuesta.</summary>
private readonly Dictionary<string, string> _unmovableNames = new(StringComparer.OrdinalIgnoreCase);

/// <summary>Apps con alguna ventana en la bandeja y ninguna a la vista.</summary>
private HashSet<string> TrayKeysLocked()
{
Expand Down
3 changes: 3 additions & 0 deletions src/FocusWShell.App/Strings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/FocusWShell.App/Strings.en.resx
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ Restore them now?
<data name="Desktop_OpenElsewhere" xml:space="preserve"><value>{0} is already open on another desktop. Switch to that desktop to use it.</value></data>
<data name="Deck_OtherDesktopTip" xml:space="preserve"><value>{0} · on another desktop. Tap to go there.</value></data>
<data name="Deck_InTrayTip" xml:space="preserve"><value>{0} · in the tray. Tap to show it.</value></data>
<data name="Deck_UnmovableTip" xml:space="preserve"><value>{0} runs as administrator: FocusWShell can't move it. Tap it to bring it to the front.</value></data>
<data name="ListState_OtherDesktop" xml:space="preserve"><value>on another desktop</value></data>
<data name="List_TipOtherDesktop" xml:space="preserve"><value>{0} · on another desktop. Click: go there.</value></data>
<data name="DeckMenu_GoToDesktop" xml:space="preserve"><value>Go to its desktop</value></data>
Expand Down
1 change: 1 addition & 0 deletions src/FocusWShell.App/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@
<data name="Desktop_OpenElsewhere" xml:space="preserve"><value>{0} ya está abierta en otro escritorio. Cambia a ese escritorio para usarla.</value></data>
<data name="Deck_OtherDesktopTip" xml:space="preserve"><value>{0} · en otro escritorio. Tócala para ir allí.</value></data>
<data name="Deck_InTrayTip" xml:space="preserve"><value>{0} · en la bandeja. Tócala para mostrarla.</value></data>
<data name="Deck_UnmovableTip" xml:space="preserve"><value>{0} corre como administrador: FocusWShell no puede moverla. Tócala para traerla al frente.</value></data>
<data name="ListState_OtherDesktop" xml:space="preserve"><value>en otro escritorio</value></data>
<data name="List_TipOtherDesktop" xml:space="preserve"><value>{0} · en otro escritorio. Clic: ir allí.</value></data>
<data name="DeckMenu_GoToDesktop" xml:space="preserve"><value>Ir a su escritorio</value></data>
Expand Down
5 changes: 3 additions & 2 deletions src/FocusWShell.Core/Windows/EligibilityFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,9 @@ private ExclusionReason FindExclusion(WindowSnapshot w)

// Ventanas sin barra de título ni marco redimensionable suelen ser popups, splash screens u overlays.
// Excepción: apps con barra de título dibujada por ellas mismas (Chromium, Electron, Terminal)
// conservan WS_THICKFRAME aunque quiten WS_CAPTION.
if (!w.HasCaption && !w.IsResizable && !w.IsAppWindow)
// conservan WS_THICKFRAME aunque quiten WS_CAPTION; y las apps sin marco (Qt, como SADP) conservan
// WS_MINIMIZEBOX para minimizarse a la barra de tareas, cosa que una pantalla de inicio no hace.
if (!w.HasCaption && !w.IsResizable && !w.HasMinimizeBox && !w.IsAppWindow)
{
return ExclusionReason.NoCaption;
}
Expand Down
3 changes: 3 additions & 0 deletions src/FocusWShell.Core/Windows/WindowSnapshot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ public sealed record WindowSnapshot
/// <summary>Se puede redimensionar (<c>WS_THICKFRAME</c>).</summary>
public bool IsResizable { get; init; }

/// <summary>Tiene botón de minimizar (<c>WS_MINIMIZEBOX</c>): se minimiza a la barra de tareas como una app.</summary>
public bool HasMinimizeBox { get; init; }

public bool IsTopmost { get; init; }

/// <summary>Rectángulo completo, incluye bordes invisibles de redimensionado (<c>GetWindowRect</c>).</summary>
Expand Down
1 change: 1 addition & 0 deletions src/FocusWShell.Win32/WindowEnumerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public static unsafe TimeSpan IdleTime()
IsTopmost = exStyle.HasFlag(WINDOW_EX_STYLE.WS_EX_TOPMOST),
HasCaption = (style & WINDOW_STYLE.WS_CAPTION) == WINDOW_STYLE.WS_CAPTION,
IsResizable = style.HasFlag(WINDOW_STYLE.WS_THICKFRAME),
HasMinimizeBox = style.HasFlag(WINDOW_STYLE.WS_MINIMIZEBOX),
Bounds = bounds,
VisibleBounds = GetVisibleBounds(hwnd) ?? bounds,
MonitorBounds = GetMonitorBounds(hwnd),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,15 @@ public void FixedBorderlessPopupIsExcluded()
Assert.Equal(ExclusionReason.NoCaption, result.Reason);
}

[Fact]
public void BorderlessWindowWithAMinimizeButtonIsAnApp()
{
// Qt sin marco (SADP): ni barra de título ni marco redimensionable, pero se minimiza a la barra de tareas.
var result = Evaluate(NormalWindow() with { HasCaption = false, IsResizable = false, HasMinimizeBox = true });

Assert.True(result.IsCandidate);
}

[Fact]
public void UserExclusionIsApplied()
{
Expand Down
Loading