From 14d5cf52614a32ed849099194ce03103bd3c596d Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Mon, 10 Jun 2024 14:20:24 +0200 Subject: [PATCH 1/6] Move hyprland-swap-workspace to dir --- home/programs/graphical/wms/hyprland/packages/default.nix | 2 +- .../default.nix} | 0 .../{ => hyprland-swap-workspace}/hyprland-swap-workspace.sh | 0 3 files changed, 1 insertion(+), 1 deletion(-) rename home/programs/graphical/wms/hyprland/packages/{hyprland-swap-workspace.nix => hyprland-swap-workspace/default.nix} (100%) rename home/programs/graphical/wms/hyprland/packages/{ => hyprland-swap-workspace}/hyprland-swap-workspace.sh (100%) diff --git a/home/programs/graphical/wms/hyprland/packages/default.nix b/home/programs/graphical/wms/hyprland/packages/default.nix index 2679e8c..773332b 100644 --- a/home/programs/graphical/wms/hyprland/packages/default.nix +++ b/home/programs/graphical/wms/hyprland/packages/default.nix @@ -3,7 +3,7 @@ ... }: let packages = { - hyprland-swap-workspace = pkgs.callPackage ./hyprland-swap-workspace.nix {}; + hyprland-swap-workspace = pkgs.callPackage ./hyprland-swap-workspace {}; }; in packages diff --git a/home/programs/graphical/wms/hyprland/packages/hyprland-swap-workspace.nix b/home/programs/graphical/wms/hyprland/packages/hyprland-swap-workspace/default.nix similarity index 100% rename from home/programs/graphical/wms/hyprland/packages/hyprland-swap-workspace.nix rename to home/programs/graphical/wms/hyprland/packages/hyprland-swap-workspace/default.nix diff --git a/home/programs/graphical/wms/hyprland/packages/hyprland-swap-workspace.sh b/home/programs/graphical/wms/hyprland/packages/hyprland-swap-workspace/hyprland-swap-workspace.sh similarity index 100% rename from home/programs/graphical/wms/hyprland/packages/hyprland-swap-workspace.sh rename to home/programs/graphical/wms/hyprland/packages/hyprland-swap-workspace/hyprland-swap-workspace.sh From 98f1ed00890d880d4f074ffbca9f8029f5c6f957 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Mon, 10 Jun 2024 14:23:59 +0200 Subject: [PATCH 2/6] Add hyprland-move-window script --- .../wms/hyprland/config/keybinds.nix | 5 ++- .../graphical/wms/hyprland/default.nix | 3 +- .../wms/hyprland/packages/default.nix | 1 + .../packages/hyprland-move-window/default.nix | 5 +++ .../hyprland-move-window.sh | 35 +++++++++++++++++++ 5 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 home/programs/graphical/wms/hyprland/packages/hyprland-move-window/default.nix create mode 100644 home/programs/graphical/wms/hyprland/packages/hyprland-move-window/hyprland-move-window.sh diff --git a/home/programs/graphical/wms/hyprland/config/keybinds.nix b/home/programs/graphical/wms/hyprland/config/keybinds.nix index cd9fc84..171791a 100644 --- a/home/programs/graphical/wms/hyprland/config/keybinds.nix +++ b/home/programs/graphical/wms/hyprland/config/keybinds.nix @@ -89,7 +89,10 @@ # # Move floating windows # - # TODO: requires script (move-window.sh) + "SUPER_ALT, left, exec, hyprland-move-window 100 l" + "SUPER_ALT, right, exec, hyprland-move-window 100 r" + "SUPER_ALT, up, exec, hyprland-move-window 100 u" + "SUPER_ALT, down, exec, hyprland-move-window 100 d" # # Override split direction for next window (manual tiling) diff --git a/home/programs/graphical/wms/hyprland/default.nix b/home/programs/graphical/wms/hyprland/default.nix index ba062f0..1cc249b 100644 --- a/home/programs/graphical/wms/hyprland/default.nix +++ b/home/programs/graphical/wms/hyprland/default.nix @@ -6,7 +6,7 @@ }: let inherit (lib) mkIf; - inherit (import ./packages {inherit pkgs;}) hyprland-swap-workspace; + inherit (import ./packages {inherit pkgs;}) hyprland-swap-workspace hyprland-move-window; cfg = osConfig.myOptions.home-manager.wms.hyprland; in { @@ -17,6 +17,7 @@ in { config = mkIf cfg.enable { home.packages = with pkgs; [ hyprland-swap-workspace + hyprland-move-window ]; wayland.windowManager.hyprland = { diff --git a/home/programs/graphical/wms/hyprland/packages/default.nix b/home/programs/graphical/wms/hyprland/packages/default.nix index 773332b..47fca74 100644 --- a/home/programs/graphical/wms/hyprland/packages/default.nix +++ b/home/programs/graphical/wms/hyprland/packages/default.nix @@ -4,6 +4,7 @@ }: let packages = { hyprland-swap-workspace = pkgs.callPackage ./hyprland-swap-workspace {}; + hyprland-move-window = pkgs.callPackage ./hyprland-move-window {}; }; in packages diff --git a/home/programs/graphical/wms/hyprland/packages/hyprland-move-window/default.nix b/home/programs/graphical/wms/hyprland/packages/hyprland-move-window/default.nix new file mode 100644 index 0000000..1bcd3a6 --- /dev/null +++ b/home/programs/graphical/wms/hyprland/packages/hyprland-move-window/default.nix @@ -0,0 +1,5 @@ +{pkgs, ...}: + pkgs.writeShellScriptBin "hyprland-move-window" '' + ${builtins.readFile ./hyprland-move-window.sh} + '' + diff --git a/home/programs/graphical/wms/hyprland/packages/hyprland-move-window/hyprland-move-window.sh b/home/programs/graphical/wms/hyprland/packages/hyprland-move-window/hyprland-move-window.sh new file mode 100644 index 0000000..f71fa8b --- /dev/null +++ b/home/programs/graphical/wms/hyprland/packages/hyprland-move-window/hyprland-move-window.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +RESIZE_SIZE=${1:?Missing resize size} + +RESIZE_PARAMS_X=0 +RESIZE_PARAMS_Y=0 + +DIRECTION=${2:?Missing move direction} +case $DIRECTION in +l) + RESIZE_PARAMS_X=-$RESIZE_SIZE + ;; +r) + RESIZE_PARAMS_X=$RESIZE_SIZE + ;; +u) + RESIZE_PARAMS_Y=-$RESIZE_SIZE + ;; +d) + RESIZE_PARAMS_Y=$RESIZE_SIZE + ;; +*) + echo "kbye" + return 1 + ;; +esac + +ACTIVE_WINDOW=$(hyprctl activewindow -j) +IS_FLOATING=$(echo "$ACTIVE_WINDOW" | jq .floating) + +if [ "$IS_FLOATING" = "true" ]; then + hyprctl dispatch moveactive "$RESIZE_PARAMS_X" "$RESIZE_PARAMS_Y" +else + hyprctl dispatch movewindow "$DIRECTION" +fi From 0f4d3f1e05d7c760835c73ee7725f5c5c5cd1cb4 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Mon, 10 Jun 2024 14:32:51 +0200 Subject: [PATCH 3/6] Add brightness script --- .../wms/hyprland/config/keybinds.nix | 5 +- .../graphical/wms/hyprland/default.nix | 1 + .../packages/brightness/brightness.sh | 166 ++++++++++++++++++ .../hyprland/packages/brightness/default.nix | 6 + .../wms/hyprland/packages/default.nix | 1 + 5 files changed, 178 insertions(+), 1 deletion(-) create mode 100644 home/programs/graphical/wms/hyprland/packages/brightness/brightness.sh create mode 100644 home/programs/graphical/wms/hyprland/packages/brightness/default.nix diff --git a/home/programs/graphical/wms/hyprland/config/keybinds.nix b/home/programs/graphical/wms/hyprland/config/keybinds.nix index 171791a..b79ff0c 100644 --- a/home/programs/graphical/wms/hyprland/config/keybinds.nix +++ b/home/programs/graphical/wms/hyprland/config/keybinds.nix @@ -38,7 +38,10 @@ # # Brightness control # - # TODO: requires script + "SUPER, Right, exec, brightness -i 5% -n" + "SUPER, Left, exec, brightness -d 5% -n" + ", XF86MonBrightnessUp, exec, brightness -i 5% -n" + ", XF86MonBrightnessDown, exec, brightness -d 5% -n" # diff --git a/home/programs/graphical/wms/hyprland/default.nix b/home/programs/graphical/wms/hyprland/default.nix index 1cc249b..cd89d71 100644 --- a/home/programs/graphical/wms/hyprland/default.nix +++ b/home/programs/graphical/wms/hyprland/default.nix @@ -18,6 +18,7 @@ in { home.packages = with pkgs; [ hyprland-swap-workspace hyprland-move-window + brightness ]; wayland.windowManager.hyprland = { diff --git a/home/programs/graphical/wms/hyprland/packages/brightness/brightness.sh b/home/programs/graphical/wms/hyprland/packages/brightness/brightness.sh new file mode 100644 index 0000000..e5a9fa2 --- /dev/null +++ b/home/programs/graphical/wms/hyprland/packages/brightness/brightness.sh @@ -0,0 +1,166 @@ +#!/bin/sh + +# Parse arguments +# ------------------------------------------------------------------------------------ +BRIGHTNESS_DIR="/sys/class/backlight/*" +SEND_NOTIFICATION=0 +URGENCY="normal" +INCREASE=0 +DECREASE=0 +SET=0 +BRIGHTNESS=0 + +PARSED=$(getopt \ + --options=hnu:i:d:s:p:N \ + --longoptions=help,notification,urgency:,increase:,decrease:,set:,path:,no-notification \ + --name "$0" \ + -- \ + "$@") + +if [ $? != 0 ]; then + exit 2 +fi + +eval set -- "$PARSED" + +while [ "$1" ]; do + case "$1" in + -h | --help) + cat </dev/null +} + +# Main Logic +# ------------------------------------------------------------------------------------ + +# Determine the absolute new brightness level +if [ $INCREASE -eq 1 ] || [ $DECREASE -eq 1 ] || [ $SET -eq 1 ]; then + # If we're dealing with percentages, change to absolutes + if echo "$BRIGHTNESS" | grep -qE '%$'; then + numeric=$(echo "$BRIGHTNESS" | sed 's/.$//') + absolute=$(echo "($BRIGHTNESS_MAX / 100) * $numeric" | bc -l) + BRIGHTNESS=$(printf "%.0f" $absolute) + fi + + # Get the new requested absolute brightness + if [ $SET -eq 1 ]; then + new_brightness=$BRIGHTNESS + elif [ $DECREASE -eq 1 ]; then + cur_brightness=$(cat $BRIGHTNESS_FILE) + new_brightness=$(($cur_brightness - $BRIGHTNESS)) + else + cur_brightness=$(cat $BRIGHTNESS_FILE) + new_brightness=$(($cur_brightness + $BRIGHTNESS)) + fi + + # Ensure we respect max/min boundaries + if [ $new_brightness -lt 0 ]; then + new_brightness=0 + elif [ $new_brightness -gt $BRIGHTNESS_MAX ]; then + new_brightness=$BRIGHTNESS_MAX + fi + + # Update the brightness + set_brightness $new_brightness +fi + +cur_brightness=$(cat $BRIGHTNESS_FILE) +percent_brightness=$(echo "($cur_brightness / $BRIGHTNESS_MAX) * 100" | bc -l) +percent_brightness_2f=$(printf "%.2f" $percent_brightness) +percent_brightness_rounded=$(printf "%.0f" $percent_brightness) + +if [ $SEND_NOTIFICATION -eq 1 ]; then + send_brightness_notify "$percent_brightness_rounded" "Level: $percent_brightness_rounded" +fi + +echo "Brightness: ${percent_brightness_2f}% (absolute: $cur_brightness)" diff --git a/home/programs/graphical/wms/hyprland/packages/brightness/default.nix b/home/programs/graphical/wms/hyprland/packages/brightness/default.nix new file mode 100644 index 0000000..7a8d515 --- /dev/null +++ b/home/programs/graphical/wms/hyprland/packages/brightness/default.nix @@ -0,0 +1,6 @@ +{pkgs, ...}: + pkgs.writeShellScriptBin "brightness" '' + ${builtins.readFile ./brightness.sh} + '' + + diff --git a/home/programs/graphical/wms/hyprland/packages/default.nix b/home/programs/graphical/wms/hyprland/packages/default.nix index 47fca74..bbead15 100644 --- a/home/programs/graphical/wms/hyprland/packages/default.nix +++ b/home/programs/graphical/wms/hyprland/packages/default.nix @@ -5,6 +5,7 @@ packages = { hyprland-swap-workspace = pkgs.callPackage ./hyprland-swap-workspace {}; hyprland-move-window = pkgs.callPackage ./hyprland-move-window {}; + brightness = pkgs.callPackage ./brightness {}; }; in packages From bb39670cd1cb25469827589dff8a307efccfb0a6 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Mon, 10 Jun 2024 15:11:49 +0200 Subject: [PATCH 4/6] Use brightnessctl --- home/packages/cli/default.nix | 1 + home/packages/cli/desktop.nix | 18 ++ .../wms/hyprland/config/keybinds.nix | 9 +- .../graphical/wms/hyprland/default.nix | 11 +- .../packages/brightness/brightness.sh | 162 +----------------- .../hyprland/packages/brightness/default.nix | 2 - 6 files changed, 38 insertions(+), 165 deletions(-) create mode 100644 home/packages/cli/desktop.nix diff --git a/home/packages/cli/default.nix b/home/packages/cli/default.nix index 46d4c7f..6f102c9 100644 --- a/home/packages/cli/default.nix +++ b/home/packages/cli/default.nix @@ -1,5 +1,6 @@ _: { imports = [ ./shared.nix + ./desktop.nix ]; } diff --git a/home/packages/cli/desktop.nix b/home/packages/cli/desktop.nix new file mode 100644 index 0000000..4d0b918 --- /dev/null +++ b/home/packages/cli/desktop.nix @@ -0,0 +1,18 @@ +{ + osConfig, + lib, + pkgs, + ... +}: let + inherit (lib) mkIf; + + devType = osConfig.myOptions.device.roles.type; + acceptedTypes = [ "laptop" "desktop" ]; +in { + config = mkIf (builtins.elem devType acceptedTypes) { + home.packages = with pkgs; [ + trash-cli + bitwarden-cli + ]; + }; +} diff --git a/home/programs/graphical/wms/hyprland/config/keybinds.nix b/home/programs/graphical/wms/hyprland/config/keybinds.nix index b79ff0c..dbed510 100644 --- a/home/programs/graphical/wms/hyprland/config/keybinds.nix +++ b/home/programs/graphical/wms/hyprland/config/keybinds.nix @@ -38,11 +38,10 @@ # # Brightness control # - "SUPER, Right, exec, brightness -i 5% -n" - "SUPER, Left, exec, brightness -d 5% -n" - ", XF86MonBrightnessUp, exec, brightness -i 5% -n" - ", XF86MonBrightnessDown, exec, brightness -d 5% -n" - + "SUPER, Right, exec, brightness 5%+" + "SUPER, Left, exec, brightness 5%-" + ", XF86MonBrightnessUp, exec, brightness 5%+" + ", XF86MonBrightnessDown, exec, brightness 5%-" # # Audio/Volume control diff --git a/home/programs/graphical/wms/hyprland/default.nix b/home/programs/graphical/wms/hyprland/default.nix index cd89d71..166748f 100644 --- a/home/programs/graphical/wms/hyprland/default.nix +++ b/home/programs/graphical/wms/hyprland/default.nix @@ -6,7 +6,7 @@ }: let inherit (lib) mkIf; - inherit (import ./packages {inherit pkgs;}) hyprland-swap-workspace hyprland-move-window; + hyprPkgs = (import ./packages {inherit pkgs;}); cfg = osConfig.myOptions.home-manager.wms.hyprland; in { @@ -15,10 +15,11 @@ in { ]; config = mkIf cfg.enable { - home.packages = with pkgs; [ - hyprland-swap-workspace - hyprland-move-window - brightness + home.packages = [ + hyprPkgs.hyprland-swap-workspace + hyprPkgs.hyprland-move-window + pkgs.brightnessctl + hyprPkgs.brightness ]; wayland.windowManager.hyprland = { diff --git a/home/programs/graphical/wms/hyprland/packages/brightness/brightness.sh b/home/programs/graphical/wms/hyprland/packages/brightness/brightness.sh index e5a9fa2..d48c21c 100644 --- a/home/programs/graphical/wms/hyprland/packages/brightness/brightness.sh +++ b/home/programs/graphical/wms/hyprland/packages/brightness/brightness.sh @@ -1,166 +1,22 @@ #!/bin/sh - -# Parse arguments -# ------------------------------------------------------------------------------------ -BRIGHTNESS_DIR="/sys/class/backlight/*" -SEND_NOTIFICATION=0 -URGENCY="normal" -INCREASE=0 -DECREASE=0 -SET=0 -BRIGHTNESS=0 - -PARSED=$(getopt \ - --options=hnu:i:d:s:p:N \ - --longoptions=help,notification,urgency:,increase:,decrease:,set:,path:,no-notification \ - --name "$0" \ - -- \ - "$@") - -if [ $? != 0 ]; then - exit 2 -fi - -eval set -- "$PARSED" - -while [ "$1" ]; do - case "$1" in - -h | --help) - cat </dev/null -} - -# Main Logic -# ------------------------------------------------------------------------------------ - -# Determine the absolute new brightness level -if [ $INCREASE -eq 1 ] || [ $DECREASE -eq 1 ] || [ $SET -eq 1 ]; then - # If we're dealing with percentages, change to absolutes - if echo "$BRIGHTNESS" | grep -qE '%$'; then - numeric=$(echo "$BRIGHTNESS" | sed 's/.$//') - absolute=$(echo "($BRIGHTNESS_MAX / 100) * $numeric" | bc -l) - BRIGHTNESS=$(printf "%.0f" $absolute) - fi - - # Get the new requested absolute brightness - if [ $SET -eq 1 ]; then - new_brightness=$BRIGHTNESS - elif [ $DECREASE -eq 1 ]; then - cur_brightness=$(cat $BRIGHTNESS_FILE) - new_brightness=$(($cur_brightness - $BRIGHTNESS)) - else - cur_brightness=$(cat $BRIGHTNESS_FILE) - new_brightness=$(($cur_brightness + $BRIGHTNESS)) - fi - - # Ensure we respect max/min boundaries - if [ $new_brightness -lt 0 ]; then - new_brightness=0 - elif [ $new_brightness -gt $BRIGHTNESS_MAX ]; then - new_brightness=$BRIGHTNESS_MAX - fi - - # Update the brightness - set_brightness $new_brightness -fi - -cur_brightness=$(cat $BRIGHTNESS_FILE) -percent_brightness=$(echo "($cur_brightness / $BRIGHTNESS_MAX) * 100" | bc -l) -percent_brightness_2f=$(printf "%.2f" $percent_brightness) -percent_brightness_rounded=$(printf "%.0f" $percent_brightness) - -if [ $SEND_NOTIFICATION -eq 1 ]; then - send_brightness_notify "$percent_brightness_rounded" "Level: $percent_brightness_rounded" -fi - -echo "Brightness: ${percent_brightness_2f}% (absolute: $cur_brightness)" +out="$(brightnessctl s "$1")" +cur_percent="$(echo "$out" | grep "Current" | grep -oP '\(\d+%' | tr -d '()%')" +send_brightness_notify "$cur_percent" diff --git a/home/programs/graphical/wms/hyprland/packages/brightness/default.nix b/home/programs/graphical/wms/hyprland/packages/brightness/default.nix index 7a8d515..609c6ff 100644 --- a/home/programs/graphical/wms/hyprland/packages/brightness/default.nix +++ b/home/programs/graphical/wms/hyprland/packages/brightness/default.nix @@ -2,5 +2,3 @@ pkgs.writeShellScriptBin "brightness" '' ${builtins.readFile ./brightness.sh} '' - - From 5ac92f8d3dd3376faf9a3590905933c5d1454421 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Mon, 10 Jun 2024 15:24:13 +0200 Subject: [PATCH 5/6] Update keybinds --- .../wms/hyprland/config/keybinds.nix | 378 +++++++++++------- 1 file changed, 228 insertions(+), 150 deletions(-) diff --git a/home/programs/graphical/wms/hyprland/config/keybinds.nix b/home/programs/graphical/wms/hyprland/config/keybinds.nix index dbed510..9aab3e6 100644 --- a/home/programs/graphical/wms/hyprland/config/keybinds.nix +++ b/home/programs/graphical/wms/hyprland/config/keybinds.nix @@ -1,179 +1,257 @@ { - wayland.windowManager.hyprland.settings = { - "$MOUSE_LMB" = "mouse:272"; - "$MOUSE_RMB" = "mouse:273"; - "$MOUSE_MMB" = "mouse:274"; - "$MOUSE_EX1" = "mouse:275"; - "$MOUSE_EX2" = "mouse:276"; + wayland.windowManager.hyprland = { + settings = { + "$MOUSE_LMB" = "mouse:272"; + "$MOUSE_RMB" = "mouse:273"; + "$MOUSE_MMB" = "mouse:274"; + "$MOUSE_EX1" = "mouse:275"; + "$MOUSE_EX2" = "mouse:276"; - "$XF86Favorites" = "164"; + "$XF86Favorites" = "164"; - bind = [ - # - # Active window - # - "SUPER, W, killactive," - "SUPER, F, togglefloating," - "SUPER, Space, fullscreen, 0" - "SUPER, Space, fullscreen, 1" # maximize - "SUPER_SHIFT, S, layoutmsg, togglesplit" + bind = [ + # + # Active window + # + "SUPER, W, killactive," + "SUPER, F, togglefloating," + "SUPER, Space, fullscreen, 0" + "SUPER, Space, fullscreen, 1" # maximize + "SUPER_SHIFT, S, layoutmsg, togglesplit" - # - # Programs - # - "SUPER, Return, exec, kitty" - # TODO: requires programs + # + # Programs + # + "SUPER, Return, exec, kitty" + # TODO: requires programs - # - # DE/WM Control programs - # - # TODO: Requires programs - "SUPER_SHIFT, L, exec, wlogout -p layer-shell" + # + # DE/WM Control programs + # + # TODO: Requires programs + "SUPER_SHIFT, L, exec, wlogout -p layer-shell" + "SUPER_CTRL, L, exec, loginctl lock-session" - # - # Screenshots - # - # TODO: requires script + # + # Screenshots + # + # TODO: requires script - # - # Brightness control - # - "SUPER, Right, exec, brightness 5%+" - "SUPER, Left, exec, brightness 5%-" - ", XF86MonBrightnessUp, exec, brightness 5%+" - ", XF86MonBrightnessDown, exec, brightness 5%-" + # + # Brightness control + # + "SUPER, Right, exec, brightness 5%+" + "SUPER, Left, exec, brightness 5%-" + ", XF86MonBrightnessUp, exec, brightness 5%+" + ", XF86MonBrightnessDown, exec, brightness 5%-" - # - # Audio/Volume control - # - "SUPER, Down, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.05-" - "SUPER, Up, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.05+" - ", XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.05-" - ", XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.05+" - ", XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" - ", XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle" + # + # Audio/Volume control + # + ", XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" + ", XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle" + # (rest in binde section) - # - # Notifications - # - # TODO: Requires notification daemon (dunst?) + # + # Notifications + # + # TODO: Requires notification daemon (dunst?) - # - # Window groups - # - "SUPER, G, togglegroup," - "ALT, tab, changegroupactive, f" - "ALT, grave, changegroupactive, b" + # + # Window groups + # + "SUPER, G, togglegroup," + "ALT, tab, changegroupactive, f" + "ALT, grave, changegroupactive, b" - # - # Special workspace (scratchpad) - # - "ALT, grave, movetoworkspace, special" - "SUPER, grave, togglespecialworkspace," + # + # Special workspace (scratchpad) + # + "ALT, grave, movetoworkspace, special" + "SUPER, grave, togglespecialworkspace," - # - # Move window focus - # - "SUPER, h, movefocus, l" - "SUPER, l, movefocus, r" - "SUPER, k, movefocus, u" - "SUPER, j, movefocus, d" + # + # Move window focus + # + "SUPER, h, movefocus, l" + "SUPER, l, movefocus, r" + "SUPER, k, movefocus, u" + "SUPER, j, movefocus, d" - # - # Move active window in direction - # - "SUPER_ALT, h, movewindow, l" - "SUPER_ALT, l, movewindow, r" - "SUPER_ALT, k, movewindow, u" - "SUPER_ALT, j, movewindow, d" + # + # Move active window in direction + # + "SUPER_ALT, h, movewindow, l" + "SUPER_ALT, l, movewindow, r" + "SUPER_ALT, k, movewindow, u" + "SUPER_ALT, j, movewindow, d" - # - # Move floating windows - # - "SUPER_ALT, left, exec, hyprland-move-window 100 l" - "SUPER_ALT, right, exec, hyprland-move-window 100 r" - "SUPER_ALT, up, exec, hyprland-move-window 100 u" - "SUPER_ALT, down, exec, hyprland-move-window 100 d" + # + # Move floating windows + # + "SUPER_ALT, left, exec, hyprland-move-window 100 l" + "SUPER_ALT, right, exec, hyprland-move-window 100 r" + "SUPER_ALT, up, exec, hyprland-move-window 100 u" + "SUPER_ALT, down, exec, hyprland-move-window 100 d" - # - # Override split direction for next window (manual tiling) - # - "SUPER_ALT, left, layoutmsg, preselect l" - "SUPER_ALT, right, layoutmsg, preselect r" - "SUPER_ALT, up, layoutmsg, preselect u" - "SUPER_ALT, down, layoutmsg, preselect d" + # + # Override split direction for next window (manual tiling) + # + "SUPER_ALT, left, layoutmsg, preselect l" + "SUPER_ALT, right, layoutmsg, preselect r" + "SUPER_ALT, up, layoutmsg, preselect u" + "SUPER_ALT, down, layoutmsg, preselect d" - # - # Switch workspace (swapping to current monitor) - # - "SUPER, 1, exec, hyprland-swap-workspace 1" - "SUPER, 2, exec, hyprland-swap-workspace 2" - "SUPER, 3, exec, hyprland-swap-workspace 3" - "SUPER, 4, exec, hyprland-swap-workspace 4" - "SUPER, 5, exec, hyprland-swap-workspace 5" - "SUPER, 6, exec, hyprland-swap-workspace 6" - "SUPER, 7, exec, hyprland-swap-workspace 7" - "SUPER, 8, exec, hyprland-swap-workspace 8" - "SUPER, 9, exec, hyprland-swap-workspace 9" + # + # Switch workspace (swapping to current monitor) + # + "SUPER, 1, exec, hyprland-swap-workspace 1" + "SUPER, 2, exec, hyprland-swap-workspace 2" + "SUPER, 3, exec, hyprland-swap-workspace 3" + "SUPER, 4, exec, hyprland-swap-workspace 4" + "SUPER, 5, exec, hyprland-swap-workspace 5" + "SUPER, 6, exec, hyprland-swap-workspace 6" + "SUPER, 7, exec, hyprland-swap-workspace 7" + "SUPER, 8, exec, hyprland-swap-workspace 8" + "SUPER, 9, exec, hyprland-swap-workspace 9" - # - # Move window to workspace - # - "SUPER_SHIFT, 1, movetoworkspacesilent, 1" - "SUPER_SHIFT, 2, movetoworkspacesilent, 2" - "SUPER_SHIFT, 3, movetoworkspacesilent, 3" - "SUPER_SHIFT, 4, movetoworkspacesilent, 4" - "SUPER_SHIFT, 5, movetoworkspacesilent, 5" - "SUPER_SHIFT, 6, movetoworkspacesilent, 6" - "SUPER_SHIFT, 7, movetoworkspacesilent, 7" - "SUPER_SHIFT, 8, movetoworkspacesilent, 8" - "SUPER_SHIFT, 9, movetoworkspacesilent, 9" + # + # Move window to workspace + # + "SUPER_SHIFT, 1, movetoworkspacesilent, 1" + "SUPER_SHIFT, 2, movetoworkspacesilent, 2" + "SUPER_SHIFT, 3, movetoworkspacesilent, 3" + "SUPER_SHIFT, 4, movetoworkspacesilent, 4" + "SUPER_SHIFT, 5, movetoworkspacesilent, 5" + "SUPER_SHIFT, 6, movetoworkspacesilent, 6" + "SUPER_SHIFT, 7, movetoworkspacesilent, 7" + "SUPER_SHIFT, 8, movetoworkspacesilent, 8" + "SUPER_SHIFT, 9, movetoworkspacesilent, 9" - # - # Move window to workspace + focus it - # - "ALT, 1, movetoworkspace, 1" - "ALT, 2, movetoworkspace, 2" - "ALT, 3, movetoworkspace, 3" - "ALT, 4, movetoworkspace, 4" - "ALT, 5, movetoworkspace, 5" - "ALT, 6, movetoworkspace, 6" - "ALT, 7, movetoworkspace, 7" - "ALT, 8, movetoworkspace, 8" - "ALT, 9, movetoworkspace, 9" + # + # Move window to workspace + focus it + # + "ALT, 1, movetoworkspace, 1" + "ALT, 2, movetoworkspace, 2" + "ALT, 3, movetoworkspace, 3" + "ALT, 4, movetoworkspace, 4" + "ALT, 5, movetoworkspace, 5" + "ALT, 6, movetoworkspace, 6" + "ALT, 7, movetoworkspace, 7" + "ALT, 8, movetoworkspace, 8" + "ALT, 9, movetoworkspace, 9" - # - # Cycle workspaces (relative movement) - # - "SUPER, mouse_down, workspace, +1" - "SUPER, mouse_up, workspace, -1" - "SUPER, bracketright, workspace, +1" - "SUPER, bracketleft, workspace, -1" + # + # Cycle workspaces (relative movement) + # + "SUPER, mouse_down, workspace, +1" + "SUPER, mouse_up, workspace, -1" + "SUPER, bracketright, workspace, +1" + "SUPER, bracketleft, workspace, -1" - # - # Cycle monitors (relative movement) - # - "SUPER_SHIFT, mouse_down, focusmonitor, +1" - "SUPER_SHIFT, mouse_up, focusmonitor, -1" - "SUPER_SHIFT, bracketright, focusmonitor, +1" - "SUPER_SHIFT, bracketleft, focusmonitor, -1" + # + # Cycle monitors (relative movement) + # + "SUPER_SHIFT, mouse_down, focusmonitor, +1" + "SUPER_SHIFT, mouse_up, focusmonitor, -1" + "SUPER_SHIFT, bracketright, focusmonitor, +1" + "SUPER_SHIFT, bracketleft, focusmonitor, -1" + ]; - # - # Window resizing - # - # TODO: Submaps + binde + # Mouse bindings + bindm = [ + # + # Mouse window resizing + # + "SUPER, $MOUSE_LMB, movewindow" + "SUPER, $MOUSE_RMB, resizewindow" + ]; + # Repeat bindings + binde = [ + # + # Audio/Volume control + # + "SUPER, Down, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.05-" + "SUPER, Up, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.05+" + ", XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.05-" + ", XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.05+" + # (rest in bind section) + + # + # Window resizing + # + "ALT, right, resizeactive, 10 0" + "ALT, left, resizeactive, -10 0" + "ALT, up, resizeactive, 0 -10" + "ALT, down, resizeactive, 0 10 " + "ALT, H, resizeactive, -10 0" + "ALT, K, resizeactive, 0 -10" + "ALT, J, resizeactive, 0 10" + "ALT, L, resizeactive, 10 0" + ]; + }; + + # Used for submaps, which don't support `settings` + extraConfig = '' # # Isolation group # - # TODO: Submaps - ]; - bindm = [ - # Mouse window resizing - "SUPER, $MOUSE_LMB, movewindow" - "SUPER, $MOUSE_RMB, resizewindow" - ]; + # Useful to prevent keybind capturing (for games, etc) + # SUPER + Fn + F12 (Favorites) + bind = SUPER, XF86Favorites, exec, hyprctl dispatch submap isolate && notify-send "Keybind isolation" "Keybind isolation on" + submap = isolate + bind = SUPER, XF86Favorites, exec, hyprctl dispatch submap reset && notify-send "Keybind isolation" "Keybind isolation off" + submap = reset + + # + # Precise keyboard window resizing + # + + bind = SUPER, slash, submap, resize + submap = resize + + binde = , right, resizeactive, 10 0 + binde = , left, resizeactive, -10 0 + binde = , up, resizeactive, 0 -10 + binde = , down, resizeactive, 0 10 + + binde = SUPER, right, resizeactive, 30 0 + binde = SUPER, left, resizeactive, -30 0 + binde = SUPER, up, resizeactive, 0 -30 + binde = SUPER, down, resizeactive, 0 30 + + binde = SHIFT, right, resizeactive, 1 0 + binde = SHIFT, left, resizeactive, -1 0 + binde = SHIFT, up, resizeactive, 0 -1 + binde = SHIFT, down, resizeactive, 0 1 + + binde = , H, resizeactive, -10 0 + binde = , K, resizeactive, 0 -10 + binde = , J, resizeactive, 0 10 + binde = , L, resizeactive, 10 0 + + binde = , right, resizeactive, 10 0 + binde = , left, resizeactive, -10 0 + binde = , up, resizeactive, 0 -10 + binde = , down, resizeactive, 0 10 + + binde = SUPER, H, resizeactive, -30 0 + binde = SUPER, K, resizeactive, 0 -30 + binde = SUPER, J, resizeactive, 0 30 + binde = SUPER, L, resizeactive, 30 0 + + binde = SHIFT, H, resizeactive, -1 0 + binde = SHIFT, K, resizeactive, 0 -1 + binde = SHIFT, J, resizeactive, 0 1 + binde = SHIFT, L, resizeactive, 1 0 + + bind = , escape, submap, reset + bind = , return, submap, reset + bind = SUPER, slash, submap, reset + submap = reset + ''; }; } From aa8cc541404eb4ef0670f468860f57f4d32947be Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Mon, 10 Jun 2024 15:30:37 +0200 Subject: [PATCH 6/6] Add window rules --- .../wms/hyprland/config/window_rules.nix | 96 ++++++++++++++++++- 1 file changed, 95 insertions(+), 1 deletion(-) diff --git a/home/programs/graphical/wms/hyprland/config/window_rules.nix b/home/programs/graphical/wms/hyprland/config/window_rules.nix index 52564eb..4268218 100644 --- a/home/programs/graphical/wms/hyprland/config/window_rules.nix +++ b/home/programs/graphical/wms/hyprland/config/window_rules.nix @@ -1,7 +1,101 @@ { wayland.windowManager.hyprland.settings = { windowrulev2 = [ - # TODO: Add these + # + # Assigned workspaces + # + "workspace, 2, class:^(firefox)$" + "workspace 4, class:^(discord)$" + "workspace 4, class:^(vesktop)$" + "workspace 4, class:^(WebCord)$" + "workspace 5, class:^(Spotify)$" + "workspace 6, class:^(Stremio)$" + "workspace 6, class:^(com.stremio.stremio)$" + + # + # Idle inhibition + # + "idleinhibit focus, class:^(Stremio)$" + "idleinhibit focus, class:^(com.stremio.stremio)$" + "idleinhibit focus, class:^(mpv)$" + "idleinhibit focus, class:^(firefox)$,title:^(.+ - YouTube — Mozilla Firefox)$" + "idleinhibit focus, class:^(firefox)$,title:^(Picture-in-Picture)$" + + # + # Correct size / Auto tile + # + "size 800 550, class:^(qalculate-gtk)$" + "tile, class:^(Spotify)$" + + # + # Auto float + # + "float, class:^(Lxappearance)$" + "float, class:^(Rofi)$" + "float, class:^(feh)$" + "float, class:^(pavucontrol-qt)$" + "float, class:^(pavucontrol)$" + "float, class:^(file-roller)$" + "float, class:^(qalculate-gtk)$" + "float, class:^(com.github.wwmm.easyeffects)" + "float, class:^(opensnitch_ui)$" + "float, class:^(Brave-browser)$,title:^(_crx_.+)$" + "float, class:^(hyprland-share-picker)$" + "float,class:^(floating)$" + + "center, class:^(hyprland-share-picker)$" + "animation slide, class:^(hyprland-share-picker)$" + + # Float firefox windows (like bookmark menus, or some extension windows) + "float, class:^(firefox)$,title:^(Revert Bookmarks)$" + "float, class:^(firefox)$,title:^(Library)$" + "float, class:^(firefox)$,title:^(Extension: \(uBlock Origin\))" + "float, class:^(firefox)$,title:^(Firefox — Sharing Indicator)$" + "float, class:^(firefox)$,title:^(Opening .+)$" + "float, class:^(firefox)$,title:^$" + + # Float some pcmanfm windows + "float, class:^(pcmanfm-qt)$,title:^(Mount)$" + "float, class:^(pcmanfm-qt)$,title:^(Preferences)$" + "float, class:^(pcmanfm-qt)$,title:^(Move files)$" + "float, class:^(pcmanfm-qt)$,title:^(Search Files)$" + "float, class:^(pcmanfm-qt)$,title:^(Copy Files)$" + "float, class:^(pcmanfm-qt)$,title:^(Confirm to replace files)$" + + # Float some windows from other apps + "float, class:^(Spotify)$,title:^(Ozone X11)$" + "float, class:^(python3)$,title:^(Tor Browser Launcher Settings)$" + "float, class:^(python3)$,title:^(Tor Browser)$" + + # General float rules + "float, class:^(file_progress)$" + "float, class:^(confirm)$" + "float, class:^(dialog)$" + "float, class:^(download)$" + "float, class:^(notification)$" + "float, class:^(error)$" + "float, class:^(splash)$" + "float, class:^(confirmreset)$" + + # + # Fixes + # + + # Jetbrains + "windowdance, class:^(jetbrains-.*)$,floating:1" + "center, class:^(jetbrains-.*)$,title:^(splash)$,floating:1" + "nofocus, class:^(jetbrains-.*)$,title:^(splash)$,floating:1" + "noborder, class:^(jetbrains-.*)$,title:^(splash)$,floating:1" + "center, class:^(jetbrains-.*)$,title:^( )$,floating:1" + "stayfocused, class:^(jetbrains-.*)$,title:^( )$,floating:1" + "noborder, class:^(jetbrains-.*)$,title:^( )$,floating:1" + "nofocus, class:^(jetbrains-.*)$,title:^(win.*)$,floating:1" + "noinitialfocus, class:^(jetbrains-.*)$,title:^(win.*)$" + ]; + + layerrule = [ + # Don't add borders to grim selections when taking screenshots + "noanim, ^(selection)$" ]; }; }