Cleaning up hyprprofile/qutecontainer implementation

This commit is contained in:
Emmet 2024-08-13 15:45:45 -05:00
parent cd4de928e8
commit 87980af597
9 changed files with 36 additions and 6 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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;

View file

@ -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)'

View file

@ -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)'

View file

@ -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)'

View file

@ -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)'

View file

@ -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)'