From 09513b5c4e4babfaefdd06c592ef34c0908dc572 Mon Sep 17 00:00:00 2001 From: sadbeast Date: Thu, 30 May 2024 00:47:47 +0000 Subject: oh god what have i done --- home/sadbeast/features/desktop/default.nix | 21 +++++ home/sadbeast/features/desktop/firefox.nix | 127 +++++++++++++++++++++++++++ home/sadbeast/features/desktop/foot.nix | 21 +++++ home/sadbeast/features/desktop/sway.nix | 132 +++++++++++++++++++++++++++++ home/sadbeast/features/desktop/waybar.css | 70 +++++++++++++++ home/sadbeast/features/desktop/waybar.nix | 57 +++++++++++++ 6 files changed, 428 insertions(+) create mode 100644 home/sadbeast/features/desktop/default.nix create mode 100644 home/sadbeast/features/desktop/firefox.nix create mode 100644 home/sadbeast/features/desktop/foot.nix create mode 100644 home/sadbeast/features/desktop/sway.nix create mode 100644 home/sadbeast/features/desktop/waybar.css create mode 100644 home/sadbeast/features/desktop/waybar.nix (limited to 'home/sadbeast/features/desktop') diff --git a/home/sadbeast/features/desktop/default.nix b/home/sadbeast/features/desktop/default.nix new file mode 100644 index 0000000..d393fff --- /dev/null +++ b/home/sadbeast/features/desktop/default.nix @@ -0,0 +1,21 @@ +{ + pkgs, + config, + lib, + ... +}: { + imports = [ + ./firefox.nix + ./foot.nix + ./sway.nix + ./waybar.nix + ]; + + home = { + packages = with pkgs; [ + galculator + pavucontrol + wine + ]; + }; +} diff --git a/home/sadbeast/features/desktop/firefox.nix b/home/sadbeast/features/desktop/firefox.nix new file mode 100644 index 0000000..08ec448 --- /dev/null +++ b/home/sadbeast/features/desktop/firefox.nix @@ -0,0 +1,127 @@ +{ + pkgs, + inputs, + lib, + config, + ... +}: let + addons = inputs.firefox-addons.packages.${pkgs.system}; +in { + programs.browserpass.enable = true; + programs.firefox = { + enable = true; + profiles.sadbeast = { + search = { + force = true; + default = "Google"; + privateDefault = "DuckDuckGo"; + order = ["Google" "DuckDuckGo"]; + }; + bookmarks = {}; + extensions = with addons; [ + ublock-origin + browserpass + ]; + bookmarks = {}; + settings = { + "browser.startup.homepage" = "about:home"; + + # Disable irritating first-run stuff + "browser.disableResetPrompt" = true; + "browser.download.panel.shown" = true; + "browser.feeds.showFirstRunUI" = false; + "browser.messaging-system.whatsNewPanel.enabled" = false; + "browser.rights.3.shown" = true; + "browser.shell.checkDefaultBrowser" = false; + "browser.shell.defaultBrowserCheckCount" = 1; + "browser.startup.homepage_override.mstone" = "ignore"; + "browser.uitour.enabled" = false; + "startup.homepage_override_url" = ""; + "trailhead.firstrun.didSeeAboutWelcome" = true; + "browser.bookmarks.restore_default_bookmarks" = false; + "browser.bookmarks.addedImportButton" = true; + + # Don't ask for download dir + "browser.download.useDownloadDir" = false; + + # Disable crappy home activity stream page + "browser.newtabpage.activity-stream.feeds.topsites" = false; + "browser.newtabpage.activity-stream.showSponsoredTopSites" = false; + "browser.newtabpage.activity-stream.improvesearch.topSiteSearchShortcuts" = false; + "browser.newtabpage.blocked" = lib.genAttrs [ + # Youtube + "26UbzFJ7qT9/4DhodHKA1Q==" + # Facebook + "4gPpjkxgZzXPVtuEoAL9Ig==" + # Wikipedia + "eV8/WsSLxHadrTL1gAxhug==" + # Reddit + "gLv0ja2RYVgxKdp0I5qwvA==" + # Amazon + "K00ILysCaEq8+bEqV/3nuw==" + # Twitter + "T9nJot5PurhJSy8n038xGA==" + ] (_: 1); + + # Disable some telemetry + "app.shield.optoutstudies.enabled" = false; + "browser.discovery.enabled" = false; + "browser.newtabpage.activity-stream.feeds.telemetry" = false; + "browser.newtabpage.activity-stream.telemetry" = false; + "browser.ping-centre.telemetry" = false; + "datareporting.healthreport.service.enabled" = false; + "datareporting.healthreport.uploadEnabled" = false; + "datareporting.policy.dataSubmissionEnabled" = false; + "datareporting.sessions.current.clean" = true; + "devtools.onboarding.telemetry.logged" = false; + "toolkit.telemetry.archive.enabled" = false; + "toolkit.telemetry.bhrPing.enabled" = false; + "toolkit.telemetry.enabled" = false; + "toolkit.telemetry.firstShutdownPing.enabled" = false; + "toolkit.telemetry.hybridContent.enabled" = false; + "toolkit.telemetry.newProfilePing.enabled" = false; + "toolkit.telemetry.prompted" = 2; + "toolkit.telemetry.rejected" = true; + "toolkit.telemetry.reportingpolicy.firstRun" = false; + "toolkit.telemetry.server" = ""; + "toolkit.telemetry.shutdownPingSender.enabled" = false; + "toolkit.telemetry.unified" = false; + "toolkit.telemetry.unifiedIsOptIn" = false; + "toolkit.telemetry.updatePing.enabled" = false; + + # Disable fx accounts + "identity.fxaccounts.enabled" = false; + # Disable "save password" prompt + "signon.rememberSignons" = false; + # Harden + "privacy.trackingprotection.enabled" = true; + "dom.security.https_only_mode" = true; + # Layout + "browser.uiCustomization.state" = builtins.toJSON { + currentVersion = 20; + newElementCount = 5; + dirtyAreaCache = ["nav-bar" "PersonalToolbar" "toolbar-menubar" "TabsToolbar" "widget-overflow-fixed-list"]; + placements = { + PersonalToolbar = ["personal-bookmarks"]; + TabsToolbar = ["tabbrowser-tabs" "new-tab-button" "alltabs-button"]; + nav-bar = ["back-button" "forward-button" "stop-reload-button" "urlbar-container" "downloads-button" "ublock0_raymondhill_net-browser-action" "browserpass_maximbaz_com-browser-action" "reset-pbm-toolbar-button" "unified-extensions-button"]; + toolbar-menubar = ["menubar-items"]; + unified-extensions-area = []; + widget-overflow-fixed-list = []; + }; + seen = ["save-to-pocket-button" "developer-button" "ublock0_raymondhill_net-browser-action" "browserpass_maximbaz_com-browser-action"]; + }; + }; + }; + }; + + # home = { + # persistence = { + # # Not persisting is safer + # "/persistent${config.home.homeDirectory}" = { + # directories = [ ".mozilla/firefox" ]; + # allowOther = true; + # }; + # }; + # }; +} diff --git a/home/sadbeast/features/desktop/foot.nix b/home/sadbeast/features/desktop/foot.nix new file mode 100644 index 0000000..d6bb965 --- /dev/null +++ b/home/sadbeast/features/desktop/foot.nix @@ -0,0 +1,21 @@ +{ + inputs, + outputs, + ... +}: { + programs.foot = { + enable = true; + + # server.enable = true; + + settings = { + main = { + font = "Iosevka-11:style=Medium,Regular, JoyPixels"; + font-bold = "Iosevka-11:style=Bold"; + font-italic = "Iosevka-11:style=Italic"; + + underline-offset = 1; + }; + }; + }; +} diff --git a/home/sadbeast/features/desktop/sway.nix b/home/sadbeast/features/desktop/sway.nix new file mode 100644 index 0000000..39e9834 --- /dev/null +++ b/home/sadbeast/features/desktop/sway.nix @@ -0,0 +1,132 @@ +{ + config, + lib, + pkgs, + ... +}: { + home.packages = with pkgs; [ + grim + iosevka + (nerdfonts.override {fonts = ["Iosevka"];}) + light + slurp + swayimg + wl-clipboard + dmenu-wayland + ]; + + fonts.fontconfig.enable = true; + + home.sessionVariables = { + XDG_CURRENT_DESKTOP = "sway"; + MOZ_ENABLE_WAYLAND = 1; + QT_QPA_PLATFORM = "wayland"; + LIBSEAT_BACKEND = "logind"; + SDL_VIDEODRIVER = "wayland"; + }; + + gtk = { + enable = true; + theme = { + package = pkgs.gnome-themes-extra; + # name = "Adwaita-dark"; + name = "Adwaita"; + }; + }; + + home.pointerCursor = { + gtk.enable = true; + package = pkgs.vanilla-dmz; + name = "Vanilla-DMZ"; + size = 22; + }; + + wayland.windowManager.sway = { + enable = true; + + config = { + modifier = "Mod4"; + + bars = []; + + fonts = { + names = ["Iosevka"]; + size = 11.0; + }; + + gaps = { + smartGaps = true; + outer = 0; + }; + + input = { + "*" = { + xkb_layout = "us"; + xkb_options = "ctrl:nocaps"; + tap = "enabled"; + }; + }; + + keybindings = let + modifier = config.wayland.windowManager.sway.config.modifier; + in + lib.mkOptionDefault { + "${modifier}+p" = "exec passmenu"; + "${modifier}+Shift+Return" = "exec qutebrowser"; + "${modifier}+y" = "exec grim ~/scrn-$(date +\"%Y-%m-%d-%H-%M-%S\").png"; + "${modifier}+Shift+y" = "exec slurp | grim -g - ~/scrn-$(date +\"%Y-%m-%d-%H-%M-%S\").png"; + "XF86AudioRaiseVolume" = "exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%+ && wpctl get-volume @DEFAULT_AUDIO_SINK@ | sed 's/[^0-9]//g' > $XDG_RUNTIME_DIR/wob.sock"; + "XF86AudioLowerVolume" = "exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%- && wpctl get-volume @DEFAULT_AUDIO_SINK@ | sed 's/[^0-9]//g' > $XDG_RUNTIME_DIR/wob.sock"; + "XF86AudioMute" = "exec wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle && (wpctl get-volume @DEFAULT_AUDIO_SINK@ | grep -q MUTED && echo 0 > $XDG_RUNTIME_DIR/wob.sock) || wpctl get-volume @DEFAULT_AUDIO_SINK@ > $XDG_RUNTIME_DIR/wob.sock"; + + "XF86MonBrightnessUp" = "exec light -A 5 && light -G | cut -d'.' -f1 > $XDG_RUNTIME_DIR/wob.sock"; + "XF86MonBrightnessDown" = "exec light -U 5 && light -G | cut -d'.' -f1 > $XDG_RUNTIME_DIR/wob.sock"; + }; + + startup = [ + { + command = "systemctl --user restart waybar"; + always = true; + } + ]; + + terminal = "${pkgs.foot}/bin/foot"; + }; + + extraConfig = '' + # Window borders + default_border pixel 1 + default_floating_border normal + hide_edge_borders smart + ''; + }; + + services = { + mako = { + enable = true; + + extraConfig = '' + [mode=do-not-disturb] + invisible=1 + ''; + }; + + swayidle = { + enable = true; + + events = [ + # { event = "timeout 300"; command = "${pkgs.swaylock}/bin/swaylock -fF -c 000000"; } + # { event = "timeout 600"; command = "swaymsg \"output * dpms off\""; } + { + event = "after-resume"; + command = "swaymsg \"output * dpms on\""; + } + { + event = "before-sleep"; + command = "${pkgs.swaylock}/bin/swaylock -fF -c 000000"; + } + ]; + }; + wob.enable = true; + }; +} diff --git a/home/sadbeast/features/desktop/waybar.css b/home/sadbeast/features/desktop/waybar.css new file mode 100644 index 0000000..725514c --- /dev/null +++ b/home/sadbeast/features/desktop/waybar.css @@ -0,0 +1,70 @@ +* { + border: none; + border-radius: 0; + font-family: Iosevka; + font-size: 13px; + min-height: 0; +} + +window#waybar { + background: rgba(43, 48, 59, 0.5); + border-bottom: 2px solid rgba(100, 114, 125, 0.5); + color: white; +} + +#workspaces { + margin-right: 5px; +} + +#workspaces button { + padding: 0 5px; + background: transparent; + color: white; + border-bottom: 2px solid transparent; +} + +#workspaces button.focused { + background: #64727D; + border-bottom: 2px solid white; +} + +#mode, #clock, #battery { + padding: 0 10px; + margin: 0 5px; +} + +#mode { + background: #64727D; + border-bottom: 2px solid white; +} + +#clock { + background-color: #64727D; +} + +#battery { + background-color: #ffffff; + color: black; +} + +#battery.charging { + color: white; + background-color: #26A65B; +} + +@keyframes blink { + to { + background-color: #ffffff; + color: black; + } +} + +#battery.warning:not(.charging) { + background: #f53c3c; + color: white; + animation-name: blink; + animation-duration: 0.5s; + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; +} diff --git a/home/sadbeast/features/desktop/waybar.nix b/home/sadbeast/features/desktop/waybar.nix new file mode 100644 index 0000000..02410b4 --- /dev/null +++ b/home/sadbeast/features/desktop/waybar.nix @@ -0,0 +1,57 @@ +{ + programs.waybar = { + enable = true; + systemd.enable = true; + + settings = { + mainBar = { + layer = "bottom"; + position = "top"; + height = 20; + + modules-left = ["sway/workspaces" "sway/mode" "sway/window"]; + modules-right = ["tray" "battery" "clock"]; + + "sway/workspaces" = { + format = "{name}"; + disable-scroll = true; + }; + + "sway/mode" = { + format = " {}"; + }; + + "sway/window" = { + max-length = 80; + tooltip = false; + }; + + clock = { + format = "{:%a %d %I:%M}"; + tooltip = false; + }; + + battery = { + format = "{capacity}% {icon}"; + format-alt = "{time} {icon}"; + format-icons = ["" "" "" "" ""]; + format-charging = "{capacity}% "; + interval = 30; + + states = { + warning = 25; + critical = 10; + }; + + tooltip = false; + }; + + tray = { + icon-size = 18; + }; + }; + }; + + style = ./waybar.css; + }; +} -- cgit v1.2.3