diff --git a/hosts/randolph/home.nix b/hosts/randolph/home.nix index 600cad5..d1d22f9 100644 --- a/hosts/randolph/home.nix +++ b/hosts/randolph/home.nix @@ -1,24 +1,35 @@ -{ config, lib, pkgs, ... }: +{ pkgs, ... }: -let - scripts = ../../scripts; - extra = ../../extra; - terminal = pkgs.alacritty; -in { +rec { imports = [ - ../../snippets/gammastep.nix - ../../snippets/kdeconnect.nix - ../../snippets/ssh.nix - ../../snippets/zsh.nix - ../../snippets/taskwarrior.nix - ../../snippets/clifm.nix - ../../snippets/git.nix + ../../snippets/defaults.nix + ../../snippets/gammastep.nix + ../../snippets/kdeconnect.nix + ../../snippets/ssh.nix + ../../snippets/zsh.nix + ../../snippets/taskwarrior.nix + ../../snippets/kakoune.nix + ../../snippets/clifm.nix + ../../snippets/git.nix + ../../snippets/sway.nix + ../../snippets/waybar.nix + # ../../snippets/i3blocks.nix + ../../snippets/firefox.nix + ../../snippets/thunderbird.nix ]; + home.username = "alice"; home.homeDirectory = "/home/alice"; - home.stateVersion = "23.11"; + # Configure default applications + defaultPrograms = with pkgs; { + terminal = alacritty; + editor = kakoune; + browser = firefox; + mail = thunderbird; + }; + # Configure cursor home.pointerCursor = { package = pkgs.vanilla-dmz; @@ -78,7 +89,7 @@ in { ] ++ # Basic utilities [ bitwarden-cli htop snore hledger hledger-ui ] ++ # Personalized selection of command-line (CLI/TUI) apps - [ terminal ] ++ # Terminal emulator + [ defaultPrograms.terminal ] ++ # Terminal emulator [ evince imv @@ -139,13 +150,6 @@ in { # }; # }; - wayland.windowManager.sway = import ../../snippets/sway.nix { - inherit scripts extra config lib pkgs terminal; - }; - - programs.waybar = - import ../../snippets/waybar.nix { inherit scripts config lib pkgs terminal; }; - programs.swaylock = { enable = true; settings = { font-size = 14; }; @@ -167,14 +171,11 @@ in { # configure fonts correctly fonts.fontconfig.enable = true; xdg.configFile."fontconfig/conf.d/20-default.fonts.conf".source = - "${extra}/20-default-fonts.conf"; + ../../extra/20-default-fonts.conf; # terminal emulator programs.alacritty.enable = true; - programs.kakoune = import ../../snippets/kakoune.nix pkgs; - xdg.configFile."kak-lsp/kak-lsp.toml".source = - ../../snippets/kakoune/kak-lsp.toml; xdg.desktopEntries.kakoune = { name = "Kakoune"; genericName = "Text Editor"; @@ -229,8 +230,4 @@ in { "-d 3" ]; }; - - programs.firefox = import ../../snippets/firefox.nix { inherit pkgs; }; - - programs.thunderbird = import ../../snippets/thunderbird.nix; } diff --git a/snippets/defaults.nix b/snippets/defaults.nix new file mode 100644 index 0000000..aa9a1d1 --- /dev/null +++ b/snippets/defaults.nix @@ -0,0 +1,31 @@ +{ lib, pkgs, ... } : + +with lib; +{ + options.defaultPrograms = { + terminal = mkOption { + type = types.nullOr types.package; + default = null; + description = "Terminal emulator"; + example = pkgs.alacritty; + }; + editor = mkOption { + type = types.nullOr types.package; + default = null; + description = "Text editor"; + example = pkgs.kakoune; + }; + browser = mkOption { + type = types.nullOr types.package; + default = null; + description = "Web browser"; + example = pkgs.firefox; + }; + mail = mkOption { + type = types.nullOr types.package; + default = null; + description = "Email client"; + example = pkgs.thunderbird; + }; + }; +} diff --git a/snippets/firefox.nix b/snippets/firefox.nix index 3534ed1..b1b3120 100644 --- a/snippets/firefox.nix +++ b/snippets/firefox.nix @@ -1,96 +1,99 @@ -{ pkgs }: { - enable = true; - profiles = { - default = { - id = 0; - name = "Main Profile"; - isDefault = true; - search = { - force = true; - default = "DuckDuckGo"; - order = [ "DuckDuckGo" "Google" ]; - engines = { - "Nix Packages" = { - urls = [{ - template = "https://search.nixos.org/packages"; - params = [ - { - name = "type"; - value = "packages"; - } - { - name = "query"; - value = "{searchTerms}"; - } - ]; - }]; - icon = - "''${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; - definedAliases = [ "@np" ]; - }; - "NixOS Options" = { - urls = [{ - template = "https://search.nixos.org/options"; - params = [ - { - name = "type"; - value = "options"; - } - { - name = "query"; - value = "{searchTerms}"; - } - ]; - }]; - icon = - "''${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; - definedAliases = [ "@no" ]; - }; - "NixOS Wiki" = { - urls = [{ - template = "https://nixos.wiki/index.php?search={searchTerms}"; - }]; - iconUpdateURL = "https://nixos.wiki/favicon.png"; - updateInterval = 24 * 60 * 60 * 1000; # every day - definedAliases = [ "@nw" ]; - }; - "HomeManager Unofficial Options" = { - urls = [{ - template = "https://home-manager-options.extranix.com"; - params = [{ - name = "query"; - value = "{searchTerms}"; +{ pkgs, ... }: +{ + programs.firefox = { + enable = true; + profiles = { + default = { + id = 0; + name = "Main Profile"; + isDefault = true; + search = { + force = true; + default = "DuckDuckGo"; + order = [ "DuckDuckGo" "Google" ]; + engines = { + "Nix Packages" = { + urls = [{ + template = "https://search.nixos.org/packages"; + params = [ + { + name = "type"; + value = "packages"; + } + { + name = "query"; + value = "{searchTerms}"; + } + ]; }]; - }]; - icon = - "''${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; - definedAliases = [ "@hm" ]; + icon = + "''${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + definedAliases = [ "@np" ]; + }; + "NixOS Options" = { + urls = [{ + template = "https://search.nixos.org/options"; + params = [ + { + name = "type"; + value = "options"; + } + { + name = "query"; + value = "{searchTerms}"; + } + ]; + }]; + icon = + "''${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + definedAliases = [ "@no" ]; + }; + "NixOS Wiki" = { + urls = [{ + template = "https://nixos.wiki/index.php?search={searchTerms}"; + }]; + iconUpdateURL = "https://nixos.wiki/favicon.png"; + updateInterval = 24 * 60 * 60 * 1000; # every day + definedAliases = [ "@nw" ]; + }; + "HomeManager Unofficial Options" = { + urls = [{ + template = "https://home-manager-options.extranix.com"; + params = [{ + name = "query"; + value = "{searchTerms}"; + }]; + }]; + icon = + "''${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + definedAliases = [ "@hm" ]; + }; + "Arch Wiki" = { + urls = [{ + template = + "https://wiki.archlinux.org/index.php?search={searchTerms}"; + }]; + iconUpdateURL = "https://wiki.archlinux.org/favicon.ico"; + definedAliases = [ "@aw" ]; + }; + "GeoGuessr Join" = { + urls = + [{ template = "https://www.geoguessr.com/join/{searchTerms}"; }]; + definedAliases = [ "@ggj" ]; + }; + "Google".metaData.alias = + "@g"; # builtin engines only support specifying one additional alias }; - "Arch Wiki" = { - urls = [{ - template = - "https://wiki.archlinux.org/index.php?search={searchTerms}"; - }]; - iconUpdateURL = "https://wiki.archlinux.org/favicon.ico"; - definedAliases = [ "@aw" ]; - }; - "GeoGuessr Join" = { - urls = - [{ template = "https://www.geoguessr.com/join/{searchTerms}"; }]; - definedAliases = [ "@ggj" ]; - }; - "Google".metaData.alias = - "@g"; # builtin engines only support specifying one additional alias }; - }; - # extensions = with pkgs.nur.repos.rycee.firefox-addons; [ - # ublock-origin - # bitwarden - # multi-account-containers - # ]; - settings = { - "browser.search.region" = "CA"; - "browser.search.isUS" = false; + # extensions = with pkgs.nur.repos.rycee.firefox-addons; [ + # ublock-origin + # bitwarden + # multi-account-containers + # ]; + settings = { + "browser.search.region" = "CA"; + "browser.search.isUS" = false; + }; }; }; }; diff --git a/snippets/i3blocks.nix b/snippets/i3blocks.nix new file mode 100644 index 0000000..3a4dadc --- /dev/null +++ b/snippets/i3blocks.nix @@ -0,0 +1,45 @@ +{ pkgs, lib, config, ... }: + +rec { + programs.i3blocks = { + enable = true; + bars = { + top = { + # The title block + title = { + interval = "persist"; + command = "ls"; + }; + }; + bottom = { + time = { + command = "date +%r"; + interval = 1; + }; + # Make sure this block comes after the time block + date = lib.hm.dag.entryAfter [ "time" ] { + command = "date +%d"; + interval = 5; + }; + # And this block after the example block + example = lib.hm.dag.entryAfter [ "date" ] { + command = "echo hi $(date +%s)"; + interval = 3; + }; + }; + }; + }; + + wayland.windowManager.sway.config.bars = [ + { + statusCommand = "${pkgs.lib.getExe config.programs.i3blocks.package}"; # -c ${config.xdg.}"; + position = "top"; + fonts = config.wayland.windowManager.sway.config.fonts; + } + { + statusCommand = "${pkgs.lib.getExe config.programs.i3blocks.package} -c bottom"; + position = "bottom"; + fonts = config.wayland.windowManager.sway.config.fonts; + } + ]; +} diff --git a/snippets/kakoune.nix b/snippets/kakoune.nix index c3062f6..8d9ee02 100644 --- a/snippets/kakoune.nix +++ b/snippets/kakoune.nix @@ -1,95 +1,129 @@ -{ pkgs, ... }: { - enable = true; - defaultEditor = true; - plugins = with pkgs.kakounePlugins; - [ kak-fzf byline-kak kakboard auto-pairs-kak ]; - config = { - colorScheme = "tomorrow-night"; - numberLines = { - enable = true; - highlightCursor = true; +{ pkgs, ... }: +{ + programs.kakoune = { + enable = true; + defaultEditor = true; + plugins = with pkgs.kakounePlugins; + [ kak-fzf byline-kak kakboard auto-pairs-kak ]; + config = { + colorScheme = "tomorrow-night"; + numberLines = { + enable = true; + highlightCursor = true; + }; + showMatching = true; + tabStop = 2; + indentWidth = 2; + hooks = [ + { + name = "WinCreate"; + commands = "kakboard-enable"; + option = ".*"; + } + { + name = "BufCreate"; + commands = "set buffer filetype typst"; + option = ".*\.typ"; + } + { + # When the filetype=latex option is set in a buffer context (automatically), add a new hook to build the latex file on write + name = "BufSetOption"; + option = "filetype=latex"; + commands = "hook buffer BufWritePost .* %{ texlab-build }"; + } + { + name = "BufSetOption"; + option = "filetype=typst"; + commands = "hook buffer BufWritePost .* %{ nop %sh{ typst compile $kak_buffile } }"; + } + { + # When the filetype=markdown option is set (automatically), set word wrap on + name = "WinSetOption"; + option = "filetype=markdown"; + commands = "set-option window lintcmd \"proselint\""; + } + # { + # name = "BufSetOption"; + # option = "filetype=markdown"; + # commands = '' + # hook buffer BufWritePost .* %{ %sh{ + # + # } }; + # ''; + # } + ]; + keyMappings = [ + # Define select all + { + key = "a"; + mode = "user"; + effect = "*%s"; + docstring = "Select all"; + } + # Define usermode yank/copy and paste + { + key = "y"; + mode = "user"; + effect = " wl-copy"; + } + { + key = "p"; + mode = "user"; + effect = " wl-paste -n"; + } + { + key = "P"; + mode = "user"; + effect = "! wl-paste -n"; + } + ]; }; - showMatching = true; - tabStop = 2; - indentWidth = 2; - hooks = [ - { - name = "WinCreate"; - commands = "kakboard-enable"; - option = ".*"; - } - { - name = "BufCreate"; - commands = "set buffer filetype typst"; - option = ".*\.typ"; - } - { - # When the filetype=latex option is set in a buffer context (automatically), add a new hook to build the latex file on write - name = "BufSetOption"; - option = "filetype=latex"; - commands = "hook buffer BufWritePost .* %{ texlab-build }"; - } - { - name = "BufSetOption"; - option = "filetype=typst"; - commands = "hook buffer BufWritePost .* %{ nop %sh{ typst compile $kak_buffile } }"; - } - { - # When the filetype=markdown option is set (automatically), set word wrap on - name = "WinSetOption"; - option = "filetype=markdown"; - commands = "set-option window lintcmd \"proselint\""; - } - # { - # name = "BufSetOption"; - # option = "filetype=markdown"; - # commands = '' - # hook buffer BufWritePost .* %{ %sh{ - # - # } }; - # ''; - # } - ]; - keyMappings = [ - # Define select all - { - key = "a"; - mode = "user"; - effect = "*%s"; - docstring = "Select all"; - } - # Define usermode yank/copy and paste - { - key = "y"; - mode = "user"; - effect = " wl-copy"; - } - { - key = "p"; - mode = "user"; - effect = " wl-paste -n"; - } - { - key = "P"; - mode = "user"; - effect = "! wl-paste -n"; - } - ]; + extraConfig = '' + # highlight trailing whitespace + add-highlighter global/trailing-whitespace regex '\h+$' 0:Error + + # don't remove trailing indent + set global disabled_hooks .*-trim-indent + source ${pkgs.writeText "kakoune-divider.kak" (builtins.readFile ./kakoune/divider.kak)} + set-option global divider_face LineNumbers + divider-on 80 + + # byline enables extending selection with x + require-module byline + + eval %sh{kak-lsp --kakoune -s $kak_session} + lsp-enable + ''; }; - extraConfig = '' - # highlight trailing whitespace - add-highlighter global/trailing-whitespace regex '\h+$' 0:Error - # don't remove trailing indent - set global disabled_hooks .*-trim-indent - source ${pkgs.writeText "kakoune-divider.kak" (builtins.readFile ./kakoune/divider.kak)} - set-option global divider_face LineNumbers - divider-on 80 + xdg.configFile."kak-lsp/kak-lsp.toml".source = + ./kakoune/kak-lsp.toml; - # byline enables extending selection with x - require-module byline - - eval %sh{kak-lsp --kakoune -s $kak_session} - lsp-enable - ''; + xdg.desktopEntries.kakoune = { + name = "Kakoune"; + genericName = "Text Editor"; + comment = "Edit text files"; + icon = "kak"; + exec = "kak %F"; + terminal = true; + mimeType = [ + "text/english" + "text/plain" + "text/x-makefile" + "text/x-c++hdr" + "text/x-c++src" + "text/x-chdr" + "text/x-csrc" + "text/x-java" + "text/x-moc" + "text/x-pascal" + "text/x-tcl" + "text/x-tex" + "application/x-shellscript" + "text/x-c" + "text/x-c++" + "text/x-devicetree-source" + ]; + categories = [ "Utility" "TextEditor" ]; + }; } diff --git a/snippets/sway.nix b/snippets/sway.nix index 745a5c0..1131658 100644 --- a/snippets/sway.nix +++ b/snippets/sway.nix @@ -1,115 +1,113 @@ -{ scripts, extra, config, lib, pkgs, terminal, ... }@inputs: +{ lib, pkgs, ... }@inputs: let + extra = ../extra; + scripts = ../scripts; dynscreenshot = pkgs.writeShellScript "dynscreenshot" (builtins.readFile "${scripts}/dynscreenshot.sh"); changebrightness = pkgs.writeShellScript "changebrightness" (builtins.readFile "${scripts}/changebrightness.sh"); - mod = config.wayland.windowManager.sway.config.modifier; + mod = "Mod4"; dmenuCommand = builtins.readFile "${scripts}/dmenu.sh"; shutdownMenu = pkgs.writeShellScript "shutdownmenu" (builtins.readFile "${scripts}/shutdownmenu.sh"); backgroundImage = "${extra}/kuwaitboat.jpg"; in { - enable = true; - config = rec { - terminal = "${pkgs.lib.getExe inputs.terminal}"; - modifier = "Mod4"; - fonts = { - names = [ "Red Hat Display" ]; - style = "Regular"; - size = 12.0; - }; - input = { - "type:touchpad" = { - natural_scroll = "disabled"; - dwt = "disabled"; - click_method = "clickfinger"; - scroll_factor = "0.5"; + wayland.windowManager.sway = { + enable = true; + config = rec { + terminal = "${pkgs.lib.getExe inputs.config.defaultPrograms.terminal}"; + modifier = mod; + fonts = { + names = [ "Red Hat Display" ]; + style = "Regular"; + size = 12.0; }; - "type:keyboard" = { - xkb_layout = "ca,ca"; - xkb_variant = ",eng"; + input = { + "type:touchpad" = { + natural_scroll = "disabled"; + dwt = "disabled"; + click_method = "clickfinger"; + scroll_factor = "0.5"; + }; + "type:keyboard" = { + xkb_layout = "ca,ca"; + xkb_variant = ",eng"; + }; }; + window = { + border = 2; + titlebar = true; + }; + keybindings = let + screenshotPath = + "Pictures/Screenshots/screenshot`date +%Y%m%d%H%M%S`.png"; + in lib.mkOptionDefault ({ # Screenshot keybinds + "Print" = + "exec grim - | wl-copy && wl-paste > ${screenshotPath}"; # Take screenshot of whole screen, save it, and copy it to clipboard + "Shift+Print" = '' + exec swaymsg -t get_tree | jq -r '.. | select(.focused?) | .rect | "\(.x),\(.y) \(.width)x\(.height)"' | grim -g - | wl-copy && wl-paste > ${screenshotPath}''; # Take screenshot of current window, save it, and copy it to clipboard + "Ctrl+Print" = + "exec bash ${dynscreenshot} ${screenshotPath}"; # Take screenshot of selection, save it, and copy it to clipboard + } // rec { # Function Media Keys + XF86MonBrightnessUp = "exec bash ${changebrightness} 1"; + XF86MonBrightnessDown = "exec bash ${changebrightness} -1"; + XF86AudioMute = "exec wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; + "${mod}+XF86AudioMute" = + "exec wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"; + XF86AudioRaiseVolume = "exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.05+"; + XF86AudioLowerVolume = "exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.05-"; + "${mod}+XF86AudioRaiseVolume" = + "exec wpctl set-volume @DEFAULT_AUDIO_SOURCE@ 0.05+"; + "${mod}+XF86AudioLowerVolume" = + "exec wpctl set-volume @DEFAULT_AUDIO_SOURCE@ 0.05-"; + "${mod}+Shift+e" = null; + XF86AudioMedia = + "dunstctl set-paused toggle; dunstify -a 'dunst_mute_key' -u low -h string:x-dunst-stack-tag:dunst_mute_key 'Notifications mute toggled'"; + XF86PowerOff = + "exec DMENU_COMMAND='${dmenuCommand}' bash ${shutdownMenu}"; + "${mod}+Pause" = XF86PowerOff; + } // { + "${mod}+space" = ''input "*" xkb_switch_layout next''; + "${mod}+Shift+l" = "exec swaylock -f"; + } // { }); + menu = "j4-dmenu-desktop --no-generic --term=${ + terminal + } --dmenu='${dmenuCommand}'"; + focus.followMouse = false; }; - bars = let config = config; - in [{ - command = "${pkgs.lib.getExe pkgs.waybar}"; - position = "top"; - inherit fonts; - }]; - window = { - border = 2; - titlebar = true; - }; - keybindings = let - screenshotPath = - "Pictures/Screenshots/screenshot`date +%Y%m%d%H%M%S`.png"; - in lib.mkOptionDefault ({ # Screenshot keybinds - "Print" = - "exec grim - | wl-copy && wl-paste > ${screenshotPath}"; # Take screenshot of whole screen, save it, and copy it to clipboard - "Shift+Print" = '' - exec swaymsg -t get_tree | jq -r '.. | select(.focused?) | .rect | "\(.x),\(.y) \(.width)x\(.height)"' | grim -g - | wl-copy && wl-paste > ${screenshotPath}''; # Take screenshot of current window, save it, and copy it to clipboard - "Ctrl+Print" = - "exec bash ${dynscreenshot} ${screenshotPath}"; # Take screenshot of selection, save it, and copy it to clipboard - } // rec { # Function Media Keys - XF86MonBrightnessUp = "exec bash ${changebrightness} 1"; - XF86MonBrightnessDown = "exec bash ${changebrightness} -1"; - XF86AudioMute = "exec wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; - "${mod}+XF86AudioMute" = - "exec wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"; - XF86AudioRaiseVolume = "exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.05+"; - XF86AudioLowerVolume = "exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.05-"; - "${mod}+XF86AudioRaiseVolume" = - "exec wpctl set-volume @DEFAULT_AUDIO_SOURCE@ 0.05+"; - "${mod}+XF86AudioLowerVolume" = - "exec wpctl set-volume @DEFAULT_AUDIO_SOURCE@ 0.05-"; - "${mod}+Shift+e" = null; - XF86AudioMedia = - "dunstctl set-paused toggle; dunstify -a 'dunst_mute_key' -u low -h string:x-dunst-stack-tag:dunst_mute_key 'Notifications mute toggled'"; - XF86PowerOff = - "exec DMENU_COMMAND='${dmenuCommand}' bash ${shutdownMenu}"; - "${mod}+Pause" = XF86PowerOff; - } // { - "${mod}+space" = ''input "*" xkb_switch_layout next''; - "${mod}+Shift+l" = "exec swaylock -f"; - } // { }); - menu = "j4-dmenu-desktop --no-generic --term=${ - pkgs.lib.getExe inputs.terminal - } --dmenu='${dmenuCommand}'"; - focus.followMouse = false; + extraConfig = '' + output 'eDP-1' scale 1.50 + '' + # Fractional scaling to 1.50 + '' + exec gammastep-indicator + '' + # gammastep-indicator enables red shift + '' + exec dunst + '' + # Enable notifications + '' + exec "activate-linux -c 0.5-0.5-0.5-0.5" + '' + # Enable Activate Linux + '' + bindgesture swipe:4:up focus parent + bindgesture swipe:4:left workspace prev + bindgesture swipe:4:right workspace next + bindgesture swipe:3:up focus up + bindgesture swipe:3:down focus down + bindgesture swipe:3:left focus left + bindgesture swipe:3:right focus right + '' + # Multi-touch touchpad gestures + '' + exec swaybg -i ${backgroundImage} + '' + # Background image + '' + focus_on_window_activation focus + '' + # Focus on window activation lol + '' + set $laptop eDP-1 + bindswitch --reload --locked lid:on output $laptop disable + bindswitch --reload --locked lid:off output $laptop enable + '' + # Clamshell mode + ""; }; - extraConfig = '' - output 'eDP-1' scale 1.50 - '' + # Fractional scaling to 1.50 - '' - exec gammastep-indicator - '' + # gammastep-indicator enables red shift - '' - exec dunst - '' + # Enable notifications - '' - exec "activate-linux -c 0.5-0.5-0.5-0.5" - '' + # Enable Activate Linux - '' - bindgesture swipe:4:up focus parent - bindgesture swipe:4:left workspace prev - bindgesture swipe:4:right workspace next - bindgesture swipe:3:up focus up - bindgesture swipe:3:down focus down - bindgesture swipe:3:left focus left - bindgesture swipe:3:right focus right - '' + # Multi-touch touchpad gestures - '' - exec swaybg -i ${backgroundImage} - '' + # Background image - '' - focus_on_window_activation focus - '' + # Focus on window activation lol - '' - set $laptop eDP-1 - bindswitch --reload --locked lid:on output $laptop disable - bindswitch --reload --locked lid:off output $laptop enable - '' + # Clamshell mode - ""; } diff --git a/snippets/thunderbird.nix b/snippets/thunderbird.nix index 65bedcd..a673f1a 100644 --- a/snippets/thunderbird.nix +++ b/snippets/thunderbird.nix @@ -1,4 +1,6 @@ -{ - enable = true; - profiles = { main = { isDefault = true; }; }; +{ ... }: { + programs.thunderbird = { + enable = true; + profiles = { main = { isDefault = true; }; }; + }; } diff --git a/snippets/waybar.nix b/snippets/waybar.nix index 2c45f9b..0ffe73a 100644 --- a/snippets/waybar.nix +++ b/snippets/waybar.nix @@ -1,142 +1,151 @@ -{ scripts, config, lib, pkgs, terminal, ... }: +{ pkgs, config, ... }: -let terminalExec = "${pkgs.lib.getExe terminal} -e"; -in { - enable = true; - settings = [{ - modules-left = [ "sway/workspaces" ]; - modules-right = [ - "pulseaudio" - "bluetooth" - "network" - "cpu" - "memory" - "disk" - "battery" - "tray" - "sway/language" - "clock" - ]; - "sway/workspaces" = { - enable-bar-scroll = true; - disable-scroll-wraparound = true; - smooth-scrolling-threshold = 2.0; - }; - pulseaudio = { - format = "{volume}% {icon} {format_source}"; - format-bluetooth = "{volume}% {icon} {format_source}"; - format-muted = "{volume}%  {format_source}"; - format-source = "{volume}% "; - format-source-muted = "{volume}% "; - format-icons = [ "" "" ]; - on-click = "exec wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; - on-click-right = "exec wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"; - on-click-middle = "exec pavucontrol"; - on-scroll-up = ""; - on-scroll-down = ""; - }; - network = { - format-wifi = "{essid} ({signalStrength}%) "; - format-ethernet = "{ipaddr}/{cidr} "; - tooltip-format = "{ifname} via {gwaddr} "; - format-linked = "{ifname} (No IP) "; - format-disconnected = "Disconnected ⚠"; - format-alt = "{ifname}: {ipaddr}/{cidr}"; - on-click-right = "exec ${terminalExec} nmtui"; - }; - bluetooth = { - format = " {status}"; - format-disabled = ""; # hide module - format-connected = " {num_connections}"; - tooltip-format = "{controller_alias} {controller_address}"; - tooltip-format-connected = '' - {controller_alias} {controller_address} - - {device_enumerate}''; - tooltip-format-enumerate-connected = "{device_alias} {device_address}"; - on-click = "exec blueman-manager"; - on-click-right = "exec bluetoothctl disconnect"; - }; - cpu = { format = "{usage}% "; }; - memory = { format = "{used:0.1f}GB/{total:0.1f}GB "; }; - disk = { - format = "{used} "; - path = "/"; - }; - battery = { - states = { - good = 95; - warning = 20; - critical = 10; +let terminalExec = "${pkgs.lib.getExe config.defaultPrograms.terminal} -e"; +in +rec { + programs.waybar = { + enable = true; + settings = [{ + modules-left = [ "sway/workspaces" ]; + modules-right = [ + "pulseaudio" + "bluetooth" + "network" + "cpu" + "memory" + "disk" + "battery" + "tray" + "sway/language" + "clock" + ]; + "sway/workspaces" = { + enable-bar-scroll = true; + disable-scroll-wraparound = true; + smooth-scrolling-threshold = 2.0; }; - format = "{capacity}% {icon}"; - format-charging = "{capacity}% "; - format-plugged = "{capacity}% "; - # format-alt = "{time} {icon}"; - format-icons = [ "" "" "" "" "" ]; - on-click = ""; - }; - tray = { - icon-size = 20; - spacing = 5; - }; - "sway/language" = { - format = "{shortDescription}"; - tooltip-format = "{long}"; - on-click = ''swaymsg input "*" xkb_switch_layout next''; - }; - clock = { - interval = 1; - format = "{:L%H:%M:%S %a %F}"; - locale = - "fr_CA.utf8"; # TODO fix this; I don't want it to be hardcoded but rather tied to i18n.defaultLocale - tooltip-format = '' - {:L%Y %B} - {calendar}''; - }; + pulseaudio = { + format = "{volume}% {icon} {format_source}"; + format-bluetooth = "{volume}% {icon} {format_source}"; + format-muted = "{volume}%  {format_source}"; + format-source = "{volume}% "; + format-source-muted = "{volume}% "; + format-icons = [ "" "" ]; + on-click = "exec wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; + on-click-right = "exec wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"; + on-click-middle = "exec pavucontrol"; + on-scroll-up = ""; + on-scroll-down = ""; + }; + network = { + format-wifi = "{essid} ({signalStrength}%) "; + format-ethernet = "{ipaddr}/{cidr} "; + tooltip-format = "{ifname} via {gwaddr} "; + format-linked = "{ifname} (No IP) "; + format-disconnected = "Disconnected ⚠"; + format-alt = "{ifname}: {ipaddr}/{cidr}"; + on-click-right = "exec ${terminalExec} nmtui"; + }; + bluetooth = { + format = " {status}"; + format-disabled = ""; # hide module + format-connected = " {num_connections}"; + tooltip-format = "{controller_alias} {controller_address}"; + tooltip-format-connected = '' + {controller_alias} {controller_address} + + {device_enumerate}''; + tooltip-format-enumerate-connected = "{device_alias} {device_address}"; + on-click = "exec blueman-manager"; + on-click-right = "exec bluetoothctl disconnect"; + }; + cpu = { format = "{usage}% "; }; + memory = { format = "{used:0.1f}GB/{total:0.1f}GB "; }; + disk = { + format = "{used} "; + path = "/"; + }; + battery = { + states = { + good = 95; + warning = 20; + critical = 10; + }; + format = "{capacity}% {icon}"; + format-charging = "{capacity}% "; + format-plugged = "{capacity}% "; + # format-alt = "{time} {icon}"; + format-icons = [ "" "" "" "" "" ]; + on-click = ""; + }; + tray = { + icon-size = 20; + spacing = 5; + }; + "sway/language" = { + format = "{shortDescription}"; + tooltip-format = "{long}"; + on-click = ''swaymsg input "*" xkb_switch_layout next''; + }; + clock = { + interval = 1; + format = "{:L%H:%M:%S %a %F}"; + locale = + "fr_CA.utf8"; # TODO fix this; I don't want it to be hardcoded but rather tied to i18n.defaultLocale + tooltip-format = '' + {:L%Y %B} + {calendar}''; + }; + }]; + style = '' + * { + font-family: FontAwesome, Red Hat Display, sans-serif; + font-size: 12pt; + min-height: 20pt; + } + '' + '' + window#waybar { + background: rgba(34, 34, 34, 1); + color: white; + } + '' + '' + #workspaces button { + padding: 0 3px; + background: rgba(34, 34, 34, 1); + border-style: hidden; + border-radius: 0; + color: white; + } + '' + '' + #workspaces button.focused { + background: rgba(40, 85, 119, 1); + } + + .modules-right label, + .modules-right box { + border-left: 1px solid #d3d3d3; + padding-left: 5px; + padding-right: 5px; + } + '' + '' + #battery.warning:not(.charging) { + background: rgba(140, 0, 0, 1); + } + + #battery.critical:not(.charging) { + background: #ffffff; + color: black; + } + '' + '' + #language { + min-width: 30px; + } + '' + ""; + }; + + wayland.windowManager.sway.config.bars = [{ + command = "${pkgs.lib.getExe config.programs.waybar.package}"; + position = "top"; + fonts = config.wayland.windowManager.sway.config.fonts; }]; - style = '' - * { - font-family: FontAwesome, Red Hat Display, sans-serif; - font-size: 12pt; - min-height: 20pt; - } - '' + '' - window#waybar { - background: rgba(34, 34, 34, 1); - color: white; - } - '' + '' - #workspaces button { - padding: 0 3px; - background: rgba(34, 34, 34, 1); - border-style: hidden; - border-radius: 0; - color: white; - } - '' + '' - #workspaces button.focused { - background: rgba(40, 85, 119, 1); - } - - .modules-right label, - .modules-right box { - border-left: 1px solid #d3d3d3; - padding-left: 5px; - padding-right: 5px; - } - '' + '' - #battery.warning:not(.charging) { - background: rgba(140, 0, 0, 1); - } - - #battery.critical:not(.charging) { - background: #ffffff; - color: black; - } - '' + '' - #language { - min-width: 30px; - } - '' + ""; }