diff --git a/colors/catppuccin_mocha.nix b/colors/catppuccin_mocha.nix deleted file mode 100644 index 9569149..0000000 --- a/colors/catppuccin_mocha.nix +++ /dev/null @@ -1,21 +0,0 @@ -# catppuccin mocha -{ - foreground = "cdd6f4"; # Text - background = "1e1e2e"; # Base - regular0 = "45475a"; # Surface 1 - regular1 = "f38ba8"; # red - regular2 = "a6e3a1"; # green - regular3 = "f9e2af"; # yellow - regular4 = "89b4fa"; # blue - regular5 = "f5c2e7"; # pink - regular6 = "94e2d5"; # teal - regular7 = "bac2de"; # Subtext 1 - bright0 = "585b70"; # Surface 2 - bright1 = "f38ba8"; # red - bright2 = "a6e3a1"; # green - bright3 = "f9e2af"; # yellow - bright4 = "89b4fa"; # blue - bright5 = "f5c2e7"; # pink - bright6 = "94e2d5"; # teal - bright7 = "a6adc8"; # Subtext 0 -} diff --git a/colors/default.nix b/colors/default.nix deleted file mode 120000 index f3abd1a..0000000 --- a/colors/default.nix +++ /dev/null @@ -1 +0,0 @@ -catppuccin_mocha.nix \ No newline at end of file diff --git a/flake.lock b/flake.lock index 0c35dd4..fd69bd2 100644 --- a/flake.lock +++ b/flake.lock @@ -24,6 +24,22 @@ "type": "github" } }, + "base16-schemes": { + "flake": false, + "locked": { + "lastModified": 1654895891, + "narHash": "sha256-xYYmZkHnyLCUBAkqkZ7v1Lc5m39857MukQLMRtGuvdk=", + "owner": "base16-project", + "repo": "base16-schemes", + "rev": "7c247f734eac7f04518c6e28d098635ee8dcabf5", + "type": "github" + }, + "original": { + "owner": "base16-project", + "repo": "base16-schemes", + "type": "github" + } + }, "bernbot": { "inputs": { "nci": "nci", @@ -734,6 +750,25 @@ "type": "github" } }, + "nix-colors": { + "inputs": { + "base16-schemes": "base16-schemes", + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1664216202, + "narHash": "sha256-7qXPLkgsXpi2nmxGN14DVZWMFw4QIx7foqEN6GXeTj8=", + "owner": "Misterio77", + "repo": "nix-colors", + "rev": "bb56fe29c3e16029a783b7a85354fc14098f2560", + "type": "github" + }, + "original": { + "owner": "Misterio77", + "repo": "nix-colors", + "type": "github" + } + }, "nixinate": { "inputs": { "nixpkgs": [ @@ -797,6 +832,21 @@ "type": "indirect" } }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1655599917, + "narHash": "sha256-kjZbt5WdTrnjMxL79okg9TCoRUdADG50x/TWozbyTsE=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "5fb55578aa2f1a502d636a8ac71aece57cb730bb", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, "nixpkgs-wayland": { "flake": false, "locked": { @@ -914,6 +964,7 @@ "hyprland": "hyprland", "hyprland-contrib": "hyprland-contrib", "nil": "nil", + "nix-colors": "nix-colors", "nixinate": "nixinate", "nixos-hardware": "nixos-hardware", "nixos-persistence": "nixos-persistence", @@ -1073,11 +1124,11 @@ "webcord": "webcord_2" }, "locked": { - "lastModified": 1663692072, - "narHash": "sha256-W9y2ow4tkjFhIsPHvUuaOvawxRgxvr9hb6IMwpMoFlM=", + "lastModified": 1664817607, + "narHash": "sha256-1c9doRBUy61lrkA5MTRF4xIE9VcnBxfWUGzXMnMm0CM=", "owner": "fufexan", "repo": "webcord-flake", - "rev": "9578b63fe42746fdbf80a0364781946c8c35aca9", + "rev": "6fdcb79b9aa692acf95c2c9e05b7cd7fa426a385", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index d092671..f2496a1 100644 --- a/flake.nix +++ b/flake.nix @@ -38,6 +38,8 @@ eww.url = "github:elkowar/eww"; eww.inputs.nixpkgs.follows = "nixpkgs"; + + nix-colors.url = "github:Misterio77/nix-colors"; }; outputs = inputs: let @@ -67,6 +69,7 @@ ) allPkgs; in { + lib = tlib; nixosConfigurations = import ./hosts {inherit lib tlib inputs;}; packages = lib.mapAttrs (_: pkgs: pkgs._exported) allPkgs; diff --git a/hosts/tkaronto/modules/iwd.nix b/hosts/tkaronto/modules/iwd.nix deleted file mode 120000 index 62cc2d0..0000000 --- a/hosts/tkaronto/modules/iwd.nix +++ /dev/null @@ -1 +0,0 @@ -../../../modules/network/iwd.nix \ No newline at end of file diff --git a/hosts/tkaronto/modules/network.nix b/hosts/tkaronto/modules/network.nix new file mode 120000 index 0000000..d1730b7 --- /dev/null +++ b/hosts/tkaronto/modules/network.nix @@ -0,0 +1 @@ +../../../modules/network/default.nix \ No newline at end of file diff --git a/lib/colors.nix b/lib/colors.nix new file mode 100644 index 0000000..33a19d6 --- /dev/null +++ b/lib/colors.nix @@ -0,0 +1,71 @@ +lib: +with lib; rec { + # color-related functions + + # convert rrggbb hex to #rrggbb + x = c: "#${c}"; + + # same as x but adds an alpha channel for transparency + xrgba = c: "${c}88"; + xargb = c: "88${c}"; + + # convert rrggbb hex to rgba(r, g, b, a) css + rgba = c: let + r = toString (hexToDec (__substring 0 2 c)); + g = toString (hexToDec (__substring 2 2 c)); + b = toString (hexToDec (__substring 4 2 c)); + res = "rgba(${r}, ${g}, ${b}, 0.5)"; + in + res; + + # general stuff + + # functions copied from https://gist.github.com/corpix/f761c82c9d6fdbc1b3846b37e1020e11 + # convert a hex value to an integer + hexToDec = v: let + hexToInt = { + "0" = 0; + "1" = 1; + "2" = 2; + "3" = 3; + "4" = 4; + "5" = 5; + "6" = 6; + "7" = 7; + "8" = 8; + "9" = 9; + "a" = 10; + "b" = 11; + "c" = 12; + "d" = 13; + "e" = 14; + "f" = 15; + "A" = 10; + "B" = 11; + "C" = 12; + "D" = 13; + "E" = 14; + "F" = 15; + }; + chars = stringToCharacters v; + charsLen = length chars; + in + foldl + (a: v: a + v) + 0 + (imap0 + (k: v: hexToInt."${v}" * (pow 16 (charsLen - k - 1))) + chars); + + pow = let + pow' = base: exponent: value: + # FIXME: It will silently overflow on values > 2**62 :( + # The value will become negative or zero in this case + if exponent == 0 + then 1 + else if exponent <= 1 + then value + else (pow' base (exponent - 1) (value * base)); + in + base: exponent: pow' base exponent base; +} diff --git a/lib/default.nix b/lib/default.nix index abd7253..00310dc 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -18,4 +18,6 @@ lib.makeExtensible (self: { b.map (name: "${modules}/${name}") (b.attrNames files); in filesToImport; + + colors = import ./colors.nix lib; }) diff --git a/modules/base/hm-system-defaults.nix b/modules/base/hm-system-defaults.nix index e0925de..c44bfaa 100644 --- a/modules/base/hm-system-defaults.nix +++ b/modules/base/hm-system-defaults.nix @@ -17,6 +17,28 @@ xdg.configFile."nix/nix.conf".source = config.environment.etc."nix/nix.conf".source; # xdg.configFile."nix/netrc".source = config.environment.etc."nix/netrc".source; } + ({ + config, + pkgs, + lib, + ... + }: { + home.packages = [ + ( + pkgs.writeShellScriptBin "apply-hm-env" '' + ${lib.optionalString (config.home.sessionPath != []) '' + export PATH=${builtins.concatStringsSep ":" config.home.sessionPath}:$PATH + ''} + ${builtins.concatStringsSep "\n" (lib.mapAttrsToList (k: v: '' + export ${k}="${v}" + '') + config.home.sessionVariables)} + ${config.home.sessionVariablesExtra} + exec "$@" + '' + ) + ]; + }) ]; home-manager.extraSpecialArgs = {inherit inputs tlib;}; } diff --git a/modules/de/gnome/default.nix b/modules/de/gnome/default.nix new file mode 100644 index 0000000..d51d31c --- /dev/null +++ b/modules/de/gnome/default.nix @@ -0,0 +1,40 @@ +{lib, ...}: { + services.gnome = { + gnome-keyring.enable = true; + core-shell.enable = true; + core-os-services.enable = true; + at-spi2-core.enable = true; + chrome-gnome-shell.enable = false; + gnome-online-accounts.enable = false; + gnome-online-miners.enable = lib.mkForce false; + gnome-remote-desktop.enable = false; + core-utilities.enable = false; + tracker-miners.enable = false; + tracker.enable = false; + gnome-settings-daemon.enable = lib.mkForce false; + sushi.enable = false; + }; + services.xserver = { + enable = true; + desktopManager = { + gnome.enable = true; + xterm.enable = false; + }; + displayManager = { + autoLogin = { + enable = true; + user = "patriot"; + }; + gdm = { + enable = true; + wayland = true; + }; + startx.enable = false; + }; + }; + systemd.services = { + "getty@tty1".enable = false; + "autovt@tty1".enable = false; + }; + services.power-profiles-daemon.enable = false; +} diff --git a/modules/network/default.nix b/modules/network/default.nix index 3ffa333..589a65c 100644 --- a/modules/network/default.nix +++ b/modules/network/default.nix @@ -1,9 +1,3 @@ { - imports = [./dns]; - networking.dhcpcd.enable = true; - networking.useDHCP = false; - networking.dhcpcd.extraConfig = '' - noarp - nodelay - ''; + imports = [./networkmanager]; } diff --git a/modules/network/dns/cloudflare.nix b/modules/network/dns/cloudflare.nix index 36d6173..1191589 100644 --- a/modules/network/dns/cloudflare.nix +++ b/modules/network/dns/cloudflare.nix @@ -1,5 +1,6 @@ { networking.resolvconf.useLocalResolver = true; + networking.networkmanager.dns = "none"; services.dnscrypt-proxy2 = { enable = true; settings = { diff --git a/modules/network/iwd.nix b/modules/network/iwd/default.nix similarity index 92% rename from modules/network/iwd.nix rename to modules/network/iwd/default.nix index 5c43682..e7ebfb8 100644 --- a/modules/network/iwd.nix +++ b/modules/network/iwd/default.nix @@ -1,5 +1,4 @@ { - imports = [./dns]; networking.wireless.iwd = { enable = true; settings = { diff --git a/modules/network/networkmanager/default.nix b/modules/network/networkmanager/default.nix index 871f6ca..79b15bd 100644 --- a/modules/network/networkmanager/default.nix +++ b/modules/network/networkmanager/default.nix @@ -1,4 +1,4 @@ { - imports = [../dns]; + imports = [../dns ../iwd]; networking.networkmanager.enable = true; } diff --git a/pkgs-set/overlays/rofi-bluetooth.nix b/pkgs-set/overlays/rofi-bluetooth.nix new file mode 100644 index 0000000..0b6b4c2 --- /dev/null +++ b/pkgs-set/overlays/rofi-bluetooth.nix @@ -0,0 +1,12 @@ +final: prev: { + rofi-bluetooth-wayland = + (prev.rofi-bluetooth.override {rofi-unwrapped = final.rofi-wayland-unwrapped;}) + .overrideAttrs (old: { + src = final.fetchFromGitHub { + owner = "nickclyde"; + repo = "rofi-bluetooth"; + rev = "0c07719c428984893c46f6cfe0a56660e03ccf50"; + sha256 = "sha256-Er59/fMhcA7xCXn3abMeBlrYfDYsOBApeykR1r8XbNU="; + }; + }); +} diff --git a/users/modules/colors/default.nix b/users/modules/colors/default.nix new file mode 100644 index 0000000..e4781e5 --- /dev/null +++ b/users/modules/colors/default.nix @@ -0,0 +1,27 @@ +{lib, ...}: let + l = lib // builtins; + t = l.types; +in { + options = { + colors = { + theme = l.mkOption { + type = t.str; + }; + base = l.mkOption { + type = t.attrsOf t.str; + }; + x = l.mkOption { + type = t.attrsOf t.str; + }; + xrgba = l.mkOption { + type = t.attrsOf t.str; + }; + xargb = l.mkOption { + type = t.attrsOf t.str; + }; + rgba = l.mkOption { + type = t.attrsOf t.str; + }; + }; + }; +} diff --git a/users/modules/discord/default.nix b/users/modules/discord/default.nix index b5216c5..91c90ad 100644 --- a/users/modules/discord/default.nix +++ b/users/modules/discord/default.nix @@ -4,23 +4,18 @@ pkgs, lib, ... -}: { +}: let + theme = pkgs.fetchurl { + url = "https://raw.githubusercontent.com/catppuccin/discord/c162aee9d71a06908abf285f9a5239c6bea8b5e9/themes/mocha.theme.css"; + hash = "sha256-dPKW+Mru+KvivvobwbOgj2g8mSiSspdVOXrxbXCel8M="; + }; +in { home.persistence."${config.system.persistDir}${config.home.homeDirectory}".directories = [ ".config/WebCord" ]; home.packages = let - pkg = inputs.webcord.packages.${pkgs.system}.webcord; - in [ - ( - pkgs.runCommand pkg.name {nativeBuildInputs = [pkgs.makeWrapper];} '' - mkdir -p $out - ln -sf ${pkg}/* $out/ - rm $out/bin - mkdir $out/bin - ln -s ${pkg}/bin/webcord $out/bin/webcord - wrapProgram $out/bin/webcord \ - --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [pkgs.pipewire]}" - '' - ) - ]; + pkg = inputs.webcord.packages.${pkgs.system}.webcord.override { + flags = "--add-css-theme=${theme}"; + }; + in [pkg]; } diff --git a/users/modules/dunst/default.nix b/users/modules/dunst/default.nix new file mode 100644 index 0000000..a1fb9a1 --- /dev/null +++ b/users/modules/dunst/default.nix @@ -0,0 +1,57 @@ +{ + config, + pkgs, + ... +}: let + x = config.colors.x; +in { + # notification daemon + services.dunst = { + enable = true; + iconTheme = config.settings.iconTheme; + settings = { + global = { + alignment = "center"; + corner_radius = 16; + follow = "mouse"; + font = config.settings.font.fullName; + format = "%s\\n%b"; + frame_width = 1; + offset = "5x5"; + horizontal_padding = 8; + icon_position = "left"; + indicate_hidden = "yes"; + markup = "yes"; + max_icon_size = 64; + mouse_left_click = "do_action"; + mouse_middle_click = "close_all"; + mouse_right_click = "close_current"; + padding = 8; + plain_text = "no"; + separator_color = "auto"; + separator_height = 1; + show_indicators = false; + shrink = "no"; + word_wrap = "yes"; + }; + + fullscreen_delay_everything = {fullscreen = "delay";}; + + urgency_critical = { + background = x.base00; + foreground = x.base06; + frame_color = x.base08; + }; + urgency_low = { + background = x.base00; + foreground = x.base06; + frame_color = x.base05; + }; + urgency_normal = { + background = x.base00; + foreground = x.base06; + frame_color = x.base06; + }; + }; + }; +} diff --git a/users/modules/eww/css/_notification.scss b/users/modules/eww/css/_notification.scss new file mode 100644 index 0000000..a4dff76 --- /dev/null +++ b/users/modules/eww/css/_notification.scss @@ -0,0 +1,42 @@ +.side { + padding: 1em; + background: $bg; + border-radius: 16px; + @include wshadow; +} + +.notification { + background-color: $crust; + padding: 1rem; + border-radius: 8px; + :hover { + border: 1px solid $border; + } + + .appname { + font-size: 0.9rem; + font-weight: bold; + color: $peach; + } + + .summary { + font-size: 1.1rem; + font-weight: bold; + color: $text; + } + + .body { + color: $text; + } +} + +.notification-label { + font-size: 1.5rem; + color: $blue; +} + +.notification-action { + font-size: 2rem; + color: $text; + margin-left: 1rem; +} diff --git a/users/modules/eww/default.nix b/users/modules/eww/default.nix index f07b009..25300e2 100644 --- a/users/modules/eww/default.nix +++ b/users/modules/eww/default.nix @@ -4,35 +4,70 @@ inputs, lib, ... -}: { - home.packages = with pkgs; [ - config.wayland.windowManager.hyprland.package - config.programs.eww.package - bc - bluez - coreutils - findutils - gawk - gnused - jq - light - networkmanager - playerctl - procps - pulseaudio - ripgrep - socat - upower - wget - wireplumber - # fonts - material-icons - material-design-icons - ]; +}: let + dependencies = + config.home.packages + ++ (with pkgs; [ + config.wayland.windowManager.hyprland.package + config.programs.eww.package + bash + bc + bluez + coreutils + dbus + dunst + findutils + gawk + gnused + jq + light + networkmanager + playerctl + procps + pulseaudio + ripgrep + socat + udev + upower + wget + wireplumber + ]); +in { + imports = [../rofi-nm]; + # home.packages = [inputs.eww.packages.${pkgs.system}.eww-wayland]; + # home.file.".config/eww".source = config.lib.file.mkOutOfStoreSymlink ./.; programs.eww = { enable = true; package = inputs.eww.packages.${pkgs.system}.eww-wayland; - configDir = ./.; + # remove nix files + configDir = lib.cleanSourceWith { + filter = name: _type: let + baseName = baseNameOf (toString name); + in + !(lib.hasSuffix ".nix" baseName); + src = lib.cleanSource ./.; + }; + }; + + home.packages = with pkgs; [ + material-icons + material-design-icons + (nerdfonts.override {fonts = ["Hack"];}) + ]; + + systemd.user.services.eww = { + Unit = { + Description = "Eww Daemon"; + # not yet implemented + # PartOf = ["tray.target"]; + PartOf = ["graphical-session.target"]; + }; + Service = { + Environment = "PATH=/run/wrappers/bin:${lib.makeBinPath dependencies}"; + ExecStart = "${config.programs.eww.package}/bin/eww daemon --no-daemonize"; + Restart = "on-failure"; + }; + Install.WantedBy = ["graphical-session.target"]; }; } diff --git a/users/modules/eww/eww.scss b/users/modules/eww/eww.scss index a21d505..8b7089a 100644 --- a/users/modules/eww/eww.scss +++ b/users/modules/eww/eww.scss @@ -5,51 +5,34 @@ margin: 15px 20px 25px; } +* { + all: unset; + font-size: 1.2rem; +} + @import 'css/calendar'; @import 'css/music'; +@import 'css/notification'; @import 'css/system'; @import 'css/volume'; -* { - all: unset; - font-family: Comic Mono; - font-size: 1.3rem; -} - .bar { background-color: $bg; - border-radius: 8px; color: $fg; } .module { margin: 0 5px; } -tooltip { - background-color: $bg; - border: 1px solid $border; - border-radius: 10px; - color: $fg; +.clock { font-size: 1.4rem; } +.hour { font-weight: bold; } +.date { + label { + font-size: 1.4rem; + } - label { margin: 5px; } -} - -.clock-time-sep { - color: $fg; - font-weight: bold; -} - -.clock-date-class { + background: $bg; color: $flamingo; - margin-right: 10px; -} - -.clock-minute-class { - color: $text; - margin-right: 5px; -} - -.clock-time-class { - color: $text; - font-weight: bold; + margin-left: -1rem; + padding: 0 1rem; } .bright-icon { color: $yellow; } @@ -59,13 +42,14 @@ tooltip { } .module-ssid, -.module-net { - color: $lavender; - font-size: 1.2rem; -} - +.module-net { color: $lavender; } .module-bt { font-size: 1.2rem; } -.separ { color: $surface0; } + +.separ { + color: $surface0; + padding-bottom: 2px; + font-size: 1.5rem; +} scale trough { background-color: $bg1; @@ -75,11 +59,17 @@ scale trough { min-width: 70px; } -.ws { - margin-left: 4px; +.ws { margin-top: .4rem; } +.workspaces { margin-left: 10px; } - label { - font-size: 16px; - margin-top: 5px; - } +.launcher label { + background-color: $blue; + color: $bg; + font-family: monospace; + font-size: 1.5rem; + padding: 0 1.1rem 0 .5rem; +} + +.notif-toggle { + padding: 0 5px; } diff --git a/users/modules/eww/eww.yuck b/users/modules/eww/eww.yuck index 6dbb3d3..92135b6 100644 --- a/users/modules/eww/eww.yuck +++ b/users/modules/eww/eww.yuck @@ -11,12 +11,21 @@ (include "./windows/calendar.yuck") (include "./windows/music_win.yuck") +(include "./windows/notifications.yuck") (include "./windows/system.yuck") (include "./windows/volume_win.yuck") (defwidget sep [] (label :class "separ module" :text "|")) +(defwidget notif-toggle [] + (button + :class "notif-toggle module" + :onclick "scripts/reveal_toggle notification_rev ${EWW_CMD}"; + {notif_icons.icon})) + +; clipboard 󰅌 󰅍 󰄷 + (defwidget workspaces [] (literal :content workspace)) @@ -39,7 +48,8 @@ (mem) (bat) (sep) - (clock_module))) + (clock_module) + (notif-toggle))) (defwidget center [] (box @@ -57,8 +67,8 @@ (defwindow bar :monitor 0 :geometry (geometry :x "0%" - :y "5px" - :width "1584px" + :y "0%" + :width "100%" :height "32px" :anchor "top center") :stacking "fg" diff --git a/users/modules/eww/modules/bluetooth.yuck b/users/modules/eww/modules/bluetooth.yuck index 2f15c2c..aa9ff97 100644 --- a/users/modules/eww/modules/bluetooth.yuck +++ b/users/modules/eww/modules/bluetooth.yuck @@ -14,6 +14,6 @@ :text {bluetooth.text})) (button :class "module-bt module" - :onclick "blueman" + :onclick "rofi-bluetooth" :style "color: ${bluetooth.color};" {bluetooth.icon})))) diff --git a/users/modules/eww/modules/clock.yuck b/users/modules/eww/modules/clock.yuck index 51eb290..fa8a1b9 100644 --- a/users/modules/eww/modules/clock.yuck +++ b/users/modules/eww/modules/clock.yuck @@ -1,25 +1,25 @@ +(defvar date_rev false) + (defwidget clock_module [] (eventbox - :onhover "${EWW_CMD} update time_rev=true" - :onhoverlost "${EWW_CMD} update time_rev=false" - (box - :space-evenly "false" - :spacing "3" + :onhover "${EWW_CMD} update time_rev=false; ${EWW_CMD} update date_rev=true" + :onhoverlost "${EWW_CMD} update time_rev=false; ${EWW_CMD} update date_rev=false" + (overlay :class "module" - (label - :text {time.hour} - :class "clock-time-class") - (label - :text ":" - :class "clock-time-sep") - (label - :text {time.minute} - :class "clock-minute-class") + (box + :space-evenly "false" + (label + :text {time.hour} + :class "clock hour") + (label + :text ":" + :class "clock") + (label + :text {time.minute} + :class "clock minute")) (revealer - :transition "slideleft" - :reveal time_rev - :duration "350ms" + :reveal date_rev (button - :class "clock-date-class module" + :class "date clock" :onclick "./scripts/pop calendar" {time.date}))))) diff --git a/users/modules/eww/modules/music.yuck b/users/modules/eww/modules/music.yuck index 21fa26d..b614b76 100644 --- a/users/modules/eww/modules/music.yuck +++ b/users/modules/eww/modules/music.yuck @@ -7,16 +7,16 @@ :space-evenly "false" (box :class "song-cover-art" - :style "background-image: url(\"${cover_art}\");") + :style "background-image: url(\"${music_cover}\");") (button :class "module" :onclick "./scripts/pop music" - song_title) + {music.title}) (revealer :transition "slideright" :reveal music_reveal :duration "350ms" (box - (button :class "song-button" :onclick "playerctl previous" "⏮") - (button :class "song-button" :onclick "playerctl play-pause" song_status) - (button :class "song-button" :onclick "playerctl next" "⏭")))))) + (button :class "song-button" :onclick "playerctl previous" "") + (button :class "song-button" :onclick "playerctl play-pause" {music.status}) + (button :class "song-button" :onclick "playerctl next" "")))))) diff --git a/users/modules/eww/modules/net.yuck b/users/modules/eww/modules/net.yuck index d47dee0..a41f6f5 100644 --- a/users/modules/eww/modules/net.yuck +++ b/users/modules/eww/modules/net.yuck @@ -14,5 +14,6 @@ :text {net.essid})) (button :class "module-net module" + :onclick "rofi-nm" :style "color: ${net.color};" {net.icon})))) diff --git a/users/modules/eww/modules/variables.yuck b/users/modules/eww/modules/variables.yuck index ac200f0..edd8288 100644 --- a/users/modules/eww/modules/variables.yuck +++ b/users/modules/eww/modules/variables.yuck @@ -1,6 +1,7 @@ (defvar bright_reveal false) (defvar bt_rev false) (defvar music_reveal false) +(defvar notification_rev false) (defvar net_rev false) (defvar time_rev false) (defvar vol_reveal false) @@ -11,16 +12,10 @@ (deflisten bluetooth "scripts/bluetooth") (deflisten brightness "scripts/brightness") (deflisten memory "scripts/memory") +(deflisten music "scripts/music") +(deflisten music_cover "scripts/music cover") +(deflisten notifications "scripts/notifications") +(deflisten notif_icons :initial `{"icon": "󰆄", "toggle_icon": ""}` "scripts/notifications icons") (deflisten net "scripts/net") (deflisten volume "scripts/volume") - -(deflisten song_artist "playerctl -F metadata artist || true") -(deflisten song_title "playerctl -F metadata title || true") -(deflisten cover_art :initial "images/music.png" "scripts/music cover") -(deflisten song_status :initial "" "scripts/music status") - -(deflisten song_length "scripts/music length_time") -(deflisten song_pos :initial "0" "scripts/music position_time") -(deflisten song_pos_perc :initial "0" "scripts/music position") - (deflisten workspace "scripts/workspaces") diff --git a/users/modules/eww/scripts/battery b/users/modules/eww/scripts/battery index e48c773..7a244a0 100755 --- a/users/modules/eww/scripts/battery +++ b/users/modules/eww/scripts/battery @@ -38,7 +38,7 @@ gettime() { else EX="($FULL - $NOW) / $RATE" fi - date -u -d@$(bc -l <<< "$EX * 3600") +%H:%M + date -u -d@"$(bc -l <<< "$EX * 3600")" +%H:%M fi } @@ -48,5 +48,5 @@ while true; do STATE=$(cat /sys/class/power_supply/BAT0/status) echo '{ "percentage": '"$CAPACITY"', "wattage": "'"$(wattage)"'", "status": "'"$(status)"'", "color": "'"$(color)"'" }' - sleep 60 + sleep 3 done \ No newline at end of file diff --git a/users/modules/eww/scripts/bluetooth b/users/modules/eww/scripts/bluetooth index 89e7e7b..3f6e0c0 100755 --- a/users/modules/eww/scripts/bluetooth +++ b/users/modules/eww/scripts/bluetooth @@ -31,5 +31,5 @@ while true; do echo '{ "icon": "'"$icon"'", "text": "'"$text"'", "color": "'"$color"'" }' - sleep 10 + sleep 3 done diff --git a/users/modules/eww/scripts/memory b/users/modules/eww/scripts/memory index 7da8446..051c400 100755 --- a/users/modules/eww/scripts/memory +++ b/users/modules/eww/scripts/memory @@ -6,15 +6,15 @@ while true; do # non-human-readable freeN=$(free --mega | rg "Mem:") - total="$(echo $freeH | awk '{ print $2 }')" - used="$(echo $freeH | awk '{ print $3 }')" - t="$(echo $freeN | awk '{ print $2 }')" - u="$(echo $freeN | awk '{ print $3 }')" + total="$(echo "$freeH" | awk '{ print $2 }')" + used="$(echo "$freeH" | awk '{ print $3 }')" + t="$(echo "$freeN" | awk '{ print $2 }')" + u="$(echo "$freeN" | awk '{ print $3 }')" free=$(printf '%.1fG' "$(bc -l <<< "($t - $u) / 1000")") perc=$(printf '%.1f' "$(free -m | rg Mem | awk '{print ($3/$2)*100}')") echo '{ "total": "'"$total"'", "used": "'"$used"'", "free": "'"$free"'", "percentage": '"$perc"' }' - sleep 5 + sleep 3 done diff --git a/users/modules/eww/scripts/music b/users/modules/eww/scripts/music index 66f8058..4177634 100755 --- a/users/modules/eww/scripts/music +++ b/users/modules/eww/scripts/music @@ -1,65 +1,65 @@ #!/usr/bin/env bash get_status() { - playerctl -F status | while read -r s; do - if [ "$s" = "Playing" ]; then - echo "⏸" - else - echo "⏵" - fi - done + s=$1 + if [ "$s" = "Playing" ]; then + echo "" + else + echo "" + fi } get_length_sec() { - playerctl -F metadata mpris:length | while read -r len; do - if [ -z "$len" ]; then - echo 0 - else - bc <<< "$len / 1000000" - fi - done + len=$1 + if [ -z "$len" ]; then + echo 0 + else + bc <<< "$len / 1000000" + fi } get_length_time() { - playerctl -F metadata mpris:length | while read -r len; do - if [ -n "$len" ]; then - len=$(bc <<< "$len / 1000000") - date -d@"$len" +%M:%S - else - echo "" - fi - done + len=$1 + if [ -n "$len" ]; then + len=$(bc <<< "$len / 1000000 + 1") + date -d@"$len" +%M:%S + else + echo "" + fi } get_position() { - playerctl -F metadata -f '{{position}} {{mpris:length}}' 2>/dev/null | while read -r pos len; do - if [ -n "$pos" ]; then - bc -l <<< "$pos / $len * 100" - else - echo 0 - fi - done + pos=$1 + len=$2 + if [ -n "$pos" ]; then + bc -l <<< "$pos / $len * 100" + else + echo 0 + fi } get_position_time() { - playerctl -F metadata -f '{{position}} {{mpris:length}}' 2>/dev/null | while read -r pos len; do - if [ -n "$pos" ]; then - date -d@"$(bc -l <<< "$pos / 1000000")" +%M:%S - else - echo 0 - fi - done + pos=$1 + len=$2 + if [ -n "$pos" ]; then + date -d@"$(bc <<< "$pos / 1000000")" +%M:%S + else + echo "" + fi } get_cover() { + # COVER_URL=$1 mkdir -p "$XDG_CACHE_HOME/eww_covers" cd "$XDG_CACHE_HOME/eww_covers" || exit IMGPATH="$XDG_CACHE_HOME/eww_covers/cover_art.png" - playerctl -F metadata mpris:artUrl | while read -r COVER_URL; do + playerctl -F metadata mpris:artUrl 2>/dev/null | while read -r COVER_URL; do if [[ "$COVER_URL" = https* ]]; then - wget -N "$COVER_URL" -o /dev/null + if [ ! -e "$XDG_CACHE_HOME/eww_covers/$(basename "$COVER_URL")" ]; then + wget -N "$COVER_URL" -o /dev/null + fi rm "$IMGPATH" ln -s "$(basename "$COVER_URL")" "$IMGPATH" @@ -73,17 +73,10 @@ get_cover() { done } -## Execute accordingly -if [ "$1" = "status" ]; then - get_status -elif [ "$1" = "length" ]; then - get_length_sec -elif [ "$1" = "length_time" ]; then - get_length_time -elif [ "$1" = "position" ]; then - get_position -elif [ "$1" = "position_time" ]; then - get_position_time -elif [ "$1" = "cover" ]; then +if [ "$1" = "cover" ]; then get_cover +else + playerctl -F metadata -f '{{title}}\{{artist}}\{{status}}\{{position}}\{{mpris:length}}' 2>/dev/null | while IFS="$(printf '\\')" read -r title artist status position len; do + echo '{"artist": "'"$artist"'", "title": "'"$title"'", "status": "'"$(get_status "$status")"'", "position": "'"$(get_position "$position" "$len")"'", "position_time": "'"$(get_position_time "$position" "$len")"'", "length": "'"$(get_length_time "$len")"'"}' #, "cover": "'"$(get_cover $art)"'" + done fi diff --git a/users/modules/eww/scripts/net b/users/modules/eww/scripts/net index 050941e..8433602 100755 --- a/users/modules/eww/scripts/net +++ b/users/modules/eww/scripts/net @@ -1,20 +1,17 @@ #!/usr/bin/env bash while true; do - info="$(iwctl station wlan0 show)" - status=$(echo "$info" | awk 'FNR == 6 {print $2}') - _signal=$(echo "$info" | awk 'FNR == 13 {print $2}') - signal=${_signal#"-"} - essid=$(echo "$info" | awk 'FNR == 7 {print $3}') + status=$(nmcli g | tail -n 1 | awk '{print $1}') + signal=$(nmcli dev wifi | rg "\*" | awk '{ print $8 }') + essid=$(nmcli -t -f NAME connection show --active | head -n1) icons=("󰤯" "󰤟" "󰤢" "󰤥" "󰤨") if [ "$status" = "disconnected" ] ; then icon="" - text="" color="#988ba2" else - level=$(awk -v n="$signal" 'BEGIN{print int(n/15)}') + level=$(awk -v n="$signal" 'BEGIN{print int(n/20)}') if [ "$level" -gt 4 ]; then level=4 fi @@ -25,5 +22,5 @@ while true; do echo '{ "essid": "'"$essid"'", "icon": "'"$icon"'", "color": "'"$color"'" }' - sleep 10 + sleep 3 done \ No newline at end of file diff --git a/users/modules/eww/scripts/notifications b/users/modules/eww/scripts/notifications new file mode 100755 index 0000000..0a19182 --- /dev/null +++ b/users/modules/eww/scripts/notifications @@ -0,0 +1,79 @@ +#!/usr/bin/env bash + +tmp=$XDG_CACHE_HOME/dunst-history.json +declare ids +export toggle_icon="" + +get_ids() { + mapfile -t ids < <(dunstctl history | jq -r ".data[] | .[] | select(.appname.data != \"Spotify\") | .id.data") +} + +get_notif() { + + echo -n "(box :orientation \"v\" :space-evenly \"false\" :spacing \"10\" :halign \"start\" " + + for id in "${ids[@]}"; do + mapfile -t n < <(jq -r ".data[] | .[] | select(.id.data == $id) | .appname.data, .summary.data, .body.data" "$tmp" | sed -r '/^\s*$/d' | sed -e 's/\%/ percent/g') + echo -n "(eventbox :onclick \"dunstctl history-pop $id && dunstctl action 0 && dunstctl close\" \ + (box :class \"notification\" :orientation \"h\" :width 300 :space-evenly \"false\" \ + (box :orientation \"v\" :space-evenly \"false\" :valign \"start\" :width 300 :spacing 10 \ + (box :orientation \"h\" :space-evenly \"false\" :width 300 :spacing 10 \ + (label :xalign 0 :wrap \"true\" :class \"summary\" :text \"${n[1]}\") \ + (label :xalign 1 :wrap \"true\" :class \"appname\" :text \"${n[0]}\")) \ + (label :xalign 0 :wrap \"true\" :class \"body\" :text \"${n[2]}\"))))" + done + echo ")" +} + +toggle() { + dunstctl set-paused toggle + lock="$XDG_CACHE_HOME/dunst-toggle.lock" + + if [ ! -f "$lock" ]; then + export toggle_icon="" + touch "$lock" + else + export toggle_icon="" + rm "$lock" + fi +} + +clear() { + get_ids + for id in "${ids[@]}"; do + dunstctl history-pop "$id" + done + get_ids +} + +get_icon() { + if [ ${#ids[@]} -eq 0 ]; then + echo "󰆂" + else + echo "󰆄" + fi +} + +if [ "$1" == "toggle" ]; then + toggle + dunstctl history > "$tmp" +elif [ "$1" == "clear" ]; then + clear + dunstctl history > "$tmp" +elif [ "$1" == "icons" ]; then + dunstctl history > "$tmp" + get_ids + echo '{"toggle_icon": "'"$toggle_icon"'", "icon": "'"$(get_icon)"'"}' + tail -f "$tmp" 2>/dev/null | rg --line-buffered "aa\{sv\}" | while read -r; do + get_ids + echo '{"toggle_icon": "'"$toggle_icon"'", "icon": "'"$(get_icon)"'"}' + done +else + dunstctl history > "$tmp" + get_ids + get_notif + tail -f "$tmp" 2>/dev/null | rg --line-buffered "aa\{sv\}" | while read -r; do + get_ids + get_notif + done +fi diff --git a/users/modules/eww/scripts/reveal_toggle b/users/modules/eww/scripts/reveal_toggle new file mode 100755 index 0000000..e535023 --- /dev/null +++ b/users/modules/eww/scripts/reveal_toggle @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +if [ "$($2 get "$1")" == "true" ]; then + state="false" +else + state="true" +fi + +$2 update "$1=$state" diff --git a/users/modules/eww/scripts/workspaces b/users/modules/eww/scripts/workspaces index 0269489..897e8bd 100755 --- a/users/modules/eww/scripts/workspaces +++ b/users/modules/eww/scripts/workspaces @@ -37,7 +37,7 @@ monitor_event() { # generates the eww widget generate() { - echo -n '(eventbox :onscroll "echo {} | sed -e \"s/up/-1/g\" -e \"s/down/+1/g\" | xargs hyprctl dispatch workspace" (box :orientation "h" :class "module" :spacing 5 :space-evenly "true" ' + echo -n '(eventbox :onscroll "echo {} | sed -e \"s/up/-1/g\" -e \"s/down/+1/g\" | xargs hyprctl dispatch workspace" (box :orientation "h" :class "module workspaces" :spacing 5 :space-evenly "true" ' for i in {1..10}; do echo -n "(button :onclick \"hyprctl dispatch workspace $i\" :class \"ws\" :style \"$(status "$i")\" \"●\") " done diff --git a/users/modules/eww/windows/music_win.yuck b/users/modules/eww/windows/music_win.yuck index 0fbd970..994751a 100644 --- a/users/modules/eww/windows/music_win.yuck +++ b/users/modules/eww/windows/music_win.yuck @@ -3,42 +3,42 @@ :class "music-window" (box :class "music-cover-art" - :style "background-image: url(\"${cover_art}\");") + :style "background-image: url(\"${music_cover}\");") (box :orientation "v" :class "music-box" (label :class "music-title" :limit-width 18 - :text song_title) + :text {music.title}) (label :class "music-artist" :wrap "true" :limit-width 30 - :text song_artist) + :text {music.artist}) (centerbox :halign "center" :class "music-button-box" - (button :class "music-button" :onclick "playerctl previous" "⏮") - (button :class "music-button" :onclick "playerctl play-pause" song_status) - (button :class "music-button" :onclick "playerctl next" "⏭")) + (button :class "music-button" :onclick "playerctl previous" "") + (button :class "music-button" :onclick "playerctl play-pause" {music.status}) + (button :class "music-button" :onclick "playerctl next" "")) (box :orientation "v" (centerbox (label :xalign 0 :class "music-time" - :text song_pos) + :text {music.position_time}) (label) (label :xalign 1 :class "music-time" - :text song_length)) + :text {music.length})) (box :class "music-bar" (scale :onchange "playerctl position `bc <<< \"{} * $(playerctl metadata mpris:length) / 1000000 / 100\"`" - :value song_pos_perc)))))) + :value {music.position})))))) (defwindow music_win :stacking "fg" diff --git a/users/modules/eww/windows/notifications.yuck b/users/modules/eww/windows/notifications.yuck new file mode 100644 index 0000000..143dbbd --- /dev/null +++ b/users/modules/eww/windows/notifications.yuck @@ -0,0 +1,55 @@ +(defwindow notifications_win + :geometry + (geometry + :x "0px" + :y "0px" + :width "0px" + :height "0px" + :anchor "right center") + :stacking "fg" + :monitor "0" +(rightside)) + +(defwidget rightside [] + (revealer + :transition "slideleft" + :reveal notification_rev + :duration "350ms" + (box + :class "side" + :orientation "v" + :space-evenly "false" + :spacing "10" + :halign "center" + (box + :class "notification-header" + :orientation "h" + :space-evenly "false" + (label + :class "notification-label" + :halign "start" + :text "Notifications") + (box + :orientation "h" + :space-evenly "false" + :halign "end" + (button + :class "notification-action" + :tooltip "Refresh" + :onclick "dunstctl history > $XDG_CACHE_HOME/dunst-history.json" "") + (button + :class "notification-action" + :tooltip "Pause/Resume Notifications" + :onclick "scripts/notifications toggle" {notif_icons.toggle_icon}) + (button + :class "notification-action" + :tooltip "Clear Notifications" + :onclick "scripts/notifications clear" "󰅙"))); 󰅖 + (scroll + :vscroll "true" + :hscroll "false" + :height 840 + :width 200 + (literal + :content notifications) +)))) diff --git a/users/modules/foot/default.nix b/users/modules/foot/default.nix index da4ef3f..80195c1 100644 --- a/users/modules/foot/default.nix +++ b/users/modules/foot/default.nix @@ -1,8 +1,4 @@ -{ - config, - inputs, - ... -}: { +{config, ...}: { settings.terminal.name = "foot"; programs.foot = { enable = true; @@ -12,7 +8,26 @@ font = "${config.settings.font.name}:size=${toString config.settings.font.size}"; dpi-aware = "yes"; }; - colors = import "${inputs.self}/colors"; + colors = { + foreground = "cdd6f4"; # Text + background = "1e1e2e"; # Base + regular0 = "45475a"; # Surface 1 + regular1 = "f38ba8"; # red + regular2 = "a6e3a1"; # green + regular3 = "f9e2af"; # yellow + regular4 = "89b4fa"; # blue + regular5 = "f5c2e7"; # pink + regular6 = "94e2d5"; # teal + regular7 = "bac2de"; # Subtext 1 + bright0 = "585b70"; # Surface 2 + bright1 = "f38ba8"; # red + bright2 = "a6e3a1"; # green + bright3 = "f9e2af"; # yellow + bright4 = "89b4fa"; # blue + bright5 = "f5c2e7"; # pink + bright6 = "94e2d5"; # teal + bright7 = "a6adc8"; # Subtext 0 + }; }; }; } diff --git a/users/modules/hyprland/config.nix b/users/modules/hyprland/config.nix new file mode 100644 index 0000000..28dc894 --- /dev/null +++ b/users/modules/hyprland/config.nix @@ -0,0 +1,151 @@ +{ + config, + pkgs, + ... +}: let + run-as-service = slice: + pkgs.writeShellScript "as-systemd-transient" '' + exec ${pkgs.systemd}/bin/systemd-run \ + --slice=app-${slice}.slice \ + --property=ExitType=cgroup \ + --user \ + --wait \ + bash -lc "exec apply-hm-env $@" + ''; + launcher = "rofi"; + launcherCmd = "${launcher} -show drun"; + term = config.settings.terminal.name; +in { + wayland.windowManager.hyprland.extraConfig = '' + # should be configured per-profile + monitor=eDP-1,preferred,0x0,1.6 + monitor=HDMI-A-1,1920x1080@75,auto,1 + workspace=eDP-1,1 + workspace=HDMI-A-1,2 + + exec-once=xprop -root -f _XWAYLAND_GLOBAL_OUTPUT_SCALE 32c -set _XWAYLAND_GLOBAL_OUTPUT_SCALE 2 + exec-once=swaybg -i ~/.config/wallpaper + exec-once=eww open-many bar notifications_win + + input { + kb_layout=tr + follow_mouse=1 + force_no_accel=1 + touchpad { + natural_scroll=1 + } + } + general { + main_mod=SUPER + gaps_in=5 + gaps_out=5 + border_size=0 + } + decoration { + rounding=16 + blur=1 + blur_size=3 + blur_passes=3 + blur_new_optimizations=1 + drop_shadow=0 + shadow_ignore_window=1 + } + animations { + enabled=1 + animation=windows,1,3,default,popin 80% + animation=border,1,2,default + animation=fade,1,4,default + animation=workspaces,1,2,default,slide + } + dwindle { + pseudotile=1 + preserve_split=1 + no_gaps_when_only=1 + } + misc { + no_vfr=0 + } + + # window rules + windowrule=float,title:^(Media viewer)$ + windowrule=float,title:^(Picture-in-Picture)$ + windowrule=pin,title:^(Picture-in-Picture)$ + windowrule=float,title:^(Firefox — Sharing Indicator)$ + windowrule=move 0 0,title:^(Firefox — Sharing Indicator)$ + + # window rules for organization + windowrule=workspace 1,title:^(Firefox)$ + windowrule=workspace 2,title:^(Discord)$ + windowrule=workspace 2,title:^(WebCord)$ + windowrule=workspace 3,title:^(foot)$ + + # mouse + bindm=SUPER,mouse:272,movewindow + bindm=SUPER,mouse:273,resizewindow + bindm=SUPERALT,mouse:272,resizewindow + + # compositor binds + bind=SUPERSHIFT,E,exec,pkill Hyprland + bind=SUPER,Q,killactive, + bind=SUPER,F,fullscreen, + bind=SUPER,P,pseudo, + bind=SUPERSHIFT,T,togglefloating, + + # utilities + bind=SUPER,L,exec,swaylock + bind=SUPER,RETURN,exec, ${term} + bind=SUPER,D,exec,pkill ${launcher} || ${launcherCmd} + bind=SUPER,Escape,exec,wlogout -p layer-shell + + # media management + bind=,XF86AudioPlay,exec,playerctl play-pause + bind=,XF86AudioPrev,exec,playerctl previous + bind=,XF86AudioNext,exec,playerctl next + + # volume management + bindle=,XF86AudioRaiseVolume,exec,wpctl set-volume @DEFAULT_AUDIO_SINK@ 6%+ + bindle=,XF86AudioLowerVolume,exec,wpctl set-volume @DEFAULT_AUDIO_SINK@ 6%- + bind=,XF86AudioMute,exec,wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle + bind=,XF86AudioMicMute,exec,wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle + + # brightness management + bind=,XF86MonBrightnessUp,exec,light -A 5 + bind=,XF86MonBrightnessDown,exec,light -U 5 + + # move focus + bind=SUPER,left,movefocus,l + bind=SUPER,right,movefocus,r + bind=SUPER,up,movefocus,u + bind=SUPER,down,movefocus,d + + # cycle workspaces + bind=SUPER,bracketleft,workspace,m-1 + bind=SUPER,bracketright,workspace,m+1 + + # cycle monitors + bind=SUPERSHIFT,braceleft,focusmonitor,l + bind=SUPERSHIFT,braceright,focusmonitor,r + + # workspaces + ${builtins.concatStringsSep "\n" (builtins.genList ( + x: let + ws = let + c = (x + 1) / 10; + in + builtins.toString (x + 1 - (c * 10)); + in '' + bind=SUPER,${ws},workspace,${toString (x + 1)} + bind=SHIFTSUPER,${ws},movetoworkspacesilent,${toString (x + 1)} + '' + ) + 10)} + + # screenshot + bind=,Print,exec,grimblast --notify copysave area + bind=SUPERSHIFT,R,exec,grimblast --notify copysave area + bind=CTRL,Print,exec,grimblast --notify --cursor copysave output + bind=SUPERSHIFTCTRL,R,exec,grimblast --notify --cursor copysave output + bind=ALT,Print,exec,grimblast --notify --cursor copysave screen + bind=SUPERSHIFTALT,R,exec,grimblast --notify --cursor copysave screen + ''; +} diff --git a/users/modules/hyprland/default.nix b/users/modules/hyprland/default.nix index 43e2a0d..6d69e43 100644 --- a/users/modules/hyprland/default.nix +++ b/users/modules/hyprland/default.nix @@ -8,11 +8,17 @@ ../wayland ../swaylock ../wlsunset - ./swayidle.nix ../eww + ../foot + ../dunst + ../rofi + ./swayidle.nix + ./config.nix inputs.hyprland.homeManagerModules.default ]; + home.sessionVariables.GDK_SCALE = "2"; + home.packages = with pkgs; [ wf-recorder xorg.xprop @@ -26,136 +32,5 @@ wayland.windowManager.hyprland = { enable = true; package = inputs.hyprland.packages.${pkgs.system}.hyprland; - extraConfig = let - launcher = "rofi -show drun"; - term = config.settings.terminal.name; - - notify-date = with pkgs; - writers.writeBash "notify-date" '' - ${libnotify}/bin/notify-send -t 1000 " $(${coreutils}/bin/date +'%H:%M %d/%m/%Y')" - ''; - in '' - # should be configured per-profile - monitor=eDP-1,preferred,0x0,1.6 - monitor=HDMI-A-1,1920x1080@75,auto,1 - workspace=eDP-1,1 - workspace=HDMI-A-1,2 - - exec-once=xprop -root -f _XWAYLAND_GLOBAL_OUTPUT_SCALE 32c -set _XWAYLAND_GLOBAL_OUTPUT_SCALE 2 - exec-once=swaybg -i ~/.config/wallpaper - exec-once=eww daemon - exec-once=eww open bar - - input { - kb_layout=tr - follow_mouse=1 - force_no_accel=1 - touchpad { - natural_scroll=1 - } - } - general { - main_mod=SUPER - gaps_in=5 - gaps_out=5 - border_size=0 - } - decoration { - rounding=16 - blur=1 - blur_size=3 - blur_passes=3 - blur_new_optimizations=1 - drop_shadow=0 - shadow_ignore_window=1 - } - animations { - enabled=1 - animation=windows,1,3,default,popin 80% - animation=border,1,2,default - animation=fade,1,2,default - animation=workspaces,1,2,default,slide - } - dwindle { - pseudotile=0 # enable pseudotiling on dwindle - } - misc { - no_vfr=0 - } - - windowrule=float,title:^(Media viewer)$ - windowrule=float,title:^(Picture-in-Picture)$ - windowrule=float,title:^(Firefox — Sharing Indicator)$ - windowrule=move 0 0,title:^(Firefox — Sharing Indicator)$ - - - bind=SUPER,Escape,exec,wlogout -p layer-shell - bind=SUPER,L,exec,swaylock - bind=SUPER,RETURN,exec,${term} - bind=SUPER,D,exec,${launcher} - bind=SUPER,Q,killactive, - bind=SUPERSHIFT,E,exec,pkill Hyprland - bind=SUPER,F,fullscreen, - bind=SUPER,P,pseudo, - bind=SUPER,T,exec,${notify-date} - bind=SUPERSHIFT,T,togglefloating, - - bind=,XF86AudioPlay,exec,playerctl play-pause - bind=,XF86AudioPrev,exec,playerctl previous - bind=,XF86AudioNext,exec,playerctl next - - bindle=,XF86AudioRaiseVolume,exec,wpctl set-volume @DEFAULT_AUDIO_SINK@ 6%+ - bindle=,XF86AudioLowerVolume,exec,wpctl set-volume @DEFAULT_AUDIO_SINK@ 6%- - bind=,XF86AudioMute,exec,wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle - bind=,XF86AudioMicMute,exec,wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle - - bind=,XF86MonBrightnessUp,exec,light -A 5 - bind=,XF86MonBrightnessDown,exec,light -U 5 - - # move focus - bind=SUPER,left,movefocus,l - bind=SUPER,right,movefocus,r - bind=SUPER,up,movefocus,u - bind=SUPER,down,movefocus,d - - # go to workspace - bind=SUPER,1,workspace,1 - bind=SUPER,2,workspace,2 - bind=SUPER,3,workspace,3 - bind=SUPER,4,workspace,4 - bind=SUPER,5,workspace,5 - bind=SUPER,6,workspace,6 - bind=SUPER,7,workspace,7 - bind=SUPER,8,workspace,8 - bind=SUPER,9,workspace,9 - bind=SUPER,0,workspace,10 - - # cycle workspaces - bind=SUPER,bracketleft,workspace,m-1 - bind=SUPER,bracketright,workspace,m+1 - - # cycle monitors - bind=SUPERSHIFT,braceleft,focusmonitor,l - bind=SUPERSHIFT,braceright,focusmonitor,r - - # move to workspace - bind=SUPERSHIFT,1,movetoworkspace,1 - bind=SUPERSHIFT,2,movetoworkspace,2 - bind=SUPERSHIFT,3,movetoworkspace,3 - bind=SUPERSHIFT,4,movetoworkspace,4 - bind=SUPERSHIFT,5,movetoworkspace,5 - bind=SUPERSHIFT,6,movetoworkspace,6 - bind=SUPERSHIFT,7,movetoworkspace,7 - bind=SUPERSHIFT,8,movetoworkspace,8 - bind=SUPERSHIFT,9,movetoworkspace,9 - - # screenshot - bind=,Print,exec,grimblast --notify copysave area - bind=SUPERSHIFT,R,exec,grimblast --notify copysave area - bind=CTRL,Print,exec,grimblast --notify --cursor copysave output - bind=SUPERSHIFTCTRL,R,exec,grimblast --notify --cursor copysave output - bind=ALT,Print,exec,grimblast --notify --cursor copysave screen - bind=SUPERSHIFTALT,R,exec,grimblast --notify --cursor copysave screen - ''; }; } diff --git a/users/modules/mako/default.nix b/users/modules/mako/default.nix index f0a982b..2835370 100644 --- a/users/modules/mako/default.nix +++ b/users/modules/mako/default.nix @@ -6,7 +6,7 @@ programs.mako = { enable = true; anchor = "top-center"; - font = "${config.settings.font.name} ${toString config.settings.font.size}"; + font = config.settings.font.fullName; borderRadius = 16; extraConfig = builtins.readFile ( builtins.fetchurl { diff --git a/users/modules/rofi-nm/default.nix b/users/modules/rofi-nm/default.nix new file mode 100644 index 0000000..66387ec --- /dev/null +++ b/users/modules/rofi-nm/default.nix @@ -0,0 +1,136 @@ +{ + config, + pkgs, + ... +}: let + rofi-nm = pkgs.fetchurl { + url = "https://raw.githubusercontent.com/P3rf/rofi-network-manager/1daa69406c9b6539a4744eafb0d5bb8afdc80e9b/rofi-network-manager.sh"; + hash = "sha256:1nlnjmk5b743j5826z2nzfvjwk0fmbf7gk38darby93kdr3nv5zx"; + }; +in { + xdg.configFile = { + "rofi-nm/rofi-nm.sh" = { + source = pkgs.runCommandLocal "rofi-nm" {} '' + cp --no-preserve=mode,ownership ${rofi-nm} rofi-nm.sh + substituteInPlace rofi-nm.sh \ + --replace "#!/bin/bash" "#!${pkgs.stdenv.shell}" \ + --replace "grep" "${pkgs.gnugrep}/bin/grep" + mv rofi-nm.sh $out + ''; + executable = true; + }; + "rofi-nm/rofi-network-manager.conf".text = '' + LOCATION=3 + WIDTH_FIX_MAIN=10 + WIDTH_FIX_STATUS=10 + ''; + "rofi-nm/rofi-network-manager.rasi".text = '' + configuration { + show-icons: false; + sidebar-mode: false; + hover-select: true; + me-select-entry: ""; + me-accept-entry: [MousePrimary]; + } + + * { + font: "${config.settings.font.fullName}"; + } + + @theme "catppuccin" + + element-text, element-icon , mode-switcher { + background-color: inherit; + text-color: inherit; + } + + window { + height: 40%; + width: 40%; + border: 3px; + border-color: @border-col; + background-color: @bg-col; + } + + mainbox { + background-color: @bg-col; + } + + inputbar { + children: [prompt,entry]; + background-color: @bg-col; + border-radius: 5px; + padding: 2px; + } + + prompt { + background-color: @blue; + padding: 6px; + text-color: @bg-col; + border-radius: 3px; + margin: 20px 0px 0px 20px; + } + + textbox-prompt-colon { + expand: false; + str: ":"; + } + + entry { + placeholder: ""; + padding: 6px; + margin: 20px 0px 0px 10px; + text-color: @fg-col; + background-color: @bg-col; + } + + listview { + border: 0px 0px 0px; + padding: 6px 0px 0px; + margin: 10px 0px 0px 20px; + columns: 1; + background-color: @bg-col; + } + + element { + padding: 5px; + background-color: @bg-col; + text-color: @fg-col ; + } + + element-icon { + size: 25px; + } + + element selected { + background-color: @selected-col ; + text-color: @fg-col2 ; + } + + mode-switcher { + spacing: 0; + } + + button { + padding: 10px; + background-color: @bg-col-light; + text-color: @grey; + vertical-align: 0.5; + horizontal-align: 0.5; + } + + button selected { + background-color: @bg-col; + text-color: @blue; + } + ''; + }; + + home.packages = [ + ( + pkgs.writeShellScriptBin "rofi-nm" '' + ${config.home.homeDirectory}/.config/rofi-nm/rofi-nm.sh + '' + ) + ]; +} diff --git a/users/modules/rofi/default.nix b/users/modules/rofi/default.nix index cb260eb..8738163 100644 --- a/users/modules/rofi/default.nix +++ b/users/modules/rofi/default.nix @@ -16,7 +16,7 @@ configuration{ modi: "drun"; lines: 5; - font: "${config.settings.font.name} ${toString config.settings.font.size}"; + font: "${config.settings.font.fullName}"; show-icons: true; terminal: "st"; drun-display-format: "{icon} {name}"; @@ -38,7 +38,8 @@ } window { - height: 360px; + height: 40%; + width: 40%; border: 3px; border-color: @border-col; background-color: @bg-col; diff --git a/users/modules/settings/default.nix b/users/modules/settings/default.nix index 4e2b100..ec953b4 100644 --- a/users/modules/settings/default.nix +++ b/users/modules/settings/default.nix @@ -3,38 +3,47 @@ lib, ... }: let + l = lib // builtins; + t = l.types; cfg = config.settings; - inherit - (lib) - types - mkOption - mkIf - ; in { options = { + settings.iconTheme = { + name = l.mkOption { + type = t.str; + }; + package = l.mkOption { + type = t.package; + }; + }; settings.terminal = { - name = mkOption { - type = types.str; + name = l.mkOption { + type = t.str; }; }; settings.font = { - enable = mkOption { - type = types.bool; + enable = l.mkOption { + type = t.bool; default = false; }; - name = mkOption { - type = types.str; + name = l.mkOption { + type = t.str; }; - package = mkOption { - type = types.package; + package = l.mkOption { + type = t.package; }; - size = mkOption { - type = types.ints.unsigned; + size = l.mkOption { + type = t.ints.unsigned; + }; + fullName = l.mkOption { + type = t.str; + readOnly = true; }; }; }; - config = mkIf cfg.font.enable { + config = l.mkIf cfg.font.enable { home.packages = [cfg.font.package]; + settings.font.fullName = "${cfg.font.name} ${toString cfg.font.size}"; }; } diff --git a/users/modules/wayland/default.nix b/users/modules/wayland/default.nix index c14c955..242b353 100644 --- a/users/modules/wayland/default.nix +++ b/users/modules/wayland/default.nix @@ -7,6 +7,5 @@ NIXOS_OZONE_WL = "1"; MOZ_ENABLE_WAYLAND = "1"; XDG_SESSION_TYPE = "wayland"; - GDK_SCALE = "2"; }; } diff --git a/users/patriot/colors.nix b/users/patriot/colors.nix new file mode 100644 index 0000000..b6a7f59 --- /dev/null +++ b/users/patriot/colors.nix @@ -0,0 +1,25 @@ +{ + lib, + tlib, + inputs, + ... +}: let + l = lib; + theme = "catppuccin"; + colors = with tlib.colors; let + baseColors = inputs.nix-colors.colorSchemes.${theme}.colors; + in { + base = baseColors; + # #RRGGBB + x = l.mapAttrs (_: x) baseColors; + # #RRGGBBAA + xrgba = l.mapAttrs (_: xrgba) baseColors; + # #AARRGGBB + xargb = l.mapAttrs (_: xargb) baseColors; + # rgba(,,,) colors (css) + rgba = l.mapAttrs (_: rgba) baseColors; + }; +in { + imports = [../modules/colors]; + config.colors = colors // {inherit theme;}; +} diff --git a/users/patriot/default.nix b/users/patriot/default.nix index 7da65b4..35d72e1 100644 --- a/users/patriot/default.nix +++ b/users/patriot/default.nix @@ -19,6 +19,7 @@ in { "adbusers" "dialout" "video" + (l.optional nixosConfig.networking.networkmanager.enable "networkmanager") (l.optional nixosConfig.virtualisation.docker.enable "docker") ]; shell = pkgs.zsh; @@ -32,7 +33,7 @@ in { "/home/patriot/games" "/home/patriot/.var" ]; - systemPackages = [pkgs.qt5.qtwayland]; + systemPackages = with pkgs; [qt5.qtwayland]; shells = with pkgs; [bashInteractive zsh]; }; xdg.portal = { @@ -41,8 +42,6 @@ in { wlr.settings.screencast = { output_name = "eDP-1"; max_fps = 60; - exec_before = "pkill mako"; - exec_after = "mako"; chooser_type = "default"; }; }; @@ -97,8 +96,10 @@ in { in { imports = let modulesToEnable = l.flatten [ + # wm + ["hyprland"] # desktop stuff - ["firefox" "hyprland" "foot" "rofi" "mako" "discord"] + ["firefox" "discord"] # cli stuff ["zoxide" "zsh" "fzf" "starship" "direnv"] # dev stuff @@ -106,6 +107,7 @@ in { ]; in l.flatten [ + ./colors.nix ../../modules/persist inputs.nixos-persistence.nixosModules.home-manager.impermanence (tlib.prefixStrings "${inputs.self}/users/modules/" modulesToEnable) @@ -156,9 +158,14 @@ in { package = pkgs.comic-mono; }; + settings.iconTheme = { + name = "Papirus-Dark"; + package = pkgs.papirus-icon-theme; + }; + home.pointerCursor = { - package = pkgs.quintom-cursor-theme; - name = "Quintom_Ink"; + package = pkgs.bibata-cursors; + name = "Bibata-Modern-Classic"; size = 24; gtk.enable = true; x11.enable = true; @@ -173,10 +180,7 @@ in { gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc"; - iconTheme = { - name = "Papirus-Dark"; - package = pkgs.papirus-icon-theme; - }; + iconTheme = config.settings.iconTheme; theme = { name = "Catppuccin-Orange-Dark-Compact"; @@ -215,6 +219,8 @@ in { GH_TOKEN=${secrets.githubToken} ${gh}/bin/gh $@ '' ) + obs-studio + rofi-bluetooth-wayland ]; }; programs = {