From 9e68d264974b30da58846b3a10deecc906ad4e45 Mon Sep 17 00:00:00 2001 From: Emmet Date: Sun, 13 Aug 2023 20:57:11 -0500 Subject: [PATCH] Better default app abstractions into hyprland conf --- flake.nix | 4 ++- user/app/browser/librewolf-wayland.nix | 42 -------------------------- user/app/browser/librewolf.nix | 14 +++++---- user/wm/hyprland/hyprland.nix | 21 ++++++++----- 4 files changed, 25 insertions(+), 56 deletions(-) delete mode 100644 user/app/browser/librewolf-wayland.nix diff --git a/flake.nix b/flake.nix index a84ee81..6d45d83 100644 --- a/flake.nix +++ b/flake.nix @@ -17,7 +17,8 @@ dotfilesDir = "~/.dotfiles"; # absolute path of the local repo theme = "ayu-dark"; # selcted theme from my themes directory (./themes/) wm = "hyprland"; # Selected window manager or desktop environment; must select one in both ./user/wm/ and ./system/wm/ - browser = "librewolf-wayland"; # Default browser; must select one from ./user/app/browser/ + wmType = "wayland"; # x11 or wayland + browser = "librewolf"; # Default browser; must select one from ./user/app/browser/ editor = "emacsclient"; # Default editor; term = "alacritty"; # Default terminal command; font = "Inconsolata"; # Selected font @@ -56,6 +57,7 @@ inherit font; inherit fontPkg; inherit wm; + inherit wmType; inherit browser; inherit editor; inherit term; diff --git a/user/app/browser/librewolf-wayland.nix b/user/app/browser/librewolf-wayland.nix deleted file mode 100644 index 9255027..0000000 --- a/user/app/browser/librewolf-wayland.nix +++ /dev/null @@ -1,42 +0,0 @@ -{ config, lib, pkgs, ... }: - -{ - # Module installing librewolf as default browser - home.packages = [ pkgs.librewolf-wayland ]; - - home.file.".librewolf/librewolf.overrides.cfg".text = '' - defaultPref("font.name.serif.x-western","Inconsolata"); - defaultPref("font.size.variable.x-western",20); - defaultPref("browser.toolbars.bookmarks.visibility","always"); - defaultPref("privacy.resisttFingerprinting.letterboxing", true); - defaultPref("network.http.referer.XOriginPolicy",2); - defaultPref("privacy.clearOnShutdown.history",true); - defaultPref("privacy.clearOnShutdown.downloads",true); - defaultPref("privacy.clearOnShutdown.cookies",true); - defaultPref("gfx.webrender.software.opengl",false); - defaultPref("webgl.disabled",true); - pref("font.name.serif.x-western","Inconsolata"); - pref("font.size.variable.x-western",20); - pref("browser.toolbars.bookmarks.visibility","always"); - pref("privacy.resisttFingerprinting.letterboxing", true); - pref("network.http.referer.XOriginPolicy",2); - pref("privacy.clearOnShutdown.history",true); - pref("privacy.clearOnShutdown.downloads",true); - pref("privacy.clearOnShutdown.cookies",true); - pref("gfx.webrender.software.opengl",false); - pref("webgl.disabled",true); - ''; - - xdg.mimeApps.defaultApplications = { - "text/html" = "librewolf.desktop"; - "x-scheme-handler/http" = "librewolf.desktop"; - "x-scheme-handler/https" = "librewolf.desktop"; - "x-scheme-handler/about" = "librewolf.desktop"; - "x-scheme-handler/unknown" = "librewolf.desktop"; - }; - - home.sessionVariables = { - DEFAULT_BROWSER = "${pkgs.librewolf-wayland}/bin/librewolf"; - }; - -} diff --git a/user/app/browser/librewolf.nix b/user/app/browser/librewolf.nix index ccb34a7..5a3c025 100644 --- a/user/app/browser/librewolf.nix +++ b/user/app/browser/librewolf.nix @@ -1,8 +1,14 @@ -{ config, lib, pkgs, ... }: +{ config, lib, pkgs, wmType, ... }: { # Module installing librewolf as default browser - home.packages = [ pkgs.librewolf ]; + home.packages = if (wmType == "wayland") then [ pkgs.librewolf-wayland ] + else [ pkgs.librewolf ]; + + home.sessionVariables = if (wmType == "wayland") + then { DEFAULT_BROWSER = "${pkgs.librewolf-wayland}/bin/librewolf";} + else + { DEFAULT_BROWSER = "${pkgs.librewolf}/bin/librewolf";}; home.file.".librewolf/librewolf.overrides.cfg".text = '' defaultPref("font.name.serif.x-western","Inconsolata"); @@ -35,8 +41,4 @@ "x-scheme-handler/unknown" = "librewolf.desktop"; }; - home.sessionVariables = { - DEFAULT_BROWSER = "${pkgs.librewolf}/bin/librewolf"; - }; - } diff --git a/user/wm/hyprland/hyprland.nix b/user/wm/hyprland/hyprland.nix index 3b23168..f371dc0 100644 --- a/user/wm/hyprland/hyprland.nix +++ b/user/wm/hyprland/hyprland.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, ... }: +{ config, lib, pkgs, browser, term, spawnEditor, fetchFromGitHub, ... }: { imports = [ @@ -19,15 +19,21 @@ exec-once = gnome-keyring-daemon --daemonize --login exec-once = gnome-keyring-daemon --start --components=secrets + exec = ~/.swaybg-stylix + general { layout = master } bind=SUPER,SPACE,fullscreen,1 bind=ALT,TAB,cyclenext bind=ALTSHIFT,TAB,cyclenext,prev - bind=SUPER,RETURN,exec,alacritty - bind=SUPER,A,exec,emacs - bind=SUPER,S,exec,librewolf + + bind=SUPER,RETURN,exec,''+term+'' + + bind=SUPER,A,exec,''+spawnEditor+'' + + bind=SUPER,S,exec,''+browser+'' + bind=SUPER,code:47,exec,fuzzel bind=SUPER,Q,killactive bind=SUPERSHIFT,Q,exit @@ -79,14 +85,14 @@ windowrulev2 = workspace special silent,$scratchpad windowrulev2 = center,$scratchpad - $gearyscratchpad = class:^(geary)$ windowrulev2 = float,$gearyscratchpad windowrulev2 = $scratchpadsize,$gearyscratchpad windowrulev2 = workspace special silent,$gearyscratchpad windowrulev2 = center,$gearyscratchpad - bind=SUPER,X,exec,pypr zoom + bind=SUPER,code:21,exec,pypr zoom + bind=SUPER,code:21,exec,hyprctl reload bind=SUPERCTRL,right,workspace,+1 bind=SUPERCTRL,left,workspace,-1 @@ -133,7 +139,8 @@ hyprpicker swayidle swaylock - hyprpaper + swaybg + #hyprpaper #wofi fuzzel wev