Adds hyprland steam maps through script and Ryujinx rules
- Integrates new steam mapping script for dynamic monitor control - Updates key bindings to toggle steam mapping via exec commands - Introduces Ryujinx window rules for improved session handling - Refactors submap binding output in scripts for consistency
This commit is contained in:
parent
f1ef3ca79e
commit
31af183981
5 changed files with 92 additions and 26 deletions
|
@ -48,8 +48,9 @@ let
|
|||
in
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
steam-session
|
||||
prismlauncher
|
||||
ryubing
|
||||
steam-session
|
||||
# modrinth-app
|
||||
(lutris.override {
|
||||
extraLibraries = pkgs: [
|
||||
|
|
|
@ -97,11 +97,11 @@ let
|
|||
", Home, overview:toggle"
|
||||
"ALT, Tab, cyclenext,"
|
||||
"ALT, Tab, bringactivetotop,"
|
||||
"SUPER_ALT, G, submap, steam"
|
||||
"SUPER, 1, workspace, 1"
|
||||
"SUPER, 2, workspace, 2"
|
||||
"SUPER, 3, workspace, 3"
|
||||
"SUPER, 4, workspace, 4"
|
||||
"SUPER_ALT, G, exec, ${steam-map} on ${monitors-json}"
|
||||
|
||||
## Scroller ##
|
||||
"SUPER, P, scroller:pin"
|
||||
|
@ -149,7 +149,9 @@ let
|
|||
steam = {
|
||||
binds = {
|
||||
"" = [
|
||||
"SUPER, Escape, submap, reset"
|
||||
"SUPER, Escape, exec, ${steam-map} off ${monitors-json}"
|
||||
];
|
||||
n = [
|
||||
"SUPER, SUPER_L, pass"
|
||||
", mouse:275, pass"
|
||||
", mouse:276, pass"
|
||||
|
@ -158,6 +160,9 @@ let
|
|||
};
|
||||
};
|
||||
|
||||
steam-map = import ./scripts/steam-map.nix { inherit pkgs; };
|
||||
monitors-json = pkgs.writeText "monitors.json" (builtins.toJSON config.monitors);
|
||||
|
||||
submaps-script = import ./scripts/submaps.nix { inherit pkgs; };
|
||||
submaps-json = pkgs.writeText "submaps.json" (builtins.toJSON submaps);
|
||||
submaps-run = pkgs.runCommand "submaps-run" { inherit submaps-json submaps-script; } ''
|
||||
|
|
|
@ -96,13 +96,18 @@ in
|
|||
#"size 80% 85%, workspace:^(special:special)$"
|
||||
#"center, workspace:^(special:special)$"
|
||||
|
||||
#Ryujinx
|
||||
"opaque, initialClass:^(Ryujinx)$"
|
||||
"immediate, initialClass:^(Ryujinx)$"
|
||||
"workspace 3, initialClass:^(Ryujinx)$"
|
||||
|
||||
## Steam rules ##
|
||||
"opaque, initialClass:^([Gg]amescope)$"
|
||||
# "stayfocused, initialClass:^([Gg]amescope)$"
|
||||
"fullscreen, initialClass:^([Gg]amescope)$"
|
||||
"minsize 1 1, initialClass:^([Gg]amescope)$"
|
||||
"immediate, initialClass:^([Gg]amescope)$"
|
||||
"workspace 3, initialClass:^([Gg]amescope)$"
|
||||
"monitor 0, initialClass:^([Gg]amescope)$"
|
||||
|
||||
#
|
||||
# ========== Fameshot rules ==========
|
||||
|
|
55
home/toph/common/optional/hyprland/scripts/steam-map.nix
Normal file
55
home/toph/common/optional/hyprland/scripts/steam-map.nix
Normal file
|
@ -0,0 +1,55 @@
|
|||
{
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
pkgs.writeScript "steam-map" ''
|
||||
#!/usr/bin/env fish
|
||||
# Usage: ./steam-map-toggle.fish on|off <monitors.json>
|
||||
|
||||
if test (count $argv) -lt 2
|
||||
echo "Usage: $0 on|off <monitors.json>"
|
||||
exit 1
|
||||
end
|
||||
|
||||
set mode $argv[1]
|
||||
set json_file $argv[2]
|
||||
|
||||
if not test -e $json_file
|
||||
echo "Error: File $json_file does not exist"
|
||||
exit 1
|
||||
end
|
||||
|
||||
# Parse the JSON and generate instructions for NON-primary monitors.
|
||||
# When 'off', build the monitor string; when 'on', disable the monitor.
|
||||
set instructions (${pkgs.jq}/bin/jq -r --arg mode "$mode" '
|
||||
.[] |
|
||||
if .primary then empty else
|
||||
if $mode == "off" then
|
||||
.name + "," +
|
||||
(.width|tostring) + "x" + (.height|tostring) + "@" + (.refreshRate|tostring) + "," +
|
||||
(.x|tostring) + "x" + (.y|tostring) + "," +
|
||||
(.scale|tostring) +
|
||||
(if has("transform") then ",transform," + (.transform|tostring) else "" end) +
|
||||
",vrr," + (if has("vrr") then (.vrr|tostring) else "0" end)
|
||||
else
|
||||
.name + ", disable"
|
||||
end
|
||||
end
|
||||
' $json_file)
|
||||
|
||||
# Execute hyprctl keyword monitor for each instruction.
|
||||
for instruction in $instructions
|
||||
echo "Running: hyprctl keyword monitor $instruction"
|
||||
hyprctl keyword monitor "$instruction"
|
||||
end
|
||||
|
||||
# Dispatch the appropriate submap.
|
||||
if [ "$mode" = "on" ]
|
||||
hyprctl --batch "dispatch submap steam; dispatch workspace 3"
|
||||
else if [ "$mode" = "off" ]
|
||||
hyprctl dispatch submap reset
|
||||
else
|
||||
echo "Invalid mode: $mode"
|
||||
exit 1
|
||||
end
|
||||
''
|
|
@ -7,38 +7,38 @@ pkgs.writeScript "submap-script" ''
|
|||
|
||||
# Usage: ./parse_submaps.fish path/to/file.json
|
||||
if test (count $argv) -lt 1
|
||||
echo "Usage: $argv[0] path/to/file.json"
|
||||
exit 1
|
||||
echo "Usage: $argv[0] path/to/file.json"
|
||||
exit 1
|
||||
end
|
||||
|
||||
set json_file $argv[1]
|
||||
|
||||
# Iterate over submaps preserving order
|
||||
for entry in (${pkgs.jq}/bin/jq -c '.| to_entries[]' $json_file)
|
||||
set submap_name (echo $entry | ${pkgs.jq}/bin/jq -r '.key')
|
||||
echo "submap=$submap_name"
|
||||
set submap_name (echo $entry | ${pkgs.jq}/bin/jq -r '.key')
|
||||
echo "submap=$submap_name"
|
||||
|
||||
# Process each binds entry within the submap
|
||||
for bind_entry in (echo $entry | ${pkgs.jq}/bin/jq -c '.value.binds | to_entries[]')
|
||||
set bind_key (echo $bind_entry | ${pkgs.jq}/bin/jq -r '.key')
|
||||
# Process each binds entry within the submap
|
||||
for bind_entry in (echo $entry | ${pkgs.jq}/bin/jq -c '.value.binds | to_entries[]')
|
||||
set bind_key (echo $bind_entry | ${pkgs.jq}/bin/jq -r '.key')
|
||||
|
||||
if test "$bind_key" = ""
|
||||
set prefix "bind="
|
||||
else if test "$bind_key" = "unbind"
|
||||
set prefix "unbind="
|
||||
else
|
||||
set prefix "bind$bind_key="
|
||||
end
|
||||
|
||||
# Process each binding's value in the array
|
||||
for binding in (echo $bind_entry | ${pkgs.jq}/bin/jq -r '.value[]')
|
||||
echo "$prefix$binding"
|
||||
end
|
||||
if test "$bind_key" = ""
|
||||
set prefix "bind="
|
||||
else if test "$bind_key" = "unbind"
|
||||
set prefix "unbind="
|
||||
else
|
||||
set prefix "bind$bind_key="
|
||||
end
|
||||
|
||||
# Append submap reset except for default "" submap
|
||||
if not test "$submap_name" = ""
|
||||
echo "submap=reset"
|
||||
# Process each binding's value in the array
|
||||
for binding in (echo $bind_entry | ${pkgs.jq}/bin/jq -r '.value[]')
|
||||
echo "$prefix$binding"
|
||||
end
|
||||
end
|
||||
|
||||
# Append submap reset except for default "" submap
|
||||
if not test "$submap_name" = ""
|
||||
echo "submap=reset"
|
||||
end
|
||||
end
|
||||
''
|
||||
|
|
Loading…
Add table
Reference in a new issue