Skip to content

Update nightwatch75/dns-switcher to 0.3.0 — provider row menu, DNS lookup through any resolver - #438

Open
nightwatch75 wants to merge 1 commit into
noctalia-dev:mainfrom
nightwatch75:update-dns-switcher-0.3.0
Open

Update nightwatch75/dns-switcher to 0.3.0 — provider row menu, DNS lookup through any resolver#438
nightwatch75 wants to merge 1 commit into
noctalia-dev:mainfrom
nightwatch75:update-dns-switcher-0.3.0

Conversation

@nightwatch75

Copy link
Copy Markdown
Contributor

Plugin

  • Id: nightwatch75/dns-switcher
  • New plugin
  • Update to an existing plugin (version bumped in plugin.toml)

What it does

Switches the system DNS from the bar. This update covers two releases on top of
the merged 0.1.2.

0.2.0 — every command is an argument vector (plugin_api 24). Detection and
apply were two sh -c scripts; they are now chains of single nmcli calls,
parsed in Luau. No shell parses a DNS address, a hostname, or the privilege
command any more. env runs nmcli under LC_ALL=C, because with no shell
there is no other way to set the locale, and apply reads nmcli stderr.

0.3.0 — a provider row menu (plugin_api 28, panel.openContextMenu).
Right-click a provider for three entries:

Entry Effect
Apply this provider Same as a left click. On the active row it applies the profile again, which nmcli con mod + nmcli device reapply makes safe.
Copy these addresses Copies that provider's addresses to the clipboard.
Look up name through this resolver Sends the hostname from the panel's DNS lookup box to that provider.

The lookup entry is new behaviour. Before it, the tester could only query the
resolver already in use. Now you can ask a provider if it finds a name, and
decide to switch after you see the answer. The entry needs a valid hostname in
the box and a provider with its own addresses, so it is disabled for
Default (ISP).

The row is a ui.button, which is what makes the menu possible: only
onRightClick on a button reports the pointer serial that
panel.openContextMenu requires.

Replaces #437. The template bot closed that one for a single unchecked checklist
entry, and the API refuses to reopen it. Same branch, same commit, corrected
description.

External dependencies

  • networkmanager — provides nmcli. Reads the active connection profile,
    and writes ipv4.dns / ipv4.ignore-auto-dns on a switch.
  • env — runs nmcli under LC_ALL=C. New in this update.
  • dig, nslookup — the panel's DNS lookup only. Either one works. The plugin
    switches DNS without both of them.

No network access of its own, and no files written.

Testing

Run from the working tree as a path source, on Niri.

Static checks:

  • Loaded the plugin and opened the panel. No script error in
    ~/.cache/noctalia/noctalia.log, and every translation key resolves.
  • noctalia plugins lint . — clean.
  • The community validate-plugins.py — clean.

The panel, the provider row menu and the DNS lookup were then used by hand on
Niri. The screenshots below come from that session.

  • Tested on Niri
  • Tested on Hyprland
  • Tested on Sway
  • Tested on another compositor:
  • Noctalia version tested against: v5.0.0-beta.9
  • Plugin API level: 28

Screenshots / Videos

dns2 dns1

Checklist

  • The directory name matches the part of id after the / in plugin.toml exactly.
  • It ships plugin.toml, README.md, thumbnail.webp, and translations/en.json.
  • README.md follows the
    README template, documents
    every entry id and dependency, and includes exact panel IPC commands and launcher prefixes where applicable.
  • I created thumbnail.webp with the thumbnail generator.
  • version follows semver and is bumped in this PR; plugin_api is the oldest API level this plugin requires.
  • Every non-English translation in this PR uses a locale supported by Noctalia core, and I can read, write, and
    understand that language well enough to review and maintain it (no unreviewed machine/LLM translations).
  • I did not edit catalog.toml; CI generates it.
  • This PR touches exactly one plugin directory.

Code review attestation

Plugins run as trusted, unsandboxed Luau in the user's session. Confirm:
Ready-for-review requirement: Every attestation below must be checked.

  • The code is readable and not obfuscated, minified, or generated.
  • It does not download and execute remote code.
  • Every network call, filesystem write, and spawned process is something the description above accounts for.
  • I have the right to publish this code under the license declared in plugin.toml.

Right-click a provider row for a native context menu (plugin_api 28,
panel.openContextMenu): apply the provider, copy its addresses, or look
a hostname up through it without switching to it.

The lookup entry is new behaviour. runResolve now takes an explicit
{ ip, label } server, so the panel's DNS tester can query a resolver the
system is not using. It is disabled for Default (ISP), which has no
address of its own, and until the box holds a valid hostname.

Apply stays enabled on the active row: nmcli con mod + device reapply is
idempotent, so re-applying pushes the profile back onto the live
connection.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015ig9F3FvtfrB7YKdNiwmHv
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.

1 participant