initial version of my new laptop setup

This commit is contained in:
Vivian 2022-08-24 18:17:29 +02:00
parent 7d45857a00
commit 95f5b94468
18 changed files with 709 additions and 67 deletions

80
flake.lock generated
View file

@ -27,7 +27,7 @@
"deploy-rs": {
"inputs": {
"flake-compat": "flake-compat_2",
"nixpkgs": "nixpkgs_2",
"nixpkgs": "nixpkgs_3",
"utils": "utils_4"
},
"locked": {
@ -187,11 +187,11 @@
"utils": "utils_2"
},
"locked": {
"lastModified": 1660574517,
"narHash": "sha256-Lp5D2pAPrM3iAc1eeR0iGwz5rM+SYOWzVxI3p17nlrU=",
"lastModified": 1661323822,
"narHash": "sha256-1UGGcQ00uSo5cPTwL7C3S1zkcScbpF0WzspvnceWkbQ=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "688e5c85b7537f308b82167c8eb4ecfb70a49861",
"rev": "1d81e6295ca530603478114f4977402d51299ad8",
"type": "github"
},
"original": {
@ -200,6 +200,25 @@
"type": "github"
}
},
"hyprland": {
"inputs": {
"nixpkgs": "nixpkgs",
"wlroots": "wlroots"
},
"locked": {
"lastModified": 1661332451,
"narHash": "sha256-Ikd8XUJ3rQLYz6z+OMrecpXD2CvrPHM3VIfadkpxGTI=",
"owner": "hyprwm",
"repo": "Hyprland",
"rev": "9366c187dce5ed5104f85898c8d3a8531f221e3e",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "Hyprland",
"type": "github"
}
},
"lowdown-src": {
"flake": false,
"locked": {
@ -240,11 +259,11 @@
"utils": "utils_3"
},
"locked": {
"lastModified": 1661132611,
"narHash": "sha256-VnavdFBMTAbod1C9Wsfa0XJqrERCJXXZp4GNLsnewuA=",
"lastModified": 1661219530,
"narHash": "sha256-jLKEpwbkp3ryXho5RT5hjhLjBOZelGm6X5JWUUxuwsA=",
"owner": "jyooru",
"repo": "nix-minecraft-servers",
"rev": "fe603eb27a0b920b3f6116c03e5f9cfc64cf98e8",
"rev": "e624f6c056d95df8d6335d12bed0fe3c5af05159",
"type": "github"
},
"original": {
@ -256,7 +275,7 @@
"nix": {
"inputs": {
"lowdown-src": "lowdown-src",
"nixpkgs": "nixpkgs_3"
"nixpkgs": "nixpkgs_4"
},
"locked": {
"lastModified": 1633098935,
@ -297,7 +316,7 @@
"nix_2": {
"inputs": {
"lowdown-src": "lowdown-src_2",
"nixpkgs": "nixpkgs_4"
"nixpkgs": "nixpkgs_5"
},
"locked": {
"lastModified": 1633098935,
@ -313,6 +332,22 @@
}
},
"nixpkgs": {
"locked": {
"lastModified": 1660908602,
"narHash": "sha256-SwZ85IPWvC4NxxFhWhRMTJpApSHbY1u4YK2UFWEBWvY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "495b19d5b3e62b4ec7e846bdfb6ef3d9c3b83492",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1661208473,
"narHash": "sha256-EcoSSCrhc/qkoACcbB1Q2zi1jiFvb93kb4SS1AbviFw=",
@ -328,7 +363,7 @@
"type": "github"
}
},
"nixpkgs_2": {
"nixpkgs_3": {
"locked": {
"lastModified": 1648219316,
"narHash": "sha256-Ctij+dOi0ZZIfX5eMhgwugfvB+WZSrvVNAyAuANOsnQ=",
@ -344,7 +379,7 @@
"type": "github"
}
},
"nixpkgs_3": {
"nixpkgs_4": {
"locked": {
"lastModified": 1632864508,
"narHash": "sha256-d127FIvGR41XbVRDPVvozUPQ/uRHbHwvfyKHwEt5xFM=",
@ -359,7 +394,7 @@
"type": "indirect"
}
},
"nixpkgs_4": {
"nixpkgs_5": {
"locked": {
"lastModified": 1632864508,
"narHash": "sha256-d127FIvGR41XbVRDPVvozUPQ/uRHbHwvfyKHwEt5xFM=",
@ -378,8 +413,9 @@
"inputs": {
"colmena": "colmena",
"home-manager": "home-manager",
"hyprland": "hyprland",
"minecraft-servers": "minecraft-servers",
"nixpkgs": "nixpkgs",
"nixpkgs": "nixpkgs_2",
"serokell-nix": "serokell-nix",
"vault-secrets": "vault-secrets"
}
@ -510,6 +546,24 @@
"repo": "vault-secrets",
"type": "github"
}
},
"wlroots": {
"flake": false,
"locked": {
"host": "gitlab.freedesktop.org",
"lastModified": 1660930713,
"narHash": "sha256-bY7q1NqG/sjCUAWPn/Ne9NCigLlPlH5Lk1WCMqv3rTU=",
"owner": "wlroots",
"repo": "wlroots",
"rev": "7c575922c05e4d5fd9a403c2aa631a54c7531d44",
"type": "gitlab"
},
"original": {
"host": "gitlab.freedesktop.org",
"owner": "wlroots",
"repo": "wlroots",
"type": "gitlab"
}
}
},
"root": "root",

View file

@ -24,6 +24,8 @@
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
hyprland.url = "github:hyprwm/Hyprland";
};
outputs =

View file

@ -26,12 +26,14 @@
"https://nix-community.cachix.org"
"https://nixpkgs-review-bot.cachix.org"
"https://colmena.cachix.org"
"https://hyprland.cachix.org"
];
trusted-public-keys = [
"cachix.cachix.org-1:eWNHQldwUO7G2VkjpnjDbWwy4KQ/HNxht7H4SSoMckM="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"nixpkgs-review-bot.cachix.org-1:eppgiDjPk7Hkzzz7XlUesk3rcEHqNDozGOrcLc8IqwE="
"colmena.cachix.org-1:7BzpDnjjH8ki2CT3f6GdOk7QAzPOl+1t3LvTLXqYcSg="
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
];
# Also use zsh for root;
};

View file

@ -43,6 +43,7 @@ in
recommendedProxySettings = true;
recommendedTlsSettings = true;
recommendedOptimisation = true;
clientMaxBodySize = "100m";
package = pkgs.nginxMainline.override {
modules = with pkgs.nginxModules; [ brotli ];

View file

@ -65,6 +65,7 @@ in
enable_registration = true;
public_baseurl = "https://chat.meowy.tech";
enable_metrics = true;
max_upload_size = "100m";
listeners = [
{
inherit port;

View file

@ -2,7 +2,7 @@
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, lib, ... }:
{ config, pkgs, lib, inputs, ... }:
let
nvidia-offload = pkgs.writeShellScriptBin "nvidia-offload" ''
export __NV_PRIME_RENDER_OFFLOAD=1
@ -23,6 +23,31 @@ in
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.victor = import ./home.nix;
home-manager.sharedModules = [
inputs.hyprland.homeManagerModules.default
];
fonts = {
fonts = with pkgs; [
material-design-icons
noto-fonts
noto-fonts-cjk
noto-fonts-emoji
dejavu_fonts
(nerdfonts.override { fonts = [ "DejaVuSansMono" "Noto" "Ubuntu" "DroidSansMono" ]; })
];
enableDefaultFonts = false;
fontconfig = {
defaultFonts = {
monospace = [ "DejaVuSansMono Nerd Font Mono" "Noto Color Emoji" ];
sansSerif = [ "DejaVu Sans" "DejaVuSansMono Nerd Font Mono" "Noto Color Emoji" ];
serif = [ "DejaVu Serif" "DejaVuSansMono Nerd Font Mono" "Noto Color Emoji" ];
emoji = [ "Noto Color Emoji" ];
};
};
};
# Bootloader.
boot.loader.systemd-boot.enable = true;
@ -63,12 +88,28 @@ in
};
# Enable the X11 windowing system.
services.xserver.enable = true;
# services.xserver.enable = true;
# Enable the GNOME Desktop Environment.
services.xserver.displayManager.gdm.enable = true;
services.xserver.desktopManager.gnome.enable = true;
services.udev.packages = with pkgs; [ gnome.gnome-settings-daemon ];
# services.xserver.displayManager.gdm.enable = true;
# services.xserver.desktopManager.gnome.enable = true;
# services.udev.packages = with pkgs; [ gnome.gnome-settings-daemon ];
xdg = {
portal = {
enable = true;
wlr.enable = true;
extraPortals = with pkgs; [
# xdg-desktop-portal-gtk
];
};
};
# Hyprland
programs.hyprland = {
enable = true;
package = null; # Managed by home manager
};
services.xserver = {
layout = "us";
@ -115,11 +156,12 @@ in
nvidia-offload
vim
wireguard-tools
slurp
gnome.gnome-tweaks
gnome.dconf-editor
gnomeExtensions.appindicator
gnomeExtensions.wireguard-indicator
#gnome.gnome-tweaks
#gnome.dconf-editor
#gnomeExtensions.appindicator
#gnomeExtensions.wireguard-indicator
];
programs.steam = {

View file

@ -149,7 +149,7 @@ with lib.hm.gvariant;
"org/gnome/desktop/wm/preferences" = {
focus-mode = "sloppy";
num-workspaces = 9;
num-workspaces = 6;
};
"org/gnome/epiphany" = {
@ -173,7 +173,17 @@ with lib.hm.gvariant;
};
"org/gnome/file-roller/listing" = {
list-mode = "as-folder";
name-column-width = 250;
show-path = false;
sort-method = "name";
sort-type = "ascending";
};
"org/gnome/file-roller/ui" = {
sidebar-width = 200;
window-height = 480;
window-width = 600;
};
"org/gnome/mutter" = {

View file

@ -1,12 +1,18 @@
{ config, pkgs, lib, ... }: {
programs.home-manager.enable = true;
home.username = "victor";
home.homeDirectory = "/home/victor";
home.stateVersion = "22.05";
imports = [
./dconf.nix
./hyprland
];
home.sessionVariables = {
MOZ_ENABLE_WAYLAND = 1;
};
home.packages = with pkgs; [
discord
rnix-lsp
@ -23,9 +29,18 @@
steam-run
texlive.combined.scheme-full
retroarchFull
peek
python3
];
programs.alacritty = {
enable = true;
};
programs.rofi = {
enable = true;
package = pkgs.rofi-wayland;
};
programs.git = {
enable = true;
package = pkgs.gitAndTools.gitFull;
@ -40,11 +55,11 @@
clock24 = true;
};
programs.home-manager.enable = true;
programs.firefox = {
enable = true;
package = pkgs.firefox-devedition-bin;
};
programs.vscode = {
enable = true;
package = pkgs.vscode;
@ -56,6 +71,7 @@
valentjn.vscode-ltex
];
};
programs.direnv = {
enable = true;
nix-direnv = {
@ -74,45 +90,4 @@
};
services.syncthing.enable = true;
# dconf.settings =
# let
# inherit (builtins) length head tail listToAttrs genList;
# range = a: b: if a < b then [ a ] ++ range (a + 1) b else [ ];
# globalPath = "org/gnome/settings-daemon/plugins/media-keys";
# path = "${globalPath}/custom-keybindings";
# mkPath = id: "${globalPath}/custom${toString id}";
# isEmpty = list: length list == 0;
# mkSettings = settings:
# let
# checkSettings = { name, command, binding }@this: this;
# aux = i: list:
# if isEmpty list then [ ] else
# let
# hd = head list;
# tl = tail list;
# name = mkPath i;
# in
# aux (i + 1) tl ++ [{
# name = mkPath i;
# value = checkSettings hd;
# }];
# settingsList = (aux 0 settings);
# in
# listToAttrs (settingsList ++ [
# {
# name = globalPath;
# value = {
# custom-keybindings = genList (i: "/${mkPath i}/") (length settingsList);
# };
# }
# ]);
# in
# mkSettings [
# {
# name = "Open Terminal";
# command = "kgx";
# binding = "<Super>Return";
# }
# ];
}

View file

@ -0,0 +1,105 @@
{ pkgs, ... }: {
imports = [
./eww
];
home.packages = with pkgs; [
wofi # Wayland rofi
grim # Screenshot tool
wf-recorder # Screenrecorder
wl-clipboard # Clipboard manager
];
wayland.windowManager.hyprland = {
enable = true;
extraConfig = ''
exec-once=eww daemon
exec-once=eww open bar
monitor=eDP-1,1920x1080@60,0x0,1
monitor=eDP-1,addreserved,0,0,48,0
general {
layout = dwindle
}
input {
kb_options=caps:escape
touchpad {
natural_scroll= true
}
}
gestures {
workspace_swipe = true
}
misc {
no_vfr = false
}
dwindle {
pseudotile=true
}
bind=SUPER,RETURN,exec,alacritty
bind=SUPER,f,exec,firefox-devedition
bind=SUPER,d,exec,rofi -show run
bind=,Print,exec,grim -g "$(slurp)" - | wl-copy -t image/png
bind=SUPER,W,killactive,
bind=SUPER,M,exit,
bind=SUPER,S,togglefloating,
bind=SUPER,P,pseudo,
bind=SUPER,left,movefocus,l
bind=SUPER,right,movefocus,r
bind=SUPER,up,movefocus,u
bind=SUPER,down,movefocus,d
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
bind=ALT,1,movetoworkspace,1
bind=ALT,2,movetoworkspace,2
bind=ALT,3,movetoworkspace,3
bind=ALT,4,movetoworkspace,4
bind=ALT,5,movetoworkspace,5
bind=ALT,6,movetoworkspace,6
bind=ALT,7,movetoworkspace,7
bind=ALT,8,movetoworkspace,8
bind=ALT,9,movetoworkspace,9
bind=ALT,0,movetoworkspace,10
bind=SUPER,mouse_down,workspace,e+1
bind=SUPER,mouse_up,workspace,e-1
bind=SUPER,g,togglegroup
bind=SUPER,tab,changegroupactive
# Firefox notifications
windowrule=float,title:^(\s*)$
windowrule=nofocus,title:^(\s*)$
windowrule=move 1569 0,title:^(\s*)$
windowrule=opacity 0.8,title:^(\s*)$
windowrule=rounding 3,title:^(\s*)$
windowrule=animation popin,title:^(\s*)$
bind=,XF86MonBrightnessUp,exec,brightnessctl set +5%
bind=,XF86MonBrightnessDown,exec,brightnessctl set 5%-
bind=,XF86MonRaiseVolume,exec,pamixer -i 5
bind=,XF86MonLowerVolume,exec,pamixer -d 5
bind=,XF86AudioMute,exec,pamixer -t
animation=workspaces,1,8,default,slidevert
'';
};
}

View file

@ -0,0 +1,38 @@
{ pkgs, ... }: {
home.packages = with pkgs; [
eww-wayland
brightnessctl
pamixer
lua
(nerdfonts.override { fonts = [ "JetBrainsMono" ]; })
];
home.file.".config/eww/eww.yuck".source = ./eww.yuck;
home.file.".config/eww/eww.scss".source = ./eww.scss;
# scripts
home.file.".config/eww/scripts/battery.sh" = {
source = ./scripts/battery.sh;
executable = true;
};
home.file.".config/eww/scripts/volume.sh" = {
source = ./scripts/volume.sh;
executable = true;
};
home.file.".config/eww/scripts/wifi.sh" = {
source = ./scripts/wifi.sh;
executable = true;
};
home.file.".config/eww/scripts/workspaces.sh" = {
source = ./scripts/workspaces.sh;
executable = true;
};
home.file.".config/eww/scripts/workspaces.lua" = {
source = ./scripts/workspaces.lua;
executable = true;
};
}

View file

@ -0,0 +1,178 @@
$base: #44465c;
$blue: #3fc6de;
$surface0: #44465c;
$surface1: #44465c;
$text: #d9e0ee;
$overlay0: #6e738d;
$red: #ec6a88;
$peach: #efb993;
$yellow: #efb993;
$mauve: #b072d1;
$green: #3fdaa4;
$mantle: #292a37;
$crust: #2e303e;
$light-gray: #9699b7;
* {
all: unset; //Unsets everything so you can style everything from scratch
font-family: "JetBrainsMono"
}
.icon {
font-family: monospace;
font-size: 1.4rem;
}
button {
transition: background-color 200ms, color 200ms;
}
.active {
color: $green;
font-size: 1.4rem;
}
.inactive {
color: $base;
font-size: 1.4rem;
}
.inactive:hover {
color: $light-gray;
}
.bar {
background-color: $mantle;
border-left: 4px dotted $red;
}
.wifi {
font-size: 2rem;
color: $blue;
}
.clock {
font-weight: bold;
background-color: $base;
color: $text;
border-radius: 10px;
padding: 0.2rem;
margin: 0.5rem;
}
.date {
font-size: 1.5rem;
}
.reg-btn {
font-size: 2rem;
margin: 2px 8px;
border-radius: 10px;
}
.powerbutton {
color: $red;
}
.powerbutton:hover {
background-color: $base;
}
.powerbutton:active {
background-color: $red;
color: $mantle;
}
.battery {
font-size: 1.5rem;
color: $green;
}
.volume {
font-size: 1.5rem;
color: $blue;
}
// Credits AlphaTechnolog
.powermenu-box {
padding: 0 2px;
margin: 7px 7px 7px 0px;
background: inherit;
.dispatcher {
border-radius: 15px;
background: $base;
color: $red;
font-size: 14px;
padding: 0 14px 0 10px;
&:hover {
background-color: $surface0;
}
&:active {
background-color: $surface1;
}
}
}
// powermenu
.powermenu-container {
background: $crust;
color: $text;
padding: 10px;
font-size: 55px;
transition: all 200ms cubic-bezier(.1, -0.00, .0, 1.49);
.btn {
margin: 1rem;
}
// shutdown
.shutdown-btn-box .btn {
color: $red;
border-radius: 15px;
background-color: $mantle;
&:hover {
background-color: $base;
}
&:active {
background-color: $surface1;
}
}
// reboot
.reboot-btn-box .btn {
color: $mauve;
border-radius: 15px;
background-color: $mantle;
&:hover {
background-color: $base;
}
&:active {
background-color: $surface1;
}
}
// exit
.exit-btn-box .btn {
color: $yellow;
border-radius: 15px;
background-color: $mantle;
&:hover {
background-color: $base;
}
&:active {
background-color: $surface1;
}
}
}

View file

@ -0,0 +1,133 @@
(defwidget bar []
(centerbox :orientation "v" :hexpand false
(box :valign "start" :hexpand false :vexpand true :orientation "v" :space-evenly false
(powerbutton)
)
(workspaces :halign "center" :vexpand true :hexpand false :orientation "v")
(box :valign "end" :hexpand false :vexpand true :orientation "v" :space-evenly false
(wifi)
(volume)
(battery)
(time)
)
)
)
;; Variables
; (defvar time false)
; (defvar cal false)
;; ━━━ WIFI ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
(defvar wifi "{}")
(defpoll wifi :interval "30s" "./scripts/wifi.sh")
(defwidget wifi []
(box :vexpand false :hexpand false :orientation "v"
(label :text {wifi.icon}
:limit-width 10
:tooltip {wifi.status}
:class "wifi"
)
)
)
;; ━━━ BATTERY ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
(defvar battery "{}")
(defpoll battery :interval "60s" "./scripts/battery.sh")
(defwidget battery []
(label :text {battery.icon}
:limit-width 10
:tooltip "${battery.status}: ${battery.percent}"
:class "battery"
)
)
;; ━━━ VOLUME ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
(defvar volume "{}")
(defpoll volume :interval "1s" "./scripts/volume.sh")
(defwidget volume []
(eventbox :onclick "pamixer -t"
(label :text {volume.icon}
:limit-width 10
:tooltip "${volume.percent}%"
:class "volume"
)
)
)
;; ━━━ TIME ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
(defpoll hour :interval "10s" "date +%H")
(defpoll minute :interval "10s" "date +%M")
(defpoll dateVar :interval "600s" "date '+%A %d.%m.%y'")
(defwidget time []
(eventbox :cursor "hand" :hexpand false :vexpand false
:tooltip "${dateVar}"
(box :orientation "v" :hexpand false :vexpand false :space-evenly false :class "clock"
(button :class "date"
:onclick "" "${hour}")
(button :class "date"
:onclick "" "${minute}")
)
)
)
(defwidget powerbutton []
(eventbox :cursor "hand"
(button :class "reg-btn powerbutton"
:onclick "eww open powermenu --toggle &" "")
)
)
(defwidget powermenucontent []
(box :orientation "h"
:class "powermenu-container"
(box :class "shutdown-btn-box"
:orientation "h"
(button :class "btn"
:tooltip "Shutdown"
:onclick "eww close powermenu && shutdown now"
"⏻")
)
(box :class "reboot-btn-box"
:orientation "h"
(button :class "btn"
:tooltip "Reboot"
:onclick "eww close powermenu && reboot"
"")
)
(box :class "exit-btn-box"
:orientation "h"
(button :class "btn"
:tooltip "Suspend"
:onclick "systemctl suspend"
"⏾")
)
)
)
(defwindow powermenu
:monitor 0
:geometry (geometry :x "0%"
:y "0%"
:width "30%"
:height "15%"
:anchor "center center")
:wm-ignore true
(powermenucontent))
(deflisten workspaces_listen "./scripts/workspaces.sh")
(defwidget workspaces []
(literal :content workspaces_listen))
(defwindow bar
:monitor 0
:exclusive false
:geometry (geometry :height "1080px" :x "-4px" :y "0px"
:width "52px"
:anchor "top left")
:stacking "fg"
(bar))

View file

@ -0,0 +1,31 @@
#!/usr/bin/env bash
bat=/sys/class/power_supply/BAT0
per="$(cat "$bat/capacity")"
status="$(cat "$bat/status")"
if [ "$per" -gt "90" ]; then
icon=""
elif [ "$per" -gt "80" ]; then
icon=""
elif [ "$per" -gt "70" ]; then
icon=""
elif [ "$per" -gt "60" ]; then
icon=""
elif [ "$per" -gt "50" ]; then
icon=""
elif [ "$per" -gt "40" ]; then
icon=""
elif [ "$per" -gt "30" ]; then
icon=""
elif [ "$per" -gt "20" ]; then
icon=""
elif [ "$per" -gt "10" ]; then
icon=""
elif [ "$per" -gt "0" ]; then
icon=""
else
icon=""
fi
echo "{\"percent\": \"$per\", \"icon\": \"$icon\", \"charging\": \"$charging\", \"visible\": \"true\", \"status\": \"$status\"}"

View file

@ -0,0 +1,15 @@
#!/bin/sh
per="$(pamixer --get-volume)"
if pamixer --get-mute | grep -q true; then
icon="婢"
elif [ "$per" -gt 66 ]; then
icon="墳" # high
elif [ "$per" -gt 33 ]; then
icon="奔" # med
else
icon="奄" #low
fi
printf "{\"icon\": \"${icon}\", \"percent\": \"${per}\"}"

View file

@ -0,0 +1,16 @@
#!/bin/sh
if nmcli g | rg -q "\bconnected\b"; then
icon="󰤨"
ssid=$(nmcli -t -f name connection show --active)
if echo $ssid | rg -q "Wired"; then
status="Connected via cable"
else
status="Connected to ${ssid}"
fi
else
icon="󰤭"
status="offline"
fi
printf "{\"icon\": \"${icon}\", \"status\": \"${status}\"}"

View file

@ -0,0 +1,30 @@
#!/usr/bin/env lua
function trim(s)
return (string.gsub(s, "^%s*(.-)%s*$", "%1"))
end
aw = io.popen("hyprctl monitors | grep active | sed 's/()/(1)/g' | sort | awk 'NR>1{print $1}' RS='(' FS=')'")
active_workspace = aw:read("*a")
aw:close()
ew = io.popen("hyprctl workspaces | grep ID | sed 's/()/(1)/g' | sort | awk 'NR>1{print $1}' RS='(' FS=')'")
existing_workspaces = ew:read("*a")
ew:close()
box = "(box :orientation \"v\" :spacing 1 :space-evenly \"true\" "
for i = 1, #existing_workspaces do
local c = existing_workspaces:sub(i,i)
if tonumber(c) == tonumber(active_workspace) then
local btn = "(button :class \"active\" :onclick \"hyprctl dispatch workspace "..c.." \" \"\")"
box = box .. btn
elseif c ~= "\n" then
local btn = "(button :class \"inactive\" :onclick \"hyprctl dispatch workspace "..c.."\" \"\")"
box = box .. btn
end
end
box = box .. ")"
print(box)

View file

@ -0,0 +1,8 @@
#!/bin/sh
workspaces() {
./scripts/workspaces.lua
}
workspaces
tail -f /tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/hyprland.log | grep --line-buffered "Changed to workspace" | while read -r; do
workspaces
done

View file

@ -1,4 +1,4 @@
{ nixpkgs, home-manager, ... }:
{ nixpkgs, home-manager, hyprland, ... }:
let
inherit (nixpkgs) lib;
inherit (builtins) filter mapAttrs attrValues concatLists;
@ -12,6 +12,7 @@ let
];
"local" = [
home-manager.nixosModules.home-manager
hyprland.nixosModules.default
];
};
resolve_imports = { hostname, realm, profile ? hostname, type ? "lxc", ... }: [