From af10a9346e89ae38f549f497bcfbfeb307dca861 Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Wed, 28 Jun 2023 16:20:02 +0100 Subject: [PATCH] Make hyprland workspaces more program focused Change bindings and name convention to decouple workspaces from ID number and focus more on what the workspace is used for TODO proper window rules --- home/desktop/config/waybar/modules.json | 18 ++-- home/desktop/hyprland.nix | 123 ++++++++++-------------- users/elitherl/Ronin.nix | 22 +++-- 3 files changed, 76 insertions(+), 87 deletions(-) diff --git a/home/desktop/config/waybar/modules.json b/home/desktop/config/waybar/modules.json index 6f98548d..f6710f71 100644 --- a/home/desktop/config/waybar/modules.json +++ b/home/desktop/config/waybar/modules.json @@ -171,13 +171,15 @@ "disable-scroll": true, "all-outputs": false, "sort-by-number": true, - "format": "{name}" + "format": "{icon}", + "format-icons": { + "terminal": "󰅴", + "browser": "󰈹", + "files": "󰝰", + "chat": "󰭹", + "urgent": "", + "default": "" + }, + "sort-by-number": false }, - "sway/workspaces": { - "on-click": "activate", - "disable-scroll": true, - "all-outputs": false, - "sort-by-number": true, - "format": "{name}" - } } diff --git a/home/desktop/hyprland.nix b/home/desktop/hyprland.nix index 4ca84732..5898ee75 100644 --- a/home/desktop/hyprland.nix +++ b/home/desktop/hyprland.nix @@ -50,7 +50,12 @@ col.group_border_active = $mauve col.inactive_border = $surface2 col.group_border = $surface2 - layout = master + layout = dwindle + } + + dwindle { + force_split = 2 + preserve_split = true } decoration { @@ -78,91 +83,65 @@ } # See https://wiki.hyprland.org/Configuring/Keywords/ for more - bind = SUPER, Return, exec, wezterm - bind = SUPER, Q, killactive, - bind = SUPER, V, togglefloating, - bind = SUPER, R, exec, pkill rofi || rofi -show drun - bind = SUPER, S, exec, grim -g "$(slurp)" - bind = SUPER, P, exec, swaylock - bind = SUPER, W, exec, firefox - bind = SUPER, F, exec, thunar - bind = SUPER, M, fullscreen, 0 - bind = SUPER SHIFT, M, fullscreen, 1 - bind = SUPER SHIFT, P, exec, powermenu + bind = ALT, Return, exec, wezterm + bind = ALT, Space, exec, pkill rofi || rofi -show drun + bind = ALT, Q, killactive, + bind = ALT, P, exec, swaylock + bind = ALT, M, fullscreen, 0 + bind = ALT SHIFT, M, fullscreen, 1 + bind = ALT SHIFT, P, exec, powermenu + bind = ALT SHIFT, Space, togglefloating, + bind = , Print, exec, grim -g "$(slurp)" bind = , XF86AudioMute, exec, pamixer -t binde = , XF86AudioRaiseVolume, exec, pamixer -i 2 binde = , XF86AudioLowerVolume, exec, pamixer -d 2 - # Move focus with mainMod + arrow keys - bind = SUPER, left, movefocus, l - bind = SUPER, H, movefocus, l - bind = SUPER, right, movefocus, r - bind = SUPER, L, movefocus, r - bind = SUPER, up, movefocus, u - bind = SUPER, K, movefocus, u - bind = SUPER, down, movefocus, d - bind = SUPER, J, movefocus, d + bind = ALT, H, movefocus, l + bind = ALT, L, movefocus, r + bind = ALT, K, movefocus, u + bind = ALT, J, movefocus, d + bind = ALT SHIFT, H, movewindow, l + bind = ALT SHIFT, L, movewindow, r + bind = ALT SHIFT, K, movewindow, u + bind = ALT SHIFT, J, movewindow, d - bind = SUPER SHIFT, left, movewindow, l - bind = SUPER SHIFT, H, movewindow, l - bind = SUPER SHIFT, right, movewindow, r - bind = SUPER SHIFT, L, movewindow, r - bind = SUPER SHIFT, up, movewindow, u - bind = SUPER SHIFT, K, movewindow, u - bind = SUPER SHIFT, down, movewindow, d - bind = SUPER SHIFT, J, movewindow, d + workspace = name:terminal, default:true + workspace = name:browser + workspace = name:files + workspace = name:chat - # Switch workspaces with mainMod + [0-9] - bind = SUPER, 1, moveworkspacetomonitor, 1 current - bind = SUPER, 1, workspace, 1 - bind = SUPER, 2, moveworkspacetomonitor, 2 current - bind = SUPER, 2, workspace, 2 - bind = SUPER, 3, moveworkspacetomonitor, 3 current - bind = SUPER, 3, workspace, 3 - bind = SUPER, 4, moveworkspacetomonitor, 4 current - bind = SUPER, 4, workspace, 4 - bind = SUPER, 5, moveworkspacetomonitor, 5 current - bind = SUPER, 5, workspace, 5 - bind = SUPER, 6, moveworkspacetomonitor, 6 current - bind = SUPER, 6, workspace, 6 - bind = SUPER, 7, moveworkspacetomonitor, 7 current - bind = SUPER, 7, workspace, 7 - bind = SUPER, 8, moveworkspacetomonitor, 8 current - bind = SUPER, 8, workspace, 8 - bind = SUPER, 9, moveworkspacetomonitor, 9 current - bind = SUPER, 9, workspace, 9 - bind = SUPER, 0, moveworkspacetomonitor, 0 current - bind = SUPER, 0, workspace, 10 + bind = ALT, T, moveworkspacetomonitor, name:terminal current + bind = ALT, T, workspace, name:terminal + bind = ALT SHIFT, T, moveworkspacetomonitor, name:terminal current + bind = ALT SHIFT, T, movetoworkspace, name:terminal - # Move active window to a workspace with mainMod + SHIFT + [0-9] - bind = SUPER SHIFT, 1, movetoworkspace, 1 - bind = SUPER SHIFT, 2, movetoworkspace, 2 - bind = SUPER SHIFT, 3, movetoworkspace, 3 - bind = SUPER SHIFT, 4, movetoworkspace, 4 - bind = SUPER SHIFT, 5, movetoworkspace, 5 - bind = SUPER SHIFT, 6, movetoworkspace, 6 - bind = SUPER SHIFT, 7, movetoworkspace, 7 - bind = SUPER SHIFT, 8, movetoworkspace, 8 - bind = SUPER SHIFT, 9, movetoworkspace, 9 + bind = ALT, W, moveworkspacetomonitor, name:browser current + bind = ALT, W, workspace, name:browser + bind = ALT SHIFT, W, moveworkspacetomonitor, name:browser current + bind = ALT SHIFT, W, movetoworkspace, name:browser - bind = SUPER, period, workspace, m+1 - bind = SUPER, comma, workspace, m-1 - bind = SUPER, bracketright, focusmonitor, +1 - bind = SUPER, bracketleft, focusmonitor, +1 + bind = ALT, F, moveworkspacetomonitor, name:files current + bind = ALT, F, workspace, name:files + bind = ALT SHIFT, F, moveworkspacetomonitor, name:files current + bind = ALT SHIFT, F, movetoworkspace, name:files - bind = SUPER, N, workspace, empty - bind = SUPER SHIFT, N, movetoworkspace, empty + bind = ALT, C, moveworkspacetomonitor, name:chat current + bind = ALT, C, workspace, name:chat + bind = ALT SHIFT, C, moveworkspacetomonitor, name:chat current + bind = ALT SHIFT, C, movetoworkspace, name:chat - bind = SUPER, C, togglespecialworkspace - bind = SUPER SHIFT, C, movetoworkspace, special + bind = ALT, period, workspace, m+1 + bind = ALT, comma, workspace, m-1 + bind = ALT, bracketright, focusmonitor, +1 + bind = ALT, bracketleft, focusmonitor, +1 - bind = SUPER, tab, workspace, previous - bind = SUPER SHIFT, tab, movetoworkspace, previous + bind = ALT, N, workspace, empty + bind = ALT SHIFT, N, movetoworkspace, empty # Move/resize windows with mainMod + LMB/RMB and dragging - bindm = SUPER, mouse:272, movewindow - bindm = SUPER, mouse:273, resizewindow + bindm = ALT, mouse:272, movewindow + bindm = ALT, mouse:273, resizewindow # See https://wiki.hyprland.org/Configuring/Window-Rules/ for more windowrule = float, ^(foot)$ diff --git a/users/elitherl/Ronin.nix b/users/elitherl/Ronin.nix index e4e1cf52..98b85701 100644 --- a/users/elitherl/Ronin.nix +++ b/users/elitherl/Ronin.nix @@ -1,8 +1,8 @@ {pkgs, ...}: let laptop-state = pkgs.writeShellScriptBin "check-laptop-lid-state" '' grep closed /proc/acpi/button/lid/LID0/state &&\ - hyprctl dispatch dpms off eDP-1 ||\ - hyprctl dispatch dpms on eDP-1 + hyprctl keyword monitor "eDP-1,disable" ||\ + hyprctl keyword monitor "eDP-1,1920x1080,0x0,1.0" ''; in { imports = [./default.nix]; @@ -10,21 +10,29 @@ in { home.packages = [laptop-state]; wayland.windowManager.hyprland.extraConfig = '' source=./common.conf - monitor = eDP-1,1920x1080,0x0,1.0 + bindl=,switch:Lid Switch,exec,check-laptop-lid-state + exec = ${laptop-state}/bin/check-laptop-lid-state monitor = DP-3,1920x1200,1920x0,1.0 monitor = DP-4,1920x1080,3840x0,1.0,transform,1 - bindl=,switch:Lid Switch,exec,check-laptop-lid-state - bindl=,switch:Lid Switch,exec,swaylock - exec = ${laptop-state}/bin/check-laptop-lid-state + + workspace = name:remote + bind = ALT, R, moveworkspacetomonitor, remote current + bind = ALT, R, workspace, remote + bind = ALT SHIFT, R, moveworkspacetomonitor, remote current + bind = ALT SHIFT, R, movetoworkspace, remote ''; programs.waybar.settings = { - main."output" = "!DP-4"; + main = { + "output" = "!DP-4"; + "wlr/workspaces"."format-icons"."remote" = "󰢹"; + }; alt = { "include" = [ "~/.config/waybar/modules.json" "~/.config/waybar/layout.json" ]; "output" = "DP-4"; + "wlr/workspaces"."format-icons"."remote" = "󰢹"; "modules-left" = []; "modules-center" = ["wlr/workspaces"]; "modules-right" = [];