From 77e9d0eaf356537131d33389cca15ffdd7bbefc2 Mon Sep 17 00:00:00 2001 From: Patrick Date: Sat, 6 Jul 2024 20:34:10 +0200 Subject: [PATCH] feat: clone-term with hyprland support chore: hyprland/swaync/waybar improvements --- modules-hm/streamdeck.nix | 2 +- pkgs/scripts/clone-term.nix | 2 + users/common/graphical/wayland/hyprland.nix | 54 ++++++++++++------- .../graphical/wayland/swaync/default.nix | 2 +- .../graphical/wayland/swaync/swaync.css | 12 ++--- .../graphical/wayland/waybar/default.nix | 8 ++- .../graphical/wayland/waybar/waybar.css | 1 - 7 files changed, 52 insertions(+), 29 deletions(-) diff --git a/modules-hm/streamdeck.nix b/modules-hm/streamdeck.nix index 30b641c..221a412 100644 --- a/modules-hm/streamdeck.nix +++ b/modules-hm/streamdeck.nix @@ -20,7 +20,7 @@ in { state = config.programs.streamdeck-ui.settings; }; preStart = pkgs.writeShellScript "streamdeck-setup-config" '' - cp "${cfg}" "$XDG_RUNTIME_DIR/streamdeck/config.json" + ${pkgs.coreutils}/bin/cp "${cfg}" "$XDG_RUNTIME_DIR/streamdeck/config.json" ''; in { options.programs.streamdeck-ui = { diff --git a/pkgs/scripts/clone-term.nix b/pkgs/scripts/clone-term.nix index 8709801..ff79e9d 100644 --- a/pkgs/scripts/clone-term.nix +++ b/pkgs/scripts/clone-term.nix @@ -12,6 +12,8 @@ writeShellApplication { if [[ ''${XDG_CURRENT_DESKTOP-} == sway ]]; then PAREN=$(swaymsg -t get_tree | jq '.. | select(.type?) | select(.focused==true).pid') + elif [[ ''${XDG_CURRENT_DESKTOP-} == Hyprland ]]; then + PAREN=$(hyprctl activewindow -j | jq '.pid') else PAREN=$(xdotool getwindowfocus getwindowpid) fi diff --git a/users/common/graphical/wayland/hyprland.nix b/users/common/graphical/wayland/hyprland.nix index 43cd656..2270964 100644 --- a/users/common/graphical/wayland/hyprland.nix +++ b/users/common/graphical/wayland/hyprland.nix @@ -41,7 +41,7 @@ in { }; general = { - gaps_in = 1; + gaps_in = 0; gaps_out = 0; allow_tearing = true; }; @@ -52,10 +52,10 @@ in { "3" = "u"; "4" = "a"; "5" = "x"; - "6" = "c"; - "7" = "t"; - "8" = "i"; - "9" = "e"; + "6" = "F1"; + "7" = "F2"; + "8" = "F3"; + "9" = "F4"; }; in [ @@ -63,9 +63,10 @@ in { "SUPER,return,fullscreen," "SUPER + SHIFT,return,fakefullscreen," "SUPER,f,togglefloating" + "SUPER,g,togglegroup" "SUPER,tab,cyclenext," "ALT,tab,cyclenext," - "SUPER+SHIFT,r,submap,resize" + "SUPER+CTRL,r,submap,resize" "SUPER,left,movefocus,l" "SUPER,right,movefocus,r" @@ -77,22 +78,33 @@ in { "SUPER,l,movefocus,u" "SUPER,r,movefocus,d" - "SUPER + SHIFT,left,movewindow,l" - "SUPER + SHIFT,right,movewindow,r" - "SUPER + SHIFT,up,movewindow,u" - "SUPER + SHIFT,down,movewindow,d" + "SUPER,h,changegroupactive,b" + "SUPER,m,changegroupactive,f" - "SUPER + SHIFT,n,movewindow,l" - "SUPER + SHIFT,s,movewindow,r" - "SUPER + SHIFT,l,movewindow,u" - "SUPER + SHIFT,r,movewindow,d" + "SUPER + SHIFT,left,movewindoworgroup,l" + "SUPER + SHIFT,right,movewindoworgroup,r" + "SUPER + SHIFT,up,movewindoworgroup,u" + "SUPER + SHIFT,down,movewindoworgroup,d" + + "SUPER + SHIFT,n,movewindoworgroup,l" + "SUPER + SHIFT,s,movewindoworgroup,r" + "SUPER + SHIFT,l,movewindoworgroup,u" + "SUPER + SHIFT,r,movewindoworgroup,d" "SUPER,comma,workspace,-1" "SUPER,period,workspace,+1" + "SUPER + SHIFT,comma,movetoworkspace,-1" + "SUPER + SHIFT,period,movetoworkspace,+1" "SUPER,b,exec,firefox" + "SUPER,m,exec,thunderbird" "SUPER,t,exec,kitty" ",Menu,exec,fuzzel" + "SUPER,,exec,${lib.getExe pkgs.scripts.clone-term}" + + "CTRL,F7,sendshortcut,SHIFT+CTRL,m,WebCord" + "CTRL,F8,sendshortcut,CTRL+SHIFT,d,WebCord" + "CTRL,F9,exec,systemctl --user start swww-update-wallpaper" "SUPER + SHIFT,q,exit" ] @@ -154,6 +166,10 @@ in { disable_hyprland_logo = true; mouse_move_focuses_monitor = false; }; + windowrulev2 = [ + "immediate, class:^(cs2)$" + "float,class:(firefox),title:^(.*)(Bitwarden)(.*)$" + ]; } (mkIf (nixosConfig.node.name == "desktopnix") { monitor = [ @@ -167,13 +183,14 @@ in { windowrulev2 = [ "workspace 2,class:^(firefox)$" + "workspace 3,class:^(thunderbird)$" "workspace 4,class:^(bottles)$" "workspace 4,class:^(steam)$" "workspace 4,class:^(prismlauncher)$" - "workspace 8,class:^(discord)$" - "workspace 8,class:^(WebCord)$" - "workspace 9,class:^(Signal)$" - "workspace 9,class:^(TelegramDesktop)$" + "workspace 6,class:^(discord)$" + "workspace 6,class:^(WebCord)$" + "workspace 7,class:^(Signal)$" + "workspace 7,class:^(TelegramDesktop)$" ]; workspace = [ @@ -209,7 +226,6 @@ in { bind=,escape,submap,reset submap=reset - windowrulev2 = immediate, class:^(cs2)$ exec-once = ${pkgs.xorg.xprop}/bin/xprop -root -f _XWAYLAND_GLOBAL_OUTPUT_SCALE 32c -set _XWAYLAND_GLOBAL_OUTPUT_SCALE 2 env = XCURSOR_SIZE,48 diff --git a/users/common/graphical/wayland/swaync/default.nix b/users/common/graphical/wayland/swaync/default.nix index ecd75ae..defc692 100644 --- a/users/common/graphical/wayland/swaync/default.nix +++ b/users/common/graphical/wayland/swaync/default.nix @@ -21,7 +21,7 @@ control-center-margin-right = 0; control-center-margin-left = 0; - notification-window-width = 800; + notification-window-width = 500; notification-2fa-action = true; notification-inline-replies = false; notification-icon-size = 64; diff --git a/users/common/graphical/wayland/swaync/swaync.css b/users/common/graphical/wayland/swaync/swaync.css index 11ab4fc..45c3a99 100644 --- a/users/common/graphical/wayland/swaync/swaync.css +++ b/users/common/graphical/wayland/swaync/swaync.css @@ -131,7 +131,7 @@ .notification-row .notification-background .notification .notification-default-action .notification-content .text-box .summary { /* Notification summary/title */ - font-size: 1.75rem; + font-size: 1rem; font-weight: bold; background: transparent; color: @text-color; @@ -141,7 +141,7 @@ .notification-row .notification-background .notification .notification-default-action .notification-content .text-box .time { /* Notification time-ago */ - font-size: 1.5rem; + font-size: 1rem; font-weight: bold; background: transparent; color: @text-color-muted; @@ -151,7 +151,7 @@ .notification-row .notification-background .notification .notification-default-action .notification-content .text-box .body { /* Notification body */ - font-size: 1.5rem; + font-size: 1rem; background: transparent; color: @text-color; text-shadow: none; @@ -184,7 +184,7 @@ } .notification-row .notification-background .notification .notification-default-action .notification-content .inline-reply .inline-reply-button { - font-size: 1.5rem; + font-size: 1rem; margin-left: 4px; background: @noti-bg; border: 1px solid @noti-border-color; @@ -205,7 +205,7 @@ .notification-row .notification-background .notification .notification-action { /* The alternative actions below the default action */ - font-size: 1.25rem; + font-size: 1rem; border-top: 1px solid @noti-border-color; border-radius: 0px; border-right: 1px solid @noti-border-color; @@ -254,7 +254,7 @@ .notification-group .notification-group-headers .notification-group-header { color: @text-color; - font-size: 2rem; + font-size: 1.5rem; } .notification-group .notification-group-buttons { diff --git a/users/common/graphical/wayland/waybar/default.nix b/users/common/graphical/wayland/waybar/default.nix index a743923..7f1e6f0 100644 --- a/users/common/graphical/wayland/waybar/default.nix +++ b/users/common/graphical/wayland/waybar/default.nix @@ -21,7 +21,7 @@ "backlight" "battery" "clock" - "custom/notifications" + "custom/notification" "tray" ]; @@ -69,6 +69,7 @@ format = "{icon} {volume}%"; on-click = "${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; on-click-middle = "${pkgs.hyprland}/bin/hyprctl dispatch exec \"[float;pin;move 80% 50%;size 20% 50%;noborder]\" ${lib.getExe pkgs.pwvucontrol}"; + on-click-right = "${pkgs.hyprland}/bin/hyprctl dispatch exec \"[float]\" ${lib.getExe pkgs.helvum}"; on-scroll-up = "${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%+"; on-scroll-down = "${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%-"; format-muted = "󰖁"; @@ -80,6 +81,11 @@ format-icons.urgent = ""; all-outputs = false; sort-by = "id"; + persistent-workspaces = { + "DP-3" = [1 2 3 4 5]; + "DVI-D-1" = [6 7]; + "HDMI-A-1" = [8 9]; + }; }; "hyprland/window" = { diff --git a/users/common/graphical/wayland/waybar/waybar.css b/users/common/graphical/wayland/waybar/waybar.css index dbae8b6..ccb7c33 100644 --- a/users/common/graphical/wayland/waybar/waybar.css +++ b/users/common/graphical/wayland/waybar/waybar.css @@ -23,7 +23,6 @@ button { } /* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ -#clock:hover, #custom-notification:hover, #custom-pick_color:hover, #custom-scan_qr:hover,