diff --git a/flake.nix b/flake.nix index d912795..7a82540 100644 --- a/flake.nix +++ b/flake.nix @@ -27,6 +27,7 @@ # window manager type (hyprland or x11) translator wmType = if (wm == "hyprland") then "wayland" else "x11"; browser = "qutebrowser"; # Default browser; must select one from ./user/app/browser/ + spawnBrowser = if ((browser == "qutebrowser") && (wm == "hyprland")) then "qutebrowser-hyprprofile" else (if (browser == "qutebrowser") then "qutebrowser --qt-flag enable-gpu-rasterization --qt-flag enable-native-gpu-memory-buffers --qt-flag num-raster-threads=4" else browser); # Browser spawn command must be specail for qb, since it doesn't gpu accelerate by default (why?) defaultRoamDir = "Personal.p"; # Default org roam directory relative to ~/Org term = "alacritty"; # Default terminal command; font = "Intel One Mono"; # Selected font diff --git a/user/app/browser/qute-containers.nix b/user/app/browser/qute-containers.nix index 990194a..3bb1fd0 100644 --- a/user/app/browser/qute-containers.nix +++ b/user/app/browser/qute-containers.nix @@ -16,6 +16,8 @@ in phases = "installPhase"; + postPatch = ''sed -i "s/qutebrowser/qutebrowser --qt-flag enable-gpu-rasterization --qt-flag enable-native-gpu-memory-buffers --qt-flag num-raster-threads=4/g" container-open''; + installPhase = '' mkdir -p $out $out/bin cp $src/* $out/bin diff --git a/user/wm/hyprland/hyprland.nix b/user/wm/hyprland/hyprland.nix index 3629e96..b7b9736 100644 --- a/user/wm/hyprland/hyprland.nix +++ b/user/wm/hyprland/hyprland.nix @@ -165,7 +165,7 @@ in bind=SUPER,A,exec,'' + userSettings.spawnEditor + '' - bind=SUPER,S,exec,'' + userSettings.browser + '' + bind=SUPER,S,exec,'' + userSettings.spawnBrowser + '' bind=SUPERCTRL,S,exec,container-open # qutebrowser only diff --git a/user/wm/hyprland/hyprprofiles/hyprprofiles.nix b/user/wm/hyprland/hyprprofiles/hyprprofiles.nix index 8fcd3d3..adad903 100644 --- a/user/wm/hyprland/hyprprofiles/hyprprofiles.nix +++ b/user/wm/hyprland/hyprprofiles/hyprprofiles.nix @@ -26,8 +26,35 @@ in fi fi '') + (pkgs.writeScriptBin "qutebrowser-hyprprofile" '' + #!/bin/sh + profile="$(cat ~/.hyprprofile)" + if [[ $profile ]]; then + container-open $profile $1; + else + qutebrowser --qt-flag enable-gpu-rasterization --qt-flag enable-native-gpu-memory-buffers --qt-flag num-raster-threads=4 $1; + fi + '') + (pkgs.makeDesktopItem { + name = "qutebrowser-hyprprofile"; + desktopName = "Qutebrowser Hyprprofile"; + exec = "qutebrowser-hyprprofile %u"; + categories = ["Network" "WebBrowser"]; + keywords = ["Browser"]; + terminal = false; + type = "Application"; + noDisplay = false; + icon = "qutebrowser"; + }) (pkgs.writeScriptBin "hyprprofile-dmenu" dmenuScript) ]; + xdg.mimeApps.defaultApplications = lib.mkForce { + "text/html" = "qutebrowser-hyprprofile.desktop"; + "x-scheme-handler/http" = "qutebrowser-hyprprofile.desktop"; + "x-scheme-handler/https" = "qutebrowser-hyprprofile.desktop"; + "x-scheme-handler/about" = "qutebrowser-hyprprofile.desktop"; + "x-scheme-handler/unknown" = "qutebrowser-hyprprofile.desktop"; + }; home.file.".config/hyprprofiles/" = { source = ./profiles; recursive = true; diff --git a/user/wm/hyprland/hyprprofiles/profiles/Bard/start-hook.sh b/user/wm/hyprland/hyprprofiles/profiles/Bard/start-hook.sh index 25ac77f..5af5b69 100755 --- a/user/wm/hyprland/hyprprofiles/profiles/Bard/start-hook.sh +++ b/user/wm/hyprland/hyprprofiles/profiles/Bard/start-hook.sh @@ -1,5 +1,5 @@ #!/bin/sh hyprctl keyword unbind SUPER,S; -hyprctl keyword bind SUPER,S,exec,container-open Bard; +hyprctl keyword bind SUPER,S,exec,qutebrowser-hyprprofile; emacsclient --eval '(org-roam-switch-db "Bard.p" t)' diff --git a/user/wm/hyprland/hyprprofiles/profiles/Default/start-hook.sh b/user/wm/hyprland/hyprprofiles/profiles/Default/start-hook.sh index bd7f4c9..0c8c6ba 100755 --- a/user/wm/hyprland/hyprprofiles/profiles/Default/start-hook.sh +++ b/user/wm/hyprland/hyprprofiles/profiles/Default/start-hook.sh @@ -1,5 +1,5 @@ #!/bin/sh hyprctl keyword unbind SUPER,S; -hyprctl keyword bind SUPER,S,exec,qutebrowser; +hyprctl keyword bind SUPER,S,exec,qutebrowser-hyprprofile; emacsclient --eval '(org-roam-switch-db "Personal.p" t)' diff --git a/user/wm/hyprland/hyprprofiles/profiles/Gamdev/start-hook.sh b/user/wm/hyprland/hyprprofiles/profiles/Gamdev/start-hook.sh index 8360bda..c4f7e4f 100755 --- a/user/wm/hyprland/hyprprofiles/profiles/Gamdev/start-hook.sh +++ b/user/wm/hyprland/hyprprofiles/profiles/Gamdev/start-hook.sh @@ -1,5 +1,5 @@ #!/bin/sh hyprctl keyword unbind SUPER,S; -hyprctl keyword bind SUPER,S,exec,container-open Gamedev; +hyprctl keyword bind SUPER,S,exec,qutebrowser-hyprprofile; emacsclient --eval '(org-roam-switch-db "Gamedev.s" t)' diff --git a/user/wm/hyprland/hyprprofiles/profiles/Teaching/start-hook.sh b/user/wm/hyprland/hyprprofiles/profiles/Teaching/start-hook.sh index ada48d4..7b3cfb0 100755 --- a/user/wm/hyprland/hyprprofiles/profiles/Teaching/start-hook.sh +++ b/user/wm/hyprland/hyprprofiles/profiles/Teaching/start-hook.sh @@ -1,5 +1,5 @@ #!/bin/sh hyprctl keyword unbind SUPER,S; -hyprctl keyword bind SUPER,S,exec,container-open Teaching; +hyprctl keyword bind SUPER,S,exec,qutebrowser-hyprprofile; emacsclient --eval '(org-roam-switch-db "Teaching.p" t)' diff --git a/user/wm/hyprland/hyprprofiles/profiles/Tech/start-hook.sh b/user/wm/hyprland/hyprprofiles/profiles/Tech/start-hook.sh index e79d406..e5e8468 100755 --- a/user/wm/hyprland/hyprprofiles/profiles/Tech/start-hook.sh +++ b/user/wm/hyprland/hyprprofiles/profiles/Tech/start-hook.sh @@ -1,5 +1,5 @@ #!/bin/sh hyprctl keyword unbind SUPER,S; -hyprctl keyword bind SUPER,S,exec,container-open Tech; +hyprctl keyword bind SUPER,S,exec,qutebrowser-hyprprofile; emacsclient --eval '(org-roam-switch-db "Producer.p\/LibrePhoenix.p" t)'