Merge branch 'main' of ssh://git.djairo.dev:2222/djaidjai/nixos

This commit is contained in:
2026-10-07 12:36:27 +02:00
6 changed files with 19 additions and 141 deletions

View File

@@ -30,16 +30,5 @@ in
(hyprLib.bind "SUPER + SHIFT + G" (hyprLib.exec "~/.config/hypr/scripts/gamemode_power.sh") "Toggle gaming power profile mode") (hyprLib.bind "SUPER + SHIFT + G" (hyprLib.exec "~/.config/hypr/scripts/gamemode_power.sh") "Toggle gaming power profile mode")
(hyprLib.bind "META + ALT + F6" (hyprLib.exec "~/.config/hypr/scripts/gamemode_power.sh") "Toggle gaming power profile mode") (hyprLib.bind "META + ALT + F6" (hyprLib.exec "~/.config/hypr/scripts/gamemode_power.sh") "Toggle gaming power profile mode")
]; ];
# FIXME: this patch does not work
# adds a `stretch_aspect` scaler (Valve/gamescope#927) and lets `--rt` use the
# rtprio limit from modules/gaming.nix instead of CAP_SYS_NICE.
# nixpkgs.overlays = [
# (_final: prev: {
# gamescope = prev.gamescope.overrideAttrs (old: {
# patches = (old.patches or [ ]) ++ [ ../../patches/gamescope-stretch-aspect.patch ];
# });
# })
# ];
} }

View File

@@ -5,7 +5,7 @@
users.users.djai.extraGroups = [ "gamemode" ]; users.users.djai.extraGroups = [ "gamemode" ];
# capSysNice would make glibc strip LD_PRELOAD from gamescope, breaking steam's overlay. # capSysNice would make glibc strip LD_PRELOAD from gamescope, breaking steam's overlay.
# '--rt' works through the rtprio limit below instead (see the gamescope patch on tuxcomp). # '--rt' works through the rtprio limit below instead.
programs.gamescope = { programs.gamescope = {
enable = true; enable = true;
capSysNice = false; capSysNice = false;

View File

@@ -77,9 +77,9 @@
]; ];
home-manager.users.djai.xdg.desktopEntries = { home-manager.users.djai.xdg.desktopEntries = {
opencloud = { #FIXME does not shadow other desktop file opencloudcmd = { #FIXME does not shadow other desktop file
name = "opencloud desktop "; name = "opencloud desktop ";
exec = ''env QT_STYLE_OVERRIDE="" opencloud --showsettings''; # FIXME exec = ''env QT_STYLE_OVERRIDE="" opencloud --showsettings'';
mimeType = [ "application/vnd.opencloud" ]; mimeType = [ "application/vnd.opencloud" ];
icon = "opencloud"; icon = "opencloud";
settings.StartupWMClass = "opencloud"; settings.StartupWMClass = "opencloud";

View File

@@ -60,7 +60,6 @@ in
on = [ on = [
(hyprLib.on-signal "hyprland.start" [ (hyprLib.on-signal "hyprland.start" [
''uwsm app -- env QT_STYLE_OVERRIDE= opencloud'' ''uwsm app -- env QT_STYLE_OVERRIDE= opencloud''
# "uwsm app -- openrgb --noautoconnect -p aroace.orp"# FIXME should be working already?
"uwsm app -- kitty --class scratchme -d /home/djai/Documents/diary" "uwsm app -- kitty --class scratchme -d /home/djai/Documents/diary"
"uwsm app -- nohup flameshot" "uwsm app -- nohup flameshot"
"hyprctl setcursor Catppuccin-Macchiato-Dark-Cursors 24" # really shouldnt be in here but we get veyr large cursors if we dont "hyprctl setcursor Catppuccin-Macchiato-Dark-Cursors 24" # really shouldnt be in here but we get veyr large cursors if we dont

View File

@@ -1,118 +0,0 @@
diff --git a/src/Utils/Process.cpp b/src/Utils/Process.cpp
index f5191af..434d7f4 100644
--- a/src/Utils/Process.cpp
+++ b/src/Utils/Process.cpp
@@ -423,9 +423,7 @@ namespace gamescope::Process
void SetNice( int nNice )
{
#if defined(__linux__)
- if ( !HasCapSysNice() )
- return;
-
+ // Try regardless of CAP_SYS_NICE — succeeds if RLIMIT_NICE permits.
errno = 0;
int nOldNice = nice( 0 );
if ( nOldNice != -1 || errno == 0 )
@@ -494,9 +492,7 @@ namespace gamescope::Process
bool SetRealtime()
{
#if defined(__linux__)
- if ( !HasCapSysNice() )
- return false;
-
+ // Try regardless of CAP_SYS_NICE — succeeds if RLIMIT_RTPRIO permits.
g_oOldSchedulerInfo = SchedulerInfo::Get();
if ( !g_oOldSchedulerInfo )
return false;
diff --git a/src/main.cpp b/src/main.cpp
index 1397028..bffdbdc 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -171,7 +171,7 @@ const char usage[] =
" -h, --nested-height game height\n"
" -r, --nested-refresh game refresh rate (frames per second)\n"
" -m, --max-scale maximum scale factor\n"
- " -S, --scaler upscaler type (auto, integer, fit, fill, stretch)\n"
+ " -S, --scaler upscaler type (auto, integer, fit, fill, stretch, stretch_aspect)\n"
" -F, --filter upscaler filter (linear, nearest, fsr, nis, pixel)\n"
" fsr => AMD FidelityFX™ Super Resolution 1.0\n"
" nis => NVIDIA Image Scaling v1.0.3\n"
@@ -392,6 +392,8 @@ static enum GamescopeUpscaleScaler parse_upscaler_scaler(const char *str)
return GamescopeUpscaleScaler::FILL;
} else if (strcmp(str, "stretch") == 0) {
return GamescopeUpscaleScaler::STRETCH;
+ } else if (strcmp(str, "stretch_aspect") == 0) {
+ return GamescopeUpscaleScaler::STRETCH_ASPECT;
} else {
fprintf( stderr, "gamescope: invalid value for --scaler\n" );
exit(1);
@@ -843,16 +845,12 @@ int main(int argc, char **argv)
}
}
- if ( gamescope::Process::HasCapSysNice() )
+ // Try elevating priority unconditionally; the calls succeed when either
+ // CAP_SYS_NICE is set or RLIMIT_NICE/RTPRIO permit it (PAM loginLimits).
+ gamescope::Process::SetNice( -20 );
+ if ( g_bRt && !gamescope::Process::SetRealtime() && !gamescope::Process::HasCapSysNice() )
{
- gamescope::Process::SetNice( -20 );
-
- if ( g_bRt )
- gamescope::Process::SetRealtime();
- }
- else
- {
- fprintf( stderr, "No CAP_SYS_NICE, falling back to regular-priority compute and threads.\nPerformance will be affected.\n" );
+ fprintf( stderr, "Failed to set realtime scheduling. Need CAP_SYS_NICE or RLIMIT_RTPRIO > 0.\n" );
}
#if 0
diff --git a/src/main.hpp b/src/main.hpp
index 2e6fb83..89d6bc9 100644
--- a/src/main.hpp
+++ b/src/main.hpp
@@ -54,6 +54,7 @@ enum class GamescopeUpscaleScaler : uint32_t
FIT,
FILL,
STRETCH,
+ STRETCH_ASPECT,
};
extern GamescopeUpscaleFilter g_upscaleFilter;
diff --git a/src/steamcompmgr.cpp b/src/steamcompmgr.cpp
index 0518950..2f5db9f 100644
--- a/src/steamcompmgr.cpp
+++ b/src/steamcompmgr.cpp
@@ -1508,6 +1508,31 @@ window_is_fullscreen( steamcompmgr_win_t *w )
void calc_scale_factor_scaler(float &out_scale_x, float &out_scale_y, float sourceWidth, float sourceHeight)
{
+ // Stretches source to a sub-rect of the output that matches the -W/-H aspect ratio,
+ // pillar/letterboxing the rest. Useful for e.g. 4:3-stretched on a 21:9 panel.
+ // Uses g_nPreferredOutput{Width,Height} (the user-supplied -W/-H, never mutated)
+ // rather than g_nOutput{Width,Height} (which backends overwrite on resize/fullscreen).
+ extern int g_nPreferredOutputWidth;
+ extern int g_nPreferredOutputHeight;
+ if (g_upscaleScaler == GamescopeUpscaleScaler::STRETCH_ASPECT
+ && g_nPreferredOutputWidth > 0 && g_nPreferredOutputHeight > 0
+ && currentOutputWidth > 0 && currentOutputHeight > 0)
+ {
+ float targetAspect = (float)g_nPreferredOutputWidth / (float)g_nPreferredOutputHeight;
+ float currentAspect = (float)currentOutputWidth / (float)currentOutputHeight;
+ float effW, effH;
+ if (currentAspect > targetAspect) {
+ effH = (float)currentOutputHeight;
+ effW = effH * targetAspect;
+ } else {
+ effW = (float)currentOutputWidth;
+ effH = effW / targetAspect;
+ }
+ out_scale_x = effW / sourceWidth;
+ out_scale_y = effH / sourceHeight;
+ return;
+ }
+
float XOutputRatio = currentOutputWidth / (float)g_nNestedWidth;
float YOutputRatio = currentOutputHeight / (float)g_nNestedHeight;
float outputScaleRatio = std::min(XOutputRatio, YOutputRatio);

View File

@@ -6,21 +6,29 @@ from json import dumps
from dbus_fast.aio import MessageBus from dbus_fast.aio import MessageBus
from dbus_fast.proxy_object import BaseProxyInterface, BaseProxyObject from dbus_fast.proxy_object import BaseProxyInterface, BaseProxyObject
def output(msg: string, clss: string = "unmuted-notifs"):
print(dumps({
"text": msg,
"alt": "",
"tooltip": "",
"class": clss,
"percentage": 0
}, ensure_ascii=False), flush=True)
def update_dbus_state(interface, changed, _) -> None: def update_dbus_state(interface, changed, _) -> None:
if interface != 'org.dunstproject.cmd0': if interface != 'org.dunstproject.cmd0':
output("", "error")
return return
if 'paused' in changed: if 'paused' in changed:
update_output(changed['paused'].value) update_output(changed['paused'].value)
def update_output(paused: bool) -> None: def update_output(paused: bool) -> None:
print(dumps({ output("󱙍" if paused else "󰍡", "muted-notifs" if paused else "unmuted-notifs")
"text": "󱙍" if paused else "󰍡",
"alt": "",
"tooltip": "",
"class": "muted-notifs" if paused else "unmuted-notifs",
"percentage": 0
}, ensure_ascii=False))
async def main() -> None: async def main() -> None:
bus = await MessageBus().connect() bus = await MessageBus().connect()
@@ -37,6 +45,6 @@ async def main() -> None:
await Event().wait() await Event().wait()
if __name__ == "__main__": if __name__ == "__main__":
run(main()) run(main())