From 3cb701b0420647d9cd09a9d04cc904d424a1bfc1 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Fri, 21 Jun 2024 16:13:23 +0200 Subject: [PATCH] Add toggle-fake-fullscreen script --- .../wms/hyprland/config/keybinds.nix | 1 + .../graphical/wms/hyprland/default.nix | 3 ++- .../wms/hyprland/packages/default.nix | 1 + .../toggle-fake-fullscreen/default.nix | 14 ++++++++++++ .../toggle-fake-fullscreen.sh | 22 +++++++++++++++++++ 5 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 home/programs/graphical/wms/hyprland/packages/toggle-fake-fullscreen/default.nix create mode 100644 home/programs/graphical/wms/hyprland/packages/toggle-fake-fullscreen/toggle-fake-fullscreen.sh diff --git a/home/programs/graphical/wms/hyprland/config/keybinds.nix b/home/programs/graphical/wms/hyprland/config/keybinds.nix index 9b3143f..27a5760 100644 --- a/home/programs/graphical/wms/hyprland/config/keybinds.nix +++ b/home/programs/graphical/wms/hyprland/config/keybinds.nix @@ -20,6 +20,7 @@ "SUPER, F, togglefloating," "SUPER, Space, fullscreen, 0" "SUPER_SHIFT, Space, fullscreen, 1" # maximize + "CTRL_SHIFT, Space, exec, toggle-fake-fullscreen" # fake fullscreen + custom border "SUPER_SHIFT, S, layoutmsg, togglesplit" # diff --git a/home/programs/graphical/wms/hyprland/default.nix b/home/programs/graphical/wms/hyprland/default.nix index 65bbb1c..5ad154e 100644 --- a/home/programs/graphical/wms/hyprland/default.nix +++ b/home/programs/graphical/wms/hyprland/default.nix @@ -19,9 +19,10 @@ in { hyprPkgs.hyprland-move-window hyprPkgs.hyprland-screenshot hyprPkgs.quick-record + hyprPkgs.toggle-fake-fullscreen + hyprPkgs.brightness pkgs.brightnessctl pkgs.hyprpicker - hyprPkgs.brightness ]; wayland.windowManager.hyprland = { diff --git a/home/programs/graphical/wms/hyprland/packages/default.nix b/home/programs/graphical/wms/hyprland/packages/default.nix index 2a178f7..ea0fc72 100644 --- a/home/programs/graphical/wms/hyprland/packages/default.nix +++ b/home/programs/graphical/wms/hyprland/packages/default.nix @@ -7,6 +7,7 @@ brightness = pkgs.callPackage ./brightness {}; hyprland-screenshot = pkgs.callPackage ./hyprland-screenshot {}; quick-record = pkgs.callPackage ./quick-record {}; + toggle-fake-fullscreen = pkgs.callPackage ./toggle-fake-fullscreen {}; }; in packages diff --git a/home/programs/graphical/wms/hyprland/packages/toggle-fake-fullscreen/default.nix b/home/programs/graphical/wms/hyprland/packages/toggle-fake-fullscreen/default.nix new file mode 100644 index 0000000..27f8303 --- /dev/null +++ b/home/programs/graphical/wms/hyprland/packages/toggle-fake-fullscreen/default.nix @@ -0,0 +1,14 @@ +{pkgs, ...}: +pkgs.writeShellApplication { + name = "toggle-fake-fullscreen"; + runtimeInputs = with pkgs; [ + coreutils + jq + hyprland + ]; + text = '' + ${builtins.readFile ./toggle-fake-fullscreen.sh} + ''; +} + + diff --git a/home/programs/graphical/wms/hyprland/packages/toggle-fake-fullscreen/toggle-fake-fullscreen.sh b/home/programs/graphical/wms/hyprland/packages/toggle-fake-fullscreen/toggle-fake-fullscreen.sh new file mode 100644 index 0000000..69f2666 --- /dev/null +++ b/home/programs/graphical/wms/hyprland/packages/toggle-fake-fullscreen/toggle-fake-fullscreen.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +#ACTIVE_BORDER_COLOR="0xFF327BD1" +ACTIVE_BORDER_COLOR="0xFFFF6600" +DEFAULT_BORDER_COLOR="0xFFFFA500" + +hyprctl dispatch fakefullscreen "" + +fullscreen_status="$(hyprctl activewindow -j | jq '.fakeFullscreen')" +if [ "$fullscreen_status" = "null" ]; then + echo "Update your hyprland, 'fakeFullscreen' window property not found." + exit 1 +elif [ "$fullscreen_status" = "true" ]; then + window_address="$(hyprctl activewindow -j | jq -r '.address')" + hyprctl setprop "address:$window_address" activebordercolor "$ACTIVE_BORDER_COLOR" lock +elif [ "$fullscreen_status" = "false" ]; then + window_address="$(hyprctl activewindow -j | jq -r '.address')" + hyprctl setprop "address:$window_address" activebordercolor "$DEFAULT_BORDER_COLOR" +else + echo "Unexpected output from 'fakeFullscreen' window property: $fullscreen_status" + exit 1 +fi