Skip to content

Commit

Permalink
Merge pull request #20 from AshtakaOOf/toggles
Browse files Browse the repository at this point in the history
Add backend setting to shell + misc changes
  • Loading branch information
xTrayambak authored Dec 30, 2024
2 parents d504c2b + cfef152 commit 702a7af
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 16 deletions.
6 changes: 3 additions & 3 deletions src/config.nim
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type
fps*: int = 60
launcher*: string = ""
renderer*: Renderer = Renderer.Vulkan
backend: string
backend*: string
telemetry*: bool = false
fflags*: string
apkUpdates*: bool = true
Expand All @@ -51,7 +51,7 @@ type
sun*: string = ""
font*: string = ""
excludeFonts*: seq[string] = @["RobloxEmoji.ttf", "TwemojiMozilla.ttf"]

DaemonConfig* = object
port*: uint = 9898

Expand Down Expand Up @@ -113,7 +113,7 @@ descriptionSize = 18
anchors = "top-right"
[client]
fps = 9999
fps = 60
launcher = ""
telemetry = false
fflags = "\n"
Expand Down
46 changes: 33 additions & 13 deletions src/shell/core.nim
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ viewable LucemShell:
telemetryOpt:
bool

backendOpt:
seq[string] = @["Wayland", "X11"]
backendBuff:
int

launcherBuff:
string

Expand Down Expand Up @@ -162,7 +167,7 @@ method view(app: LucemShellState): Widget =
description = "These are some optional tweaks to customize your experience."

ActionRow:
title = "Bring Back the Old \"Oof\" Sound"
title = "Bring Back the \"Oof\" Sound"
subtitle =
"This replaces the new \"Eugh\" death sound with the classic \"Oof\" sound."
CheckButton {.addSuffix.}:
Expand All @@ -177,7 +182,7 @@ method view(app: LucemShellState): Widget =
ActionRow:
title = "Custom Client Font"
subtitle =
"Force the Roblox client to use a particular font whenever possible."
"Override the Roblox fonts using your own font, Note: Emojis will not be overriden."

Entry {.addSuffix.}:
text = app.customFontPath
Expand All @@ -198,7 +203,7 @@ method view(app: LucemShellState): Widget =
ActionRow:
title = "Custom Sun Texture"
subtitle =
"For games that do not set a custom sun texture, your specified texture will be shown instead."
"For games that don't use a custom sun texture, your specified texture will be shown instead."

Entry {.addSuffix.}:
text = app.sunImgPath
Expand All @@ -220,7 +225,7 @@ method view(app: LucemShellState): Widget =
ActionRow:
title = "Custom Moon Texture"
subtitle =
"For games that do not set a custom moon texture, your specified texture will be shown instead."
"For games that don't use a custom moon texture, your specified texture will be shown instead."

Entry {.addSuffix.}:
text = app.moonImgPath
Expand Down Expand Up @@ -265,7 +270,7 @@ method view(app: LucemShellState): Widget =
ActionRow:
title = "Notify the Server Region"
subtitle =
"When you join a game, a notification will be sent containing where the server is located."
"When joining a game, a notification will be sent containing the location of the server."
CheckButton {.addSuffix.}:
state = app.serverLocationOpt

Expand All @@ -279,7 +284,7 @@ method view(app: LucemShellState): Widget =
ActionRow:
title = "Clear all API caches"
subtitle =
"This will clear all the API call caches. Some features might be slower next time you run Lucem."
"This will clear all the API call caches. Some features might be slower the next time you run Lucem."
Button {.addSuffix.}:
icon = "user-trash-symbolic"
style = [ButtonDestructive]
Expand Down Expand Up @@ -389,7 +394,7 @@ method view(app: LucemShellState): Widget =
ActionRow:
title = "Disable Telemetry"
subtitle =
"Disable all* telemetry that the Roblox client exposes via FFlags."
"Disable the Roblox client telemetry via FFlags. Note: This only enables/disables relevant FFLags."
CheckButton {.addSuffix.}:
state = app.telemetryOpt

Expand All @@ -401,7 +406,7 @@ method view(app: LucemShellState): Widget =

ActionRow:
title = "Disable FPS cap"
subtitle = "Some games might ban you if they detect this."
subtitle = "Some games might ban you if they detect this. Note: Games dependent on framerate might misbehave."
CheckButton {.addSuffix.}:
state = app.showFpsCapOpt

Expand All @@ -416,10 +421,10 @@ method view(app: LucemShellState): Widget =
if app.showFpsCapOpt:
ActionRow:
title = "FPS Cap"
subtitle = "Some games might misbehave."
subtitle = "Change the FPS cap to values Roblox doesn't offer. Avoid using a value above the monitor refresh rate."
Entry {.addSuffix.}:
text = app.showFpsCapBuff
placeholder = "Eg. 30, 60, 144, etc."
placeholder = "e.g. 30, 60 (default), 144, etc."

proc changed(text: string) =
debug "shell: fps cap entry changed: " & text
Expand All @@ -437,13 +442,28 @@ method view(app: LucemShellState): Widget =
app.showFpsCapBuff
debug "shell: " & exc.msg

ComboRow:
title = "Backend"
subtitle =
"Which display server Sober will use, on Wayland X11 will use Xwayland."
items = app.backendOpt
selected = app.backendBuff

proc select(selectedIndex: int) =
debug "shell: launcher entry changed: " & app.backendOpt[selectedIndex]
app.backendBuff = selectedIndex

proc activate() =
app.config[].client.backend = app.backendOpt[app.backendBuff]
debug "shell: backend is set to: " & app.backendOpt[app.backendBuff]

ActionRow:
title = "Launcher"
subtitle =
"Lucem will launch Sober with a specified command. Leave this empty if you don't require it."
"Lucem will launch Sober with a specified command. This is optional."
Entry {.addSuffix.}:
text = app.launcherBuff
placeholder = "Eg. gamemoderun"
placeholder = "e.g. gamemoderun"

proc changed(text: string) =
debug "shell: launcher entry changed: " & text
Expand All @@ -456,7 +476,7 @@ method view(app: LucemShellState): Widget =
ActionRow:
title = "Polling Delay"
subtitle =
"Add a tiny delay in seconds to the event watcher thread. This barely impacts performance on modern systems."
"Add a tiny delay in seconds to the event watcher thread. This is unlikely to impact performance on modern systems."

Entry {.addSuffix.}:
text = app.pollingDelayBuff
Expand Down

0 comments on commit 702a7af

Please sign in to comment.