theme/sway: added option to hide gtk titlebars if using pkgs.sway

This commit is contained in:
Aly Raffauf 2024-05-17 16:17:00 -04:00
parent 3d520d2eb5
commit d0e9385946
2 changed files with 39 additions and 1 deletions

View file

@ -55,9 +55,15 @@
};
wayland.windowManager.sway.enable = true;
wayland.windowManager.sway.package = pkgs.swayfx;
wayland.windowManager.sway.package = lib.mkDefault pkgs.swayfx;
wayland.windowManager.sway.wrapperFeatures.gtk = true;
wayland.windowManager.sway.checkConfig = false;
alyraffauf.desktop.theme.gtk.hideTitleBar =
if config.wayland.windowManager.sway.package == pkgs.sway
then true
else false;
wayland.windowManager.sway.config = let
modifier = "Mod4";

View file

@ -23,6 +23,11 @@
};
type = lib.types.package;
};
hideTitleBar = lib.mkOption {
description = "Whether to hide GTK3/4 titlebars (useful for some window managers).";
default = false;
type = lib.types.bool;
};
};
alyraffauf.desktop.theme.iconTheme = {
name = lib.mkOption {
@ -180,6 +185,33 @@
gtk3.extraConfig = lib.attrsets.optionalAttrs (config.alyraffauf.desktop.theme.colors.preferDark) {gtk-application-prefer-dark-theme = 1;};
gtk4.extraConfig = lib.attrsets.optionalAttrs (config.alyraffauf.desktop.theme.colors.preferDark) {gtk-application-prefer-dark-theme = 1;};
gtk3.extraCss =
if config.alyraffauf.desktop.theme.gtk.hideTitleBar
then ''
/* No (default) title bar on wayland */
headerbar.default-decoration {
/* You may need to tweak these values depending on your GTK theme */
margin-bottom: 50px;
margin-top: -100px;
background: transparent;
padding: 0;
border: 0;
min-height: 0;
font-size: 0;
box-shadow: none;
}
/* rm -rf window shadows */
window.csd, /* gtk4? */
window.csd decoration { /* gtk3 */
box-shadow: none;
}
''
else "/* */";
gtk4.extraCss = config.gtk.gtk3.extraCss;
};
dconf.settings = {