This commit is contained in:
dusk 2022-10-04 02:08:44 +03:00
parent b13eb72db0
commit a1490e90b7
Signed by: dusk
GPG Key ID: 1D8F8FAF2294D6EA
47 changed files with 1077 additions and 402 deletions

View File

@ -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
}

View File

@ -1 +0,0 @@
catppuccin_mocha.nix

View File

@ -24,6 +24,22 @@
"type": "github" "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": { "bernbot": {
"inputs": { "inputs": {
"nci": "nci", "nci": "nci",
@ -734,6 +750,25 @@
"type": "github" "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": { "nixinate": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -797,6 +832,21 @@
"type": "indirect" "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": { "nixpkgs-wayland": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -914,6 +964,7 @@
"hyprland": "hyprland", "hyprland": "hyprland",
"hyprland-contrib": "hyprland-contrib", "hyprland-contrib": "hyprland-contrib",
"nil": "nil", "nil": "nil",
"nix-colors": "nix-colors",
"nixinate": "nixinate", "nixinate": "nixinate",
"nixos-hardware": "nixos-hardware", "nixos-hardware": "nixos-hardware",
"nixos-persistence": "nixos-persistence", "nixos-persistence": "nixos-persistence",
@ -1073,11 +1124,11 @@
"webcord": "webcord_2" "webcord": "webcord_2"
}, },
"locked": { "locked": {
"lastModified": 1663692072, "lastModified": 1664817607,
"narHash": "sha256-W9y2ow4tkjFhIsPHvUuaOvawxRgxvr9hb6IMwpMoFlM=", "narHash": "sha256-1c9doRBUy61lrkA5MTRF4xIE9VcnBxfWUGzXMnMm0CM=",
"owner": "fufexan", "owner": "fufexan",
"repo": "webcord-flake", "repo": "webcord-flake",
"rev": "9578b63fe42746fdbf80a0364781946c8c35aca9", "rev": "6fdcb79b9aa692acf95c2c9e05b7cd7fa426a385",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -38,6 +38,8 @@
eww.url = "github:elkowar/eww"; eww.url = "github:elkowar/eww";
eww.inputs.nixpkgs.follows = "nixpkgs"; eww.inputs.nixpkgs.follows = "nixpkgs";
nix-colors.url = "github:Misterio77/nix-colors";
}; };
outputs = inputs: let outputs = inputs: let
@ -67,6 +69,7 @@
) )
allPkgs; allPkgs;
in { in {
lib = tlib;
nixosConfigurations = import ./hosts {inherit lib tlib inputs;}; nixosConfigurations = import ./hosts {inherit lib tlib inputs;};
packages = lib.mapAttrs (_: pkgs: pkgs._exported) allPkgs; packages = lib.mapAttrs (_: pkgs: pkgs._exported) allPkgs;

View File

@ -1 +0,0 @@
../../../modules/network/iwd.nix

View File

@ -0,0 +1 @@
../../../modules/network/default.nix

71
lib/colors.nix Normal file
View File

@ -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;
}

View File

@ -18,4 +18,6 @@ lib.makeExtensible (self: {
b.map (name: "${modules}/${name}") (b.attrNames files); b.map (name: "${modules}/${name}") (b.attrNames files);
in in
filesToImport; filesToImport;
colors = import ./colors.nix lib;
}) })

View File

@ -17,6 +17,28 @@
xdg.configFile."nix/nix.conf".source = config.environment.etc."nix/nix.conf".source; xdg.configFile."nix/nix.conf".source = config.environment.etc."nix/nix.conf".source;
# xdg.configFile."nix/netrc".source = config.environment.etc."nix/netrc".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;}; home-manager.extraSpecialArgs = {inherit inputs tlib;};
} }

View File

@ -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;
}

View File

@ -1,9 +1,3 @@
{ {
imports = [./dns]; imports = [./networkmanager];
networking.dhcpcd.enable = true;
networking.useDHCP = false;
networking.dhcpcd.extraConfig = ''
noarp
nodelay
'';
} }

View File

@ -1,5 +1,6 @@
{ {
networking.resolvconf.useLocalResolver = true; networking.resolvconf.useLocalResolver = true;
networking.networkmanager.dns = "none";
services.dnscrypt-proxy2 = { services.dnscrypt-proxy2 = {
enable = true; enable = true;
settings = { settings = {

View File

@ -1,5 +1,4 @@
{ {
imports = [./dns];
networking.wireless.iwd = { networking.wireless.iwd = {
enable = true; enable = true;
settings = { settings = {

View File

@ -1,4 +1,4 @@
{ {
imports = [../dns]; imports = [../dns ../iwd];
networking.networkmanager.enable = true; networking.networkmanager.enable = true;
} }

View File

@ -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=";
};
});
}

View File

@ -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;
};
};
};
}

View File

@ -4,23 +4,18 @@
pkgs, pkgs,
lib, 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 = [ home.persistence."${config.system.persistDir}${config.home.homeDirectory}".directories = [
".config/WebCord" ".config/WebCord"
]; ];
home.packages = let home.packages = let
pkg = inputs.webcord.packages.${pkgs.system}.webcord; pkg = inputs.webcord.packages.${pkgs.system}.webcord.override {
in [ flags = "--add-css-theme=${theme}";
( };
pkgs.runCommand pkg.name {nativeBuildInputs = [pkgs.makeWrapper];} '' in [pkg];
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]}"
''
)
];
} }

View File

@ -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 = "<b>%s</b>\\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;
};
};
};
}

View File

@ -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;
}

View File

@ -4,35 +4,70 @@
inputs, inputs,
lib, lib,
... ...
}: { }: let
home.packages = with pkgs; [ dependencies =
config.wayland.windowManager.hyprland.package config.home.packages
config.programs.eww.package ++ (with pkgs; [
bc config.wayland.windowManager.hyprland.package
bluez config.programs.eww.package
coreutils bash
findutils bc
gawk bluez
gnused coreutils
jq dbus
light dunst
networkmanager findutils
playerctl gawk
procps gnused
pulseaudio jq
ripgrep light
socat networkmanager
upower playerctl
wget procps
wireplumber pulseaudio
# fonts ripgrep
material-icons socat
material-design-icons 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 = { programs.eww = {
enable = true; enable = true;
package = inputs.eww.packages.${pkgs.system}.eww-wayland; 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"];
}; };
} }

View File

@ -5,51 +5,34 @@
margin: 15px 20px 25px; margin: 15px 20px 25px;
} }
* {
all: unset;
font-size: 1.2rem;
}
@import 'css/calendar'; @import 'css/calendar';
@import 'css/music'; @import 'css/music';
@import 'css/notification';
@import 'css/system'; @import 'css/system';
@import 'css/volume'; @import 'css/volume';
* {
all: unset;
font-family: Comic Mono;
font-size: 1.3rem;
}
.bar { .bar {
background-color: $bg; background-color: $bg;
border-radius: 8px;
color: $fg; color: $fg;
} }
.module { margin: 0 5px; } .module { margin: 0 5px; }
tooltip { .clock { font-size: 1.4rem; }
background-color: $bg; .hour { font-weight: bold; }
border: 1px solid $border; .date {
border-radius: 10px; label {
color: $fg; font-size: 1.4rem;
}
label { margin: 5px; } background: $bg;
}
.clock-time-sep {
color: $fg;
font-weight: bold;
}
.clock-date-class {
color: $flamingo; color: $flamingo;
margin-right: 10px; margin-left: -1rem;
} padding: 0 1rem;
.clock-minute-class {
color: $text;
margin-right: 5px;
}
.clock-time-class {
color: $text;
font-weight: bold;
} }
.bright-icon { color: $yellow; } .bright-icon { color: $yellow; }
@ -59,13 +42,14 @@ tooltip {
} }
.module-ssid, .module-ssid,
.module-net { .module-net { color: $lavender; }
color: $lavender;
font-size: 1.2rem;
}
.module-bt { font-size: 1.2rem; } .module-bt { font-size: 1.2rem; }
.separ { color: $surface0; }
.separ {
color: $surface0;
padding-bottom: 2px;
font-size: 1.5rem;
}
scale trough { scale trough {
background-color: $bg1; background-color: $bg1;
@ -75,11 +59,17 @@ scale trough {
min-width: 70px; min-width: 70px;
} }
.ws { .ws { margin-top: .4rem; }
margin-left: 4px; .workspaces { margin-left: 10px; }
label { .launcher label {
font-size: 16px; background-color: $blue;
margin-top: 5px; color: $bg;
} font-family: monospace;
font-size: 1.5rem;
padding: 0 1.1rem 0 .5rem;
}
.notif-toggle {
padding: 0 5px;
} }

View File

@ -11,12 +11,21 @@
(include "./windows/calendar.yuck") (include "./windows/calendar.yuck")
(include "./windows/music_win.yuck") (include "./windows/music_win.yuck")
(include "./windows/notifications.yuck")
(include "./windows/system.yuck") (include "./windows/system.yuck")
(include "./windows/volume_win.yuck") (include "./windows/volume_win.yuck")
(defwidget sep [] (defwidget sep []
(label :class "separ module" :text "|")) (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 [] (defwidget workspaces []
(literal :content workspace)) (literal :content workspace))
@ -39,7 +48,8 @@
(mem) (mem)
(bat) (bat)
(sep) (sep)
(clock_module))) (clock_module)
(notif-toggle)))
(defwidget center [] (defwidget center []
(box (box
@ -57,8 +67,8 @@
(defwindow bar (defwindow bar
:monitor 0 :monitor 0
:geometry (geometry :x "0%" :geometry (geometry :x "0%"
:y "5px" :y "0%"
:width "1584px" :width "100%"
:height "32px" :height "32px"
:anchor "top center") :anchor "top center")
:stacking "fg" :stacking "fg"

View File

@ -14,6 +14,6 @@
:text {bluetooth.text})) :text {bluetooth.text}))
(button (button
:class "module-bt module" :class "module-bt module"
:onclick "blueman" :onclick "rofi-bluetooth"
:style "color: ${bluetooth.color};" :style "color: ${bluetooth.color};"
{bluetooth.icon})))) {bluetooth.icon}))))

View File

@ -1,25 +1,25 @@
(defvar date_rev false)
(defwidget clock_module [] (defwidget clock_module []
(eventbox (eventbox
:onhover "${EWW_CMD} update time_rev=true" :onhover "${EWW_CMD} update time_rev=false; ${EWW_CMD} update date_rev=true"
:onhoverlost "${EWW_CMD} update time_rev=false" :onhoverlost "${EWW_CMD} update time_rev=false; ${EWW_CMD} update date_rev=false"
(box (overlay
:space-evenly "false"
:spacing "3"
:class "module" :class "module"
(label (box
:text {time.hour} :space-evenly "false"
:class "clock-time-class") (label
(label :text {time.hour}
:text ":" :class "clock hour")
:class "clock-time-sep") (label
(label :text ":"
:text {time.minute} :class "clock")
:class "clock-minute-class") (label
:text {time.minute}
:class "clock minute"))
(revealer (revealer
:transition "slideleft" :reveal date_rev
:reveal time_rev
:duration "350ms"
(button (button
:class "clock-date-class module" :class "date clock"
:onclick "./scripts/pop calendar" :onclick "./scripts/pop calendar"
{time.date}))))) {time.date})))))

View File

@ -7,16 +7,16 @@
:space-evenly "false" :space-evenly "false"
(box (box
:class "song-cover-art" :class "song-cover-art"
:style "background-image: url(\"${cover_art}\");") :style "background-image: url(\"${music_cover}\");")
(button (button
:class "module" :class "module"
:onclick "./scripts/pop music" :onclick "./scripts/pop music"
song_title) {music.title})
(revealer (revealer
:transition "slideright" :transition "slideright"
:reveal music_reveal :reveal music_reveal
:duration "350ms" :duration "350ms"
(box (box
(button :class "song-button" :onclick "playerctl previous" "") (button :class "song-button" :onclick "playerctl previous" "")
(button :class "song-button" :onclick "playerctl play-pause" song_status) (button :class "song-button" :onclick "playerctl play-pause" {music.status})
(button :class "song-button" :onclick "playerctl next" "")))))) (button :class "song-button" :onclick "playerctl next" ""))))))

View File

@ -14,5 +14,6 @@
:text {net.essid})) :text {net.essid}))
(button (button
:class "module-net module" :class "module-net module"
:onclick "rofi-nm"
:style "color: ${net.color};" :style "color: ${net.color};"
{net.icon})))) {net.icon}))))

View File

@ -1,6 +1,7 @@
(defvar bright_reveal false) (defvar bright_reveal false)
(defvar bt_rev false) (defvar bt_rev false)
(defvar music_reveal false) (defvar music_reveal false)
(defvar notification_rev false)
(defvar net_rev false) (defvar net_rev false)
(defvar time_rev false) (defvar time_rev false)
(defvar vol_reveal false) (defvar vol_reveal false)
@ -11,16 +12,10 @@
(deflisten bluetooth "scripts/bluetooth") (deflisten bluetooth "scripts/bluetooth")
(deflisten brightness "scripts/brightness") (deflisten brightness "scripts/brightness")
(deflisten memory "scripts/memory") (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 net "scripts/net")
(deflisten volume "scripts/volume") (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") (deflisten workspace "scripts/workspaces")

View File

@ -38,7 +38,7 @@ gettime() {
else else
EX="($FULL - $NOW) / $RATE" EX="($FULL - $NOW) / $RATE"
fi fi
date -u -d@$(bc -l <<< "$EX * 3600") +%H:%M date -u -d@"$(bc -l <<< "$EX * 3600")" +%H:%M
fi fi
} }
@ -48,5 +48,5 @@ while true; do
STATE=$(cat /sys/class/power_supply/BAT0/status) STATE=$(cat /sys/class/power_supply/BAT0/status)
echo '{ "percentage": '"$CAPACITY"', "wattage": "'"$(wattage)"'", "status": "'"$(status)"'", "color": "'"$(color)"'" }' echo '{ "percentage": '"$CAPACITY"', "wattage": "'"$(wattage)"'", "status": "'"$(status)"'", "color": "'"$(color)"'" }'
sleep 60 sleep 3
done done

View File

@ -31,5 +31,5 @@ while true; do
echo '{ "icon": "'"$icon"'", "text": "'"$text"'", "color": "'"$color"'" }' echo '{ "icon": "'"$icon"'", "text": "'"$text"'", "color": "'"$color"'" }'
sleep 10 sleep 3
done done

View File

@ -6,15 +6,15 @@ while true; do
# non-human-readable # non-human-readable
freeN=$(free --mega | rg "Mem:") freeN=$(free --mega | rg "Mem:")
total="$(echo $freeH | awk '{ print $2 }')" total="$(echo "$freeH" | awk '{ print $2 }')"
used="$(echo $freeH | awk '{ print $3 }')" used="$(echo "$freeH" | awk '{ print $3 }')"
t="$(echo $freeN | awk '{ print $2 }')" t="$(echo "$freeN" | awk '{ print $2 }')"
u="$(echo $freeN | awk '{ print $3 }')" u="$(echo "$freeN" | awk '{ print $3 }')"
free=$(printf '%.1fG' "$(bc -l <<< "($t - $u) / 1000")") free=$(printf '%.1fG' "$(bc -l <<< "($t - $u) / 1000")")
perc=$(printf '%.1f' "$(free -m | rg Mem | awk '{print ($3/$2)*100}')") perc=$(printf '%.1f' "$(free -m | rg Mem | awk '{print ($3/$2)*100}')")
echo '{ "total": "'"$total"'", "used": "'"$used"'", "free": "'"$free"'", "percentage": '"$perc"' }' echo '{ "total": "'"$total"'", "used": "'"$used"'", "free": "'"$free"'", "percentage": '"$perc"' }'
sleep 5 sleep 3
done done

View File

@ -1,65 +1,65 @@
#!/usr/bin/env bash #!/usr/bin/env bash
get_status() { get_status() {
playerctl -F status | while read -r s; do s=$1
if [ "$s" = "Playing" ]; then if [ "$s" = "Playing" ]; then
echo "⏸" echo ""
else else
echo "⏵" echo ""
fi fi
done
} }
get_length_sec() { get_length_sec() {
playerctl -F metadata mpris:length | while read -r len; do len=$1
if [ -z "$len" ]; then if [ -z "$len" ]; then
echo 0 echo 0
else else
bc <<< "$len / 1000000" bc <<< "$len / 1000000"
fi fi
done
} }
get_length_time() { get_length_time() {
playerctl -F metadata mpris:length | while read -r len; do len=$1
if [ -n "$len" ]; then if [ -n "$len" ]; then
len=$(bc <<< "$len / 1000000") len=$(bc <<< "$len / 1000000 + 1")
date -d@"$len" +%M:%S date -d@"$len" +%M:%S
else else
echo "" echo ""
fi fi
done
} }
get_position() { get_position() {
playerctl -F metadata -f '{{position}} {{mpris:length}}' 2>/dev/null | while read -r pos len; do pos=$1
if [ -n "$pos" ]; then len=$2
bc -l <<< "$pos / $len * 100" if [ -n "$pos" ]; then
else bc -l <<< "$pos / $len * 100"
echo 0 else
fi echo 0
done fi
} }
get_position_time() { get_position_time() {
playerctl -F metadata -f '{{position}} {{mpris:length}}' 2>/dev/null | while read -r pos len; do pos=$1
if [ -n "$pos" ]; then len=$2
date -d@"$(bc -l <<< "$pos / 1000000")" +%M:%S if [ -n "$pos" ]; then
else date -d@"$(bc <<< "$pos / 1000000")" +%M:%S
echo 0 else
fi echo ""
done fi
} }
get_cover() { get_cover() {
# COVER_URL=$1
mkdir -p "$XDG_CACHE_HOME/eww_covers" mkdir -p "$XDG_CACHE_HOME/eww_covers"
cd "$XDG_CACHE_HOME/eww_covers" || exit cd "$XDG_CACHE_HOME/eww_covers" || exit
IMGPATH="$XDG_CACHE_HOME/eww_covers/cover_art.png" 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 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" rm "$IMGPATH"
ln -s "$(basename "$COVER_URL")" "$IMGPATH" ln -s "$(basename "$COVER_URL")" "$IMGPATH"
@ -73,17 +73,10 @@ get_cover() {
done done
} }
## Execute accordingly if [ "$1" = "cover" ]; then
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
get_cover 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 fi

View File

@ -1,20 +1,17 @@
#!/usr/bin/env bash #!/usr/bin/env bash
while true; do while true; do
info="$(iwctl station wlan0 show)" status=$(nmcli g | tail -n 1 | awk '{print $1}')
status=$(echo "$info" | awk 'FNR == 6 {print $2}') signal=$(nmcli dev wifi | rg "\*" | awk '{ print $8 }')
_signal=$(echo "$info" | awk 'FNR == 13 {print $2}') essid=$(nmcli -t -f NAME connection show --active | head -n1)
signal=${_signal#"-"}
essid=$(echo "$info" | awk 'FNR == 7 {print $3}')
icons=("󰤯" "󰤟" "󰤢" "󰤥" "󰤨") icons=("󰤯" "󰤟" "󰤢" "󰤥" "󰤨")
if [ "$status" = "disconnected" ] ; then if [ "$status" = "disconnected" ] ; then
icon="" icon=""
text=""
color="#988ba2" color="#988ba2"
else 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 if [ "$level" -gt 4 ]; then
level=4 level=4
fi fi
@ -25,5 +22,5 @@ while true; do
echo '{ "essid": "'"$essid"'", "icon": "'"$icon"'", "color": "'"$color"'" }' echo '{ "essid": "'"$essid"'", "icon": "'"$icon"'", "color": "'"$color"'" }'
sleep 10 sleep 3
done done

View File

@ -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

View File

@ -0,0 +1,9 @@
#!/usr/bin/env bash
if [ "$($2 get "$1")" == "true" ]; then
state="false"
else
state="true"
fi
$2 update "$1=$state"

View File

@ -37,7 +37,7 @@ monitor_event() {
# generates the eww widget # generates the eww widget
generate() { 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 for i in {1..10}; do
echo -n "(button :onclick \"hyprctl dispatch workspace $i\" :class \"ws\" :style \"$(status "$i")\" \"●\") " echo -n "(button :onclick \"hyprctl dispatch workspace $i\" :class \"ws\" :style \"$(status "$i")\" \"●\") "
done done

View File

@ -3,42 +3,42 @@
:class "music-window" :class "music-window"
(box (box
:class "music-cover-art" :class "music-cover-art"
:style "background-image: url(\"${cover_art}\");") :style "background-image: url(\"${music_cover}\");")
(box (box
:orientation "v" :orientation "v"
:class "music-box" :class "music-box"
(label (label
:class "music-title" :class "music-title"
:limit-width 18 :limit-width 18
:text song_title) :text {music.title})
(label (label
:class "music-artist" :class "music-artist"
:wrap "true" :wrap "true"
:limit-width 30 :limit-width 30
:text song_artist) :text {music.artist})
(centerbox (centerbox
:halign "center" :halign "center"
:class "music-button-box" :class "music-button-box"
(button :class "music-button" :onclick "playerctl previous" "") (button :class "music-button" :onclick "playerctl previous" "")
(button :class "music-button" :onclick "playerctl play-pause" song_status) (button :class "music-button" :onclick "playerctl play-pause" {music.status})
(button :class "music-button" :onclick "playerctl next" "")) (button :class "music-button" :onclick "playerctl next" ""))
(box (box
:orientation "v" :orientation "v"
(centerbox (centerbox
(label (label
:xalign 0 :xalign 0
:class "music-time" :class "music-time"
:text song_pos) :text {music.position_time})
(label) (label)
(label (label
:xalign 1 :xalign 1
:class "music-time" :class "music-time"
:text song_length)) :text {music.length}))
(box (box
:class "music-bar" :class "music-bar"
(scale (scale
:onchange "playerctl position `bc <<< \"{} * $(playerctl metadata mpris:length) / 1000000 / 100\"`" :onchange "playerctl position `bc <<< \"{} * $(playerctl metadata mpris:length) / 1000000 / 100\"`"
:value song_pos_perc)))))) :value {music.position}))))))
(defwindow music_win (defwindow music_win
:stacking "fg" :stacking "fg"

View File

@ -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)
))))

View File

@ -1,8 +1,4 @@
{ {config, ...}: {
config,
inputs,
...
}: {
settings.terminal.name = "foot"; settings.terminal.name = "foot";
programs.foot = { programs.foot = {
enable = true; enable = true;
@ -12,7 +8,26 @@
font = "${config.settings.font.name}:size=${toString config.settings.font.size}"; font = "${config.settings.font.name}:size=${toString config.settings.font.size}";
dpi-aware = "yes"; 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
};
}; };
}; };
} }

View File

@ -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
'';
}

View File

@ -8,11 +8,17 @@
../wayland ../wayland
../swaylock ../swaylock
../wlsunset ../wlsunset
./swayidle.nix
../eww ../eww
../foot
../dunst
../rofi
./swayidle.nix
./config.nix
inputs.hyprland.homeManagerModules.default inputs.hyprland.homeManagerModules.default
]; ];
home.sessionVariables.GDK_SCALE = "2";
home.packages = with pkgs; [ home.packages = with pkgs; [
wf-recorder wf-recorder
xorg.xprop xorg.xprop
@ -26,136 +32,5 @@
wayland.windowManager.hyprland = { wayland.windowManager.hyprland = {
enable = true; enable = true;
package = inputs.hyprland.packages.${pkgs.system}.hyprland; 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
'';
}; };
} }

View File

@ -6,7 +6,7 @@
programs.mako = { programs.mako = {
enable = true; enable = true;
anchor = "top-center"; anchor = "top-center";
font = "${config.settings.font.name} ${toString config.settings.font.size}"; font = config.settings.font.fullName;
borderRadius = 16; borderRadius = 16;
extraConfig = builtins.readFile ( extraConfig = builtins.readFile (
builtins.fetchurl { builtins.fetchurl {

View File

@ -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
''
)
];
}

View File

@ -16,7 +16,7 @@
configuration{ configuration{
modi: "drun"; modi: "drun";
lines: 5; lines: 5;
font: "${config.settings.font.name} ${toString config.settings.font.size}"; font: "${config.settings.font.fullName}";
show-icons: true; show-icons: true;
terminal: "st"; terminal: "st";
drun-display-format: "{icon} {name}"; drun-display-format: "{icon} {name}";
@ -38,7 +38,8 @@
} }
window { window {
height: 360px; height: 40%;
width: 40%;
border: 3px; border: 3px;
border-color: @border-col; border-color: @border-col;
background-color: @bg-col; background-color: @bg-col;

View File

@ -3,38 +3,47 @@
lib, lib,
... ...
}: let }: let
l = lib // builtins;
t = l.types;
cfg = config.settings; cfg = config.settings;
inherit
(lib)
types
mkOption
mkIf
;
in { in {
options = { options = {
settings.iconTheme = {
name = l.mkOption {
type = t.str;
};
package = l.mkOption {
type = t.package;
};
};
settings.terminal = { settings.terminal = {
name = mkOption { name = l.mkOption {
type = types.str; type = t.str;
}; };
}; };
settings.font = { settings.font = {
enable = mkOption { enable = l.mkOption {
type = types.bool; type = t.bool;
default = false; default = false;
}; };
name = mkOption { name = l.mkOption {
type = types.str; type = t.str;
}; };
package = mkOption { package = l.mkOption {
type = types.package; type = t.package;
}; };
size = mkOption { size = l.mkOption {
type = types.ints.unsigned; 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]; home.packages = [cfg.font.package];
settings.font.fullName = "${cfg.font.name} ${toString cfg.font.size}";
}; };
} }

View File

@ -7,6 +7,5 @@
NIXOS_OZONE_WL = "1"; NIXOS_OZONE_WL = "1";
MOZ_ENABLE_WAYLAND = "1"; MOZ_ENABLE_WAYLAND = "1";
XDG_SESSION_TYPE = "wayland"; XDG_SESSION_TYPE = "wayland";
GDK_SCALE = "2";
}; };
} }

25
users/patriot/colors.nix Normal file
View File

@ -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;};
}

View File

@ -19,6 +19,7 @@ in {
"adbusers" "adbusers"
"dialout" "dialout"
"video" "video"
(l.optional nixosConfig.networking.networkmanager.enable "networkmanager")
(l.optional nixosConfig.virtualisation.docker.enable "docker") (l.optional nixosConfig.virtualisation.docker.enable "docker")
]; ];
shell = pkgs.zsh; shell = pkgs.zsh;
@ -32,7 +33,7 @@ in {
"/home/patriot/games" "/home/patriot/games"
"/home/patriot/.var" "/home/patriot/.var"
]; ];
systemPackages = [pkgs.qt5.qtwayland]; systemPackages = with pkgs; [qt5.qtwayland];
shells = with pkgs; [bashInteractive zsh]; shells = with pkgs; [bashInteractive zsh];
}; };
xdg.portal = { xdg.portal = {
@ -41,8 +42,6 @@ in {
wlr.settings.screencast = { wlr.settings.screencast = {
output_name = "eDP-1"; output_name = "eDP-1";
max_fps = 60; max_fps = 60;
exec_before = "pkill mako";
exec_after = "mako";
chooser_type = "default"; chooser_type = "default";
}; };
}; };
@ -97,8 +96,10 @@ in {
in { in {
imports = let imports = let
modulesToEnable = l.flatten [ modulesToEnable = l.flatten [
# wm
["hyprland"]
# desktop stuff # desktop stuff
["firefox" "hyprland" "foot" "rofi" "mako" "discord"] ["firefox" "discord"]
# cli stuff # cli stuff
["zoxide" "zsh" "fzf" "starship" "direnv"] ["zoxide" "zsh" "fzf" "starship" "direnv"]
# dev stuff # dev stuff
@ -106,6 +107,7 @@ in {
]; ];
in in
l.flatten [ l.flatten [
./colors.nix
../../modules/persist ../../modules/persist
inputs.nixos-persistence.nixosModules.home-manager.impermanence inputs.nixos-persistence.nixosModules.home-manager.impermanence
(tlib.prefixStrings "${inputs.self}/users/modules/" modulesToEnable) (tlib.prefixStrings "${inputs.self}/users/modules/" modulesToEnable)
@ -156,9 +158,14 @@ in {
package = pkgs.comic-mono; package = pkgs.comic-mono;
}; };
settings.iconTheme = {
name = "Papirus-Dark";
package = pkgs.papirus-icon-theme;
};
home.pointerCursor = { home.pointerCursor = {
package = pkgs.quintom-cursor-theme; package = pkgs.bibata-cursors;
name = "Quintom_Ink"; name = "Bibata-Modern-Classic";
size = 24; size = 24;
gtk.enable = true; gtk.enable = true;
x11.enable = true; x11.enable = true;
@ -173,10 +180,7 @@ in {
gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc"; gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc";
iconTheme = { iconTheme = config.settings.iconTheme;
name = "Papirus-Dark";
package = pkgs.papirus-icon-theme;
};
theme = { theme = {
name = "Catppuccin-Orange-Dark-Compact"; name = "Catppuccin-Orange-Dark-Compact";
@ -215,6 +219,8 @@ in {
GH_TOKEN=${secrets.githubToken} ${gh}/bin/gh $@ GH_TOKEN=${secrets.githubToken} ${gh}/bin/gh $@
'' ''
) )
obs-studio
rofi-bluetooth-wayland
]; ];
}; };
programs = { programs = {