From c119b84c302992024856528769f566b84eb2835f Mon Sep 17 00:00:00 2001 From: Noa Aarts Date: Thu, 4 Apr 2024 14:40:35 +0200 Subject: [PATCH] add wofi lazy (WIP!!) --- flake.nix | 7 ++++++- hosts/default/home.nix | 32 +++++++++++++++++++++----------- modules/wofi.nix | 17 ++++++++++++++++- 3 files changed, 43 insertions(+), 13 deletions(-) diff --git a/flake.nix b/flake.nix index 5a7c802..cc24339 100644 --- a/flake.nix +++ b/flake.nix @@ -35,9 +35,14 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + lazy = { + url = "github:bobvanderlinden/nixos-config"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; - outputs = { self, nixpkgs, nix-colors, automapaper, disko, home-manager, hyprland, ... }@inputs: + outputs = { self, nixpkgs, nix-colors, automapaper, disko, home-manager, hyprland, lazy, ... }@inputs: { nixosConfigurations = { default = nixpkgs.lib.nixosSystem { diff --git a/hosts/default/home.nix b/hosts/default/home.nix index dae6874..d6a19ec 100644 --- a/hosts/default/home.nix +++ b/hosts/default/home.nix @@ -30,7 +30,10 @@ nixpkgs.config.allowUnfree = true; - modules.hyprland.enable = true; + modules = { + hyprland.enable = true; + wofi.lazy = true; + }; # The home.packages option allows you to install Nix packages into your # environment. @@ -43,8 +46,6 @@ mtr obs-studio - steam-run - steam-tui wayvnc btop @@ -100,17 +101,26 @@ xdg = { enable = true; + userDirs = { + enable = true; + createDirectories = true; + }; + portal = { + enable = true; + extraPortals = [ pkgs.xdg-desktop-portal-hyprland ]; + }; + mimeApps = { + enable = true; + associations.added = { + "video/mp4" = [ "mpv.out.desktop" ]; + }; + defaultApplications = { + "video/mp4" = [ "mpv.out.desktop" ]; + }; + }; }; - xdg.userDirs = { - enable = true; - createDirectories = true; - }; - xdg.portal = { - enable = true; - extraPortals = [ pkgs.xdg-desktop-portal-hyprland ]; - }; dconf = { enable = true; diff --git a/modules/wofi.nix b/modules/wofi.nix index 41e9681..476b454 100644 --- a/modules/wofi.nix +++ b/modules/wofi.nix @@ -1,16 +1,31 @@ -{ lib, config, pkgs, ... }: +{ lib, config, pkgs, inputs, ... }: let cfg = config.modules.wofi; in { options.modules.wofi = { enable = lib.mkEnableOption "enable wofi app launcher"; + lazy = lib.mkEnableOption "enable lazy desktop entries"; }; imports = [ ../common/colors.nix ]; config = lib.mkIf cfg.enable { home.packages = with pkgs; [ + (lib.mkIf cfg.lazy inputs.lazy.packages.${pkgs.system}.lazy-desktop) + (lib.mkIf cfg.lazy (writeShellApplication { + name = "lo"; + runtimeInputs = [ xdg-utils ]; + text = '' + echo "opening $*" + xdg-open "$*" + ''; + })) + (lib.mkIf cfg.lazy (writeShellApplication { + name = "mt"; + runtimeInputs = [ xdg-utils ]; + text = ''xdg-mime query filetype "$@"''; + })) (writeShellScriptBin "wofi-launch" '' ${wofi}/bin/wofi --show drun '')