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
|
in
|
||||||
{
|
{
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
steam-session
|
|
||||||
prismlauncher
|
prismlauncher
|
||||||
|
ryubing
|
||||||
|
steam-session
|
||||||
# modrinth-app
|
# modrinth-app
|
||||||
(lutris.override {
|
(lutris.override {
|
||||||
extraLibraries = pkgs: [
|
extraLibraries = pkgs: [
|
||||||
|
|
|
@ -97,11 +97,11 @@ let
|
||||||
", Home, overview:toggle"
|
", Home, overview:toggle"
|
||||||
"ALT, Tab, cyclenext,"
|
"ALT, Tab, cyclenext,"
|
||||||
"ALT, Tab, bringactivetotop,"
|
"ALT, Tab, bringactivetotop,"
|
||||||
"SUPER_ALT, G, submap, steam"
|
|
||||||
"SUPER, 1, workspace, 1"
|
"SUPER, 1, workspace, 1"
|
||||||
"SUPER, 2, workspace, 2"
|
"SUPER, 2, workspace, 2"
|
||||||
"SUPER, 3, workspace, 3"
|
"SUPER, 3, workspace, 3"
|
||||||
"SUPER, 4, workspace, 4"
|
"SUPER, 4, workspace, 4"
|
||||||
|
"SUPER_ALT, G, exec, ${steam-map} on ${monitors-json}"
|
||||||
|
|
||||||
## Scroller ##
|
## Scroller ##
|
||||||
"SUPER, P, scroller:pin"
|
"SUPER, P, scroller:pin"
|
||||||
|
@ -149,7 +149,9 @@ let
|
||||||
steam = {
|
steam = {
|
||||||
binds = {
|
binds = {
|
||||||
"" = [
|
"" = [
|
||||||
"SUPER, Escape, submap, reset"
|
"SUPER, Escape, exec, ${steam-map} off ${monitors-json}"
|
||||||
|
];
|
||||||
|
n = [
|
||||||
"SUPER, SUPER_L, pass"
|
"SUPER, SUPER_L, pass"
|
||||||
", mouse:275, pass"
|
", mouse:275, pass"
|
||||||
", mouse:276, 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-script = import ./scripts/submaps.nix { inherit pkgs; };
|
||||||
submaps-json = pkgs.writeText "submaps.json" (builtins.toJSON submaps);
|
submaps-json = pkgs.writeText "submaps.json" (builtins.toJSON submaps);
|
||||||
submaps-run = pkgs.runCommand "submaps-run" { inherit submaps-json submaps-script; } ''
|
submaps-run = pkgs.runCommand "submaps-run" { inherit submaps-json submaps-script; } ''
|
||||||
|
|
|
@ -96,13 +96,18 @@ in
|
||||||
#"size 80% 85%, workspace:^(special:special)$"
|
#"size 80% 85%, workspace:^(special:special)$"
|
||||||
#"center, workspace:^(special:special)$"
|
#"center, workspace:^(special:special)$"
|
||||||
|
|
||||||
|
#Ryujinx
|
||||||
|
"opaque, initialClass:^(Ryujinx)$"
|
||||||
|
"immediate, initialClass:^(Ryujinx)$"
|
||||||
|
"workspace 3, initialClass:^(Ryujinx)$"
|
||||||
|
|
||||||
## Steam rules ##
|
## Steam rules ##
|
||||||
"opaque, initialClass:^([Gg]amescope)$"
|
"opaque, initialClass:^([Gg]amescope)$"
|
||||||
|
# "stayfocused, initialClass:^([Gg]amescope)$"
|
||||||
"fullscreen, initialClass:^([Gg]amescope)$"
|
"fullscreen, initialClass:^([Gg]amescope)$"
|
||||||
"minsize 1 1, initialClass:^([Gg]amescope)$"
|
"minsize 1 1, initialClass:^([Gg]amescope)$"
|
||||||
"immediate, initialClass:^([Gg]amescope)$"
|
"immediate, initialClass:^([Gg]amescope)$"
|
||||||
"workspace 3, initialClass:^([Gg]amescope)$"
|
"workspace 3, initialClass:^([Gg]amescope)$"
|
||||||
"monitor 0, initialClass:^([Gg]amescope)$"
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# ========== Fameshot rules ==========
|
# ========== 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
|
# Usage: ./parse_submaps.fish path/to/file.json
|
||||||
if test (count $argv) -lt 1
|
if test (count $argv) -lt 1
|
||||||
echo "Usage: $argv[0] path/to/file.json"
|
echo "Usage: $argv[0] path/to/file.json"
|
||||||
exit 1
|
exit 1
|
||||||
end
|
end
|
||||||
|
|
||||||
set json_file $argv[1]
|
set json_file $argv[1]
|
||||||
|
|
||||||
# Iterate over submaps preserving order
|
# Iterate over submaps preserving order
|
||||||
for entry in (${pkgs.jq}/bin/jq -c '.| to_entries[]' $json_file)
|
for entry in (${pkgs.jq}/bin/jq -c '.| to_entries[]' $json_file)
|
||||||
set submap_name (echo $entry | ${pkgs.jq}/bin/jq -r '.key')
|
set submap_name (echo $entry | ${pkgs.jq}/bin/jq -r '.key')
|
||||||
echo "submap=$submap_name"
|
echo "submap=$submap_name"
|
||||||
|
|
||||||
# Process each binds entry within the submap
|
# Process each binds entry within the submap
|
||||||
for bind_entry in (echo $entry | ${pkgs.jq}/bin/jq -c '.value.binds | to_entries[]')
|
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')
|
set bind_key (echo $bind_entry | ${pkgs.jq}/bin/jq -r '.key')
|
||||||
|
|
||||||
if test "$bind_key" = ""
|
if test "$bind_key" = ""
|
||||||
set prefix "bind="
|
set prefix "bind="
|
||||||
else if test "$bind_key" = "unbind"
|
else if test "$bind_key" = "unbind"
|
||||||
set prefix "unbind="
|
set prefix "unbind="
|
||||||
else
|
else
|
||||||
set prefix "bind$bind_key="
|
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
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Append submap reset except for default "" submap
|
# Process each binding's value in the array
|
||||||
if not test "$submap_name" = ""
|
for binding in (echo $bind_entry | ${pkgs.jq}/bin/jq -r '.value[]')
|
||||||
echo "submap=reset"
|
echo "$prefix$binding"
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Append submap reset except for default "" submap
|
||||||
|
if not test "$submap_name" = ""
|
||||||
|
echo "submap=reset"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
''
|
''
|
||||||
|
|
Loading…
Add table
Reference in a new issue