From 313a8e168a2316ad45ed648039d3b1dc1923e2e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Eug=C3=AAnio?= Date: Sat, 25 Feb 2023 16:43:58 -0300 Subject: [PATCH] sway: remove gtk window decoration --- overlays/default.nix | 5 ++++- pkgs/default.nix | 1 + pkgs/gtk3-nocsd.nix | 40 ++++++++++++++++++++++++++++++++++++++++ user/sway.nix | 13 ++++++++++++- user/theme.nix | 12 +++++++++++- 5 files changed, 68 insertions(+), 3 deletions(-) create mode 100644 pkgs/gtk3-nocsd.nix diff --git a/overlays/default.nix b/overlays/default.nix index 995079d..69642a7 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -36,7 +36,10 @@ ''; }; papirus_red = (final.unstable.papirus-icon-theme.override { color = "red"; }); - orchis_theme_compact = (final.orchis-theme.override { tweaks = [ "compact" "solid" ]; }); + orchis_theme_compact = (final.orchis-theme.override { + border-radius = 0; + tweaks = [ "compact" "solid" ]; + }); nerdfonts_fira_hack = (final.nerdfonts.override { fonts = [ "FiraCode" "Hack" ]; }); }); diff --git a/pkgs/default.nix b/pkgs/default.nix index 1715cba..937f8f0 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -6,4 +6,5 @@ cargo-checkmate = pkgs.callPackage ./cargo-checkmate.nix { }; lipsum = pkgs.callPackage ./lipsum.nix { inherit inputs; }; amdgpu-kernel-module = pkgs.callPackage ./amdgpu-kernel-module.nix { }; + gtk3-nocsd = pkgs.callPackage ./gtk3-nocsd.nix { }; } diff --git a/pkgs/gtk3-nocsd.nix b/pkgs/gtk3-nocsd.nix new file mode 100644 index 0000000..b9ee6f2 --- /dev/null +++ b/pkgs/gtk3-nocsd.nix @@ -0,0 +1,40 @@ +{ lib +, stdenv +, fetchFromGitHub +, pkgconfig +, gtk3 +, gobject-introspection +}: + +stdenv.mkDerivation rec { + pname = "gtk3-nocsd"; + version = "3.0.1"; + + src = fetchFromGitHub { + owner = "ZaWertun"; + repo = pname; + rev = "v${version}"; + sha256 = "035rrn9jq9bdfkmmj6xl4q8paqx7xf3hxsw6gslgk86sh7x56lvi"; + }; + + buildInputs = [ + gtk3 + gobject-introspection + ]; + + nativeBuildInputs = [ + pkgconfig + ]; + + makeFlags = [ + "prefix=${placeholder "out"}" + ]; + + meta = with lib; { + description = "A hack to disable gtk+ 3 client side decoration"; + homepage = https://github.com/PCMan/gtk3-nocsd; + license = licenses.lgpl21Plus; + # maintainers = with maintainers; [ peanutbutter144 ]; + platforms = platforms.linux; + }; +} diff --git a/user/sway.nix b/user/sway.nix index 600f09e..6b63c9f 100644 --- a/user/sway.nix +++ b/user/sway.nix @@ -188,7 +188,13 @@ in }; floating = { modifier = "Mod4"; - criteria = [{ class = "file_picker"; } { app_id = "file_picker"; }]; + criteria = [ + { class = "file_picker"; } + { app_id = "file_picker"; } + { app_id = "wdisplays"; } + { app_id = "pavucontrol"; } + { app_id = ".*[Hh]elvum.*"; } + ]; }; keybindings = let @@ -471,6 +477,7 @@ in sway swaybg swaylock + wdisplays waybar dhist @@ -509,5 +516,9 @@ in }; }; home.file = { ".local/share/backgrounds".source = ./backgrounds; }; + home.sessionVariables = { + LD_PRELOAD = "${pkgs.gtk3-nocsd}/lib/libgtk3-nocsd.so.0"; + GTK_CSD = "0"; + }; }; } diff --git a/user/theme.nix b/user/theme.nix index feb87f3..83693d4 100644 --- a/user/theme.nix +++ b/user/theme.nix @@ -24,7 +24,14 @@ in name = icon_theme; package = pkgs.papirus_red; }; - }; + } // ( + let + shared.extraConfig = { + gtk-decoration-layout = "menu:"; + }; + in + { gtk4 = shared; gtk3 = shared; } + ); # qt = { # enable = true; # platformTheme = "gtk"; @@ -39,6 +46,9 @@ in cursor-theme = cursor_theme; color-scheme = "prefer-${color.type}"; }; + "org/gnome/desktop/wm/preferences" = { + button-layout = "menu:"; + }; }; # fonts.fontconfig.enable = true;