From cd4de928e8e800e40b7469dea93732dd4f101d30 Mon Sep 17 00:00:00 2001 From: Emmet Date: Mon, 12 Aug 2024 19:45:04 -0500 Subject: [PATCH] Updated hyprland + replaced pypr for native hyprctl commands --- flake.lock | 30 ++++---- flake.nix | 2 +- user/wm/hyprland/hyprland.nix | 133 ++++++++++++++-------------------- 3 files changed, 72 insertions(+), 93 deletions(-) diff --git a/flake.lock b/flake.lock index 52b95c0..8bacf94 100644 --- a/flake.lock +++ b/flake.lock @@ -20,11 +20,11 @@ ] }, "locked": { - "lastModified": 1722347739, - "narHash": "sha256-rAoh+K6KG+b1DwSWtqRVocdojnH6nGk6q07mNltoUSM=", + "lastModified": 1723405438, + "narHash": "sha256-bpmC2m7OhlDvqgQZdZ2jBLyeIkq/Jld3X4bqRAxBSp8=", "owner": "hyprwm", "repo": "aquamarine", - "rev": "7c3565f9bedc7cb601cc0baa14792247e4dc1d5a", + "rev": "9312aa28271c91e5d67ecb9def527b2bbcff0e66", "type": "github" }, "original": { @@ -568,11 +568,11 @@ ] }, "locked": { - "lastModified": 1721330371, - "narHash": "sha256-aYlHTWylczLt6ERJyg6E66Y/XSCbVL7leVcRuJmVbpI=", + "lastModified": 1722623071, + "narHash": "sha256-sLADpVgebpCBFXkA1FlCXtvEPu1tdEsTfqK1hfeHySE=", "owner": "hyprwm", "repo": "hyprcursor", - "rev": "4493a972b48f9c3014befbbf381ed5fff91a65dc", + "rev": "912d56025f03d41b1ad29510c423757b4379eb1c", "type": "github" }, "original": { @@ -616,16 +616,17 @@ "xdph": "xdph" }, "locked": { - "lastModified": 1723058230, - "narHash": "sha256-deu8zvgseDg2gQEnZiCda4TrbA6pleE9iItoZlsoMtE=", - "rev": "9a09eac79b85c846e3a865a9078a3f8ff65a9259", - "revCount": 5069, + "lastModified": 1723484486, + "narHash": "sha256-YRU0egH+7Wv2Ehln0Q7bjdVayJ8rQxrTmuf23oJ/bQ4=", + "ref": "refs/heads/main", + "rev": "c7b72790bd63172f04ee86784d4cb2a400532927", + "revCount": 5082, "submodules": true, "type": "git", "url": "https://code.hyprland.org/hyprwm/Hyprland.git" }, "original": { - "rev": "9a09eac79b85c846e3a865a9078a3f8ff65a9259", + "rev": "c7b72790bd63172f04ee86784d4cb2a400532927", "submodules": true, "type": "git", "url": "https://code.hyprland.org/hyprwm/Hyprland.git" @@ -758,6 +759,7 @@ "locked": { "lastModified": 1721822339, "narHash": "sha256-dkhgyxPxmOI/ZHk/LZRQZAVjtk9kPx2RFQRnuEoXQ4s=", + "ref": "refs/heads/main", "rev": "58e1a4a4997728be886a46d031514b3f09763c5d", "revCount": 234, "type": "git", @@ -781,11 +783,11 @@ ] }, "locked": { - "lastModified": 1722098849, - "narHash": "sha256-D3wIZlBNh7LuZ0NaoCpY/Pvu+xHxIVtSN+KkWZYvvVs=", + "lastModified": 1722869141, + "narHash": "sha256-0KU4qhyMp441qfwbirNg3+wbm489KnEjXOz2I/RbeFs=", "owner": "hyprwm", "repo": "hyprutils", - "rev": "5dcbbc1e3de40b2cecfd2007434d86e924468f1f", + "rev": "0252fd13e78e60fb0da512a212e56007515a49f7", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index fa7cbda..d912795 100644 --- a/flake.nix +++ b/flake.nix @@ -227,7 +227,7 @@ type = "git"; url = "https://code.hyprland.org/hyprwm/Hyprland.git"; submodules = true; - rev = "9a09eac79b85c846e3a865a9078a3f8ff65a9259"; #v0.42.0 + rev = "c7b72790bd63172f04ee86784d4cb2a400532927"; #v0.42.0 inputs.nixpkgs.follows = "nixpkgs"; }; hyprland-plugins = { diff --git a/user/wm/hyprland/hyprland.nix b/user/wm/hyprland/hyprland.nix index 12db04f..3629e96 100644 --- a/user/wm/hyprland/hyprland.nix +++ b/user/wm/hyprland/hyprland.nix @@ -50,12 +50,10 @@ in exec-once = hyprprofile Default exec-once = emacs --daemon - exec-once = pypr exec-once = ydotoold #exec-once = STEAM_FRAME_FORCE_CLOSE=1 steam -silent exec-once = nm-applet exec-once = blueman-applet - exec-once = hypr-element-start exec-once = GOMAXPROCS=1 syncthing --no-browser exec-once = protonmail-bridge --noninteractive exec-once = waybar @@ -82,6 +80,7 @@ in animation = fade, 1, 10, default animation = workspaces, 1, 5, wind animation = windows, 1, 6, wind, slide + animation = specialWorkspace, 1, 6, default, slidefadevert -50% } general { @@ -180,7 +179,7 @@ in bindm=SUPER,mouse:272,movewindow bindm=SUPER,mouse:273,resizewindow bind=SUPER,T,togglefloating - bind=SUPER,G,exec,hyprctl dispatch focusworkspaceoncurrentmonitor 9; pegasus-fe; + bind=SUPER,G,exec,hyprctl dispatch focusworkspaceoncurrentmonitor 9 && pegasus-fe; bind=,code:148,exec,''+ userSettings.term + " "+''-e numbat bind=,code:107,exec,grim -g "$(slurp)" @@ -242,23 +241,50 @@ in bind=SUPERSHIFT,8,movetoworkspace,8 bind=SUPERSHIFT,9,movetoworkspace,9 - bind=SUPER,Z,exec,pypr toggle term && hyprctl dispatch bringactivetotop - bind=SUPER,F,exec,pypr toggle ranger && hyprctl dispatch bringactivetotop - bind=SUPER,N,exec,pypr toggle numbat && hyprctl dispatch bringactivetotop - bind=SUPER,M,exec,pypr toggle music && hyprctl dispatch bringactivetotop - bind=SUPER,B,exec,pypr toggle btm && hyprctl dispatch bringactivetotop - bind=SUPER,D,exec,hypr-element - bind=SUPER,code:172,exec,pypr toggle pavucontrol && hyprctl dispatch bringactivetotop + bind=SUPER,Z,exec,if hyprctl clients | grep scratch_term; then echo "scratch_term respawn not needed"; else alacritty --class scratch_term; fi + bind=SUPER,Z,togglespecialworkspace,scratch_term + bind=SUPER,F,exec,if hyprctl clients | grep scratch_ranger; then echo "scratch_ranger respawn not needed"; else kitty --class scratch_ranger -e ranger; fi + bind=SUPER,F,togglespecialworkspace,scratch_ranger + bind=SUPER,N,exec,if hyprctl clients | grep scratch_numbat; then echo "scratch_ranger respawn not needed"; else alacritty --class scratch_numbat -e numbat; fi + bind=SUPER,N,togglespecialworkspace,scratch_numbat + bind=SUPER,M,exec,if hyprctl clients | grep lollypop; then echo "scratch_ranger respawn not needed"; else lollypop; fi + bind=SUPER,M,togglespecialworkspace,scratch_music + bind=SUPER,B,exec,if hyprctl clients | grep scratch_btm; then echo "scratch_ranger respawn not needed"; else alacritty --class scratch_btm -e btm; fi + bind=SUPER,B,togglespecialworkspace,scratch_btm + bind=SUPER,D,exec,if hyprctl clients | grep Element; then echo "scratch_ranger respawn not needed"; else element-desktop; fi + bind=SUPER,D,togglespecialworkspace,scratch_element + bind=SUPER,code:172,exec,togglespecialworkspace,scratch_pavucontrol + bind=SUPER,code:172,exec,if hyprctl clients | grep pavucontrol; then echo "scratch_ranger respawn not needed"; else pavucontrol; fi + $scratchpadsize = size 80% 85% - $scratchpad = class:^(scratchpad)$ - windowrulev2 = float,$scratchpad - windowrulev2 = $scratchpadsize,$scratchpad - windowrulev2 = workspace special silent,$scratchpad - windowrulev2 = center,$scratchpad + $scratch_term = class:^(scratch_term)$ + windowrulev2 = float,$scratch_term + windowrulev2 = $scratchpadsize,$scratch_term + windowrulev2 = workspace special:scratch_term ,$scratch_term + windowrulev2 = center,$scratch_term + + $scratch_ranger = class:^(scratch_ranger)$ + windowrulev2 = float,$scratch_ranger + windowrulev2 = $scratchpadsize,$scratch_ranger + windowrulev2 = workspace special:scratch_ranger silent,$scratch_ranger + windowrulev2 = center,$scratch_ranger + + $scratch_numbat = class:^(scratch_numbat)$ + windowrulev2 = float,$scratch_numbat + windowrulev2 = $scratchpadsize,$scratch_numbat + windowrulev2 = workspace special:scratch_numbat silent,$scratch_numbat + windowrulev2 = center,$scratch_numbat + + $scratch_btm = class:^(scratch_btm)$ + windowrulev2 = float,$scratch_btm + windowrulev2 = $scratchpadsize,$scratch_btm + windowrulev2 = workspace special:scratch_btm silent,$scratch_btm + windowrulev2 = center,$scratch_btm windowrulev2 = float,class:^(Element)$ windowrulev2 = size 85% 90%,class:^(Element)$ + windowrulev2 = workspace special:scratch_element silent,class:^(Element)$ windowrulev2 = center,class:^(Element)$ windowrulev2 = float,class:^(lollypop)$ @@ -270,7 +296,7 @@ in windowrulev2 = size 70% 75%,$savetodisk windowrulev2 = center,$savetodisk - $pavucontrol = class:^(pavucontrol)$ + $pavucontrol = class:^(org.pulseaudio.pavucontrol)$ windowrulev2 = float,$pavucontrol windowrulev2 = size 86% 40%,$pavucontrol windowrulev2 = move 50% 6%,$pavucontrol @@ -311,8 +337,8 @@ in layerrule = animation fade,~nwggrid blurls = ~nwggrid - bind=SUPER,code:21,exec,pypr zoom - bind=SUPER,code:21,exec,hyprctl reload + bind=SUPER,equal, exec, hyprctl keyword cursor:zoom_factor "$(hyprctl getoption cursor:zoom_factor | grep float | awk '{print $2 + 0.5}')" + bind=SUPER,minus, exec, hyprctl keyword cursor:zoom_factor "$(hyprctl getoption cursor:zoom_factor | grep float | awk '{print $2 - 0.5}')" bind=SUPER,I,exec,networkmanager_dmenu bind=SUPER,P,exec,keepmenu @@ -401,14 +427,6 @@ in noDisplay = true; icon = "/home/"+userSettings.username+"/.local/share/pixmaps/hyprland-logo-stylix.svg"; }) - (pyprland.overrideAttrs (oldAttrs: { - src = fetchFromGitHub { - owner = "hyprland-community"; - repo = "pyprland"; - rev = "refs/tags/2.4.0"; - hash = "sha256-jK6ap/beiqAtZXVNqPB3zV8R2Kfc3LhqJBvFlWYIfb4="; - }; - })) (hyprnome.override (oldAttrs: { rustPlatform = oldAttrs.rustPlatform // { buildRustPackage = args: oldAttrs.rustPlatform.buildRustPackage (args // { @@ -474,19 +492,6 @@ in nwg-dock-hyprland -f -x -i 64 -nolauncher -a start -ml 8 -mr 8 -mb 8 fi '') - (pkgs.writeScriptBin "hypr-element-start" '' - #!/usr/bin/env sh - sleep 6 && element-desktop --hidden - '') - (pkgs.writeScriptBin "hypr-element" '' - #!/bin/sh - if hyprctl clients | grep "class: Element" > /dev/null - then - hyprctl dispatch closewindow Element - else - element-desktop - fi - '') (pkgs.writeScriptBin "sct" '' #!/bin/sh killall wlsunset &> /dev/null; @@ -599,17 +604,19 @@ in ignore_dbus_inhibit = false } + # FIXME memory leak fries computer inbetween dpms off and suspend + #listener { + # timeout = 150 # in seconds + # on-timeout = hyprctl dispatch dpms off + # on-resume = hyprctl dispatch dpms on + #} listener { - timeout = 150 # in seconds - on-timeout = hyprctl dispatch dpms off - on-resume = hyprctl dispatch dpms on - } - listener { - timeout = 160 # in seconds + timeout = 165 # in seconds on-timeout = loginctl lock-session } listener { - timeout = 5400 # in seconds + timeout = 180 # in seconds + #timeout = 5400 # in seconds on-timeout = systemctl suspend on-resume = hyprctl dispatch dpms on } @@ -701,36 +708,6 @@ in valign = center } ''; - home.file.".config/hypr/pyprland.toml".text = '' - [pyprland] - plugins = ["scratchpads", "magnify"] - - [scratchpads.term] - command = "alacritty --class scratchpad" - margin = 50 - - [scratchpads.ranger] - command = "kitty --class scratchpad -e ranger" - margin = 50 - - [scratchpads.numbat] - command = "alacritty --class scratchpad -e numbat" - margin = 50 - - [scratchpads.music] - command = "lollypop" - margin = 50 - - [scratchpads.btm] - command = "alacritty --class scratchpad -e btm" - margin = 50 - - [scratchpads.pavucontrol] - command = "pavucontrol" - margin = 50 - unfocus = "hide" - animation = "fromTop" - ''; services.swayosd.enable = true; services.swayosd.topMargin = 0.5; programs.waybar = { @@ -964,7 +941,7 @@ in "car" = ""; "default" = [ "" "" "" ]; }; - "on-click" = "pypr toggle pavucontrol && hyprctl dispatch bringactivetotop"; + "on-click" = "hyprctl dispatch togglespecialworkspace scratch_pavucontrol; if hyprctl clients | grep pavucontrol; then echo 'scratch_ranger respawn not needed'; else pavucontrol; fi"; }; "pulseaudio#text" = { "scroll-step" = 1; @@ -974,7 +951,7 @@ in "format-muted" = ""; "format-source" = "{volume}%"; "format-source-muted" = ""; - "on-click" = "pypr toggle pavucontrol && hyprctl dispatch bringactivetotop"; + "on-click" = "hyprctl dispatch togglespecialworkspace scratch_pavucontrol; if hyprctl clients | grep pavucontrol; then echo 'scratch_ranger respawn not needed'; else pavucontrol; fi"; }; "group/pulseaudio" = { "orientation" = "horizontal";