From a9ff653d05f181d16a77bdfdb32290136c88a4fe Mon Sep 17 00:00:00 2001 From: Bruce Wang Date: Tue, 19 Nov 2024 15:45:57 +1100 Subject: [PATCH] start-way-displays.sh and formatting --- flake.lock | 42 +++++------ flake.nix | 1 - home/modules/dotfiles/default.nix | 1 - home/modules/hypridle/default.nix | 18 ++--- home/modules/hyprlock/default.nix | 6 +- home/modules/hyprpaper/default.nix | 6 +- home/modules/way-displays/default.nix | 21 ++---- .../way-displays/start-way-displays.sh | 5 ++ home/modules/wayland/eww/default.nix | 5 +- home/modules/wayland/hyprland/default.nix | 71 ++++++++++--------- home/modules/wayland/hyprland/hyprland.conf | 4 ++ 11 files changed, 83 insertions(+), 97 deletions(-) create mode 100644 home/modules/way-displays/start-way-displays.sh diff --git a/flake.lock b/flake.lock index 886ab11..a5f3ca1 100644 --- a/flake.lock +++ b/flake.lock @@ -22,11 +22,11 @@ ] }, "locked": { - "lastModified": 1731746438, - "narHash": "sha256-f3SSp1axoOk0NAI7oFdRzbxG2XPBSIXC+/DaAXnvS1A=", + "lastModified": 1731895210, + "narHash": "sha256-z76Q/OXLxO/RxMII3fIt/TG665DANiE2lVvnolK2lXk=", "owner": "nix-community", "repo": "disko", - "rev": "cb64993826fa7a477490be6ccb38ba1fa1e18fa8", + "rev": "639d1520df9417ca2761536c3072688569e83c80", "type": "github" }, "original": { @@ -320,11 +320,11 @@ ] }, "locked": { - "lastModified": 1731887066, - "narHash": "sha256-uw7K/RsYioJicV79Nl39yjtfhdfTDU2aRxnBgvFhkZ8=", + "lastModified": 1731968878, + "narHash": "sha256-+hTCwETOE9N8voTAaF+IzdUZz28Ws3LDpH90FWADrEE=", "owner": "nix-community", "repo": "home-manager", - "rev": "f3a2ff69586f3a54b461526e5702b1a2f81e740a", + "rev": "a42fa14b53ceab66274a21da480c9f8e06204173", "type": "github" }, "original": { @@ -537,11 +537,11 @@ ] }, "locked": { - "lastModified": 1731842377, - "narHash": "sha256-UN1TcbN9wfrXT7qkyv9t1wYgR0GuEcyIIMK55VuXyDM=", + "lastModified": 1731911800, + "narHash": "sha256-XexksBtvDiT3J1JaA3JSXvPvd40mU6tsf1GsE6mceqA=", "owner": "nix-community", "repo": "neovim-nightly-overlay", - "rev": "591995260069de8a4dcd5490a204a43f26151419", + "rev": "cddd55515fe5f8c5af730838583a0c68759c4fd3", "type": "github" }, "original": { @@ -553,11 +553,11 @@ "neovim-src": { "flake": false, "locked": { - "lastModified": 1731800171, - "narHash": "sha256-nw7SUV3FiDSHdtuq+LsJh8deSteNPtxeBfaITxIQAi8=", + "lastModified": 1731886414, + "narHash": "sha256-Fyve6sUYgL0VcPgMysOIJIDVuAHcgTeXB8kLwx6rB5c=", "owner": "neovim", "repo": "neovim", - "rev": "9c718bc2bce53b5be45061bff940f99e50c8bfcb", + "rev": "965dc81f818e50b5078d4b7efa5fbb8b771560f8", "type": "github" }, "original": { @@ -575,11 +575,11 @@ ] }, "locked": { - "lastModified": 1731808593, - "narHash": "sha256-dyMU//DLz1Zs1bl7jAZA6d68bXCRzTYim4JyrLFfqME=", + "lastModified": 1731981116, + "narHash": "sha256-SgnDCrAuX9JxRk7NqGJCXYmt+EUkDF2rfL7QjtNImuk=", "owner": "Infinidoge", "repo": "nix-minecraft", - "rev": "ada86c417801a44c32b59374b1e0b3141826291a", + "rev": "3b71545aa21e6fe9eb7690be7ee2ee3d633b1990", "type": "github" }, "original": { @@ -799,11 +799,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1731881740, - "narHash": "sha256-obDKjh401AZjMUq1FxErpXaqe5lqfECEgBoTGftVigE=", + "lastModified": 1731935397, + "narHash": "sha256-YjOrhtDUrxNDddnKBTPya0fdbiwpG1cJvrT5Pi+4P/s=", "owner": "wamserma", "repo": "flake-programs-sqlite", - "rev": "d3d3cf5ec1d7b609b814207b7a1bf9dc9bd98179", + "rev": "6a43f2121ab404bd05f3a5a7242a6701cac96471", "type": "github" }, "original": { @@ -868,11 +868,11 @@ ] }, "locked": { - "lastModified": 1731862312, - "narHash": "sha256-NVUTFxKrJp/hjehlF1IvkPnlRYg/O9HFVutbxOM8zNM=", + "lastModified": 1731954233, + "narHash": "sha256-vvXx1m2Rsw7MkbKJdpcICzz4YPgZPApGKQGhNZfkhOI=", "owner": "Mic92", "repo": "sops-nix", - "rev": "472741cf3fee089241ac9ea705bb2b9e0bfa2978", + "rev": "e39947d0ee8e341fa7108bd02a33cdfa24a1360e", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index f502855..7b04459 100644 --- a/flake.nix +++ b/flake.nix @@ -49,7 +49,6 @@ inputs.nixpkgs.follows = "nixpkgs"; }; - disko = { url = "github:nix-community/disko"; inputs.nixpkgs.follows = "nixpkgs"; diff --git a/home/modules/dotfiles/default.nix b/home/modules/dotfiles/default.nix index 15e16ac..07fdbd0 100644 --- a/home/modules/dotfiles/default.nix +++ b/home/modules/dotfiles/default.nix @@ -4,7 +4,6 @@ _: { ... }: { config = { - xdg = { enable = true; configFile."git/config".source = ./gitconfig; diff --git a/home/modules/hypridle/default.nix b/home/modules/hypridle/default.nix index 798b0cc..9945a8c 100644 --- a/home/modules/hypridle/default.nix +++ b/home/modules/hypridle/default.nix @@ -1,14 +1,10 @@ -_: - -let - dpmsSettings = - { - timeout = 1200; - on-timeout = "hyprctl dispatch dpms off"; - on-resume = "hyprctl dispatch dpms on"; - }; -in -{ +_: let + dpmsSettings = { + timeout = 1200; + on-timeout = "hyprctl dispatch dpms off"; + on-resume = "hyprctl dispatch dpms on"; + }; +in { services.hypridle = { enable = true; settings = { diff --git a/home/modules/hyprlock/default.nix b/home/modules/hyprlock/default.nix index 57c83f5..1408b05 100644 --- a/home/modules/hyprlock/default.nix +++ b/home/modules/hyprlock/default.nix @@ -1,7 +1,5 @@ -{ pkgs, ... }: - -{ - home.packages = [ pkgs.hyprlock ]; +{pkgs, ...}: { + home.packages = [pkgs.hyprlock]; xdg.configFile."hypr/hyprlock.conf".text = '' general { diff --git a/home/modules/hyprpaper/default.nix b/home/modules/hyprpaper/default.nix index 6d566eb..1d11224 100644 --- a/home/modules/hyprpaper/default.nix +++ b/home/modules/hyprpaper/default.nix @@ -1,7 +1,5 @@ -{ pkgs, ... }: - -{ - home.packages = [ pkgs.hyprpaper ]; +{pkgs, ...}: { + home.packages = [pkgs.hyprpaper]; xdg.configFile."hypr/hyprpaper.conf".text = '' preload=${./hyprland.png} wallpaper=,${./hyprland.png} diff --git a/home/modules/way-displays/default.nix b/home/modules/way-displays/default.nix index 3352bd0..44a2d48 100644 --- a/home/modules/way-displays/default.nix +++ b/home/modules/way-displays/default.nix @@ -1,19 +1,8 @@ -_:{ pkgs, ... }: -{ - home.packages = [ pkgs.way-displays ]; +_: {pkgs, ...}: { + home.packages = [pkgs.way-displays]; - systemd.user.services.way-displays = { - Unit = { - Description = "way-displays"; - Documentation = [ "man:way-displays(1)" ]; - }; - - Service = { - ExecStart = "${pkgs.way-displays}/bin/way-displays"; - }; - - Install = { - WantedBy = [ "graphical-session.target" ]; - }; + home.file.".config/hypr/start-way-displays.sh" = { + source = ./start-way-displays.sh; + executable = true; }; } diff --git a/home/modules/way-displays/start-way-displays.sh b/home/modules/way-displays/start-way-displays.sh new file mode 100644 index 0000000..280f2aa --- /dev/null +++ b/home/modules/way-displays/start-way-displays.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +sleep 1 # give Hyprland a moment to set its defaults + +way-displays > "/tmp/way-displays.${XDG_VTNR}.${USER}.log" 2>&1 \ No newline at end of file diff --git a/home/modules/wayland/eww/default.nix b/home/modules/wayland/eww/default.nix index b51f8d9..b0deb9c 100644 --- a/home/modules/wayland/eww/default.nix +++ b/home/modules/wayland/eww/default.nix @@ -1,7 +1,4 @@ -{ - self, - ... -}: { +{self, ...}: { pkgs, config, lib, diff --git a/home/modules/wayland/hyprland/default.nix b/home/modules/wayland/hyprland/default.nix index 539b08c..a5119db 100644 --- a/home/modules/wayland/hyprland/default.nix +++ b/home/modules/wayland/hyprland/default.nix @@ -7,8 +7,7 @@ pkgs, lib, ... -}: -let +}: let fontPkgs = with pkgs; [ font-awesome # awesome fonts material-design-icons # fonts with glyphs @@ -28,23 +27,23 @@ let pulsemixer # pulseaudio mixer ]; - packages = with pkgs; [ - brightnessctl # control laptop display brightness - loupe # image viewer - libnotify # notifications - nemo # file manager - nix-search.packages.${system}.default - wl-clipboard # clipboard support - wofi # app launcher - xwaylandvideobridge # screensharing bridge - ] ++ fontPkgs ++ audioPkgs; + packages = with pkgs; + [ + brightnessctl # control laptop display brightness + loupe # image viewer + libnotify # notifications + nemo # file manager + nix-search.packages.${system}.default + wl-clipboard # clipboard support + wofi # app launcher + xwaylandvideobridge # screensharing bridge + ] + ++ fontPkgs + ++ audioPkgs; gblast = lib.getExe pkgs.grimblast; wpctl = "${pkgs.wireplumber}/bin/wpctl"; - - -in -{ +in { imports = [ # ../../shared # ../../foot @@ -83,10 +82,10 @@ in enable = true; config = { common = { - default = [ "hyprland" ]; + default = ["hyprland"]; }; hyprland = { - default = [ "gtk" "hyprland" ]; + default = ["gtk" "hyprland"]; }; }; extraPortals = with pkgs; [ @@ -98,26 +97,28 @@ in wayland.windowManager.hyprland = { enable = true; - extraConfig = (builtins.readFile ./hyprland.conf) + '' - bind=SUPER,P,exec,${lib.getExe pkgs.wofi} --show run --style=${./wofi.css} --term=footclient --prompt=Run - bind=SUPER,A,exec,${gblast} save area - bind=SUPER,S,exec,${gblast} save screen - bind=SUPERCTRL,L,exec,${lib.getExe pkgs.hyprlock} - # audio volume bindings - bindel=,XF86AudioRaiseVolume,exec,${wpctl} set-volume @DEFAULT_AUDIO_SINK@ 5%+ - bindel=,XF86AudioLowerVolume,exec,${wpctl} set-volume @DEFAULT_AUDIO_SINK@ 5%- - bindl=,XF86AudioMute,exec,${wpctl} set-mute @DEFAULT_AUDIO_SINK@ toggle + extraConfig = + (builtins.readFile ./hyprland.conf) + + '' + bind=SUPER,P,exec,${lib.getExe pkgs.wofi} --show run --style=${./wofi.css} --term=footclient --prompt=Run + bind=SUPER,A,exec,${gblast} save area + bind=SUPER,S,exec,${gblast} save screen + bind=SUPERCTRL,L,exec,${lib.getExe pkgs.hyprlock} + # audio volume bindings + bindel=,XF86AudioRaiseVolume,exec,${wpctl} set-volume @DEFAULT_AUDIO_SINK@ 5%+ + bindel=,XF86AudioLowerVolume,exec,${wpctl} set-volume @DEFAULT_AUDIO_SINK@ 5%- + bindl=,XF86AudioMute,exec,${wpctl} set-mute @DEFAULT_AUDIO_SINK@ toggle - exec-once=${lib.getExe pkgs.hyprpaper} - exec-once=${pkgs.pyprland}/bin/pypr - exec-once=${pkgs.blueman}/bin/blueman-applet - exec-once=${pkgs.networkmanagerapplet}/bin/nm-applet --sm-disable --indicator - exec-once=${lib.getExe pkgs.pasystray} - ''; - plugins = [ ]; + exec-once=${lib.getExe pkgs.hyprpaper} + exec-once=${pkgs.pyprland}/bin/pypr + exec-once=${pkgs.blueman}/bin/blueman-applet + exec-once=${pkgs.networkmanagerapplet}/bin/nm-applet --sm-disable --indicator + exec-once=${lib.getExe pkgs.pasystray} + ''; + plugins = []; systemd = { enable = true; - variables = [ "--all" ]; + variables = ["--all"]; }; xwayland.enable = true; }; diff --git a/home/modules/wayland/hyprland/hyprland.conf b/home/modules/wayland/hyprland/hyprland.conf index b652f66..d4309a6 100644 --- a/home/modules/wayland/hyprland/hyprland.conf +++ b/home/modules/wayland/hyprland/hyprland.conf @@ -1,5 +1,7 @@ debug:disable_scale_checks=true +exec-once = ${HOME}/.config/hypr/start-way-displays.sh + input { kb_layout=us kb_options=ctrl:nocaps @@ -31,6 +33,8 @@ misc { # the only sane way to get initial workspace commands working as expected initial_workspace_tracking=0 + + vrr=1 } gestures {