137 lines
4.9 KiB
QML
137 lines
4.9 KiB
QML
pragma Singleton
|
|
|
|
import Quickshell
|
|
import Quickshell.Wayland
|
|
import qs.services
|
|
|
|
Singleton {
|
|
id: root
|
|
|
|
// ---- Panel placement -------------------------------------------------
|
|
|
|
// Bottom of the screen, on the Top layer so the panel sits above normal
|
|
// windows but below fullscreen overlays and lockscreens.
|
|
readonly property int layer: WlrLayer.Top
|
|
|
|
// Layershell namespace. Compositors can target the panel with this, e.g.
|
|
// sway: `layer_effects "att_menu" blur enable`
|
|
readonly property string namespace: "att_menu"
|
|
|
|
// Reserve space so maximised windows do not sit under the panel.
|
|
readonly property bool reserveSpace: true
|
|
|
|
// ---- Window list -----------------------------------------------------
|
|
|
|
// Show only windows present on the panel's own screen. Set false to mirror
|
|
// every window onto every panel.
|
|
readonly property bool windowsPerScreen: true
|
|
|
|
readonly property int windowButtonMinWidth: 40
|
|
readonly property int windowButtonMaxWidth: 220
|
|
|
|
// ---- Launcher --------------------------------------------------------
|
|
|
|
readonly property int launcherWidth: 460
|
|
readonly property int launcherHeight: 520
|
|
|
|
// argv prefix used to run desktop entries with `Terminal=true`.
|
|
// $TERMINAL is honoured if set; otherwise change the fallback to your
|
|
// terminal of choice.
|
|
readonly property var terminal: {
|
|
const env = Quickshell.env("TERMINAL");
|
|
if (!env)
|
|
return ["foot"];
|
|
|
|
// Terminals that need an explicit flag before the command to run.
|
|
const needsExecFlag = ["alacritty", "ghostty", "xterm", "urxvt", "st", "konsole"];
|
|
return needsExecFlag.includes(env.split("/").pop()) ? [env, "-e"] : [env];
|
|
}
|
|
|
|
// ---- Wifi ------------------------------------------------------------
|
|
|
|
// Set false to drop the wifi button. It also hides itself where there is no
|
|
// wifi adapter, or no NetworkManager to talk to.
|
|
readonly property bool showWifi: true
|
|
|
|
// Cap on the SSID shown next to the panel icon, so a long name cannot
|
|
// squeeze the window list.
|
|
readonly property int wifiLabelMaxWidth: 110
|
|
|
|
readonly property int wifiMenuWidth: 300
|
|
readonly property int wifiMenuHeight: 400
|
|
|
|
// ---- Bluetooth -------------------------------------------------------
|
|
|
|
// Set false to drop the bluetooth button. It also hides itself on machines
|
|
// with no bluetooth adapter, so leaving this on costs nothing there.
|
|
readonly property bool showBluetooth: true
|
|
|
|
readonly property int bluetoothMenuWidth: 300
|
|
readonly property int bluetoothMenuHeight: 400
|
|
|
|
// ---- Power actions ---------------------------------------------------
|
|
|
|
// Ask before running the actions marked `dangerous` below.
|
|
readonly property bool confirmDangerous: true
|
|
|
|
readonly property int powerMenuWidth: 190
|
|
|
|
// `command` is argv, run detached. Reorder or trim this list to change
|
|
// which rows appear in the session menu.
|
|
readonly property var powerActions: [
|
|
{
|
|
id: "logout",
|
|
label: "Log out",
|
|
icon: "system-log-out",
|
|
glyph: "⏻",
|
|
command: root.sessionQuitCommand,
|
|
dangerous: true
|
|
},
|
|
{
|
|
id: "suspend",
|
|
label: "Suspend",
|
|
icon: "system-suspend",
|
|
glyph: "☽",
|
|
command: ["systemctl", "suspend"],
|
|
dangerous: false
|
|
},
|
|
{
|
|
id: "reboot",
|
|
label: "Restart",
|
|
icon: "system-reboot",
|
|
glyph: "↻",
|
|
command: ["systemctl", "reboot"],
|
|
dangerous: true
|
|
},
|
|
{
|
|
id: "shutdown",
|
|
label: "Shut down",
|
|
icon: "system-shutdown",
|
|
glyph: "⏼",
|
|
command: ["systemctl", "poweroff"],
|
|
dangerous: true
|
|
}
|
|
]
|
|
|
|
// Logging out is compositor specific, so detect the running one. Falls back
|
|
// to asking logind to end the session, which works anywhere.
|
|
readonly property var sessionQuitCommand: {
|
|
const desktop = (Quickshell.env("XDG_CURRENT_DESKTOP") || "").toLowerCase();
|
|
|
|
if (Quickshell.env("HYPRLAND_INSTANCE_SIGNATURE"))
|
|
return ["hyprctl", "dispatch", "exit"];
|
|
if (Quickshell.env("SWAYSOCK") || desktop.includes("sway"))
|
|
return ["swaymsg", "exit"];
|
|
if (Quickshell.env("NIRI_SOCKET") || desktop.includes("niri"))
|
|
return ["niri", "msg", "action", "quit", "--skip-confirmation"];
|
|
// river 0.4 has no riverctl: the external window manager owns session
|
|
// exit, and attwm offers it over its socket. Only river-classic (0.3.x)
|
|
// is the riverctl one.
|
|
if (desktop.includes("river"))
|
|
return Attwm.available ? ["attwmctl", "exit-session"] : ["riverctl", "exit"];
|
|
|
|
const session = Quickshell.env("XDG_SESSION_ID");
|
|
return session ? ["loginctl", "terminate-session", session] : ["loginctl", "terminate-session", "self"];
|
|
}
|
|
}
|