add wayland for electron apps

This commit is contained in:
DACHXY 2024-12-26 01:14:15 +08:00
parent 529543c412
commit e4fe20fae4
10 changed files with 153 additions and 8 deletions

View file

@ -0,0 +1,3 @@
--enable-features=UseOzonePlatform
--enable-features=WaylandWindowDecorations
--ozone-platform-hint=auto

View file

@ -0,0 +1,105 @@
/* Source file https://github.com/MrOtherGuy/firefox-csshacks/tree/master/chrome/autohide_toolbox.css made available under Mozilla Public License v. 2.0
See the above repository for updates as well as full license text. */
/* Hide the whole toolbar area unless urlbar is focused or cursor is over the toolbar
* Dimensions on non-Win10 OS probably needs to be adjusted.
*/
:root{
--uc-autohide-toolbox-delay: 200ms; /* Wait 0.1s before hiding toolbars */
--uc-toolbox-rotation: 82deg; /* This may need to be lower on mac - like 75 or so */
}
:root[sizemode="maximized"]{
--uc-toolbox-rotation: 88.5deg;
}
@media (-moz-platform: windows){
:root:not([lwtheme]) #navigator-toolbox{ background-color: -moz-dialog !important; }
}
:root[sizemode="fullscreen"],
:root[sizemode="fullscreen"] #navigator-toolbox{ margin-top: 0 !important; }
#navigator-toolbox{
--browser-area-z-index-toolbox: 3;
position: fixed !important;
background-color: var(--lwt-accent-color,black) !important;
transition: transform 82ms linear, opacity 82ms linear !important;
transition-delay: var(--uc-autohide-toolbox-delay) !important;
transform-origin: top;
transform: rotateX(var(--uc-toolbox-rotation));
opacity: 0;
line-height: 0;
z-index: 1;
pointer-events: none;
}
:root[sessionrestored] #urlbar[popover]{
pointer-events: none;
opacity: 0;
transition: transform 82ms linear var(--uc-autohide-toolbox-delay), opacity 0ms calc(var(--uc-autohide-toolbox-delay) + 82ms);
transform-origin: 0px calc(0px - var(--tab-min-height) - var(--tab-block-margin) * 2);
transform: rotateX(89.9deg);
}
#mainPopupSet:has(> [panelopen]:not(#ask-chat-shortcuts,#tab-preview-panel)) ~ toolbox #urlbar[popover],
#navigator-toolbox:is(:hover,:focus-within) #urlbar[popover],
#urlbar-container > #urlbar[popover]:is([focused],[open]){
pointer-events: auto;
opacity: 1;
transition-delay: 33ms;
transform: rotateX(0deg);
}
#mainPopupSet:has(> [panelopen]:not(#ask-chat-shortcuts,#tab-preview-panel)) ~ toolbox,
#navigator-toolbox:has(#urlbar:is([open],[focus-within])),
#navigator-toolbox:hover,
#navigator-toolbox:focus-within{
transition-delay: 33ms !important;
transform: rotateX(0);
opacity: 1;
}
/* This makes things like OS menubar/taskbar show the toolbox when hovered in maximized windows.
* Unfortunately it also means that other OS native surfaces (such as context menu on macos)
* and other always-on-top applications will trigger toolbox to show up. */
@media (-moz-bool-pref: "userchrome.autohide-toolbox.unhide-by-native-ui.enabled"){
:root[sizemode="maximized"]:not(:hover){
#navigator-toolbox:not(:-moz-window-inactive),
#urlbar[popover]:not(:-moz-window-inactive){
transition-delay: 33ms !important;
transform: rotateX(0);
opacity: 1;
}
}
}
#navigator-toolbox > *{ line-height: normal; pointer-events: auto }
#navigator-toolbox,
#navigator-toolbox > *{
width: 100vw;
-moz-appearance: none !important;
}
/* These two exist for oneliner compatibility */
#nav-bar{ width: var(--uc-navigationbar-width,100vw) }
#TabsToolbar{ width: calc(100vw - var(--uc-navigationbar-width,0px)) }
/* Don't apply transform before window has been fully created */
:root:not([sessionrestored]) #navigator-toolbox{ transform:none !important }
:root[customizing] #navigator-toolbox{
position: relative !important;
transform: none !important;
opacity: 1 !important;
}
#navigator-toolbox[inFullscreen] > #PersonalToolbar,
#PersonalToolbar[collapsed="true"]{ display: none }
/* Uncomment this if tabs toolbar is hidden with hide_tabs_toolbar.css */
/*#titlebar{ margin-bottom: -9px }*/
/* Uncomment the following for compatibility with tabs_on_bottom.css - this isn't well tested though */
/*
#navigator-toolbox{ flex-direction: column; display: flex; }
#titlebar{ order: 2 }
*/

View file

@ -25,7 +25,7 @@ bind = ALT, TAB, cyclenext
bind = ALT, TAB, bringactivetotop
bind = $mainMod, F, exec, firefox
bind = $mainMod, C, exec, code
bind = $mainMod, C, exec, NIXOS_OZONE_WL=1 code
bind = $mainMod, h, movefocus, l
bind = $mainMod, l, movefocus, r

View file

@ -1,3 +1,7 @@
xwayland {
force_zero_scaling = true
}
general {
gaps_in = 5
gaps_out = 10

View file

@ -36,5 +36,6 @@ in {
recursive = true;
source = "${configDir}/fcitx5";
};
".config/electron-flags.conf".source = "${configDir}/electron/electron-flags.conf";
};
}

View file

@ -28,8 +28,8 @@
#XDG_BIN_HOME = "\${HOME}/.local/bin";
XDG_DATA_HOME = "\${HOME}/.local/share";
GTK_IM_MODULE = "";
XDG_DATA_DIRS =
"\${XDG_DATA_DIRS}:/usr/share:/var/lib/flatpak/exports/share:\${HOME}/.local/share/flatpak/exports/share";
XDG_DATA_DIRS = "\${XDG_DATA_DIRS}:/usr/share:/var/lib/flatpak/exports/share:\${HOME}/.local/share/flatpak/exports/share";
ELECTRON_OZONE_PLATFORM_HINT = "auto";
# GPU
LIBVA_DRIVER_NAME = "nvidia";

View file

@ -3,15 +3,15 @@
enable = true;
cursorTheme = {
name = "Catppuccin-Macchiato-Blue";
package = pkgs.catppuccin-cursors.macchiatoBlue;
name = "Catppuccin-Macchiato-Lavender";
package = pkgs.catppuccin-cursors.macchiatoLavender;
};
theme = {
name = "Catppuccin-Macchiato-Compact-Blue-dark";
name = "Catppuccin-Macchiato-Compact-Lavender-dark";
package = pkgs.catppuccin-gtk.override {
size = "compact";
accents = [ "blue" ];
accents = [ "lavender" ];
variant = "macchiato";
};
};

View file

@ -2,7 +2,6 @@
{
home.packages = [
pkgs.vscode
pkgs.vesktop # discord
pkgs.firefox

View file

@ -7,5 +7,38 @@
extraLuaPackages = ps: [ ps.magick ];
extraPackages = [ pkgs.imagemagick ];
};
vscode = {
enable = true;
package = pkgs.vscode.fhs;
};
firefox.profiles.danny.settings = {
# about:config
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
"extensions.activeThemeID" = "firefox-compact-dark@mozilla.org";
"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";
};
# firefox = {
# enable = true;
# languagePacks = [
# "en-US"
# "zh-TW"
# "ja"
# ];
#
# policies = {
# DontCheckDefaultBrowser = true;
# DisplayBookmarksToolbar = "never";
# };
# };
};
}