Switch the system DNS between popular providers, custom servers, or the ISP default, from a panel on the bar — no reconnect, no captive-portal re-run. Detection reads the active connection's own ipv4.dns/ipv4.ignore-auto-dns instead of guessing, so a manually configured resolver (LAN ones included) shows as its provider and DHCP-assigned DNS shows as Default (ISP). A singleton service entry owns detection/apply so multiple bars share one engine. Every bar gesture (left/right/scroll) is a manifest [widget.actions] default, resolved through noctalia's own IPC registry, so any of them can be remapped from the bar's own gesture settings without touching the plugin. The panel also carries a DNS lookup tester: resolve a name against the active provider's own address with dig/nslookup, to confirm a switch took effect or that a provider blocks a domain. Co-authored-by: nightwatch75 <nightwatch75@users.noreply.github.com> Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
128 lines
4.1 KiB
TOML
128 lines
4.1 KiB
TOML
# DNS Switcher — switch the system DNS (NetworkManager) from the bar.
|
|
# Based on Ronin-CK's v4 "DNS Switcher", rebuilt on the v5 Luau API: the bar
|
|
# widget shows the active provider and toggles a panel listing the configured
|
|
# providers; picking one applies it immediately via `nmcli con mod` +
|
|
# `nmcli device reapply` (no reactivation, the connection never drops).
|
|
|
|
id = "nightwatch75/dns-switcher"
|
|
name = "DNS Switcher"
|
|
version = "0.1.1"
|
|
plugin_api = 17
|
|
author = "nightwatch75"
|
|
license = "MIT"
|
|
# dig (bind-tools/dnsutils) is preferred for the panel's lookup tester;
|
|
# nslookup is the fallback when dig is missing. Neither is required for the
|
|
# core switch/apply feature, only for that one panel section.
|
|
dependencies = ["networkmanager", "dig", "nslookup"]
|
|
tags = ["bar", "panel", "service", "network", "privacy"]
|
|
icon = "world"
|
|
description = "Switch the system DNS between popular providers, custom servers, or the ISP default (NetworkManager)."
|
|
|
|
# Plugin-level settings: shared by the widget engine (detection/apply) and
|
|
# the panel (provider list). Custom servers are five `Name = 1.2.3.4 5.6.7.8`
|
|
# string fields, custom_1..custom_5; see the comment on them for why.
|
|
|
|
[[setting]]
|
|
key = "providers"
|
|
type = "string"
|
|
label_key = "settings.providers.label"
|
|
description_key = "settings.providers.description"
|
|
default = "google,cloudflare,opendns,adguard,quad9"
|
|
|
|
# Five separate string settings rather than one list, because Noctalia's list
|
|
# editor shows an existing row as a static label with remove/up/down buttons: a
|
|
# typo means deleting the row and typing it again. A string renders as a text
|
|
# field, so each server can be corrected in place. Five covers any realistic
|
|
# number of custom resolvers.
|
|
#
|
|
# The keys are new names on purpose, not a retyped custom_dns. A stored value
|
|
# whose type no longer matches its declaration makes Noctalia reject every
|
|
# settings write, so the whole file stops saving; a key that simply no longer
|
|
# exists is just a warning. That is what 0.0.8 was released to fix.
|
|
[[setting]]
|
|
key = "custom_1"
|
|
type = "string"
|
|
label_key = "settings.custom_1.label"
|
|
description_key = "settings.custom.description"
|
|
default = ""
|
|
|
|
[[setting]]
|
|
key = "custom_2"
|
|
type = "string"
|
|
label_key = "settings.custom_2.label"
|
|
description_key = "settings.custom.description"
|
|
default = ""
|
|
|
|
[[setting]]
|
|
key = "custom_3"
|
|
type = "string"
|
|
label_key = "settings.custom_3.label"
|
|
description_key = "settings.custom.description"
|
|
default = ""
|
|
|
|
[[setting]]
|
|
key = "custom_4"
|
|
type = "string"
|
|
label_key = "settings.custom_4.label"
|
|
description_key = "settings.custom.description"
|
|
default = ""
|
|
|
|
[[setting]]
|
|
key = "custom_5"
|
|
type = "string"
|
|
label_key = "settings.custom_5.label"
|
|
description_key = "settings.custom.description"
|
|
default = ""
|
|
|
|
[[setting]]
|
|
key = "poll_seconds"
|
|
type = "int"
|
|
label_key = "settings.poll_seconds.label"
|
|
description_key = "settings.poll_seconds.description"
|
|
default = 10
|
|
min = 2
|
|
max = 120
|
|
|
|
[[setting]]
|
|
key = "privilege_command"
|
|
type = "string"
|
|
label_key = "settings.privilege_command.label"
|
|
description_key = "settings.privilege_command.description"
|
|
default = ""
|
|
advanced = true
|
|
|
|
[[service]]
|
|
id = "service"
|
|
entry = "service.luau"
|
|
|
|
[[panel]]
|
|
id = "panel"
|
|
entry = "panel.luau"
|
|
# Wide enough for the longest built-in row, "OpenDNS · 208.67.222.222
|
|
# 208.67.220.220", without eliding the addresses. Height grew in 0.0.13 to
|
|
# fit the lookup tester below the provider list without starving it.
|
|
width = 430
|
|
height = 460
|
|
placement = "attached"
|
|
open_near_click = true
|
|
|
|
[[widget]]
|
|
id = "dns-switcher"
|
|
entry = "dns-switcher.luau"
|
|
|
|
# Declared here rather than hard-coded in onClick/onRightClick, so the user
|
|
# can remap any of them from the bar's own gesture settings. "right"/
|
|
# "scroll_*" are the exact IPC lines service.luau's onIpc documents.
|
|
[widget.actions]
|
|
left = "panel-toggle nightwatch75/dns-switcher:panel"
|
|
right = "plugin nightwatch75/dns-switcher:service all apply default"
|
|
scroll_up = "plugin nightwatch75/dns-switcher:service all cycle next"
|
|
scroll_down = "plugin nightwatch75/dns-switcher:service all cycle prev"
|
|
|
|
[[widget.setting]]
|
|
key = "show_label"
|
|
type = "bool"
|
|
label_key = "settings.show_label.label"
|
|
description_key = "settings.show_label.description"
|
|
default = true
|