feat: add zen browser flake

This commit is contained in:
danny 2025-08-14 09:29:00 +08:00
parent 53a6b8e4a5
commit 179961297b
18 changed files with 425 additions and 185 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 MiB

View file

@ -1,36 +0,0 @@
{
"label" : "lock",
"action" : "hyprlock",
"text" : "Lock",
"keybind" : "l"
}
{
"label" : "hibernate",
"action" : "systemctl hibernate",
"text" : "Hibernate",
"keybind" : "h"
}
{
"label" : "logout",
"action" : "sleep 1; hyprctl dispatch exit",
"text" : "Logout",
"keybind" : "e"
}
{
"label" : "shutdown",
"action" : "systemctl poweroff",
"text" : "Shutdown",
"keybind" : "s"
}
{
"label" : "suspend",
"action" : "systemctl suspend",
"text" : "Suspend",
"keybind" : "u"
}
{
"label" : "reboot",
"action" : "systemctl reboot",
"text" : "Reboot",
"keybind" : "r"
}

View file

@ -1,55 +0,0 @@
@define-color main #ebdbb2;
* {
background-image: none;
transition-property: all;
transition-duration: 0.3s;
}
window {
background-color: rgba(0, 0, 0, 0);
}
button {
margin: 8px;
color: @main;
border-style: solid;
border-width: 2px;
background-position: center center;
background-size: 15%;
background-repeat: no-repeat;
}
button:active,
button:focus,
button:hover {
color: @main;
background-color: alpha(@main, 0.4);
outline-style: none;
transition-property: all;
transition-duration: 0.3s;
}
#lock {
background-image: url("icons/lock.svg");
}
#logout {
background-image: url("icons/logout.svg");
}
#suspend {
background-image: url("icons/suspend.svg");
}
#hibernate {
background-image: url("icons/hibernate.svg");
}
#shutdown {
background-image: url("icons/shutdown.svg");
}
#reboot {
background-image: url("icons/reboot.svg");
}

View file

@ -6,6 +6,7 @@
../user/direnv.nix
../user/environment.nix
../user/gtk.nix
../user/wlogout.nix
# ../user/music-production.nix
../user/nvim.nix
../user/packages.nix

View file

@ -1,12 +1,10 @@
let
configDir = ../config;
browser = "firefox.desktop";
browser = "zen.desktop";
in
{
home.file = {
".config/wallpapers".source = "${configDir}/wallpapers";
".config/neofetch".source = "${configDir}/neofetch";
".config/wlogout".source = "${configDir}/wlogout";
".config/btop".source = "${configDir}/btop";
".config/rofi".source = "${configDir}/rofi";
".config/scripts".source = "${configDir}/scripts";

View file

@ -20,6 +20,7 @@ let
# Disable Ctrl+Q
"browser.quitShortcut.disabled" = true;
"security.enterprise_roots.enabled" = true;
"browser.tabs.allow_transparent_browser" = true;
};
in
{

View file

@ -12,9 +12,9 @@ let
notransTag = "notrans";
firefox = "firefox";
browser-bin = "zen";
prefix = if nvidia-offload-enabled then "nvidia-offload" else "";
browser = "${prefix} ${firefox}";
browser = "${prefix} ${browser-bin}";
terminal = "ghostty";
filemanager = "${terminal} -e yazi";
@ -23,11 +23,11 @@ let
gamingWorkspace = 7;
toggleWlogout = pkgs.writeShellScriptBin "toggle" ''
toggleWlogout = pkgs.writeShellScript "toggle" ''
if ${pkgs.busybox}/bin/pgrep wlogout > /dev/null; then
${pkgs.busybox}/bin/pkill wlogout
else
${pkgs.wlogout}/bin/wlogout --protocol layer-shell
${config.programs.wlogout.package}/bin/wlogout --protocol layer-shell
fi
'';
@ -47,7 +47,7 @@ in
''CTRL ALT, T, exec, ${terminal}''
''${mainMod}, Q, killactive, ''
''${mainMod}, M, exec, ${toggleWlogout}/bin/toggle''
''${mainMod}, M, exec, ${toggleWlogout}''
''${mainMod}, E, exec, ${filemanager}''
''${mainMod}, V, togglefloating, ''
''ALT, SPACE, exec, rofi -config ~/.config/rofi/apps.rasi -show drun''

View file

@ -34,6 +34,8 @@ in
"float, class:^(xdg-desktop-portal-gtk)$"
"float, title:^(Steam Settings)$"
"opacity 0.9999 override, initialClass:^(zen)(.*)"
# Picture in picture windows
"float, title:^(Picture-in-Picture)$"
"pin, title:^(Picture-in-Picture)$"
@ -71,7 +73,9 @@ in
"pin, class: ^(GStreamer)$"
"float, class: ^(GStreamer)$"
"opacity 1.0 override 1.0 override, class: ^(GStreamer)$"
"noblur, class: ^(GStreamer)$"
"animation slide right 20%, class: ^(GStreamer)$"
"keepaspectratio, class: ^(GStreamer)$"
# Bluetooth
"float, class: ^(blueberry.py)$"
@ -98,13 +102,6 @@ in
# Davinci resolve
"center 1, initialClass: ^(resolve), floating: 1"
# Disable Tansparent for youtube video
"opacity 1.0 override 1.0 override, title:(.*)( - YouTube Mozilla Firefox)"
"noblur, title:(.*)( - YouTube Mozilla Firefox)"
"opacity 1.0 override 1.0 override, title:(.*)( - Mozilla Firefox)"
"noblur, title:(.*)( - YouTube Mozilla Firefox)"
# Disable Tansparent
"opacity 1.0 override 1.0 override, tag:${notransTag}"
"noblur, tag: ^(${notransTag})$"

View file

@ -19,6 +19,10 @@ let
dconf write /org/cinnamon/desktop/applications/terminal/exec-arg "''\'''\'" &
systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP QT_QPA_PLATFORMTHEME &
dbus-update-activation-environment --systemd HYPRLAND_INSTANCE_SIGNATURE
# Hint dark theme
gsettings set org.gnome.desktop.interface color-scheme "prefer-dark"
'';
mainMod = "SUPER";
@ -33,6 +37,7 @@ in
mpvpaper # Video Wallpaper
hyprcursor
libnotify
sunsetr
];
wayland.windowManager.hyprland = {
@ -117,6 +122,7 @@ in
env = [
''XDG_CURRENT_DESKTOP, Hyprland''
''XDG_SESSION_DESKTOP, Hyprland''
''GDK_PIXBUF_MODULE_FILE, ${pkgs.librsvg}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache''
];
workspace = (import ./hypr/workspace.nix { inherit monitors; });
@ -331,14 +337,12 @@ in
Unit = {
ConditionEnvironment = "WAYLAND_DISPLAY";
Description = "Blue light filter";
PartOf = [ "graphical-session.target" ];
After = [ "graphical-session.target" ];
};
Service = {
ExecStart = "${pkgs.hyprsunset}/bin/hyprsunset -t 3000k";
Restart = "always";
RestartSec = 2;
KillSignal = "SIGKILL"; # Hyprsunset seems not handle the SIGTERM signal
KillSignal = "SIGKILL"; # Hyprsunset seems not handle the SIGTERM signal properly
};
};
@ -399,7 +403,7 @@ in
''
@define-color bgc rgba(0, 0, 0, 0.1);
@define-color borderc #ebdbb2;
@define-color textc #282828;
@define-color textc #212121;
* {
font-family: JetBrainsMonoNerdFontMono;
@ -422,21 +426,21 @@ in
}
.notification {
background: @textc;
background: @bgc;
margin: 0px;
border-radius: 6px;
border-width: 3px;
border-color: #ebdbb2;
border-color: @borderc;
}
.notification-content {
background: @textc;
background: @bgc;
padding: 7px;
margin: 0;
}
.close-button {
background: @textc;
background: @bgc;
color: @borderc;
text-shadow: none;
padding: 0;
@ -454,8 +458,13 @@ in
}
.notification-action {
color: @bgc;
background: @textc;
color: @borderc;
background: @bgc;
}
.notification-action:hover {
color: @textc;
background: @borderc;
}
.summary {

113
home/user/wlogout.nix Normal file
View file

@ -0,0 +1,113 @@
{ ... }:
let
icons = {
lock = ../config/wlogout/icons/lock.svg;
hibernate = ../config/wlogout/icons/hibernate.svg;
logout = ../config/wlogout/icons/logout.svg;
shutdown = ../config/wlogout/icons/shutdown.svg;
suspend = ../config/wlogout/icons/suspend.svg;
reboot = ../config/wlogout/icons/reboot.svg;
};
in
{
programs.wlogout = {
enable = true;
layout = [
{
label = "lock";
action = "hyprlock";
text = "Lock";
keybind = "l";
}
{
label = "hibernate";
action = "systemctl hibernate";
text = "Hibernate";
keybind = "h";
}
{
label = "logout";
action = "sleep 1; hyprctl dispatch exit";
text = "Logout";
keybind = "e";
}
{
label = "shutdown";
action = "systemctl poweroff";
text = "Shutdown";
keybind = "s";
}
{
label = "suspend";
action = "systemctl suspend";
text = "Suspend";
keybind = "u";
}
{
label = "reboot";
action = "systemctl reboot";
text = "Reboot";
keybind = "r";
}
];
style =
# css
''
@define-color main #ebdbb2;
* {
background-image: none;
transition-property: all;
transition-duration: 0.3s;
}
window {
background-color: rgba(0, 0, 0, 0);
}
button {
margin: 8px;
color: @main;
border-style: solid;
border-width: 2px;
background-position: center center;
background-size: 15%;
background-repeat: no-repeat;
}
button:active,
button:focus,
button:hover {
color: @main;
background-color: alpha(@main, 0.4);
outline-style: none;
transition-property: all;
transition-duration: 0.3s;
}
#lock {
background-image: url("${icons.lock}");
}
#logout {
background-image: url("${icons.logout}");
}
#suspend {
background-image: url("${icons.suspend}");
}
#hibernate {
background-image: url("${icons.hibernate}");
}
#shutdown {
background-image: url("${icons.shutdown}");
}
#reboot {
background-image: url("${icons.reboot}");
}
'';
};
}

41
home/user/zen-browser.nix Normal file
View file

@ -0,0 +1,41 @@
{
...
}:
{
programs.zen-browser = {
enable = true;
profiles = {
"Danny Profile" = {
default = true;
name = "Danny";
settings = {
"zen.view.compact.should-enable-at-startup" = true;
"zen.widget.linux.transparency" = true;
"zen.view.compact.show-sidebar-and-toolbar-on-hover" = false;
"app.update.auto" = false;
"app.normandy.first_run" = false;
"browser.aboutConfig.showWarning" = false;
"browser.shell.checkDefaultBrowser" = false;
"browser.shell.didSkipDefaultBrowserCheckOnFirstRun" = true;
"browser.tabs.allow_transparent_browser" = true;
"browser.urlbar.placeholderName" = "Google";
"browser.urlbar.placeholderName.private" = "private";
"middlemouse.paste" = false;
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
"font.language.group" = "zh-TW";
"font.name.sans-serif.ja" = "Noto Sans CJK JP";
"font.name.sans-serif.zh-TW" = "Noto Sans CJK TC";
"font.name.serif.ja" = "Noto Serif CJK JP";
"font.name.serif.zh-TW" = "Noto Serif CJK TC";
"font.name.monospace.ja" = "Noto Sans Mono CJK JP";
"font.name.monospace.x-western" = "CaskaydiaCove Nerd Font Mono";
"font.name.monospace.zh-TW" = "Noto Sans Mono CJK TC";
};
ensureCACertifications = [
../../system/extra/ca.crt
];
};
};
};
}