nixfiles/home-manager/modules/de2u.nix

379 lines
13 KiB
Nix

inputs:
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.de2u;
in
{
options.de2u = {
enable = mkEnableOption "Enable de2 user stuff";
tiling = mkOption {
type = types.bool;
default = true;
description = "Enable tiling stuff";
};
};
config = mkIf cfg.enable {
colors.enable = lib.mkDefault true;
fonts.enable = lib.mkDefault true;
systemd.user.services.yubikey-touch-detector = {
Service = {
ExecStart = toString (pkgs.writeShellScript "yubikey-touch-detector-libnotify" ''
export SSH_AUTH_SOCK="$(${pkgs.gnupg}/bin/gpgconf --list-dirs agent-ssh-socket)"
${pkgs.yubikey-touch-detector}/bin/yubikey-touch-detector -libnotify
'');
};
Install = rec {
WantedBy = [ "graphical-session.target" ];
};
};
programs.chromium.enable = lib.mkDefault true;
programs.firefox = {
enable = lib.mkDefault true;
package = lib.mkDefault ((if pkgs ? librewolf then pkgs.librewolf else pkgs.firefox).override {
cfg = {
enableGnomeExtensions = true;
pipewireSupport = true;
};
});
extensions = lib.optionals (pkgs ? nur.repos.rycee.firefox-addons) (with pkgs.nur.repos.rycee.firefox-addons; [
darkreader
bitwarden
violentmonkey
canvasblocker
sponsorblock
stylus
]);
profiles.default =
let
customize = lib.replaceStrings
(if config.colors.enable then [
"#19171a"
"#201e21"
"#dedede"
".urlbarView {\n display: none !important;\n}"
".tabbrowser-tab:not([pinned]) .tab-icon-image {\n display: none !important;\n}"
] else [ ])
(if config.colors.enable then [
"#${config.colors.base16.base00}"
"#${config.colors.base16.base01}"
"#${config.colors.base16.base05}"
""
""
] else [ ]);
in
{
settings = {
"browser.startup.homepage" = "https://wizbos.club";
# Make the browser usable, if I wanted autism privacy, I would use TOR browser.
"privacy.resistFingerprinting" = false;
"webgl.disabled" = false;
"privacy.clearOnShutdown.history" = false;
"privacy.clearOnShutdown.cookies" = false;
"privacy.clearOnShutdown.sessions" = false;
"privacy.clearOnShutdown.cache" = false;
"places.history.enabled" = true;
# Make Jitsi work sanely
"media.setsinkid.enabled" = true;
"privacy.webrtc.legacyGlobalIndicator" = false;
"privacy.webrtc.hideGlobalIndicator" = true;
# Required by SimpleFox, and good regardless
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
"layers.acceleration.force-enabled" = true;
"gfx.webrender.all" = true;
"svg.context-properties.content.enabled" = true;
# Make Firefox dark, the reader is always light by default, and the GTK-inferred theme conflicts with SimpleFox (and our customizations)
"extensions.activeThemeID" = "firefox-compact-dark@mozilla.org";
"reader.color_scheme" = "dark";
# LibreWolf ruins the user agent making sites unusable without RFP, so use the user agent from RFP manually. This also seems sane for compatibility when using Firefox.
"general.useragent.override" = "Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0";
};
# userChrome = customize (builtins.readFile "${inputs.simplefox}/chrome/userChrome.css");
# userContent = builtins.readFile "${inputs.simplefox}/chrome/userContent.css";
};
};
programs.kermit = {
enable = lib.mkDefault true;
settings = {
key = lib.mkDefault "shift";
opacity = lib.mkDefault "1";
};
};
programs.kitty = {
enable = lib.mkDefault true;
settings = {
background_opacity = lib.mkDefault "1";
dynamic_background_opacity = lib.mkDefault true;
allow_remote_control = lib.mkDefault true;
hide_window_decorations = lib.mkDefault true;
};
};
home.packages = with pkgs; [
rhythmbox
gnomeExtensions.pop-shell
gnomeExtensions.blur-me
gnomeExtensions.remove-rounded-corners
gnomeExtensions.improved-workspace-indicator
gnomeExtensions.vitals
gnomeExtensions.clipboard-indicator
gnomeExtensions.just-perfection
gnomeExtensions.appindicator
gnomeExtensions.compiz-windows-effect
gnomeExtensions.unite-shell
];
systemd.user.sessionVariables = {
MOZ_ENABLE_WAYLAND = "1";
QT_WAYLAND_DISABLE_WINDOWDECORATION = lib.mkIf cfg.tiling "1";
};
xdg.configFile."gtk-4.0/gtk.css".text = ''
/* UNITE windowDecorations */
@import url('${config.home.homeDirectory}/.nix-profile/share/gnome-shell/extensions/unite@hardpixel.eu/styles/gtk4/buttons-right/${if cfg.tiling then "always" else "both"}.css');
/* windowDecorations UNITE */
'';
gtk.gtk3.extraCss = ''
/* UNITE windowDecorations */
@import url('${config.home.homeDirectory}/.nix-profile/share/gnome-shell/extensions/unite@hardpixel.eu/styles/gtk3/buttons-right/${if cfg.tiling then "always" else "both"}.css');
/* windowDecorations UNITE */
'';
home.activation.gtk3css-over-unite = {
data = ''
$DRY_RUN_CMD rm -f ~/.config/gtk-3.0/gtk.css
$DRY_RUN_CMD rm -f ~/.config/gtk-4.0/gtk.css
'';
before = [ "checkLinkTargets" ];
after = [ ];
};
xdg.mimeApps = {
enable = true;
defaultApplications =
let
browser =
if config.programs.firefox.enable then
(
if config.programs.firefox.package.pname == "firefox" then
"firefox.desktop"
else
"librewolf.desktop"
)
else
"chromium-browser.desktop";
in
{
"text/plain" = "org.gnome.gedit.desktop";
"inode/directory" = "org.gnome.Nautilus.desktop";
"image/*" = "org.gnome.eog.desktop";
"video/*" = "org.gnome.Totem.desktop";
"text/html" = browser;
"x-scheme-handler/http" = browser;
"x-scheme-handler/https" = browser;
"x-scheme-handler/about" = browser;
"x-scheme-handler/mailto" = "org.gnome.Geary.desktop";
"application/zip" = "org.gnome.FileRoller.desktop";
"application/rar" = "org.gnome.FileRoller.desktop";
"application/7z" = "org.gnome.FileRoller.desktop";
"application/*tar" = "org.gnome.FileRoller.desktop";
};
};
dconf.settings = with lib.hm.gvariant; {
"org/gnome/desktop/interface" = {
enable-hot-corners = !cfg.tiling;
show-battery-percentage = true;
};
"org/gnome/shell/extensions/pop-shell" = {
tile-by-default = cfg.tiling;
show-title = !cfg.tiling;
active-hint = false;
};
"org/gnome/shell/extensions/improved-workspace-indicator" = {
panel-position = "left";
};
"org/gnome/shell/extensions/vitals" = {
hide-zeros = true;
show-battery = true;
update-time = 10;
};
"org/gnome/shell/extensions/appindicator" = {
icon-opacity = 255;
tray-pos = "center";
};
"org/gnome/shell/extensions/user-theme" = {
name = if config.colors.enable then "Generated" else "Default";
};
"org/gnome/shell/extensions/just-perfection" = {
# activities-button = !cfg.tiling; # conflicts with unite?
startup-status = 0;
workspace-popup = false;
window-picker-icon = false;
animation = 3;
dash = false;
double-super-to-appgrid = true;
};
"org/gnome/shell" = {
disable-user-extensions = false;
disabled-extensions = [ "" ];
enabled-extensions = [
"pop-shell@system76.com"
"rrc@ogarcia.me"
"native-window-placement@gnome-shell-extensions.gcampax.github.com"
"user-theme@gnome-shell-extensions.gcampax.github.com"
"improved-workspace-indicator@michaelaquilina.github.io"
"Vitals@CoreCoding.com"
"clipboard-indicator@tudmotu.com"
"just-perfection-desktop@just-perfection"
"appindicatorsupport@rgcjonas.gmail.com"
"launch-new-instance@gnome-shell-extensions.gcampax.github.com"
"unite@hardpixel.eu"
];
};
"org/gnome/desktop/peripherals/touchpad" = {
natural-scroll = false;
};
"org/gnome/mutter" = {
edge-tiling = !cfg.tiling;
dynamic-workspaces = !cfg.tiling;
only-on-primary = cfg.tiling;
};
"org/gnome/shell/extensions/unite" = {
hide-window-titlebars = if cfg.tiling then "always" else "both";
hide-activities-button = if cfg.tiling then "never" else "always";
show-window-buttons = if cfg.tiling then "never" else "both";
notifications-position = "center";
restrict-to-primary-screen = false;
show-legacy-tray = false;
show-desktop-name = false;
extend-left-box = false;
hide-app-menu-icon = false;
reduce-panel-spacing = false;
hide-dropdown-arrows = true;
};
"org/gnome/shell/extensions/blur-me" = {
toggle-app-blur = false;
};
"org/gnome/desktop/wm/preferences" = {
focus-mode = if cfg.tiling then "sloppy" else "click";
resize-with-right-button = true;
num-workspaces = 9;
};
"org/gnome/maps" = {
night-mode = true;
transportation-type = "car";
};
"org/gnome/system/location" = {
enabled = true;
};
"org/gnome/desktop/wm/keybindings" =
let
workspaceAttrsList = lib.flatten (map
(n: [
(lib.nameValuePair "move-to-workspace-${n}" [ "<Shift><Super>${n}" ])
(lib.nameValuePair "switch-to-workspace-${n}" [ "<Super>${n}" ])
])
(map (n: toString n) (lib.range 1 9)));
in
lib.listToAttrs workspaceAttrsList // {
minimize = [ "<Super>comma" ];
maximize = [ "" ];
unmaximize = [ "" ];
move-to-monitor-up = [ "" ];
move-to-monitor-down = [ "" ];
move-to-monitor-left = [ "" ];
move-to-monitor-right = [ "" ];
move-to-workspace-down = [ "" ];
move-to-workspace-up = [ "" ];
switch-to-workspace-down = [ "<Primary><Super>Down" "<Primary><Super>j" ];
switch-to-workspace-up = [ "<Primary><Super>Up" "<Primary><Super>k" ];
toggle-maximized = [ "<Super>m" ];
close = [ "<Super>q" ];
cycle-windows = [ "" ];
panel-run-dialog = [ "<Super>d" ];
move-to-workspace-right = [ "" ];
move-to-workspace-left = [ "" ];
switch-to-workspace-right = [ "" ];
switch-to-workspace-left = [ "" ];
# And deal with the remaining alt keys, screw alt keys
cycle-windows-backward = [ "" ];
activate-window-menu = [ "" ];
cycle-panels = [ "" ];
cycle-panels-backward = [ ""];
switch-panels = [ "" ];
switch-panels-backward = [ "" ];
switch-applications = [ "<Super>Tab" ];
switch-applications-backward = [ "<Shift><Super>Tab" ];
cycle-group = [ "" ];
cycle-group-backward = [ "" ];
switch-group = [ "" ];
switch-group-backward = [ "" ];
begin-resize = [ "" ];
begin-move = [ "" ];
};
"org/gnome/mutter/keybindings" = {
toggle-tiled-left = [ "" ];
toggle-tiled-right = [ "" ];
};
"org/gnome/mutter/wayland/keybindings" = {
restore-shortcuts = [ "" ];
};
"org/gnome/shell/keybindings" = lib.listToAttrs (map (n: lib.nameValuePair "switch-to-application-${toString n}" [ "" ]) (lib.range 1 9)) // {
open-application-menu = [ "" ];
toggle-message-tray = [ "<Super>v" ];
toggle-overview = [ "" ];
};
"org/gnome/settings-daemon/plugins/media-keys" = {
play = [ "<Super>backslash" ];
next = [ "<Super>bracketright" ];
previous = [ "<Super>bracketleft" ];
volume-down = [ "<Super>minus" ];
volume-up = [ "<Super>equal" ];
screensaver = [ "<Super>Escape" ];
home = [ "<Super>f" ];
email = [ "<Super>e" ];
www = [ "<Super>b" ];
rotate-video-lock-static = [ "" ];
area-screenshot = [ "<Primary><Shift>Print" ];
area-screenshot-clip = [ "<Shift>Print" ];
screenshot = [ "<Primary>Print" ];
screenshot-clip = [ "Print" ];
window-screenshot = [ "<Primary><Alt>Print" ];
window-screenshot-clip = [ "<Alt>Print" ];
};
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" = {
binding = "<Super>t";
command = "kermit";
name = "Kermit terminal";
};
};
};
}