Add gamer-mode plugin (#168)

* feat: add gamer-mode plugin

Live CPU, RAM, swap, GPU, VRAM, load and network readings in the bar and a
panel, plus a one-click mode that suspends background resource hogs and
restores exactly what it suspended.

* chore: rebuild the thumbnail with the upstream generator

Produced by assets.noctalia.dev/plugins/thumbnail-generator.html with the
title, the Gaming tag, the panel screenshot and the Red accent, rather than
composed by hand at the same dimensions.

* fix(gamer-mode): write the session before suspending anything

Enable suspended targets first and dropped the writeSnapshot return, so
a failed write left processes frozen and units stopped with no record to
restore them from, while the service published gamer mode as off and
switched the power profile.

The snapshot now lands on disk first, and a failed write aborts the
enable with the machine untouched and an error notification.

Writing first can record a target whose suspend command then failed.
That direction is safe: thawing is unconditional and SIGCONT to a
running process is a no-op, and a stop target restarts only after a live
probe says it is still down.
This commit is contained in:
RAMA
2026-07-30 22:32:21 -04:00
committed by GitHub
parent d1a7e72632
commit 0f64148bea
8 changed files with 3242 additions and 0 deletions
+94
View File
@@ -0,0 +1,94 @@
id = "nomadcxx/gamer-mode"
name = "Gamer Mode"
version = "0.6.4"
plugin_api = 19
author = "Nomadcxx"
license = "MIT"
dependencies = ["pgrep", "pkill", "powerprofilesctl", "systemctl"]
tags = ["bar", "panel", "service", "gaming", "system", "hardware"]
icon = "device-gamepad-2"
description = "Live CPU/RAM/GPU metrics and a one-click gamer mode that suspends and restores background resource hogs."
[[setting]]
key = "glyph"
type = "glyph"
label_key = "settings.glyph.label"
description_key = "settings.glyph.description"
default = "device-gamepad-2"
[[setting]]
key = "click_action"
type = "select"
label_key = "settings.click_action.label"
description_key = "settings.click_action.description"
default = "open_panel"
options = [
{ value = "open_panel", label_key = "settings.click_action.options.open_panel" },
{ value = "toggle", label_key = "settings.click_action.options.toggle" },
]
[[setting]]
key = "poll_interval"
type = "select"
label_key = "settings.poll_interval.label"
description_key = "settings.poll_interval.description"
default = "3"
options = [
{ value = "2", label_key = "settings.poll_interval.options.2" },
{ value = "3", label_key = "settings.poll_interval.options.3" },
{ value = "5", label_key = "settings.poll_interval.options.5" },
]
[[setting]]
key = "profile"
type = "select"
label_key = "settings.profile.label"
description_key = "settings.profile.description"
default = "light"
options = [
{ value = "light", label_key = "settings.profile.options.light" },
{ value = "heavy", label_key = "settings.profile.options.heavy" },
]
[[setting]]
key = "auto_performance"
type = "bool"
label_key = "settings.auto_performance.label"
description_key = "settings.auto_performance.description"
default = true
[[setting]]
key = "show_temps"
type = "bool"
label_key = "settings.show_temps.label"
description_key = "settings.show_temps.description"
default = true
[[setting]]
key = "targets"
type = "string"
label_key = "settings.targets.label"
description_key = "settings.targets.description"
default = ""
advanced = true
[[service]]
id = "service"
entry = "service.luau"
[[panel]]
id = "main"
entry = "panel.luau"
width = 560
height = 820
placement = "attached"
position = "auto"
# "on_demand" takes keyboard focus only when you click inside the panel, so opening it
# from the bar leaves focus where it was. "none" would refuse focus entirely, but the
# shell requires dismiss_on_outside_click = false alongside it, which would leave the
# panel on screen until you click the bar icon again.
keyboard_focus = "on_demand"
[[widget]]
id = "gamermode"
entry = "widget.luau"