-
Notifications
You must be signed in to change notification settings - Fork 87
PluginHostname
Fábio Luciano edited this page Dec 24, 2025
·
1 revision
Display current system hostname with short or full domain format.
macbook-pro # Short format (default)
server.local # Short format with local domain
server.example.com # Full format
| Property | Value |
|---|---|
| Platform | macOS, Linux, FreeBSD |
| Dependencies | None (uses built-in commands) |
| Content Type | dynamic |
| Presence | always |
# Enable plugin
set -g @powerkit_plugins "hostname"# Enable plugin
set -g @powerkit_plugins "hostname"
# Hostname format: short or full
set -g @powerkit_plugin_hostname_format "short"
# Icon
set -g @powerkit_plugin_hostname_icon ""| Option | Type | Default | Description |
|---|---|---|---|
@powerkit_plugin_hostname_format |
string | short |
Hostname format: short (hostname only) or full (FQDN) |
@powerkit_plugin_hostname_icon |
icon | |
Hostname icon |
@powerkit_plugin_hostname_show_only_on_threshold |
bool | false |
Only show based on conditions |
| State | Condition | Visibility |
|---|---|---|
active |
Always active | Visible |
| Level | Condition | Color |
|---|---|---|
ok |
Always | Green |
| Context | Description |
|---|---|
local |
Not in SSH session |
remote |
Inside SSH session |
Displays only the hostname without domain:
set -g @powerkit_plugin_hostname_format "short"Examples:
macbook-proserverworkstation
Displays fully qualified domain name (FQDN):
set -g @powerkit_plugin_hostname_format "full"Examples:
macbook-pro.localserver.example.comworkstation.internal.company.com
set -g @powerkit_plugins "hostname"set -g @powerkit_plugins "hostname"
set -g @powerkit_plugin_hostname_format "full"set -g @powerkit_plugins "hostname"
set -g @powerkit_plugin_hostname_icon "💻"# Show hostname with SSH indicator
set -g @powerkit_plugins "ssh,hostname"
# Hostname will show 'remote' context when in SSHShow hostname to identify which machine you're working on:
set -g @powerkit_plugins "hostname,datetime"Display full hostname to distinguish between servers:
set -g @powerkit_plugins "hostname"
set -g @powerkit_plugin_hostname_format "full"Hostname automatically detects SSH context. Combine with SSH plugin for complete info:
set -g @powerkit_plugins "ssh,hostname"Output: user@remote server.example.com
-
Verify hostname is set:
hostname # Short format hostname -f # Full format (FQDN)
-
Set hostname if missing:
# Temporary sudo hostname my-machine # Permanent (varies by distro) # Debian/Ubuntu sudo hostnamectl set-hostname my-machine # macOS sudo scutil --set HostName my-machine sudo scutil --set ComputerName my-machine sudo scutil --set LocalHostName my-machine
- Your system may not have a fully qualified domain name configured
- This is normal for most desktop/laptop machines
- Servers typically have FQDN configured via DNS
The plugin detects SSH sessions via environment variables:
SSH_CONNECTIONSSH_CLIENTSSH_TTY
If context is wrong, check these variables:
echo $SSH_CONNECTION
echo $SSH_CLIENT| Platform | Short Format | Full Format |
|---|---|---|
| macOS | hostname -s |
hostname -f or scutil |
| Linux | hostname -s |
hostname -f |
| FreeBSD | hostname -s |
hostname |
- Hostname is cached for 1 hour by default (rarely changes)
- Very lightweight - no external dependencies
- No network calls required
- PluginSsh - SSH session indicator
- PluginDatetime - Date and time display
- PluginUptime - System uptime