Skip to content

Fixed: Widget title and refresh button cut off by rounded corners; add theme-aware style, background color/opacity and text color settings and One UI blur - #175

Open
byzosc wants to merge 3 commits into
termux:masterfrom
byzosc:widget-skin-opacity
Open

byzosc wants to merge 3 commits into
termux:masterfrom
byzosc:widget-skin-opacity

Conversation

@byzosc

@byzosc byzosc commented Nov 3, 2026 •

Copy link
Copy Markdown

Closes #10

Screenshots

Samsung Galaxy Z Fold8, One UI 9 / Android 17, One UI Home. Left: current 0.15.0 — the "Termux" title and the refresh button run into the clipped corners. Right: the first commit of this PR (dark theme, reduced background opacity) — nothing is cut off. These were taken before the color option and the One UI blur were added.

Before (0.15.0) After (first commit)

What

Main fix: the title and the refresh button are no longer cut off by the rounded corners. On Android 12+ launchers clip every widget to the system widget corner radius. The old layout puts the "Termux" title and the refresh button right into the corners, so on launchers with a large radius (e.g. Samsung One UI Home) both get visibly cut. The title row is now inset by 16dp, which stays clear of radii up to ~54dp, and the background is the @android:id/background root view, which Android 12+ launchers clip with the system radius.

Also:

  • Theme-aware style: the widget follows the system light/dark theme instead of the hardcoded black title bar and light list background.
  • Widget settings (new TermuxWidgetConfigureActivity), stored per widget instance by appWidgetId and cleared in onDeleted. It opens from the launcher's widget "Settings" entry (android:widgetFeatures="reconfigurable|configuration_optional", so adding a widget does not force the config screen) and by tapping the widget title, for launchers that do not show a reconfigure entry.
    • Background color (added in the second commit): follow dark mode (default), white, black, or wallpaper color (system palette system_accent1_100/_800, Android 12+ only). Title, refresh button and list text get a matching light or dark color. On Android 12+ colors are set with RemoteViews.setColorInt(), so they follow dark mode changes without a widget update.
    • Text color (added in the third commit): follow background (default, unchanged), white, or black. The selected color applies to the title, list items, empty-list hint and refresh button; explicit white/black choices use a translucent version of the same color for secondary text. The settings screen is scrollable to keep the save button reachable.
    • Background opacity: a 0–100% slider.
  • Samsung One UI Home blur (second commit): the background color is set with setBackgroundColor() on the root view and its alpha is kept between 1 and 254. With the app:widgetStyle="colorful" and app:widgetSize provider attributes (defined in values/attrs.xml), One UI Home 7.0+ then draws its own wallpaper blur behind the widget and tints it with the background color, the same frosted glass look as Samsung's own widgets. Lower opacity gives more visible blur. Samsung does not document these attributes; the approach follows blur-widget-demo. Other launchers ignore them and simply draw the translucent color.
  • The refresh button uses the same color as the title.

No changes to the shortcut list behaviour, signing config, sharedUserId or version.

Notes

  • Overlaps with Make the widget corners rounded #145 (rounded corners).
  • Below Android 12 the background is no longer drawn with its own 16dp rounded shape (launchers there do not clip widgets), so corners are square there, as in 0.15.0. The first commit kept a rounded drawable and used setImageAlpha, but One UI Home only applies its blur to a plain background color on the root view.
  • New strings are English only.

Tested

Installed over the GitHub 0.15.0 build (same test key) on a Samsung Galaxy Z Fold8, One UI 9 / Android 17, One UI Home launcher: the widget renders with the launcher's corner radius, the title and refresh button are not clipped, the One UI wallpaper blur shows behind the widget, and shortcuts and refresh still work. The launcher reports the widget with semWidgetStyle=1 and semIsWallpaperBlurSupported=true in its options. Light/dark switching, every color choice, other launchers and Android versions below 12 have not been tested separately yet.

AI assistance disclosure: this change was written with Claude Opus 5.5 (Claude Code); I reviewed it and tested it on my device.

🤖 Generated with Claude Code

…ting

- The list widget now follows the system light/dark theme instead of the
  hardcoded black title bar and light list background.
- The background is drawn with the system widget corner radius on Android 12+
  (`system_app_widget_background_radius`) and the title/refresh button are
  inset so the launcher's corner clipping no longer cuts them off.
- Add a configuration activity to set the background opacity per widget
  instance. It is reachable from the launcher's widget "Settings" entry
  (`reconfigurable|configuration_optional`) and by tapping the widget title.

Closes termux#10

Assisted-by: Claude Opus 5.5 (Claude Code)
@byzosc
byzosc force-pushed the widget-skin-opacity branch from ff0399f to 5173f16 Compare November 3, 2026 09:02
@byzosc byzosc changed the title Added: Theme-aware widget style and per-widget background opacity setting Fixed: Widget title and refresh button cut off by rounded corners; add theme-aware style and background opacity setting Nov 3, 2026
byzosc added a commit to byzosc/termux-widget that referenced this pull request Nov 3, 2026
- Add a background color choice to the widget settings: follow dark mode
  (default), white, black, or the wallpaper based system palette on
  Android 12+. The title, refresh button and list items use a matching
  light or dark text color. On Android 12+ the colors follow dark mode
  changes without a widget update (`RemoteViews.setColorInt()`).
- The root view is now `@android:id/background` and its color is set with
  `setBackgroundColor()`, with alpha kept between 1 and 254. Together with
  the `app:widgetStyle` and `app:widgetSize` provider attributes this makes
  Samsung One UI Home 7.0+ draw its wallpaper blur behind the widget, like
  it does for its own widgets. Other launchers ignore these attributes and
  draw the translucent color.
- The refresh button now uses the title color.

Assisted-by: Claude Opus 5.5 (Claude Code)
@byzosc byzosc changed the title Fixed: Widget title and refresh button cut off by rounded corners; add theme-aware style and background opacity setting Fixed: Widget title and refresh button cut off by rounded corners; add theme-aware style, background color/opacity settings and One UI blur Nov 5, 2026
- Add a per-widget text color choice: follow background (default,
  preserving the existing behavior), white, or black. Explicit choices
  keep the same text color across backgrounds and system light/dark modes.
- Use the selected color for the title, list items and refresh button,
  with a translucent version of the same color for the empty-list hint.
- Make the settings screen scrollable so the save button stays reachable
  on smaller screens and with larger text.

Assisted-by: Claude Opus 5.5 (Claude Code), Codex
@byzosc byzosc changed the title Fixed: Widget title and refresh button cut off by rounded corners; add theme-aware style, background color/opacity settings and One UI blur Fixed: Widget title and refresh button cut off by rounded corners; add theme-aware style, background color/opacity and text color settings and One UI blur Nov 6, 2026
@byzosc

byzosc commented Nov 13, 2026

Copy link
Copy Markdown
Author

Friendly ping: this PR is ready for review whenever someone has time.

Summary of the three commits:

  1. Fix the widget title and refresh button being clipped by rounded corners (closes [Request] Add ability to set widget background color and opacity #10).
  2. Theme-aware widget style with per-widget background opacity, a background color option, and One UI Home wallpaper blur.
  3. A text color option.

Built and tested on a Galaxy Z Fold8 (One UI 9 / Android 17). If smaller PRs would make review easier, I'm happy to split it up or adjust anything. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Request] Add ability to set widget background color and opacity

1 participant