From d8c0068a491ab89fe6402ed1ebfb56b3bd1f8939 Mon Sep 17 00:00:00 2001
From: Bruno Henriques <4727729+bphenriques@users.noreply.github.com>
Date: Mon, 4 Nov 2024 12:08:46 +0000
Subject: [PATCH 01/34] progress...?
---
README.md | 2 +-
.../desktop/{wayland => }/README.md | 2 +-
config/home-manager/desktop/default.nix | 47 +++-
config/home-manager/desktop/dunst.nix | 76 ++++++
.../home-manager/desktop/hyprland/default.nix | 57 +++++
.../desktop/hyprland/keybindings.nix | 107 +++++++++
.../hyprland/scripts/monitor-toggle.sh | 60 +++++
.../hyprland/scripts/wofi-kanshi-profile.sh | 0
.../desktop/hyprland/scripts/wofi-session.sh | 34 +++
.../desktop/hyprland/settings.nix | 161 +++++++++++++
config/home-manager/desktop/kanshi.nix | 42 ++++
.../home-manager/desktop/waybar/default.nix | 218 ++++++++++++++++++
config/home-manager/desktop/waybar/style.css | 178 ++++++++++++++
config/home-manager/media/video.nix | 1 +
config/home-manager/terminal/ghostty.nix | 10 +-
config/nixos/default.nix | 5 +
config/nixos/file-manager.nix | 15 ++
config/nixos/wayland.nix | 20 ++
flake.nix | 2 +
19 files changed, 1033 insertions(+), 4 deletions(-)
rename config/home-manager/desktop/{wayland => }/README.md (98%)
create mode 100644 config/home-manager/desktop/dunst.nix
create mode 100644 config/home-manager/desktop/hyprland/default.nix
create mode 100644 config/home-manager/desktop/hyprland/keybindings.nix
create mode 100644 config/home-manager/desktop/hyprland/scripts/monitor-toggle.sh
create mode 100644 config/home-manager/desktop/hyprland/scripts/wofi-kanshi-profile.sh
create mode 100644 config/home-manager/desktop/hyprland/scripts/wofi-session.sh
create mode 100644 config/home-manager/desktop/hyprland/settings.nix
create mode 100644 config/home-manager/desktop/kanshi.nix
create mode 100644 config/home-manager/desktop/waybar/default.nix
create mode 100644 config/home-manager/desktop/waybar/style.css
create mode 100644 config/nixos/file-manager.nix
create mode 100644 config/nixos/wayland.nix
diff --git a/README.md b/README.md
index c86639b1..e0e022d4 100644
--- a/README.md
+++ b/README.md
@@ -18,7 +18,7 @@ This repository contains the definition of my machines using [nix](https://nixos
| `laptop` | AMD Ryzen™ 7 7840HS | 32GB | AMD Radeon™ 780M | NVIDIA® GeForce RTX™ 4060 8GB | ❄️ |
| `work-macos` | Apple M2 Pro 8-core CPU | 16GB | Apple M2 Pro 10-core GPU | | 🍏 |
-# Flake Outputs
+# 📦 Flake Outputs
Listing only the most relevant outputs. See the source-code for more details.
diff --git a/config/home-manager/desktop/wayland/README.md b/config/home-manager/desktop/README.md
similarity index 98%
rename from config/home-manager/desktop/wayland/README.md
rename to config/home-manager/desktop/README.md
index e1f3ca86..5efc6cd1 100644
--- a/config/home-manager/desktop/wayland/README.md
+++ b/config/home-manager/desktop/README.md
@@ -51,7 +51,7 @@ https://github.com/NickCao/flakes/blob/d99c0a28b9357adce9749ca49364038184a1b95e/
-https://github.com/fufexan/dotfiles/tree/main/home/programs/wayland
+
Sway
https://github.com/NickCao/flakes/blob/d99c0a28b9357adce9749ca49364038184a1b95e/nixos/mainframe/home.nix#L22
diff --git a/config/home-manager/desktop/default.nix b/config/home-manager/desktop/default.nix
index 7fd3e39d..ce999db0 100644
--- a/config/home-manager/desktop/default.nix
+++ b/config/home-manager/desktop/default.nix
@@ -1,4 +1,49 @@
{ config, lib, pkgs, ... }:
{
- imports = [ ./wofi.nix ];
+ # https://github.com/prasanthrangan/hyprdots?tab=readme-ov-file
+ imports = [
+ ./hyprland
+ ./wofi.nix # Application Launcher
+ ./waybar # Bar on top
+ ./kanshi.nix # Display Manager
+ ./dunst.nix # Notifications
+ ];
+
+ # Use the following theme: https://github.com/iynaix/dotfiles/blob/56d2d63b3b5f4c621429d79fb2aef8d44fdc25b9/home-manager/gui/gtk.nix#L85
+ home.pointerCursor = {
+ gtk.enable = true;
+ package = pkgs.bibata-cursors;
+ name = "Bibata-Modern-Classic";
+ size = 16;
+ };
+
+ home.file.${config.gtk.gtk2.configLocation}.force = true;
+
+ gtk = {
+ enable = true;
+ theme = {
+ package = pkgs.flat-remix-gtk;
+ name = "Flat-Remix-GTK-Grey-Darkest";
+ };
+
+ iconTheme = {
+ package = pkgs.adwaita-icon-theme;
+ name = "Adwaita";
+ };
+
+ font = {
+ name = "Sans";
+ size = 11;
+ };
+
+ gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc"; # Leave my $HOME
+ gtk3.extraConfig = {
+ gtk-application-prefer-dark-theme = 1;
+ gtk-error-bell = 0;
+ };
+ gtk4.extraConfig = {
+ gtk-application-prefer-dark-theme = 1;
+ gtk-error-bell = 0;
+ };
+ };
}
\ No newline at end of file
diff --git a/config/home-manager/desktop/dunst.nix b/config/home-manager/desktop/dunst.nix
new file mode 100644
index 00000000..77af7c24
--- /dev/null
+++ b/config/home-manager/desktop/dunst.nix
@@ -0,0 +1,76 @@
+{ config, lib, pkgs, ... }:
+
+{
+ services.dunst = {
+ enable = true;
+ iconTheme = {
+ name = "Papirus-Dark";
+ package = pkgs.papirus-icon-theme;
+ };
+ settings = {
+ global = {
+ rounded = "yes";
+ origin = "top-right";
+ monitor = "0";
+ alignment = "left";
+ vertical_alignment = "center";
+ width = "400";
+ height = "400";
+ scale = 0;
+ gap_size = 0;
+ progress_bar = true;
+ transparency = 0;
+ text_icon_padding = 0;
+ separator_color = "frame";
+ sort = "yes";
+ idle_threshold = 120;
+ line_height = 0;
+ markup = "full";
+ show_age_threshold = 60;
+ ellipsize = "middle";
+ ignore_newline = "no";
+ stack_duplicates = true;
+ sticky_history = "yes";
+ history_length = 20;
+ always_run_script = true;
+ corner_radius = 10;
+ follow = "mouse";
+ font = "Source Sans Pro 10";
+ format = "%s\\n%b"; #format = "%s %p\n%b"
+ frame_color = "#232323";
+ frame_width = 1;
+ offset = "15x15";
+ horizontal_padding = 10;
+ icon_position = "left";
+ indicate_hidden = "yes";
+ min_icon_size = 0;
+ max_icon_size = 64;
+ mouse_left_click = "do_action, close_current";
+ mouse_middle_click = "close_current";
+ mouse_right_click = "close_all";
+ padding = 10;
+ plain_text = "no";
+ separator_height = 2;
+ show_indicators = "yes";
+ shrink = "no";
+ word_wrap = "yes";
+ browser = "/usr/bin/env librewolf -new-tab";
+ };
+
+ fullscreen_delay_everything = {fullscreen = "delay";};
+
+ urgency_critical = {
+ background = "#d64e4e";
+ foreground = "#f0e0e0";
+ };
+ urgency_low = {
+ background = "#232323";
+ foreground = "#2596be";
+ };
+ urgency_normal = {
+ background = "#1e1e2a";
+ foreground = "#2596be";
+ };
+ };
+ };
+}
diff --git a/config/home-manager/desktop/hyprland/default.nix b/config/home-manager/desktop/hyprland/default.nix
new file mode 100644
index 00000000..0dc5271f
--- /dev/null
+++ b/config/home-manager/desktop/hyprland/default.nix
@@ -0,0 +1,57 @@
+{ config, lib, pkgs, self, ... }:
+let
+ wallpapersPkg = self.private.wallpapers.override {
+ selected = [ "lake-fishing-sunset" "mountains" "whale-sunset" "watch-tower" ];
+ };
+
+ wallpapers = [
+ "${wallpapersPkg}/share/wallpapers/mountains.png"
+ ];
+in
+
+# TODO: https://github.com/ErikReider/SwayOSD
+{
+ imports = [
+ ./settings.nix
+ ./keybindings.nix
+ ];
+
+ home.packages = with pkgs; [
+ hyprpaper # TODO: it is a systemd service.. why doesnt it run?
+ networkmanagerapplet
+ ];
+
+ services.hyprpaper = {
+ enable = true;
+ settings = {
+ preload = wallpapers;
+ wallpaper = wallpapers;
+ };
+ };
+
+ # https://wiki.hyprland.org/Nix/Hyprland-on-Home-Manager/
+ wayland.windowManager.hyprland = {
+ enable = true;
+ settings = {
+ "monitor" = [ ",preferred,auto,auto" ];
+
+ "$terminal" = "ghostty";
+ "$fileManager" = "thunar";
+ "$menu" = "wofi --show drun";
+ "$browser" = "firefox";
+
+ env = [
+ "XDG_SESSION_TYPE,wayland"
+ "QT_WAYLAND_DISABLE_WINDOWDECORATION,1"
+
+ # Nvidia
+ "LIBVA_DRIVER_NAME,nvidia"
+ "GBM_BACKEND,nvidia-drm"
+ "__GLX_VENDOR_LIBRARY_NAME,nvidia"
+ ];
+ };
+ };
+
+ # notifications
+ #services.mako.enable = true;
+}
\ No newline at end of file
diff --git a/config/home-manager/desktop/hyprland/keybindings.nix b/config/home-manager/desktop/hyprland/keybindings.nix
new file mode 100644
index 00000000..39fafae5
--- /dev/null
+++ b/config/home-manager/desktop/hyprland/keybindings.nix
@@ -0,0 +1,107 @@
+{ lib, config, ... }:
+
+let
+ shortcuts = [
+ "$mod, Q, exec, $terminal"
+ "$mod, E, exec, $fileManager"
+ "$mod, R, exec, $menu"
+ "$mod, F, exec, $browser"
+ ];
+
+ focus = [
+ # Move focus with mod + arrow keys
+ "$mod, left, movefocus, l"
+ "$mod, right, movefocus, r"
+ "$mod, up, movefocus, u"
+ "$mod, down, movefocus, d"
+ ];
+
+ workspace = [
+ # Switch workspaces with mod + [0-9]
+ "$mod, 1, workspace, 1"
+ "$mod, 2, workspace, 2"
+ "$mod, 3, workspace, 3"
+ "$mod, 4, workspace, 4"
+ "$mod, 5, workspace, 5"
+ "$mod, 6, workspace, 6"
+ "$mod, 7, workspace, 7"
+ "$mod, 8, workspace, 8"
+ "$mod, 9, workspace, 9"
+ "$mod, 0, workspace, 10"
+
+ # Move active window to a workspace with mod + SHIFT + [0-9]
+ "$mod SHIFT, 1, movetoworkspace, 1"
+ "$mod SHIFT, 2, movetoworkspace, 2"
+ "$mod SHIFT, 3, movetoworkspace, 3"
+ "$mod SHIFT, 4, movetoworkspace, 4"
+ "$mod SHIFT, 5, movetoworkspace, 5"
+ "$mod SHIFT, 6, movetoworkspace, 6"
+ "$mod SHIFT, 7, movetoworkspace, 7"
+ "$mod SHIFT, 8, movetoworkspace, 8"
+ "$mod SHIFT, 9, movetoworkspace, 9"
+ "$mod SHIFT, 0, movetoworkspace, 10"
+
+ # Example special workspace (scratchpad)
+ "$mod, S, togglespecialworkspace, magic"
+ "$mod SHIFT, S, movetoworkspace, special:magic"
+
+ # Scroll through existing workspaces with mod + scroll
+ "$mod, mouse_down, workspace, e+1"
+ "$mod, mouse_up, workspace, e-1"
+ ];
+
+ toggle_waybar = {
+ bind = [ "$mod, W, exec, pkill -SIGUSR1 waybar" ];
+ bindr = [ "$mod, W, exec, pkill -SIGUSR1 waybar" ];
+ };
+in
+{
+ wayland.windowManager.hyprland.settings = lib.mkMerge [
+
+ {
+ bind = [ "$mod, W, exec, pkill -SIGUSR1 waybar" ]; # Toggle waybar
+ }
+ {
+ # See https://wiki.hyprland.org/Configuring/Keywords/
+ "$mod" = "SUPER"; # Sets "Windows" key as main modifier
+
+ # Mouse bindings
+ bindm = [
+ # Move/resize windows with mod + LMB/RMB and dragging
+ "bindm = $mod, mouse:272, movewindow"
+ "bindm = $mod, mouse:273, resizewindow"
+ ];
+
+
+ bind = [
+ # Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more
+ "$mod, C, killactive,"
+ "$mod, F, fullscreen,"
+ "$mod, M, exit,"
+ "$mod, V, togglefloating,"
+ "$mod, P, pseudo," # dwindle
+ "$mod, J, togglesplit," # dwindle
+
+ "Ctrl+Alt, W, exec, killall waybar || waybar" # toggle waybar
+ ] ++ shortcuts ++ focus ++ workspace;
+
+ bindel = [
+ # Laptop multimedia keys for volume and LCD brightness
+ ",XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+"
+ ",XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"
+ ",XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"
+ ",XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"
+ ",XF86MonBrightnessUp, exec, brightnessctl s 10%+"
+ ",XF86MonBrightnessDown, exec, brightnessctl s 10%-"
+ ];
+
+ # Requires playerctl
+ bindl = [
+ ", XF86AudioNext, exec, playerctl next"
+ ", XF86AudioPause, exec, playerctl play-pause"
+ ", XF86AudioPlay, exec, playerctl play-pause"
+ ", XF86AudioPrev, exec, playerctl previous"
+ ];
+ }
+ ];
+}
diff --git a/config/home-manager/desktop/hyprland/scripts/monitor-toggle.sh b/config/home-manager/desktop/hyprland/scripts/monitor-toggle.sh
new file mode 100644
index 00000000..8c099888
--- /dev/null
+++ b/config/home-manager/desktop/hyprland/scripts/monitor-toggle.sh
@@ -0,0 +1,60 @@
+#! /usr/bin/env sh
+
+# A hyprland script for a laptop-external-monitor setup, toggling between which is in use
+
+# Launch at startup to make hyprland disable the internal monitor if an external monitor is detected and enabled
+# Additionally it's called with a keybind to switch between a laptop monitor and an external display
+# Ideally the conditional monitor behaviour was instead done directly in hyprland.conf, but I'm not sure whether that's possible
+#
+# Relevant info:
+# - hyprctl monitors: identifies currently enabled monitors
+# - hyprctl monitors all: identifies ALL connected monitors - including those not in use
+#
+# Suggested use:
+# Add this line somewhere after the regular monitor configuration in hyprland.conf:
+# exec = /path/to/hyprland-monitors-toggle.sh
+# Add a keybind to run this script on demand:
+# bind =,SomeKeyHere, exec, /path/to/hyprland-monitors-toggle.sh
+
+move_all_workspaces_to_monitor() {
+ TARGET_MONITOR="$1"
+
+ hyprctl workspaces | grep ^workspace | cut --delimiter ' ' --fields 3 | xargs -I '{}' hyprctl dispatch moveworkspacetomonitor '{}' "$TARGET_MONITOR"
+
+ # Previous approach
+ #hyprctl swapactiveworkspaces $EXTERNAL_MONITOR $INTERNAL_MONITOR
+}
+
+# TODO: Detect these instead of hardcoding them
+INTERNAL_MONITOR="ADD YOUR INTERNAL MONITOR NAME HERE"
+EXTERNAL_MONITOR="ADD YOUR EXTERNAL MONITOR NAME HERE"
+
+NUM_MONITORS=$(hyprctl monitors all | grep --count Monitor)
+NUM_MONITORS_ACTIVE=$(hyprctl monitors | grep --count Monitor)
+
+# For initial startup if you use hyprland's default monitor settings:
+# Turn off the laptop monitor if it + another monitor is active
+if [ "$NUM_MONITORS_ACTIVE" -ge 2 ] && hyprctl monitors | cut --delimiter ' ' --fields 2 | grep --quiet ^$INTERNAL_MONITOR; then
+ # Doing this I hopefully end up on workspace 1 on the external monitor rather than 2 at startup
+ move_all_workspaces_to_monitor $EXTERNAL_MONITOR
+ hyprctl keyword monitor "$INTERNAL_MONITOR, disable"
+ # Alternate fix to ensure I start on workspace 1
+ #hyprctl dispatch workspace 1
+ exit
+fi
+
+# For dynamically toggling which monitor is active later via a keybind
+if [ "$NUM_MONITORS" -gt 1 ]; then # Handling multiple monitors
+ if hyprctl monitors | cut --delimiter ' ' --fields 2 | grep --quiet ^$EXTERNAL_MONITOR; then
+ hyprctl keyword monitor $INTERNAL_MONITOR,preferred,0x0,1
+ move_all_workspaces_to_monitor $INTERNAL_MONITOR
+ hyprctl keyword monitor "$EXTERNAL_MONITOR, disable"
+ else
+ hyprctl keyword monitor $EXTERNAL_MONITOR,preferred,0x0,1
+ move_all_workspaces_to_monitor $EXTERNAL_MONITOR
+ hyprctl keyword monitor "$INTERNAL_MONITOR, disable"
+ fi
+else # If the external monitor is disconnected without running this script first, it might become the case that no monitor is on - therefore turn on the laptop monitor!
+ hyprctl keyword monitor $INTERNAL_MONITOR,preferred,0x0,1
+ move_all_workspaces_to_monitor $INTERNAL_MONITOR
+fi
\ No newline at end of file
diff --git a/config/home-manager/desktop/hyprland/scripts/wofi-kanshi-profile.sh b/config/home-manager/desktop/hyprland/scripts/wofi-kanshi-profile.sh
new file mode 100644
index 00000000..e69de29b
diff --git a/config/home-manager/desktop/hyprland/scripts/wofi-session.sh b/config/home-manager/desktop/hyprland/scripts/wofi-session.sh
new file mode 100644
index 00000000..b5c5f4e8
--- /dev/null
+++ b/config/home-manager/desktop/hyprland/scripts/wofi-session.sh
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+# options to be displayed
+option0="lock"
+option1="logout"
+option2="suspend"
+option3="scheduled suspend (10min)"
+option4="scheduled suspend (20min)"
+option5="scheduled suspend (30min)"
+option6="reboot"
+option7="shutdown"
+
+# options passed into variable
+options="$option0\n$option1\n$option2\n$option3\n$option4\n$option5\n$option6\n$option7"
+
+chosen="$(echo -e "$options" | wofi -lines 8 -dmenu -p "power")"
+case $chosen in
+ $option0)
+ i3lock;;
+ $option1)
+ i3-msg exit;;
+ $option2)
+ systemctl suspend;;
+ $option3)
+ sleep 600 && systemctl suspend;;
+ $option4)
+ sleep 1200 && systemctl suspend;;
+ $option5)
+ sleep 1800 && systemctl suspend;;
+ $option6)
+ systemctl reboot;;
+ $option7)
+ systemctl poweroff;;
+esac
\ No newline at end of file
diff --git a/config/home-manager/desktop/hyprland/settings.nix b/config/home-manager/desktop/hyprland/settings.nix
new file mode 100644
index 00000000..1fb4bb65
--- /dev/null
+++ b/config/home-manager/desktop/hyprland/settings.nix
@@ -0,0 +1,161 @@
+{ pkgs, lib, config, ... }:
+
+let
+ pointer = config.home.pointerCursor;
+ cursorName = "Bibata-Modern-Classic-Hyprcursor";
+in
+
+# https://github.com/hyprwm/Hyprland/blob/main/example/hyprland.conf
+# https://github.com/iynaix/dotfiles/blob/f0f8918caed8f4c245fa82fc505ae0de09a32f5c/home-manager/hyprland/default.nix
+{
+ #
+ wayland.windowManager.hyprland.settings = {
+ env = [
+ "XDG_SESSION_TYPE,wayland"
+ "QT_WAYLAND_DISABLE_WINDOWDECORATION,1"
+
+ # Nvidia
+ "LIBVA_DRIVER_NAME,nvidia"
+ "GBM_BACKEND,nvidia-drm"
+ "__GLX_VENDOR_LIBRARY_NAME,nvidia"
+ ];
+
+ general = {
+ gaps_in = 8;
+ gaps_out = 8;
+ border_size = 2;
+ layout = "master";
+
+ # https://wiki.hyprland.org/Configuring/Variables/#variable-types for info about colors
+ "col.active_border" = "rgba(33ccffee) rgba(00ff99ee) 45deg";
+ "col.inactive_border" = "rgba(595959aa)";
+
+ # Set to true enable resizing windows by clicking and dragging on borders and gaps
+ resize_on_border = true;
+
+ # Please see https://wiki.hyprland.org/Configuring/Tearing/ before you turn this on
+ allow_tearing = false;
+ };
+
+ decoration = {
+ rounding = 2;
+
+ # Change transparency of focused and unfocused windows
+ active_opacity = 1.0;
+ inactive_opacity = 0.9;
+
+ drop_shadow = true;
+ shadow_range = 4;
+ shadow_render_power = 3;
+ "col.shadow" = "rgba(1a1a1aee)";
+
+ # https://wiki.hyprland.org/Configuring/Variables/#blur
+ blur = {
+ enabled = true;
+ size = 2;
+ passes = 3;
+ new_optimizations = true;
+ };
+ };
+
+ # https://wiki.hyprland.org/Configuring/Variables/#animations
+ animations = {
+ enabled = true;
+
+ # Default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more
+ bezier = [
+ "overshot, 0.05, 0.9, 0.1, 1.05"
+ "smoothOut, 0.36, 0, 0.66, -0.56"
+ "smoothIn, 0.25, 1, 0.5, 1"
+ ];
+
+ animation = [
+ "windows, 1, 5, overshot, slide"
+ "windowsOut, 1, 4, smoothOut, slide"
+ "windowsMove, 1, 4, smoothIn, slide"
+ "layers, 1, 5, default, popin 80%"
+ "border, 1, 5, default"
+ # 1 loop every 5 minutes
+ "borderangle, 1, ${toString (10 * 60 * 5)}, default, loop"
+ "fade, 1, 5, smoothIn"
+ "fadeDim, 1, 5, smoothIn"
+ "workspaces, 1, 6, default"
+ ];
+ };
+
+ # See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more
+ dwindle = {
+ pseudotile = true; # Master switch for pseudotiling. Enabling is bound to mod + P in the keybinds section below
+ preserve_split = true; # You probably want this
+ };
+
+ # See https://wiki.hyprland.org/Configuring/Master-Layout/ for more
+ master = {
+ new_status = "master";
+ };
+
+ exec-once = [
+ "${lib.getExe pkgs.hyprpaper}"
+ #"sleep 1; hypr-wallpaper && launch-waybar"
+ "waybar"
+ # TODO: It seems that the cursor gets broken and this fixes that
+ "hyprctl setcursor ${cursorName} ${toString pointer.size}"
+ ];
+
+ misc = {
+ disable_autoreload = false; # disable auto polling for config file changes
+ animate_mouse_windowdragging = false; # disable dragging animation
+ force_default_wallpaper = -1; # Set to 0 or 1 to disable the anime mascot wallpapers
+ disable_hyprland_logo = false; # If true disables the random hyprland logo / anime girl background. :(
+ };
+
+ input = {
+ kb_layout = "us,pt";
+ kb_variant = "euro,";
+ kb_model = "";
+ kb_options = "";
+ kb_rules = "";
+
+ follow_mouse = 1;
+
+ sensitivity = 0; # -1.0 - 1.0, 0 means no modification.
+
+ touchpad = {
+ natural_scroll = false;
+ };
+ };
+
+ # touchpad gestures
+ gestures = {
+ workspace_swipe = true;
+ workspace_swipe_forever = true;
+ };
+
+ windowrulev2 = [
+ # "dimaround,floating:1"
+ "bordersize 5,fullscreen:1" # monocle mode
+ "float,class:(wlroots)" # hyprland debug session
+ # save dialog
+ "float,class:(xdg-desktop-portal-gtk)"
+ "size <50% <50%,class:(xdg-desktop-portal-gtk)"
+
+
+ # Ignore maximize requests from apps. You'll probably like this.
+ "suppressevent maximize, class:.*"
+ "suppressevent fullscreen, class:.*"
+ ];
+ };
+}
+
+# # Input - More on https://wiki.archlinux.org/title/Xorg/Keyboard_configuration
+# services.xserver = {
+# #exportConfiguration = true; # Do I need this?
+# xkb.layout = "us,pt"; # localectl list-x11-keymap-layouts and
+# xkb.variant = "euro,"; # localectl list-x11-keymap-variants us
+# xkb.options = builtins.concatStringsSep " " [
+# "caps:ctrl_modifier" # Replace caps-lock for Ctrl
+# "grp:ralt_rshift_toggle" # Right Alt + Right Shift: Switch keyboard layouts. See more using `xkeyboard-config`
+# ];
+#
+# excludePackages = [ pkgs.xterm ];
+# };
\ No newline at end of file
diff --git a/config/home-manager/desktop/kanshi.nix b/config/home-manager/desktop/kanshi.nix
new file mode 100644
index 00000000..a2d48939
--- /dev/null
+++ b/config/home-manager/desktop/kanshi.nix
@@ -0,0 +1,42 @@
+{ pkgs, config, ... }:
+# More examples:
+# - https://github.com/colemickens/nixcfg/blob/f28e80177328a7e005bea96d0931a0f1a98d9df5/mixins/kanshi.nix#L21
+# - https://github.com/MatthewCroughan/nixcfg/blob/afab322e6da20cc038d8577dd4a365673702d183/users/matthew/modules/kanshi.nix#L2
+let
+ laptopScreen = {
+ criteria = "eDP-1";
+ mode = "2880x1800@143.91Hz";
+ scale = 1.5;
+ };
+ dellScreen = {
+ criteria = "Dell Inc. DELL S2721DGF 4P11R83";
+ mode = "2560x1440@120.00Hz";
+ scale = 1.0;
+ };
+
+ enable = screen: screen // { status = "enable"; };
+ disable = screen: screen // { status = "disable"; };
+in
+{
+ home.packages = [ pkgs.kanshi ]; # need for kanshictl switch
+ services.kanshi = {
+ enable = true;
+ systemdTarget = "hyprland-session.target";
+ settings = [
+ {
+ profile.name = "undocked";
+ profile.outputs = [
+ (enable laptopScreen)
+ (disable dellScreen)
+ ];
+ }
+ {
+ profile.name = "docked-office";
+ profile.outputs = [
+ (disable laptopScreen)
+ (enable dellScreen)
+ ];
+ }
+ ];
+ };
+}
\ No newline at end of file
diff --git a/config/home-manager/desktop/waybar/default.nix b/config/home-manager/desktop/waybar/default.nix
new file mode 100644
index 00000000..f418dcca
--- /dev/null
+++ b/config/home-manager/desktop/waybar/default.nix
@@ -0,0 +1,218 @@
+{ lib, config, pkgs, ... }:
+# https://codeberg.org/explosion-mental/wallust generates colors autoamtically.
+let
+ alertSpan = s: ''${s}'';
+in
+{
+ # https://github.com/nix-community/home-manager/issues/3599
+ # do not use the systemd service as it is flaky and unreliable
+
+ programs.waybar = {
+ enable = true;
+ style = ./style.css;
+ settings = {
+ "bar" = {
+ output = ["eDP-1" "HDMI-A-1"];
+
+ layer = "top";
+ position = "top";
+ margin-left = 9;
+ margin-right = 9;
+ margin-top = 0;
+ margin-bottom = 0;
+ spacing = 4;
+
+ reload_style_on_change = true;
+
+ modules-left = [
+ "custom/spacer"
+ "hyprland/workspaces"
+ "hyprland/window"
+ ]; # [ "custom/nix" "idle_inhibitor" ];
+ modules-center = [
+ ];
+
+ modules-right = [
+ "pulseaudio"
+ "network"
+ "memory"
+ "cpu"
+ "backlight"
+ "battery"
+ "clock"
+ "tray"
+ ];
+
+ "custom/spacer" = {
+ format = " ";
+ };
+
+ "wlr/taskbar" = {
+ all-outputs = false;
+ format = "{icon}";
+ icon-size = 13;
+ tooltip = true;
+ tooltip-format = "{title}";
+ active-first = false;
+ };
+
+ cpu = {
+ format = "{usage}% ";
+ tooltip = false;
+ };
+
+ memory = {
+ interval = 30;
+ format = " {used}GB";
+ format-m = " {used}GB";
+ format-h = " {used}GB";
+ format-c = " {used}GB";
+ max-length = 10;
+ tooltip = true;
+ tooltip-format = " {percentage}%\n {used:0.1f}GB/{total:0.1f}GB";
+ };
+
+ backlight = {
+ format = "{icon} {percent}%";
+ format-icons = ["" "" "" "" "" "" "" "" ""];
+ on-scroll-up = "${lib.getExe pkgs.brightnessctl} s +1%";
+ on-scroll-down = "${lib.getExe pkgs.brightnessctl} s 1%-";
+ min-length = 6;
+ };
+
+ battery = {
+ states = {
+ good = 95;
+ warning = 30;
+ critical = 20;
+ };
+ format = "{icon} {capacity}%";
+ format-charging = " {capacity}%";
+ format-plugged = " {capacity}%";
+ format-alt = "{time} {icon}";
+ format-icons = [ "" "" "" "" "" ];
+ format-time = "{H}h {M}min";
+ };
+
+ # TODO: bluetooth
+
+ clock = {
+ calendar = {
+ mode = "year";
+ mode-mon-col = 3;
+ on-scroll = 1;
+ actions = {
+ on-click-right = "mode";
+ on-scroll-down = "shift_down";
+ on-scroll-up = "shift_up";
+ };
+ format = {
+ days = "{}";
+ months = "{}";
+ today = "{}";
+ weekdays = "{}";
+ };
+ };
+ format = " {:%a %d %b %H:%M}";
+ format-alt = "{:%H:%M %Y-%m-%d}";
+ interval = 10;
+ tooltip-format = "{calendar}";
+ };
+
+ tray = {
+ icon-size = 18;
+ spacing = 10;
+ };
+
+ #"custom/nix" = {
+ # format = "";
+ # on-click = "hypr-wallpaper";
+ # on-click-right = "wallpapers-select";
+ # tooltip = false;
+ #};
+
+ #idle_inhibitor = lib.mkIf cfg.idleInhibitor {
+ # format = "{icon}";
+ # format-icons = {
+ # activated = alertSpan "";
+ # deactivated = "";
+ # };
+ #};
+
+ "hyprland/workspaces" = {
+ disable-scroll = false;
+ all-outputs = false;
+ active-only = false;
+ format = "{icon}";
+ format-icons = {
+ "1" = "1";
+ "2" = "2";
+ "3" = "3";
+ "4" = "4";
+ "5" = "5";
+ "6" = "6";
+ "7" = "7";
+ "8" = "8";
+ "9" = "9";
+ urgent = " ";
+ };
+ };
+
+ "hyprland/window" = {
+ max-length = 50;
+ format = "{title}";
+ separate-outputs = true;
+ icon = true;
+ icon-size = 13;
+ };
+
+ network = {
+ format-wifi = "{essid} ({signalStrength}%) ";
+ format-ethernet = "{ipaddr}/{cidr} ";
+ format-linked = "{ifname} (No IP)";
+ format-disconnected = alertSpan "Disconnected ⚠";
+ format-alt = "{ifname}: {ipaddr}";
+ tooltip = true;
+ tooltip-format = ''
+ IP: {ipaddr}/{cidr}
+ Gateway: {gwaddr}'';
+
+ on-click = "${config.xdg.configHome}/rofi/rofi-wifi-menu"; # FIXME
+ on-click-right = "nmtui"; #FIXME
+ };
+
+ # See more: https://github.com/prasanthrangan/hyprdots/blob/main/Configs/.config/waybar/modules/pulseaudio.jsonc
+ pulseaudio = {
+ format = "{volume}% {icon} {format_source}";
+ format-bluetooth = "{volume}% {icon} {format_source}";
+ format-bluetooth-muted = " {icon} {format_source}";
+ format-muted = " {format_source}";
+ format-source = "{volume}% ";
+ format-source-muted = "";
+ format-icons = {
+ headphone = "";
+ hands-free = "";
+ headset = "";
+ phone = "";
+ portable = "";
+ car = "";
+ default = ["" "" ""];
+ };
+ on-click = "${lib.getExe pkgs.pavucontrol}";
+
+ tooltip = true;
+ tooltip-format = "{icon} {desc} // {volume}%";
+ };
+
+ #"custom/powermenu" = {
+ # "format" = "";
+ # "on-click" = "pkill rofi || ~/.config/rofi/powermenu/type-3/powermenu.sh";
+ # "tooltip" = false;
+ #};
+
+
+ # Notification: https://github.com/prasanthrangan/hyprdots/blob/main/Configs/.config/waybar/modules/notifications.jsonc
+ };
+ };
+ };
+}
diff --git a/config/home-manager/desktop/waybar/style.css b/config/home-manager/desktop/waybar/style.css
new file mode 100644
index 00000000..7ef13951
--- /dev/null
+++ b/config/home-manager/desktop/waybar/style.css
@@ -0,0 +1,178 @@
+/* Catppuccin Mocha color scheme */
+@define-color rosewater #f5e0dc;
+@define-color flamingo #f2cdcd;
+@define-color pink #f5c2e7;
+@define-color mauve #cba6f7;
+@define-color red #f38ba8;
+@define-color maroon #eba0ac;
+@define-color peach #fab387;
+@define-color yellow #f9e2af;
+@define-color green #a6e3a1;
+@define-color teal #94e2d5;
+@define-color sky #89dceb;
+@define-color sapphire #74c7ec;
+@define-color blue #89b4fa;
+@define-color lavender #b4befe;
+@define-color text #cdd6f4;
+@define-color subtext1 #bac2de;
+@define-color subtext0 #a6adc8;
+@define-color overlay2 #9399b2;
+@define-color overlay1 #7f849c;
+@define-color overlay0 #6c7086;
+@define-color surface2 #585b70;
+@define-color surface1 #45475a;
+@define-color surface0 #313244;
+@define-color base #1e1e2e;
+@define-color mantle #181825;
+@define-color crust #11111b;
+
+* {
+ font-family: "Maple Mono", "CaskaydiaCove NF";
+ font-size: 15px;
+ min-height: 0;
+}
+
+#waybar {
+ background: rgba(30, 30, 46, 0.9);
+ color: @text;
+ border-radius: 5px;
+}
+
+#custom-spacer {
+ background: @blue;
+ color: @crust;
+ border-radius: 5px;
+ margin: 2px 2px;
+ padding: 0.1rem 0.7rem;
+}
+
+#workspaces {
+ font-weight: bold;
+ background: @surface0;
+ color: @text;
+ box-shadow: none;
+ text-shadow: none;
+ border-radius: 10px;
+ transition: 0.2s ease;
+ padding-left: 4px;
+ padding-right: 4px;
+ padding-top: 1px;
+ margin: 5px 5px;
+}
+
+#workspaces button {
+ color: @overlay2;
+ transition: all 0.3s ease-in-out;
+ padding: 0.2rem 10px;
+ /* animation: ws_normal 20s ease-in-out 1; */
+}
+
+#workspaces button.empty {
+ color: @text;
+}
+
+#workspaces button.visible {
+ color: @crust;
+ padding: 0.2rem 2rem;
+ background: @sky;
+ transition: all 0.3s ease-in-out;
+ /* transition: all 0.4s cubic-bezier(0.55, 0.68, 0.48, 1.682); */
+}
+
+#workspaces button.active {
+ color: @crust;
+ background: @mauve;
+ transition: all 0.3s ease-in-out;
+ padding: 0.2rem 2rem;
+ /* transition: all 0.4s cubic-bezier(0.55, 0.68, 0.48, 1.682); */
+}
+
+#workspaces button:hover {
+ padding: 0.2rem 2rem;
+ color: @crust;
+ background: @overlay2;
+ animation: ws_hover 20s ease-in-out 1;
+ transition: all 0.5s cubic-bezier(0.55, -0.68, 0.48, 1.682);
+}
+
+#taskbar,
+#window {
+ background-color: @surface0;
+ border-radius: 5px;
+ padding: 0rem 1rem;
+ margin: 5px 5px;
+}
+
+window#waybar.empty {
+ background-color: @base;
+}
+
+window#waybar.fullscreen,
+window#waybar.swallowing {
+ color: @red;
+}
+
+#network,
+#idle_inhibitor,
+#cpu,
+#memory,
+#backlight,
+#battery,
+#pulseaudio {
+ background: @surface0;
+ padding: 0.1rem 0.7rem;
+ border-radius: 5px;
+ margin: 5px 5px;
+}
+
+#network {
+ color: @text;
+ margin-left: 0px;
+ margin-right: 0px;
+ border-radius: 5px;
+}
+
+#cpu {
+ color: @pink;
+}
+
+#memory {
+ color: @yellow;
+}
+
+#clock {
+ color: @mauve;
+ border-radius: 5px;
+ background: @surface0;
+ margin: 5px 5px;
+ padding: 0.1rem 0.7rem;
+}
+
+#battery {
+ color: @pink;
+}
+
+#battery.charging {
+ color: @pink;
+}
+
+#battery.warning:not(.charging) {
+ color: @mauve;
+}
+
+#backlight {
+ color: @yellow;
+}
+
+#backlight,
+#battery {
+ color: @pink;
+}
+
+#pulseaudio {
+ color: @green;
+}
+
+#tray {
+ padding: 0.1rem 0.7rem;
+}
\ No newline at end of file
diff --git a/config/home-manager/media/video.nix b/config/home-manager/media/video.nix
index 3f23385a..a1e6f82f 100644
--- a/config/home-manager/media/video.nix
+++ b/config/home-manager/media/video.nix
@@ -1,4 +1,5 @@
{ pkgs, lib, config, host, ... }:
+# TODO: Check https://github.com/iynaix/dotfiles/blob/f0f8918caed8f4c245fa82fc505ae0de09a32f5c/home-manager/programs/mpv.nix
let
# Interesting guides:
# - https://kokomins.wordpress.com/2019/10/14/mpv-config-guide/
diff --git a/config/home-manager/terminal/ghostty.nix b/config/home-manager/terminal/ghostty.nix
index 476504fc..8ad14534 100644
--- a/config/home-manager/terminal/ghostty.nix
+++ b/config/home-manager/terminal/ghostty.nix
@@ -52,17 +52,25 @@ in
# MacOS requires installation by hand for now: https://github.com/ghostty-org/ghostty/releases/tag/tip
home.packages = lib.optionals pkgs.stdenv.isLinux [
# Fixes issues with GTK, need to sort this out separately
- (pkgs.writeScriptBin "ghostty" ''
+ (pkgs.writeScriptBin "ghostty-x11" ''
#!${pkgs.stdenv.shell}
GDK_BACKEND=x11 exec ${community.pkgs.ghostty}/bin/ghostty "$@"
'')
(pkgs.makeDesktopItem {
name = "Ghostty";
+ desktopName = "Ghostty-X11";
+ categories = [ "Utility" "Development" ];
+ exec = "GDK_BACKEND=x11 exec ${community.pkgs.ghostty}/bin/ghostty";
+ })
+
+ (pkgs.makeDesktopItem {
+ name = "Ghostty-Wayland";
desktopName = "Ghostty";
categories = [ "Utility" "Development" ];
exec = "GDK_BACKEND=x11 exec ${community.pkgs.ghostty}/bin/ghostty";
})
+
];
xdg.mimeApps.defaultApplications."x-scheme-handler/terminal" = [ "Ghostty.desktop" ];
diff --git a/config/nixos/default.nix b/config/nixos/default.nix
index 61fa459a..e0831f75 100644
--- a/config/nixos/default.nix
+++ b/config/nixos/default.nix
@@ -1,5 +1,10 @@
{ pkgs, lib, network-devices, ... }:
{
+ imports = [
+ ./wayland.nix
+ ./file-manager.nix
+ ];
+
nix = {
gc = {
automatic = true;
diff --git a/config/nixos/file-manager.nix b/config/nixos/file-manager.nix
new file mode 100644
index 00000000..1a12d3fb
--- /dev/null
+++ b/config/nixos/file-manager.nix
@@ -0,0 +1,15 @@
+{ pkgs, ... }:
+{
+ # https://wiki.archlinux.org/title/Thunar
+ programs.thunar = {
+ enable = true;
+ plugins = with pkgs.xfce; [
+ exo
+ thunar-archive-plugin # Unarchive filess more easily
+ thunar-volman # Removable media
+ ];
+ };
+
+ services.gvfs.enable = true; # Mount, trash, and other functionalities
+ services.tumbler.enable = true; # Thumbnail support for images
+}
\ No newline at end of file
diff --git a/config/nixos/wayland.nix b/config/nixos/wayland.nix
new file mode 100644
index 00000000..46d43f84
--- /dev/null
+++ b/config/nixos/wayland.nix
@@ -0,0 +1,20 @@
+{ pkgs, ... }:
+{
+ # https://wiki.hyprland.org/Nvidia/
+ environment.sessionVariables = {
+ LIBVA_DRIVER_NAME = "nvidia";
+ XDG_SESSION_TYPE = "wayland";
+ GBM_BACKEND = "nvidia-drm";
+ __GLX_VENDOR_LIBRARY_NAME = "nvidia";
+ };
+
+ xdg.portal = {
+ enable = true;
+ extraPortals = with pkgs; [
+ xdg-desktop-portal-gtk
+ xdg-desktop-portal-hyprland
+ ];
+ };
+
+ programs.hyprland.enable = true; # Home-Manager sets the rest
+}
\ No newline at end of file
diff --git a/flake.nix b/flake.nix
index 5b203921..f5976cc3 100644
--- a/flake.nix
+++ b/flake.nix
@@ -5,10 +5,12 @@
extra-substituters = [
"https://nix-community.cachix.org"
"https://nixpkgs-wayland.cachix.org"
+ "https://hyprland.cachix.org"
];
extra-trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"nixpkgs-wayland.cachix.org-1:3lwxaILxMRkVhehr5StQprHdEo4IrE8sRho9R9HOLYA="
+ "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
];
};
From d52e27b5b7452662ffb91486f3dd88230d8d7c35 Mon Sep 17 00:00:00 2001
From: Bruno Henriques <4727729+bphenriques@users.noreply.github.com>
Date: Wed, 6 Nov 2024 18:22:36 +0000
Subject: [PATCH 02/34] progress...
---
config/home-manager/desktop/default.nix | 4 +-
config/home-manager/desktop/dunst.nix | 4 +-
.../home-manager/desktop/hyprland/default.nix | 38 ++-
.../desktop/hyprland/keybindings.nix | 1 -
.../home-manager/desktop/hyprland/rules.nix | 46 ++++
.../desktop/hyprland/scripts/close-active.sh | 7 +
.../desktop/hyprland/scripts/volume.sh | 32 +++
.../desktop/hyprland/settings.nix | 38 +--
config/home-manager/desktop/kanshi.nix | 21 +-
config/home-manager/desktop/walker.nix | 5 +
.../home-manager/desktop/waybar/default.nix | 235 +++++++++++-------
.../desktop/waybar/menu/power_menu.xml | 28 +++
config/home-manager/desktop/waybar/style.css | 119 ++++-----
config/home-manager/desktop/wlogout.nix | 39 +++
config/home-manager/desktop/wofi.nix | 3 +
config/home-manager/media/video.nix | 1 +
config/home-manager/terminal/ghostty.nix | 11 +-
config/nixos/default.nix | 2 +-
config/nixos/file-manager.nix | 15 --
config/nixos/thunar.nix | 17 ++
config/nixos/wayland.nix | 15 +-
flake.lock | 59 ++++-
flake.nix | 3 +
hosts/laptop/default.nix | 2 +-
lib/hosts.nix | 1 +
25 files changed, 509 insertions(+), 237 deletions(-)
create mode 100644 config/home-manager/desktop/hyprland/rules.nix
create mode 100644 config/home-manager/desktop/hyprland/scripts/close-active.sh
create mode 100755 config/home-manager/desktop/hyprland/scripts/volume.sh
create mode 100644 config/home-manager/desktop/walker.nix
create mode 100644 config/home-manager/desktop/waybar/menu/power_menu.xml
create mode 100644 config/home-manager/desktop/wlogout.nix
delete mode 100644 config/nixos/file-manager.nix
create mode 100644 config/nixos/thunar.nix
diff --git a/config/home-manager/desktop/default.nix b/config/home-manager/desktop/default.nix
index ce999db0..7eafbb3a 100644
--- a/config/home-manager/desktop/default.nix
+++ b/config/home-manager/desktop/default.nix
@@ -3,10 +3,12 @@
# https://github.com/prasanthrangan/hyprdots?tab=readme-ov-file
imports = [
./hyprland
- ./wofi.nix # Application Launcher
./waybar # Bar on top
./kanshi.nix # Display Manager
./dunst.nix # Notifications
+ ./wlogout.nix # Notifications
+ ./wofi.nix # Application Launcher
+ ./walker.nix # Application Launcher
];
# Use the following theme: https://github.com/iynaix/dotfiles/blob/56d2d63b3b5f4c621429d79fb2aef8d44fdc25b9/home-manager/gui/gtk.nix#L85
diff --git a/config/home-manager/desktop/dunst.nix b/config/home-manager/desktop/dunst.nix
index 77af7c24..80d7b90c 100644
--- a/config/home-manager/desktop/dunst.nix
+++ b/config/home-manager/desktop/dunst.nix
@@ -57,7 +57,9 @@
browser = "/usr/bin/env librewolf -new-tab";
};
- fullscreen_delay_everything = {fullscreen = "delay";};
+ fullscreen_delay_everything = {
+ fullscreen = "delay";
+ };
urgency_critical = {
background = "#d64e4e";
diff --git a/config/home-manager/desktop/hyprland/default.nix b/config/home-manager/desktop/hyprland/default.nix
index 0dc5271f..29ec73ce 100644
--- a/config/home-manager/desktop/hyprland/default.nix
+++ b/config/home-manager/desktop/hyprland/default.nix
@@ -3,29 +3,30 @@ let
wallpapersPkg = self.private.wallpapers.override {
selected = [ "lake-fishing-sunset" "mountains" "whale-sunset" "watch-tower" ];
};
-
- wallpapers = [
- "${wallpapersPkg}/share/wallpapers/mountains.png"
- ];
in
+# https://github.com/Remedan/dotfiles/blob/9c0007afb4b2c7b2dd419db598ef58a44cb92e8b/modules/user/hyprland.nix#L347 ?
# TODO: https://github.com/ErikReider/SwayOSD
+# TODO: https://github.com/JaKooLit/Ja-ZaneyOS/blob/0bed326404ad90ca6803c0a9096426a36a14a35a/config/hyprland.nix#L83
+# TODO: https://github.com/diniamo/niqs/blob/53288d72902365ee8d3bfdd6aff0ec79eb7c1c36/modules/workstation/hyprland.nix
+# https://github.com/JaKooLit/Ja-ZaneyOS/blob/0bed326404ad90ca6803c0a9096426a36a14a35a/config/hyprland.nix
{
imports = [
./settings.nix
./keybindings.nix
+ ./rules.nix
];
home.packages = with pkgs; [
- hyprpaper # TODO: it is a systemd service.. why doesnt it run?
+ hyprpaper
networkmanagerapplet
];
services.hyprpaper = {
enable = true;
settings = {
- preload = wallpapers;
- wallpaper = wallpapers;
+ preload = [ "${wallpapersPkg}/share/wallpapers/mountains.png" ];
+ wallpaper = [ ",${wallpapersPkg}/share/wallpapers/mountains.png" ];
};
};
@@ -37,21 +38,36 @@ in
"$terminal" = "ghostty";
"$fileManager" = "thunar";
- "$menu" = "wofi --show drun";
+ "$menu" = "walker";
"$browser" = "firefox";
env = [
"XDG_SESSION_TYPE,wayland"
"QT_WAYLAND_DISABLE_WINDOWDECORATION,1"
+ # Specific for my laptop with dual gpu. lspci | grep -E 'VGA|3D' -> ls -l /dev/dri/by-path shows that card1 is the iGPU which will take precedence.
+ "AQ_DRM_DEVICES,/dev/dri/card1:/dev/dri/card0"
+
# Nvidia
"LIBVA_DRIVER_NAME,nvidia"
"GBM_BACKEND,nvidia-drm"
"__GLX_VENDOR_LIBRARY_NAME,nvidia"
];
+
+ exec-once = [
+ "dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP" # Fix long-time to start systemd: https://wiki.hyprland.org/FAQ/#some-of-my-apps-take-a-really-long-time-to-open
+ "waybar"
+ "${lib.getExe pkgs.hyprpaper}"
+ "${lib.getExe pkgs.udiskie} --tray"
+ "walker --gapplication-service"
+ "${pkgs.blueman}/bin/blueman-applet"
+ #"${pkgs.networkmanagerapplet}/bin/nm-applet --indicator"
+ ];
};
- };
- # notifications
- #services.mako.enable = true;
+ #systemd = {
+ # enable = true;
+ # variables = ["--all"];
+ #};
+ };
}
\ No newline at end of file
diff --git a/config/home-manager/desktop/hyprland/keybindings.nix b/config/home-manager/desktop/hyprland/keybindings.nix
index 39fafae5..b3a076ff 100644
--- a/config/home-manager/desktop/hyprland/keybindings.nix
+++ b/config/home-manager/desktop/hyprland/keybindings.nix
@@ -57,7 +57,6 @@ let
in
{
wayland.windowManager.hyprland.settings = lib.mkMerge [
-
{
bind = [ "$mod, W, exec, pkill -SIGUSR1 waybar" ]; # Toggle waybar
}
diff --git a/config/home-manager/desktop/hyprland/rules.nix b/config/home-manager/desktop/hyprland/rules.nix
new file mode 100644
index 00000000..ae26e763
--- /dev/null
+++ b/config/home-manager/desktop/hyprland/rules.nix
@@ -0,0 +1,46 @@
+{ lib, config, ... }:
+{
+ wayland.windowManager.hyprland.settings = lib.mkMerge [
+ {
+ windowrulev2 = [
+ # "dimaround,floating:1"
+ "bordersize 5,fullscreen:1" # monocle mode
+ "float,class:(wlroots)" # hyprland debug session
+
+ # Ignore maximize requests from apps. You'll probably like this.
+ "suppressevent maximize, class:.*"
+ "suppressevent fullscreen, class:.*"
+
+ # Save dialog
+ "float,class:(xdg-desktop-portal-gtk)"
+ "size <50% <50%,class:(xdg-desktop-portal-gtk)"
+
+ # Firefox
+ "float,title:^(About Mozilla Firefox)$"
+ "float,class:^(firefox)$,title:^(Picture-in-Picture)$"
+
+ # Misc
+ "float,class:^(org.pulseaudio.pavucontrol)$"
+ "float,class:^(nm-connection-editor)$"
+ "float,class:^(nblueman-manager)$"
+ ];
+ }
+ {
+ layerrule = [
+ # ROFI
+ "blur, launcher"
+ "blur, waybar"
+ "blurpopups, waybar" # Blur waybar popups too!
+ "ignorealpha 0.2, waybar" # Make it so transparent parts are ignored
+ ];
+ }
+ ];
+}
+
+#"blur,notifications"
+#"ignorezero,notifications"
+#"blur,swaync-notification-window"
+#"ignorezero,swaync-notification-window"
+#"blur,swaync-control-center"
+#"ignorezero,swaync-control-center"
+#"blur,logout_dialog"
diff --git a/config/home-manager/desktop/hyprland/scripts/close-active.sh b/config/home-manager/desktop/hyprland/scripts/close-active.sh
new file mode 100644
index 00000000..598e5d7b
--- /dev/null
+++ b/config/home-manager/desktop/hyprland/scripts/close-active.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+if [ "$(hyprctl activewindow -j | jq -r ".class")" = "Steam" ]; then
+ xdotool getactivewindow windowunmap
+else
+ hyprctl dispatch killactive ""
+fi
\ No newline at end of file
diff --git a/config/home-manager/desktop/hyprland/scripts/volume.sh b/config/home-manager/desktop/hyprland/scripts/volume.sh
new file mode 100755
index 00000000..4955c026
--- /dev/null
+++ b/config/home-manager/desktop/hyprland/scripts/volume.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+# TODO: See https://github.com/dunst-project/dunst/blob/master/contrib/progress-notify.sh
+# Similar thing for brigthness? cat /sys/class/backlight/amdgpu_bl1/
+
+get_volume() { amixer get Master | grep '%' | head -n 1 | cut -d '[' -f 2 | cut -d '%' -f 1; }
+is_muted() { amixer get Master | grep '%' | grep -oE '[^ ]+$' | grep off > /dev/null; }
+send_notification() {
+ dunstify -h string:x-canonical-private-synchronous:audio \
+ --icon H \
+ "Volume: " -h int:value:"$(get_volume)";
+}
+
+case $1 in
+ up)
+ amixer -q sset Master 5%+ --quiet
+ send_notification
+ ;;
+ down)
+ amixer -q sset Master 5%- --quiet
+ send_notification
+ ;;
+ mute)
+ amixer -q sset Master toggle
+ amixer -D pulse set Master 1+ toggle > /dev/null
+ if is_muted ; then
+ dunstify -h string:x-canonical-private-synchronous:audio "Volume: 0"
+ else
+ send_notification
+ fi
+ ;;
+esac
\ No newline at end of file
diff --git a/config/home-manager/desktop/hyprland/settings.nix b/config/home-manager/desktop/hyprland/settings.nix
index 1fb4bb65..fd444809 100644
--- a/config/home-manager/desktop/hyprland/settings.nix
+++ b/config/home-manager/desktop/hyprland/settings.nix
@@ -21,16 +21,16 @@ in
];
general = {
- gaps_in = 8;
- gaps_out = 8;
- border_size = 2;
+ gaps_in = 2;
+ gaps_out = 0;
+ border_size = 1;
layout = "master";
+ no_border_on_floating = true;
# https://wiki.hyprland.org/Configuring/Variables/#variable-types for info about colors
"col.active_border" = "rgba(33ccffee) rgba(00ff99ee) 45deg";
"col.inactive_border" = "rgba(595959aa)";
- # Set to true enable resizing windows by clicking and dragging on borders and gaps
resize_on_border = true;
# Please see https://wiki.hyprland.org/Configuring/Tearing/ before you turn this on
@@ -40,9 +40,8 @@ in
decoration = {
rounding = 2;
- # Change transparency of focused and unfocused windows
- active_opacity = 1.0;
- inactive_opacity = 0.9;
+
+ dim_inactive = true;
drop_shadow = true;
shadow_range = 4;
@@ -56,6 +55,8 @@ in
passes = 3;
new_optimizations = true;
};
+
+ # Disable shadows? I honstly dont care much about blur
};
# https://wiki.hyprland.org/Configuring/Variables/#animations
@@ -95,10 +96,6 @@ in
};
exec-once = [
- "${lib.getExe pkgs.hyprpaper}"
- #"sleep 1; hypr-wallpaper && launch-waybar"
- "waybar"
- # TODO: It seems that the cursor gets broken and this fixes that
"hyprctl setcursor ${cursorName} ${toString pointer.size}"
];
@@ -112,9 +109,7 @@ in
input = {
kb_layout = "us,pt";
kb_variant = "euro,";
- kb_model = "";
- kb_options = "";
- kb_rules = "";
+ kb_options = "caps:ctrl_modifier";
follow_mouse = 1;
@@ -122,6 +117,7 @@ in
touchpad = {
natural_scroll = false;
+ tap_button_map = "lmr";
};
};
@@ -130,20 +126,6 @@ in
workspace_swipe = true;
workspace_swipe_forever = true;
};
-
- windowrulev2 = [
- # "dimaround,floating:1"
- "bordersize 5,fullscreen:1" # monocle mode
- "float,class:(wlroots)" # hyprland debug session
- # save dialog
- "float,class:(xdg-desktop-portal-gtk)"
- "size <50% <50%,class:(xdg-desktop-portal-gtk)"
-
-
- # Ignore maximize requests from apps. You'll probably like this.
- "suppressevent maximize, class:.*"
- "suppressevent fullscreen, class:.*"
- ];
};
}
diff --git a/config/home-manager/desktop/kanshi.nix b/config/home-manager/desktop/kanshi.nix
index a2d48939..b7570396 100644
--- a/config/home-manager/desktop/kanshi.nix
+++ b/config/home-manager/desktop/kanshi.nix
@@ -2,6 +2,7 @@
# More examples:
# - https://github.com/colemickens/nixcfg/blob/f28e80177328a7e005bea96d0931a0f1a98d9df5/mixins/kanshi.nix#L21
# - https://github.com/MatthewCroughan/nixcfg/blob/afab322e6da20cc038d8577dd4a365673702d183/users/matthew/modules/kanshi.nix#L2
+# - Check: https://www.reddit.com/r/hyprland/comments/12bv4ps/comment/jho4gko/
let
laptopScreen = {
criteria = "eDP-1";
@@ -18,13 +19,13 @@ let
disable = screen: screen // { status = "disable"; };
in
{
- home.packages = [ pkgs.kanshi ]; # need for kanshictl switch
+ home.packages = [ pkgs.kanshi ]; # needed to run `kanshictl switch`
services.kanshi = {
enable = true;
systemdTarget = "hyprland-session.target";
settings = [
{
- profile.name = "undocked";
+ profile.name = "laptop";
profile.outputs = [
(enable laptopScreen)
(disable dellScreen)
@@ -37,6 +38,22 @@ in
(enable dellScreen)
];
}
+
+ # FIXME
+ {
+ profile.name = "docked-extend";
+ profile.outputs = [
+ (disable laptopScreen)
+ (enable dellScreen)
+ ];
+ }
+ {
+ profile.name = "living-room";
+ profile.outputs = [
+ (disable laptopScreen)
+ (enable dellScreen)
+ ];
+ }
];
};
}
\ No newline at end of file
diff --git a/config/home-manager/desktop/walker.nix b/config/home-manager/desktop/walker.nix
new file mode 100644
index 00000000..7217d27a
--- /dev/null
+++ b/config/home-manager/desktop/walker.nix
@@ -0,0 +1,5 @@
+{ config, pkgs, lib, community, ... }:
+{
+ # Alternative that does not require a external flake: https://codeberg.org/dnkl/fuzzel
+ home.packages = [ community.pkgs.walker pkgs.fuzzel ];
+}
\ No newline at end of file
diff --git a/config/home-manager/desktop/waybar/default.nix b/config/home-manager/desktop/waybar/default.nix
index f418dcca..06518a33 100644
--- a/config/home-manager/desktop/waybar/default.nix
+++ b/config/home-manager/desktop/waybar/default.nix
@@ -1,8 +1,10 @@
{ lib, config, pkgs, ... }:
# https://codeberg.org/explosion-mental/wallust generates colors autoamtically.
-let
- alertSpan = s: ''${s}'';
-in
+# https://github.com/bitSheriff/dotfiles/blob/master/configuration/.config/waybar/modules/modules.jsonc
+# Notification: https://github.com/prasanthrangan/hyprdots/blob/main/Configs/.config/waybar/modules/notifications.jsonc
+
+
+# pkill waybar && hyprctl dispatch exec waybar
{
# https://github.com/nix-community/home-manager/issues/3599
# do not use the systemd service as it is flaky and unreliable
@@ -12,39 +14,71 @@ in
style = ./style.css;
settings = {
"bar" = {
- output = ["eDP-1" "HDMI-A-1"];
-
+ #output = ["eDP-1" "HDMI-A-1"];
+ reload_style_on_change = true;
layer = "top";
position = "top";
- margin-left = 9;
- margin-right = 9;
+ margin-left = 0;
+ margin-right = 0;
margin-top = 0;
margin-bottom = 0;
- spacing = 4;
+ spacing = 2;
- reload_style_on_change = true;
modules-left = [
- "custom/spacer"
+ "custom/os"
"hyprland/workspaces"
- "hyprland/window"
- ]; # [ "custom/nix" "idle_inhibitor" ];
+ ];
modules-center = [
+ "hyprland/window"
];
-
modules-right = [
+ "tray"
"pulseaudio"
+ "battery"
+ "hyprland/language"
"network"
+
+ # List of unsure widgets
"memory"
"cpu"
+ "disk"
"backlight"
- "battery"
+ "power-profiles-daemon"
+
"clock"
- "tray"
];
- "custom/spacer" = {
- format = " ";
+ "hyprland/language" = {
+ format-en = "US";
+ format-pt = "PT";
+ };
+
+ "custom/os" = {
+ format = "";
+ on-click = "wofi --show drun";
+ tooltip = false;
+ #menu = "on-click";
+ #menu-file = ./menu/power_menu.xml;
+ #menu-actions = {
+ # shutdown = "shutdown";
+ # reboot = "reboot";
+ # suspend = "systemctl suspend";
+ # hibernate = "systemctl hibernate";
+ #};
+ };
+
+ "custom/media" = {
+ format = "{icon} {}";
+ escape = true;
+ return-type = "json";
+ max-length = 40;
+ on-click = "playerctl play-pause";
+ on-click-right = "playerctl stop";
+ smooth-scrolling-threshold = 10; # // This value was tested using a trackpad, it should be lowered if using a mouse.
+ on-scroll-up = "playerctl next";
+ on-scroll-down = "playerctl previous";
+ exec = "$HOME/.config/waybar/mediaplayer.py 2> /dev/null"; # // Script in resources/custom_modules folder
};
"wlr/taskbar" = {
@@ -61,15 +95,27 @@ in
tooltip = false;
};
+ temperature = {
+ thermal-zone = 2;
+ critical-threshold = 80;
+ format = "{temperatureC}°C ";
+ };
+
+ disk = {
+ interval = 30;
+ format = " {percentage_used}%";
+ path = "/";
+ tooltip = true;
+ unit = "GB";
+ tooltip-format = "Available {free} of {total}";
+ };
+
memory = {
interval = 30;
- format = " {used}GB";
- format-m = " {used}GB";
- format-h = " {used}GB";
- format-c = " {used}GB";
+ format = " {usage}%";
max-length = 10;
tooltip = true;
- tooltip-format = " {percentage}%\n {used:0.1f}GB/{total:0.1f}GB";
+ tooltip-format = " {used:0.1f}GB/{total:0.1f}GB";
};
backlight = {
@@ -92,71 +138,79 @@ in
format-alt = "{time} {icon}";
format-icons = [ "" "" "" "" "" ];
format-time = "{H}h {M}min";
+ on-click = "${lib.getExe pkgs.wlogout} &";
};
# TODO: bluetooth
clock = {
- calendar = {
- mode = "year";
- mode-mon-col = 3;
- on-scroll = 1;
- actions = {
- on-click-right = "mode";
- on-scroll-down = "shift_down";
- on-scroll-up = "shift_up";
- };
- format = {
- days = "{}";
- months = "{}";
- today = "{}";
- weekdays = "{}";
- };
- };
- format = " {:%a %d %b %H:%M}";
- format-alt = "{:%H:%M %Y-%m-%d}";
+ format = "{:%a %d %b %H:%M}";
interval = 10;
tooltip-format = "{calendar}";
+ calendar = {
+ mode = "year";
+ mode-mon-col = 3;
+ weeks-pos = "right" ;
+ on-scroll = 1;
+ on-click-right = "mode";
+ format = {
+ months = "{}";
+ days = "{}";
+ weeks = "W{}";
+ weekdays = "{}";
+ today = "{}";
+ };
+ };
+ actions = {
+ on-click-right = "mode";
+ on-click-forward = "tz_up";
+ on-click-backward = "tz_down";
+ on-scroll-up = "shift_up";
+ on-scroll-down = "shift_down";
+ };
};
+
tray = {
icon-size = 18;
spacing = 10;
};
- #"custom/nix" = {
- # format = "";
- # on-click = "hypr-wallpaper";
- # on-click-right = "wallpapers-select";
- # tooltip = false;
- #};
-
- #idle_inhibitor = lib.mkIf cfg.idleInhibitor {
- # format = "{icon}";
- # format-icons = {
- # activated = alertSpan "";
- # deactivated = "";
- # };
- #};
-
- "hyprland/workspaces" = {
- disable-scroll = false;
- all-outputs = false;
- active-only = false;
- format = "{icon}";
- format-icons = {
- "1" = "1";
- "2" = "2";
- "3" = "3";
- "4" = "4";
- "5" = "5";
- "6" = "6";
- "7" = "7";
- "8" = "8";
- "9" = "9";
- urgent = " ";
- };
+ "hyprland/workspaces" = {
+ icon-size = 32;
+ spacing = 16;
+ disable-scroll = false;
+ all-outputs = false;
+ active-only = false;
+ on-scroll-up = "hyprctl dispatch workspace e+1";
+ on-scroll-down = "hyprctl dispatch workspace e-1";
+ format = "{icon}";
+ format-icons = {
+ "1" = "1";
+ "2" = "2";
+ "3" = "3";
+ "4" = "4";
+ "5" = "5";
+ "6" = "6";
+ "7" = "7";
+ "8" = "8";
+ "9" = "9";
+ urgent = " ";
+ };
+ };
+
+ power-profiles-daemon = {
+ format = "{icon}";
+ tooltip-format = "Power profile: {profile}\nDriver: {driver}";
+ tooltip = true;
+ format-icons = {
+ default = "";
+ performance = "";
+ balanced = "";
+ power-saver = "";
};
+ min-length = 6;
+ };
"hyprland/window" = {
max-length = 50;
@@ -167,28 +221,28 @@ in
};
network = {
- format-wifi = "{essid} ({signalStrength}%) ";
- format-ethernet = "{ipaddr}/{cidr} ";
- format-linked = "{ifname} (No IP)";
- format-disconnected = alertSpan "Disconnected ⚠";
- format-alt = "{ifname}: {ipaddr}";
+ format-wifi = " {icon}";
+ format-ethernet = " ";
+ format-disconnected = "";
+ format-icons = [ " " " " " " " " " " ];
tooltip = true;
tooltip-format = ''
- IP: {ipaddr}/{cidr}
- Gateway: {gwaddr}'';
+ IP: {ipaddr}/{cidr}
+ Gateway: {gwaddr}'';
on-click = "${config.xdg.configHome}/rofi/rofi-wifi-menu"; # FIXME
on-click-right = "nmtui"; #FIXME
};
+
# See more: https://github.com/prasanthrangan/hyprdots/blob/main/Configs/.config/waybar/modules/pulseaudio.jsonc
pulseaudio = {
- format = "{volume}% {icon} {format_source}";
- format-bluetooth = "{volume}% {icon} {format_source}";
- format-bluetooth-muted = " {icon} {format_source}";
- format-muted = " {format_source}";
- format-source = "{volume}% ";
- format-source-muted = "";
+ format = "{icon}";
+ format-bluetooth = "{icon}";
+ format-bluetooth-muted = " {icon}";
+ #format-muted = " {format_source}";
+ format-source = "";
+ format-source-muted = "";
format-icons = {
headphone = "";
hands-free = "";
@@ -201,17 +255,8 @@ in
on-click = "${lib.getExe pkgs.pavucontrol}";
tooltip = true;
- tooltip-format = "{icon} {desc} // {volume}%";
+ tooltip-format = ''{icon} {volume}% - {desc}'';
};
-
- #"custom/powermenu" = {
- # "format" = "";
- # "on-click" = "pkill rofi || ~/.config/rofi/powermenu/type-3/powermenu.sh";
- # "tooltip" = false;
- #};
-
-
- # Notification: https://github.com/prasanthrangan/hyprdots/blob/main/Configs/.config/waybar/modules/notifications.jsonc
};
};
};
diff --git a/config/home-manager/desktop/waybar/menu/power_menu.xml b/config/home-manager/desktop/waybar/menu/power_menu.xml
new file mode 100644
index 00000000..49c75e35
--- /dev/null
+++ b/config/home-manager/desktop/waybar/menu/power_menu.xml
@@ -0,0 +1,28 @@
+
+
+
+
\ No newline at end of file
diff --git a/config/home-manager/desktop/waybar/style.css b/config/home-manager/desktop/waybar/style.css
index 7ef13951..fd5af26d 100644
--- a/config/home-manager/desktop/waybar/style.css
+++ b/config/home-manager/desktop/waybar/style.css
@@ -26,6 +26,25 @@
@define-color mantle #181825;
@define-color crust #11111b;
+
+
+@define-color bg_main rgba(25, 25, 25, 0.65);
+@define-color bg_main_tooltip rgba(0, 0, 0, 0.7);
+
+
+/*base background color of selections */
+@define-color bg_hover rgba(200, 200, 200, 0.3);
+/*base background color of active elements */
+@define-color bg_active rgba(100, 100, 100, 0.5);
+
+/*base border color*/
+@define-color border_main rgba(255, 255, 255, 0.2);
+/*text color for entries, views and content in general */
+@define-color content_main white;
+/*text color for entries that are unselected */
+@define-color content_inactive rgba(255, 255, 255, 0.25);
+
+
* {
font-family: "Maple Mono", "CaskaydiaCove NF";
font-size: 15px;
@@ -33,78 +52,47 @@
}
#waybar {
- background: rgba(30, 30, 46, 0.9);
+ background: rgba(30, 30, 46, 0.75);
color: @text;
- border-radius: 5px;
}
-#custom-spacer {
- background: @blue;
- color: @crust;
- border-radius: 5px;
- margin: 2px 2px;
- padding: 0.1rem 0.7rem;
+#custom-os {
+ font-family: "JetBrainsMono Nerd Font";
+ font-size: 20px;
+ padding-left: 12px;
+ padding-right: 20px;
+ transition: all 0.25s cubic-bezier(0.165, 0.84, 0.44, 1);
+}
+#custom-os_button:hover {
+ background: @bg_hover;
+ color: @content_main;
}
#workspaces {
- font-weight: bold;
- background: @surface0;
- color: @text;
- box-shadow: none;
- text-shadow: none;
- border-radius: 10px;
- transition: 0.2s ease;
- padding-left: 4px;
- padding-right: 4px;
- padding-top: 1px;
- margin: 5px 5px;
+ color: transparent;
+ margin-right: 1.5px;
+ margin-left: 1.5px;
}
-
#workspaces button {
- color: @overlay2;
- transition: all 0.3s ease-in-out;
- padding: 0.2rem 10px;
- /* animation: ws_normal 20s ease-in-out 1; */
-}
-
-#workspaces button.empty {
- color: @text;
-}
-
-#workspaces button.visible {
- color: @crust;
- padding: 0.2rem 2rem;
- background: @sky;
- transition: all 0.3s ease-in-out;
- /* transition: all 0.4s cubic-bezier(0.55, 0.68, 0.48, 1.682); */
+ padding: 3px;
+ color: @content_inactive;
+ transition: all 0.25s cubic-bezier(0.165, 0.84, 0.44, 1);
}
-
#workspaces button.active {
- color: @crust;
- background: @mauve;
- transition: all 0.3s ease-in-out;
- padding: 0.2rem 2rem;
- /* transition: all 0.4s cubic-bezier(0.55, 0.68, 0.48, 1.682); */
+ color: @content_main;
+ border-bottom: 3px solid white;
}
-
-#workspaces button:hover {
- padding: 0.2rem 2rem;
- color: @crust;
- background: @overlay2;
- animation: ws_hover 20s ease-in-out 1;
- transition: all 0.5s cubic-bezier(0.55, -0.68, 0.48, 1.682);
+#workspaces button.focused {
+ color: @bg_active;
}
-
-#taskbar,
-#window {
- background-color: @surface0;
- border-radius: 5px;
- padding: 0rem 1rem;
- margin: 5px 5px;
+#workspaces button.urgent {
+ background: rgba(255, 200, 0, 0.35);
+ border-bottom: 3px dashed @warning_color;
+ color: @warning_color;
}
-
-window#waybar.empty {
- background-color: @base;
+#workspaces button:hover {
+ background: @bg_hover;
+ color: @content_main;
}
window#waybar.fullscreen,
@@ -119,9 +107,7 @@ window#waybar.swallowing {
#backlight,
#battery,
#pulseaudio {
- background: @surface0;
padding: 0.1rem 0.7rem;
- border-radius: 5px;
margin: 5px 5px;
}
@@ -129,7 +115,6 @@ window#waybar.swallowing {
color: @text;
margin-left: 0px;
margin-right: 0px;
- border-radius: 5px;
}
#cpu {
@@ -142,16 +127,20 @@ window#waybar.swallowing {
#clock {
color: @mauve;
- border-radius: 5px;
- background: @surface0;
margin: 5px 5px;
- padding: 0.1rem 0.7rem;
}
#battery {
color: @pink;
}
+#language {
+ margin: 5px 5px;
+ padding: 0.1rem 0.7rem;
+ border-radius: 5px;
+ border: 1px solid white;
+}
+
#battery.charging {
color: @pink;
}
diff --git a/config/home-manager/desktop/wlogout.nix b/config/home-manager/desktop/wlogout.nix
new file mode 100644
index 00000000..b041c61f
--- /dev/null
+++ b/config/home-manager/desktop/wlogout.nix
@@ -0,0 +1,39 @@
+{ pkgs, lib, ... }:
+{
+ # Theme? https://github.com/Sum1Code/nixos-dotfile/blob/ce81aab23096e65ea7448a060ddf41b0bb627167/home/apps/wlogout/style.nix
+ programs.wlogout = {
+ enable = true;
+ layout = [
+ {
+ label = "lock";
+ action = "hyprlock";
+ text = "Lock";
+ keybind = "l";
+ }
+ {
+ label = "logout";
+ action = "hyprctl dispatch exit 0";
+ text = "Logout";
+ keybind = "e";
+ }
+ {
+ label = "shutdown";
+ action = "systemctl poweroff";
+ text = "Shutdown";
+ keybind = "s";
+ }
+ {
+ label = "suspend";
+ action = "systemctl suspend";
+ text = "Suspend";
+ keybind = "u";
+ }
+ {
+ label = "reboot";
+ action = "systemctl reboot";
+ text = "Reboot";
+ keybind = "r";
+ }
+ ];
+ };
+}
\ No newline at end of file
diff --git a/config/home-manager/desktop/wofi.nix b/config/home-manager/desktop/wofi.nix
index 25a6e2af..d42239e3 100644
--- a/config/home-manager/desktop/wofi.nix
+++ b/config/home-manager/desktop/wofi.nix
@@ -1,4 +1,7 @@
{ config, lib, pkgs, ... }:
+# TODO alternative: https://github.com/abenz1267/walker
+
+
let
font = {
variable = "Hack Nerd Font Mono";
diff --git a/config/home-manager/media/video.nix b/config/home-manager/media/video.nix
index a1e6f82f..1e861bd5 100644
--- a/config/home-manager/media/video.nix
+++ b/config/home-manager/media/video.nix
@@ -1,5 +1,6 @@
{ pkgs, lib, config, host, ... }:
# TODO: Check https://github.com/iynaix/dotfiles/blob/f0f8918caed8f4c245fa82fc505ae0de09a32f5c/home-manager/programs/mpv.nix
+# TODO: https://github.com/diniamo/niqs/blob/53288d72902365ee8d3bfdd6aff0ec79eb7c1c36/home/mpv/anime.nix
let
# Interesting guides:
# - https://kokomins.wordpress.com/2019/10/14/mpv-config-guide/
diff --git a/config/home-manager/terminal/ghostty.nix b/config/home-manager/terminal/ghostty.nix
index 8ad14534..ba10aaaf 100644
--- a/config/home-manager/terminal/ghostty.nix
+++ b/config/home-manager/terminal/ghostty.nix
@@ -52,25 +52,18 @@ in
# MacOS requires installation by hand for now: https://github.com/ghostty-org/ghostty/releases/tag/tip
home.packages = lib.optionals pkgs.stdenv.isLinux [
# Fixes issues with GTK, need to sort this out separately
+ community.pkgs.ghostty
(pkgs.writeScriptBin "ghostty-x11" ''
#!${pkgs.stdenv.shell}
GDK_BACKEND=x11 exec ${community.pkgs.ghostty}/bin/ghostty "$@"
'')
(pkgs.makeDesktopItem {
- name = "Ghostty";
+ name = "Ghostty-X11";
desktopName = "Ghostty-X11";
categories = [ "Utility" "Development" ];
exec = "GDK_BACKEND=x11 exec ${community.pkgs.ghostty}/bin/ghostty";
})
-
- (pkgs.makeDesktopItem {
- name = "Ghostty-Wayland";
- desktopName = "Ghostty";
- categories = [ "Utility" "Development" ];
- exec = "GDK_BACKEND=x11 exec ${community.pkgs.ghostty}/bin/ghostty";
- })
-
];
xdg.mimeApps.defaultApplications."x-scheme-handler/terminal" = [ "Ghostty.desktop" ];
diff --git a/config/nixos/default.nix b/config/nixos/default.nix
index e0831f75..dd241795 100644
--- a/config/nixos/default.nix
+++ b/config/nixos/default.nix
@@ -2,7 +2,7 @@
{
imports = [
./wayland.nix
- ./file-manager.nix
+ ./thunar.nix
];
nix = {
diff --git a/config/nixos/file-manager.nix b/config/nixos/file-manager.nix
deleted file mode 100644
index 1a12d3fb..00000000
--- a/config/nixos/file-manager.nix
+++ /dev/null
@@ -1,15 +0,0 @@
-{ pkgs, ... }:
-{
- # https://wiki.archlinux.org/title/Thunar
- programs.thunar = {
- enable = true;
- plugins = with pkgs.xfce; [
- exo
- thunar-archive-plugin # Unarchive filess more easily
- thunar-volman # Removable media
- ];
- };
-
- services.gvfs.enable = true; # Mount, trash, and other functionalities
- services.tumbler.enable = true; # Thumbnail support for images
-}
\ No newline at end of file
diff --git a/config/nixos/thunar.nix b/config/nixos/thunar.nix
new file mode 100644
index 00000000..2e1c26cc
--- /dev/null
+++ b/config/nixos/thunar.nix
@@ -0,0 +1,17 @@
+{ pkgs, ... }:
+{
+ # https://wiki.archlinux.org/title/Thunar
+ programs.thunar = {
+ enable = true;
+ plugins = with pkgs.xfce; [
+ exo
+ thunar-archive-plugin # Unarchive filess more easily
+ thunar-volman # Removable media
+ ];
+ };
+
+ programs.xfconf.enable = true; # Required to persist Thunar settings as we're not running on XFCE
+ services.gvfs.enable = true; # Mount, trash, and other functionalities
+ services.tumbler.enable = true; # Thumbnail support for images
+ programs.file-roller.enable = true; # For thunar-archive-plugin
+}
\ No newline at end of file
diff --git a/config/nixos/wayland.nix b/config/nixos/wayland.nix
index 46d43f84..923ae107 100644
--- a/config/nixos/wayland.nix
+++ b/config/nixos/wayland.nix
@@ -1,12 +1,15 @@
{ pkgs, ... }:
{
# https://wiki.hyprland.org/Nvidia/
- environment.sessionVariables = {
- LIBVA_DRIVER_NAME = "nvidia";
- XDG_SESSION_TYPE = "wayland";
- GBM_BACKEND = "nvidia-drm";
- __GLX_VENDOR_LIBRARY_NAME = "nvidia";
- };
+ #environment.sessionVariables = {
+ # LIBVA_DRIVER_NAME = "nvidia";
+ # XDG_SESSION_TYPE = "wayland";
+ # GBM_BACKEND = "nvidia-drm";
+ # __GLX_VENDOR_LIBRARY_NAME = "nvidia";
+ #};
+
+ # TODO: Can I run this on demand?
+ programs.nm-applet.enable = true;
xdg.portal = {
enable = true;
diff --git a/flake.lock b/flake.lock
index db13a9f1..4399eb35 100644
--- a/flake.lock
+++ b/flake.lock
@@ -61,6 +61,27 @@
"url": "ssh://git@github.com/bphenriques/dotfiles-private"
}
},
+ "flake-parts": {
+ "inputs": {
+ "nixpkgs-lib": [
+ "walker",
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1719994518,
+ "narHash": "sha256-pQMhCCHyQGRzdfAkdJ4cIWiw+JNuWsTX7f0ZYSyz0VY=",
+ "owner": "hercules-ci",
+ "repo": "flake-parts",
+ "rev": "9227223f6d922fee3c7b190b2cc238a99527bbb7",
+ "type": "github"
+ },
+ "original": {
+ "owner": "hercules-ci",
+ "repo": "flake-parts",
+ "type": "github"
+ }
+ },
"flake-utils": {
"inputs": {
"systems": "systems"
@@ -199,6 +220,22 @@
"type": "github"
}
},
+ "nixpkgs_2": {
+ "locked": {
+ "lastModified": 1720957393,
+ "narHash": "sha256-oedh2RwpjEa+TNxhg5Je9Ch6d3W1NKi7DbRO1ziHemA=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "693bc46d169f5af9c992095736e82c3488bf7dbb",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "nixos-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
"nur": {
"locked": {
"lastModified": 1729525671,
@@ -224,7 +261,8 @@
"nixpkgs": "nixpkgs",
"nixpkgs-stable": "nixpkgs-stable_2",
"nur": "nur",
- "sops-nix": "sops-nix"
+ "sops-nix": "sops-nix",
+ "walker": "walker"
}
},
"sops-nix": {
@@ -263,6 +301,25 @@
"type": "github"
}
},
+ "walker": {
+ "inputs": {
+ "flake-parts": "flake-parts",
+ "nixpkgs": "nixpkgs_2"
+ },
+ "locked": {
+ "lastModified": 1730878291,
+ "narHash": "sha256-TiZcHS/r7RrS+sr19Qhb0UFu+AYYzyR78bzicwMg7qE=",
+ "owner": "abenz1267",
+ "repo": "walker",
+ "rev": "470c43621279b12c9d824909645052ae7b6b8219",
+ "type": "github"
+ },
+ "original": {
+ "owner": "abenz1267",
+ "repo": "walker",
+ "type": "github"
+ }
+ },
"zig": {
"inputs": {
"flake-compat": [
diff --git a/flake.nix b/flake.nix
index f5976cc3..4e24a47f 100644
--- a/flake.nix
+++ b/flake.nix
@@ -6,11 +6,13 @@
"https://nix-community.cachix.org"
"https://nixpkgs-wayland.cachix.org"
"https://hyprland.cachix.org"
+ "https://walker-git.cachix.org"
];
extra-trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"nixpkgs-wayland.cachix.org-1:3lwxaILxMRkVhehr5StQprHdEo4IrE8sRho9R9HOLYA="
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
+ "walker-git.cachix.org-1:vmC0ocfPWh0S/vRAQGtChuiZBTAe4wiKDeyyXM0/7pM="
];
};
@@ -35,6 +37,7 @@
disko.inputs.nixpkgs.follows = "nixpkgs";
nur.url = "github:nix-community/nur"; # Collection of packages. Use it for Firefox extensions
ghostty.url = "git+ssh://git@github.com/mitchellh/ghostty"; # Terminal
+ walker.url = "github:abenz1267/walker"; # Application launcher
};
outputs = inputs @ { nixpkgs, ... }:
diff --git a/hosts/laptop/default.nix b/hosts/laptop/default.nix
index ad3c1500..5c49bf84 100644
--- a/hosts/laptop/default.nix
+++ b/hosts/laptop/default.nix
@@ -1,4 +1,4 @@
-{ self, mylib, nixpkgs, home-manager, sops-nix, disko, nur, ... }:
+{ self, mylib, nixpkgs, home-manager, sops-nix, disko, nur, walker, ... }:
let
inherit (nixpkgs.lib.attrsets) attrValues;
diff --git a/lib/hosts.nix b/lib/hosts.nix
index 92a8dc36..e1e6eff1 100644
--- a/lib/hosts.nix
+++ b/lib/hosts.nix
@@ -24,6 +24,7 @@ let
};
community.pkgs = {
ghostty = inputs.ghostty.packages.${system}.default;
+ walker = inputs.walker.packages.${system}.default;
firefox-addons = inputs.firefox-addons.packages.${system};
};
From dfdc8c7b1394f234e7325f129012c40964706359 Mon Sep 17 00:00:00 2001
From: Bruno Henriques <4727729+bphenriques@users.noreply.github.com>
Date: Fri, 8 Nov 2024 15:53:34 +0000
Subject: [PATCH 03/34] progress.. actually disabling kde and breaking most
things
---
config/home-manager/coding/helix.nix | 2 +
.../desktop/ags/config/.gitignore | 5 +
.../config/assets/nix-snowflake-symbolic.svg | 155 ++++++++++++++++++
.../home-manager/desktop/ags/config/config.js | 14 ++
.../home-manager/desktop/ags/config/main.ts | 39 +++++
.../ags/config/notification-daemon/battery.ts | 14 ++
.../config/notification-daemon/ignore-list.ts | 16 ++
.../ags/config/notification-daemon/init.ts | 22 +++
.../desktop/ags/config/options.ts | 104 ++++++++++++
.../desktop/ags/config/style/main.scss | 0
.../desktop/ags/config/style/style.css | 118 +++++++++++++
.../desktop/ags/config/tsconfig.json | 18 ++
.../desktop/ags/config/widget/bar/bar.ts | 22 +++
.../desktop/ags/config/widget/bar/battery.js | 13 ++
.../desktop/ags/config/widget/bar/clock.js | 10 ++
.../ags/config/widget/bar/hyprland-active.js | 9 +
.../config/widget/bar/hyprland-workspaces.js | 37 +++++
.../desktop/ags/config/widget/bar/launcher.ts | 8 +
.../desktop/ags/config/widget/bar/media.ts | 20 +++
.../desktop/ags/config/widget/bar/systray.ts | 15 ++
.../desktop/ags/config/widget/bar/volume.js | 22 +++
.../ags/config/widget/notification-popup.js | 130 +++++++++++++++
config/home-manager/desktop/ags/default.nix | 19 +++
config/home-manager/desktop/default.nix | 49 +++++-
config/home-manager/desktop/dunst.nix | 78 ---------
config/home-manager/desktop/fuzzel.nix | 4 +
.../home-manager/desktop/hyprland/default.nix | 20 ++-
.../home-manager/desktop/hyprland/rules.nix | 11 +-
.../desktop/hyprland/settings.nix | 12 +-
config/home-manager/desktop/walker.nix | 5 -
config/home-manager/desktop/wlogout.nix | 39 -----
config/nixos/wayland.nix | 35 ++--
flake.lock | 102 ++++++------
flake.nix | 8 +-
hosts/laptop/config.nix | 16 +-
hosts/laptop/default.nix | 20 ++-
hosts/laptop/filesystem/disko.nix | 2 +-
lib/hosts.nix | 1 -
38 files changed, 963 insertions(+), 251 deletions(-)
create mode 100644 config/home-manager/desktop/ags/config/.gitignore
create mode 100644 config/home-manager/desktop/ags/config/assets/nix-snowflake-symbolic.svg
create mode 100644 config/home-manager/desktop/ags/config/config.js
create mode 100644 config/home-manager/desktop/ags/config/main.ts
create mode 100644 config/home-manager/desktop/ags/config/notification-daemon/battery.ts
create mode 100644 config/home-manager/desktop/ags/config/notification-daemon/ignore-list.ts
create mode 100644 config/home-manager/desktop/ags/config/notification-daemon/init.ts
create mode 100644 config/home-manager/desktop/ags/config/options.ts
create mode 100644 config/home-manager/desktop/ags/config/style/main.scss
create mode 100644 config/home-manager/desktop/ags/config/style/style.css
create mode 100644 config/home-manager/desktop/ags/config/tsconfig.json
create mode 100644 config/home-manager/desktop/ags/config/widget/bar/bar.ts
create mode 100644 config/home-manager/desktop/ags/config/widget/bar/battery.js
create mode 100644 config/home-manager/desktop/ags/config/widget/bar/clock.js
create mode 100644 config/home-manager/desktop/ags/config/widget/bar/hyprland-active.js
create mode 100644 config/home-manager/desktop/ags/config/widget/bar/hyprland-workspaces.js
create mode 100644 config/home-manager/desktop/ags/config/widget/bar/launcher.ts
create mode 100644 config/home-manager/desktop/ags/config/widget/bar/media.ts
create mode 100644 config/home-manager/desktop/ags/config/widget/bar/systray.ts
create mode 100644 config/home-manager/desktop/ags/config/widget/bar/volume.js
create mode 100644 config/home-manager/desktop/ags/config/widget/notification-popup.js
create mode 100644 config/home-manager/desktop/ags/default.nix
delete mode 100644 config/home-manager/desktop/dunst.nix
create mode 100644 config/home-manager/desktop/fuzzel.nix
delete mode 100644 config/home-manager/desktop/walker.nix
delete mode 100644 config/home-manager/desktop/wlogout.nix
diff --git a/config/home-manager/coding/helix.nix b/config/home-manager/coding/helix.nix
index 1c731bed..17444d64 100644
--- a/config/home-manager/coding/helix.nix
+++ b/config/home-manager/coding/helix.nix
@@ -11,6 +11,8 @@
nodePackages.bash-language-server # LSP for Bash
nodePackages.yaml-language-server # LSP for YAML
nodePackages.vscode-json-languageserver # LSP for JSON
+ vscode-langservers-extracted # LSP for HTML/CSS/JSON/ESLint
+ typescript-language-server # LSP for Typescript
docker-compose-language-service # LSP for docker-compose
dockerfile-language-server-nodejs # LSP for docker
texlab # LSP for LaTeX
diff --git a/config/home-manager/desktop/ags/config/.gitignore b/config/home-manager/desktop/ags/config/.gitignore
new file mode 100644
index 00000000..f9346ea5
--- /dev/null
+++ b/config/home-manager/desktop/ags/config/.gitignore
@@ -0,0 +1,5 @@
+node_modules
+types
+package-lock.json
+bun.lockb
+.weather
\ No newline at end of file
diff --git a/config/home-manager/desktop/ags/config/assets/nix-snowflake-symbolic.svg b/config/home-manager/desktop/ags/config/assets/nix-snowflake-symbolic.svg
new file mode 100644
index 00000000..7bb42edd
--- /dev/null
+++ b/config/home-manager/desktop/ags/config/assets/nix-snowflake-symbolic.svg
@@ -0,0 +1,155 @@
+
+
diff --git a/config/home-manager/desktop/ags/config/config.js b/config/home-manager/desktop/ags/config/config.js
new file mode 100644
index 00000000..2f1be32b
--- /dev/null
+++ b/config/home-manager/desktop/ags/config/config.js
@@ -0,0 +1,14 @@
+const entry = App.configDir + '/main.ts'
+const outdir = '/tmp/ags/js'
+
+try {
+ await Utils.execAsync([
+ 'bun', 'build', entry,
+ '--outdir', outdir,
+ '--external', 'resource://*',
+ '--external', 'gi://*',
+ ])
+ await import(`file://${outdir}/main.js`)
+} catch (error) {
+ console.error(error)
+}
\ No newline at end of file
diff --git a/config/home-manager/desktop/ags/config/main.ts b/config/home-manager/desktop/ags/config/main.ts
new file mode 100644
index 00000000..407fbc58
--- /dev/null
+++ b/config/home-manager/desktop/ags/config/main.ts
@@ -0,0 +1,39 @@
+import { Bar } from "./widget/bar/bar.js"
+import { NotificationPopups } from "./widget/notification-popup.js"
+import { setupNotificationDaemon } from "./notification-daemon/init.js"
+
+// https://aylur.github.io/ags-docs/config/theming/
+function debug() {
+ Utils.monitorFile(
+ // directory that contains the scss files
+ `${App.configDir}/style`,
+
+ // reload function
+ function() {
+ // main scss file
+ //const scss = `${App.configDir}/style.scss`
+
+ // target css file
+ //const css = `/tmp/my-style.css`
+ console.log("reloading")
+ const css = `${App.configDir}/style/style.css`
+ // compile, reset, apply
+ //Utils.exec(`sassc ${scss} ${css}`)
+ App.resetCss()
+ App.applyCss(css)
+ },
+ )
+}
+
+debug()
+App.addIcons(`${App.configDir}/assets`)
+App.config({
+ onConfigParsed: () => {
+ setupNotificationDaemon()
+ },
+ style: `${App.configDir}/style/style.css`,
+ windows: [
+ NotificationPopups(),
+ Bar(0)
+ ]
+})
\ No newline at end of file
diff --git a/config/home-manager/desktop/ags/config/notification-daemon/battery.ts b/config/home-manager/desktop/ags/config/notification-daemon/battery.ts
new file mode 100644
index 00000000..dbb5dd71
--- /dev/null
+++ b/config/home-manager/desktop/ags/config/notification-daemon/battery.ts
@@ -0,0 +1,14 @@
+const bat = await Service.import("battery")
+
+export default async function init() {
+ bat.connect("notify::percent", ({ percent, charging }) => {
+ const low = 30
+ if (percent !== low || percent !== low / 2 || !charging)
+ return
+
+ Utils.notify({
+ summary: `${percent}% Battery Percentage`,
+ urgency: "critical",
+ })
+ })
+}
\ No newline at end of file
diff --git a/config/home-manager/desktop/ags/config/notification-daemon/ignore-list.ts b/config/home-manager/desktop/ags/config/notification-daemon/ignore-list.ts
new file mode 100644
index 00000000..4a4e2ff7
--- /dev/null
+++ b/config/home-manager/desktop/ags/config/notification-daemon/ignore-list.ts
@@ -0,0 +1,16 @@
+import options from "options"
+const notifs = await Service.import("notifications")
+
+// TODO: consider adding this to upstream
+
+// const { blacklist } = options.notifications
+
+export default function init() {
+ const notify = notifs.constructor.prototype.Notify.bind(notifs)
+ notifs.constructor.prototype.Notify = function(appName: string, ...rest: unknown[]) {
+ if (blacklist.value.includes(appName))
+ return Number.MAX_SAFE_INTEGER
+
+ return notify(appName, ...rest)
+ }
+}
\ No newline at end of file
diff --git a/config/home-manager/desktop/ags/config/notification-daemon/init.ts b/config/home-manager/desktop/ags/config/notification-daemon/init.ts
new file mode 100644
index 00000000..dceea547
--- /dev/null
+++ b/config/home-manager/desktop/ags/config/notification-daemon/init.ts
@@ -0,0 +1,22 @@
+import battery from "./battery"
+
+function exampleNotification() {
+ Utils.timeout(100, () => Utils.notify({
+ summary: "Notification Popup Example",
+ iconName: "info-symbolic",
+ body: "Lorem ipsum dolor sit amet, qui minim labore adipisicing "
+ + "minim sint cillum sint consectetur cupidatat.",
+ actions: {
+ "Cool": () => print("pressed Cool"),
+ },
+ }))
+}
+
+export function setupNotificationDaemon() {
+ try {
+ battery()
+ exampleNotification()
+ } catch (error) {
+ logError(error)
+ }
+}
\ No newline at end of file
diff --git a/config/home-manager/desktop/ags/config/options.ts b/config/home-manager/desktop/ags/config/options.ts
new file mode 100644
index 00000000..c0d59225
--- /dev/null
+++ b/config/home-manager/desktop/ags/config/options.ts
@@ -0,0 +1,104 @@
+import { opt, mkOptions } from "lib/option"
+import { icon } from "lib/utils"
+import icons from "lib/icons"
+
+const nix = JSON.parse(Utils.readFile(Utils.CACHE_DIR + "/options-nix.json") || '{}')
+
+//https://github.com/Serpentian/AlfheimOS/blob/master/non-nix/ags/widget/bar/buttons/Launcher.ts
+//https://github.com/Serpentian/AlfheimOS/blob/master/user/wm/hyprland/ags.nix
+
+const options = mkOptions(OPTIONS, {
+ wallpaper: opt(nix?.wallpaper || ""),
+
+ font: {
+ size: opt(nix?.font?.size || 12),
+ name: opt(nix?.font?.name || "Ubuntu Nerd Font"),
+ },
+
+ bar: {
+ layout: {
+ start: opt>([
+ "launcher",
+ "workspaces",
+ // "taskbar",
+ "media",
+ "expander",
+ "cava",
+ ]),
+ center: opt>([
+ "date",
+ ]),
+ end: opt>([
+ "cava",
+ "expander",
+ "submap",
+ "battery",
+ "systray",
+ "system",
+ "powermenu",
+ ]),
+ },
+ launcher: {
+ icon: {
+ colored: opt(false),
+ icon: opt(icon(icons.nix.nix, icons.ui.search)),
+ },
+ label: {
+ colored: opt(false),
+ label: opt(""),
+ },
+ action: opt(() => App.toggleWindow("launcher")),
+ },
+ date: {
+ format: opt("%R, %a, %d %b"),
+ action: opt(() => App.toggleWindow("datemenu")),
+ },
+ battery: {
+ bar: opt<"hidden" | "regular" | "whole">("hidden"),
+ charging: opt("#00D787"),
+ percentage: opt(true),
+ blocks: opt(7),
+ width: opt(50),
+ low: opt(30),
+ },
+ workspaces: {
+ workspaces: opt(7),
+ },
+ taskbar: {
+ iconSize: opt(0),
+ monochrome: opt(true),
+ exclusive: opt(false),
+ },
+ systray: {
+ ignore: opt([
+ "KDE Connect Indicator",
+ "spotify-client",
+ ]),
+ },
+ media: {
+ monochrome: opt(true),
+ preferred: opt("spotify"),
+ direction: opt<"left" | "right">("right"),
+ format: opt(" {artist} - {title} "),
+ length: opt(0),
+ },
+ powermenu: {
+ monochrome: opt(false),
+ action: opt(() => App.toggleWindow("powermenu")),
+ },
+ },
+
+ powermenu: {
+ sleep: opt("systemctl suspend"),
+ reboot: opt("systemctl reboot"),
+ logout: opt("pkill Hyprland"),
+ shutdown: opt("shutdown now"),
+ },
+
+ notifications: {
+ blacklist: opt(["Spotify"]),
+ },
+})
+
+globalThis["options"] = options
+export default options
\ No newline at end of file
diff --git a/config/home-manager/desktop/ags/config/style/main.scss b/config/home-manager/desktop/ags/config/style/main.scss
new file mode 100644
index 00000000..e69de29b
diff --git a/config/home-manager/desktop/ags/config/style/style.css b/config/home-manager/desktop/ags/config/style/style.css
new file mode 100644
index 00000000..9a441aeb
--- /dev/null
+++ b/config/home-manager/desktop/ags/config/style/style.css
@@ -0,0 +1,118 @@
+@define-color bg_hover rgba(200, 200, 200, 0.3);
+@define-color content_main white;
+@define-color content_inactive rgba(255, 255, 255, 0.25);
+
+* {
+ font-size: 15px;
+}
+
+/* reset default settings */
+button {
+ all: unset;
+}
+
+.bar {
+ background-color: rgba(30, 30, 46, 0.75);
+ color: #cdd6f4;
+}
+
+.launcher {
+ background-color: transparent;
+ margin-bottom: 2px;
+ margin-top: 2px;
+}
+
+.launcher label {
+ font-family: "JetBrainsMono Nerd Font";
+ font-size: 20px;
+ padding-left: 8px;
+ padding-right: 15px;
+}
+
+.launcher:hover {
+ background: @bg_hover;
+ color: @content_main;
+}
+
+.workspaces {
+ color: transparent;
+ margin-right: 1.5px;
+ margin-left: 1.5px;
+}
+
+.workspaces button {
+ padding: 3px;
+ color: @content_inactive;
+}
+
+.workspaces button .focused {
+ color: @content_main;
+ border-bottom: 3px solid white;
+}
+
+.workspaces button:hover {
+ background: @bg_hover;
+ color: @content_main;
+}
+
+
+window.notification-popups box.notifications {
+ padding: .5em;
+}
+
+.icon {
+ min-width: 68px;
+ min-height: 68px;
+ margin-right: 1em;
+}
+
+.icon image {
+ font-size: 58px;
+ /* to center the icon */
+ margin: 5px;
+ color: @theme_fg_color;
+}
+
+.icon box {
+ min-width: 68px;
+ min-height: 68px;
+ border-radius: 7px;
+}
+
+.volume {
+}
+
+.notification {
+ min-width: 350px;
+ border-radius: 11px;
+ padding: 1em;
+ margin: .5em;
+ border: 1px solid @wm_borders_edge;
+ background-color: @theme_bg_color;
+}
+
+.notification.critical {
+ border: 1px solid lightcoral;
+}
+
+.title {
+ color: @theme_fg_color;
+ font-size: 1.4em;
+}
+
+.body {
+ color: @theme_unfocused_fg_color;
+}
+
+.actions .action-button {
+ margin: 0 .4em;
+ margin-top: .8em;
+}
+
+.actions .action-button:first-child {
+ margin-left: 0;
+}
+
+.actions .action-button:last-child {
+ margin-right: 0;
+}
\ No newline at end of file
diff --git a/config/home-manager/desktop/ags/config/tsconfig.json b/config/home-manager/desktop/ags/config/tsconfig.json
new file mode 100644
index 00000000..f03f2d12
--- /dev/null
+++ b/config/home-manager/desktop/ags/config/tsconfig.json
@@ -0,0 +1,18 @@
+{
+ "compilerOptions": {
+ "target": "ES2022",
+ "module": "ES2022",
+ "lib": [
+ "ES2022"
+ ],
+ "allowJs": true,
+ "checkJs": true,
+ "strict": true,
+ "noImplicitAny": false,
+ "baseUrl": ".",
+ "typeRoots": [
+ "./types"
+ ],
+ "skipLibCheck": true
+ }
+}
\ No newline at end of file
diff --git a/config/home-manager/desktop/ags/config/widget/bar/bar.ts b/config/home-manager/desktop/ags/config/widget/bar/bar.ts
new file mode 100644
index 00000000..c4ea8b6f
--- /dev/null
+++ b/config/home-manager/desktop/ags/config/widget/bar/bar.ts
@@ -0,0 +1,22 @@
+import { BatteryLabel } from './battery.js'
+import { Clock } from './clock.js'
+import { Workspaces } from './hyprland-workspaces.js'
+import { ClientTitle } from './hyprland-active.js' /* FIXME: Use plain titles per window */
+import { Volume } from './volume.js'
+import { Media } from './media.js'
+import { SysTray } from './systray.js'
+import { Launcher } from './launcher.js'
+``
+export function Bar(monitor: number){
+ return Widget.Window({
+ name: `bar-${monitor}`,
+ class_name: "bar",
+ anchor: ["top", "left", "right"],
+ exclusivity: "exclusive",
+ child: Widget.CenterBox({
+ start_widget: Widget.Box({ spacing: 8, children: [ Launcher(), Workspaces() ] }),
+ center_widget: Widget.Box({ spacing: 8, children: [ Media() ] }),
+ end_widget: Widget.Box({ hpack: "end", spacing: 8, children: [ Volume(), BatteryLabel(), Clock(), SysTray() ] }),
+ }),
+ })
+}
diff --git a/config/home-manager/desktop/ags/config/widget/bar/battery.js b/config/home-manager/desktop/ags/config/widget/bar/battery.js
new file mode 100644
index 00000000..4e3f9657
--- /dev/null
+++ b/config/home-manager/desktop/ags/config/widget/bar/battery.js
@@ -0,0 +1,13 @@
+const battery = await Service.import('battery')
+
+export function BatteryLabel() {
+ const icon = battery.bind("percent").as(p => `battery-level-${Math.floor(p / 10) * 10}-symbolic`)
+
+ return Widget.Box({
+ class_name: "battery",
+ visible: battery.bind("available"),
+ children: [
+ Widget.Icon({ icon }),
+ ],
+ })
+}
\ No newline at end of file
diff --git a/config/home-manager/desktop/ags/config/widget/bar/clock.js b/config/home-manager/desktop/ags/config/widget/bar/clock.js
new file mode 100644
index 00000000..fb0eca31
--- /dev/null
+++ b/config/home-manager/desktop/ags/config/widget/bar/clock.js
@@ -0,0 +1,10 @@
+const date = Variable("", {
+ poll: [1000, 'date "+%a%e %b %H:%M"'],
+})
+
+export function Clock() {
+ return Widget.Label({
+ class_name: "clock",
+ label: date.bind(),
+ })
+}
diff --git a/config/home-manager/desktop/ags/config/widget/bar/hyprland-active.js b/config/home-manager/desktop/ags/config/widget/bar/hyprland-active.js
new file mode 100644
index 00000000..5c7e50a6
--- /dev/null
+++ b/config/home-manager/desktop/ags/config/widget/bar/hyprland-active.js
@@ -0,0 +1,9 @@
+// FIXME: Is it bad having this imported multiple times?
+const hyprland = await Service.import("hyprland")
+
+export function ClientTitle() {
+ return Widget.Label({
+ class_name: "client-title",
+ label: hyprland.active.client.bind("title"),
+ })
+}
\ No newline at end of file
diff --git a/config/home-manager/desktop/ags/config/widget/bar/hyprland-workspaces.js b/config/home-manager/desktop/ags/config/widget/bar/hyprland-workspaces.js
new file mode 100644
index 00000000..da95559f
--- /dev/null
+++ b/config/home-manager/desktop/ags/config/widget/bar/hyprland-workspaces.js
@@ -0,0 +1,37 @@
+const hyprland = await Service.import("hyprland")
+
+// Example with scrollable workspaces: https://aylur.github.io/ags-docs/services/hyprland/
+export function Workspaces2() {
+ const activeId = hyprland.active.workspace.bind("id")
+ const workspaces = hyprland.bind("workspaces")
+ .as(ws => ws.map(({ id }) => Widget.Button({
+ on_clicked: () => hyprland.messageAsync(`dispatch workspace ${id}`),
+ child: Widget.Label(`${id}`),
+ class_name: activeId.as(i => `${i === id ? "focused" : ""}`),
+ })))
+
+ return Widget.Box({
+ class_name: "workspaces",
+ children: workspaces,
+ })
+}
+
+const dispatch = ws => hyprland.messageAsync(`dispatch workspace ${ws}`);
+
+export const Workspaces = () => Widget.EventBox({
+ class_name: 'workspaces',
+ onScrollUp: () => dispatch('+1'),
+ onScrollDown: () => dispatch('-1'),
+ child: Widget.Box({
+ children: Array.from({ length: 10 }, (_, i) => i + 1).map(i => Widget.Button({
+ attribute: i,
+ label: `${i}`,
+ onClicked: () => dispatch(i),
+ })),
+
+ // remove this setup hook if you want fixed number of buttons
+ setup: self => self.hook(hyprland, () => self.children.forEach(btn => {
+ btn.visible = hyprland.workspaces.some(ws => ws.id === btn.attribute);
+ })),
+ }),
+})
\ No newline at end of file
diff --git a/config/home-manager/desktop/ags/config/widget/bar/launcher.ts b/config/home-manager/desktop/ags/config/widget/bar/launcher.ts
new file mode 100644
index 00000000..0e03e04d
--- /dev/null
+++ b/config/home-manager/desktop/ags/config/widget/bar/launcher.ts
@@ -0,0 +1,8 @@
+export function Launcher() {
+ return Widget.Button({
+ class_name: 'launcher',
+ on_primary_click_release: (evt) => Utils.exec("wofi"),
+ //child: Widget.Icon({icon: "nix-snowflake-symbolic"}),
+ child: Widget.Label({label: ""}),
+ })
+}
\ No newline at end of file
diff --git a/config/home-manager/desktop/ags/config/widget/bar/media.ts b/config/home-manager/desktop/ags/config/widget/bar/media.ts
new file mode 100644
index 00000000..c00adec5
--- /dev/null
+++ b/config/home-manager/desktop/ags/config/widget/bar/media.ts
@@ -0,0 +1,20 @@
+const mpris = await Service.import("mpris")
+
+export function Media() {
+ const label = Utils.watch("", mpris, "player-changed", () => {
+ if (mpris.players[0]) {
+ const { track_artists, track_title } = mpris.players[0]
+ return `${track_artists.join(", ")} - ${track_title}`
+ } else {
+ return "Nothing is playing"
+ }
+ })
+
+ return Widget.Button({
+ class_name: "media",
+ on_primary_click: () => mpris.getPlayer("")?.playPause(),
+ on_scroll_up: () => mpris.getPlayer("")?.next(),
+ on_scroll_down: () => mpris.getPlayer("")?.previous(),
+ child: Widget.Label({ label }),
+ })
+}
\ No newline at end of file
diff --git a/config/home-manager/desktop/ags/config/widget/bar/systray.ts b/config/home-manager/desktop/ags/config/widget/bar/systray.ts
new file mode 100644
index 00000000..6de24e0e
--- /dev/null
+++ b/config/home-manager/desktop/ags/config/widget/bar/systray.ts
@@ -0,0 +1,15 @@
+const systemtray = await Service.import("systemtray")
+
+export function SysTray() {
+ const items = systemtray.bind("items")
+ .as(items => items.map(item => Widget.Button({
+ child: Widget.Icon({ icon: item.bind("icon") }),
+ on_primary_click: (_, event) => item.activate(event),
+ on_secondary_click: (_, event) => item.openMenu(event),
+ tooltip_markup: item.bind("tooltip_markup"),
+ })))
+
+ return Widget.Box({
+ children: items,
+ })
+}
\ No newline at end of file
diff --git a/config/home-manager/desktop/ags/config/widget/bar/volume.js b/config/home-manager/desktop/ags/config/widget/bar/volume.js
new file mode 100644
index 00000000..829ec8f2
--- /dev/null
+++ b/config/home-manager/desktop/ags/config/widget/bar/volume.js
@@ -0,0 +1,22 @@
+const audio = await Service.import("audio")
+
+const icons = {
+ 101: "overamplified",
+ 67: "high",
+ 34: "medium",
+ 1: "low",
+ 0: "muted",
+}
+
+function getIcon() {
+ const icon = audio.speaker.is_muted ? 0 : [101, 67, 34, 1, 0].find(threshold => threshold <= audio.speaker.volume * 100)
+ return `audio-volume-${icons[icon]}-symbolic`
+}
+
+export function Volume() {
+ return Widget.Button({
+ class_name: "volume",
+ on_primary_click_release: (evt) => Utils.exec("pavucontrol"),
+ child: Widget.Icon({ icon: Utils.watch(getIcon(), audio.speaker, getIcon) }),
+ })
+}
\ No newline at end of file
diff --git a/config/home-manager/desktop/ags/config/widget/notification-popup.js b/config/home-manager/desktop/ags/config/widget/notification-popup.js
new file mode 100644
index 00000000..4c63d740
--- /dev/null
+++ b/config/home-manager/desktop/ags/config/widget/notification-popup.js
@@ -0,0 +1,130 @@
+const notifications = await Service.import("notifications")
+
+/** @param {import('resource:///com/github/Aylur/ags/service/notifications.js').Notification} n */
+function NotificationIcon({ app_entry, app_icon, image }) {
+ if (image) {
+ return Widget.Box({
+ css: `background-image: url("${image}");`
+ + "background-size: contain;"
+ + "background-repeat: no-repeat;"
+ + "background-position: center;",
+ })
+ }
+
+ let icon = "dialog-information-symbolic"
+ if (Utils.lookUpIcon(app_icon))
+ icon = app_icon
+
+ if (app_entry && Utils.lookUpIcon(app_entry))
+ icon = app_entry
+
+ return Widget.Box({
+ child: Widget.Icon(icon),
+ })
+}
+
+/** @param {import('resource:///com/github/Aylur/ags/service/notifications.js').Notification} n */
+function Notification(n) {
+ const icon = Widget.Box({
+ vpack: "start",
+ class_name: "icon",
+ child: NotificationIcon(n),
+ })
+
+ const title = Widget.Label({
+ class_name: "title",
+ xalign: 0,
+ justification: "left",
+ hexpand: true,
+ max_width_chars: 24,
+ truncate: "end",
+ wrap: true,
+ label: n.summary,
+ use_markup: true,
+ })
+
+ const body = Widget.Label({
+ class_name: "body",
+ hexpand: true,
+ use_markup: true,
+ xalign: 0,
+ justification: "left",
+ label: n.body,
+ wrap: true,
+ })
+
+ const actions = Widget.Box({
+ class_name: "actions",
+ children: n.actions.map(({ id, label }) => Widget.Button({
+ class_name: "action-button",
+ on_clicked: () => {
+ n.invoke(id)
+ n.dismiss()
+ },
+ hexpand: true,
+ child: Widget.Label(label),
+ })),
+ })
+
+ return Widget.EventBox(
+ {
+ attribute: { id: n.id },
+ on_primary_click: n.dismiss,
+ },
+ Widget.Box(
+ {
+ class_name: `notification ${n.urgency}`,
+ vertical: true,
+ },
+ Widget.Box([
+ icon,
+ Widget.Box(
+ { vertical: true },
+ title,
+ body,
+ ),
+ ]),
+ actions,
+ ),
+ )
+}
+
+export function NotificationPopups(monitor = 0) {
+ const list = Widget.Box({
+ vertical: true,
+ children: notifications.popups.map(Notification),
+ })
+
+ function onNotified(_, /** @type {number} */ id) {
+ const n = notifications.getNotification(id)
+ if (n)
+ list.children = [Notification(n), ...list.children]
+ }
+
+ function onDismissed(_, /** @type {number} */ id) {
+ list.children.find(n => n.attribute.id === id)?.destroy()
+ }
+
+ list.hook(notifications, onNotified, "notified")
+ .hook(notifications, onDismissed, "dismissed")
+
+ return Widget.Window({
+ monitor,
+ name: `notifications${monitor}`,
+ class_name: "notification-popups",
+ anchor: ["top", "right"],
+ child: Widget.Box({
+ css: "min-width: 2px; min-height: 2px;",
+ class_name: "notifications",
+ vertical: true,
+ child: list,
+
+ /** this is a simple one liner that could be used instead of
+ hooking into the 'notified' and 'dismissed' signals.
+ but its not very optimized becuase it will recreate
+ the whole list everytime a notification is added or dismissed */
+ // children: notifications.bind('popups')
+ // .as(popups => popups.map(Notification))
+ }),
+ })
+}
\ No newline at end of file
diff --git a/config/home-manager/desktop/ags/default.nix b/config/home-manager/desktop/ags/default.nix
new file mode 100644
index 00000000..453004ce
--- /dev/null
+++ b/config/home-manager/desktop/ags/default.nix
@@ -0,0 +1,19 @@
+{ pkgs, lib, inputs, ... }:
+
+# https://github.com/Serpentian/AlfheimOS/blob/master/user/wm/hyprland/ags.nix
+{
+ home.packages = [
+ pkgs.bun
+ pkgs.pavucontrol
+ ];
+
+ programs.ags = {
+ enable = true;
+ configDir = ./config; # Init types using ags --init ./config.js
+ extraPackages = with pkgs; [
+ gtksourceview
+ webkitgtk
+ accountsservice
+ ];
+ };
+}
\ No newline at end of file
diff --git a/config/home-manager/desktop/default.nix b/config/home-manager/desktop/default.nix
index 7eafbb3a..03f370f0 100644
--- a/config/home-manager/desktop/default.nix
+++ b/config/home-manager/desktop/default.nix
@@ -1,14 +1,24 @@
{ config, lib, pkgs, ... }:
+let
+ nerdfonts = pkgs.nerdfonts.override {
+ fonts = [
+ "Ubuntu"
+ "UbuntuMono"
+ "CascadiaCode"
+ "FantasqueSansMono"
+ "FiraCode"
+ "Mononoki"
+ ];
+ };
+in
{
# https://github.com/prasanthrangan/hyprdots?tab=readme-ov-file
imports = [
./hyprland
- ./waybar # Bar on top
./kanshi.nix # Display Manager
- ./dunst.nix # Notifications
- ./wlogout.nix # Notifications
./wofi.nix # Application Launcher
- ./walker.nix # Application Launcher
+ ./fuzzel.nix # Application Launcher
+ ./ags # Top bar, widgets, and notifications. The whole kit.
];
# Use the following theme: https://github.com/iynaix/dotfiles/blob/56d2d63b3b5f4c621429d79fb2aef8d44fdc25b9/home-manager/gui/gtk.nix#L85
@@ -19,22 +29,24 @@
size = 16;
};
+ # KDE seems to force the replacemente of this file. TODO: remove once we move away from KDE.
home.file.${config.gtk.gtk2.configLocation}.force = true;
gtk = {
enable = true;
theme = {
- package = pkgs.flat-remix-gtk;
- name = "Flat-Remix-GTK-Grey-Darkest";
+ package = pkgs.adw-gtk3;
+ name = "adw-gtk3-dark";
};
iconTheme = {
- package = pkgs.adwaita-icon-theme;
- name = "Adwaita";
+ package = pkgs.morewaita-icon-theme;
+ name = "MoreWaita";
};
font = {
- name = "Sans";
+ name = "Ubuntu Nerd Font";
+ package = nerdfonts;
size = 11;
};
@@ -43,9 +55,28 @@
gtk-application-prefer-dark-theme = 1;
gtk-error-bell = 0;
};
+
+ # TODO: Replace by xdg directories
+ gtk3.bookmarks = [
+ "file://${config.home.homeDirectory}/desktop"
+ "file://${config.home.homeDirectory}/downloads"
+ "file://${config.home.homeDirectory}/games"
+ "file://${config.home.homeDirectory}/music"
+ "file://${config.home.homeDirectory}/pictures"
+ "file://${config.home.homeDirectory}/screenshots"
+ "file://${config.home.homeDirectory}/workdir"
+ "file://${config.home.homeDirectory}/.config Config"
+ ];
+
gtk4.extraConfig = {
gtk-application-prefer-dark-theme = 1;
gtk-error-bell = 0;
};
};
+
+ # Double check what this does exactly
+ qt = {
+ enable = true;
+ platformTheme.name = "kde";
+ };
}
\ No newline at end of file
diff --git a/config/home-manager/desktop/dunst.nix b/config/home-manager/desktop/dunst.nix
deleted file mode 100644
index 80d7b90c..00000000
--- a/config/home-manager/desktop/dunst.nix
+++ /dev/null
@@ -1,78 +0,0 @@
-{ config, lib, pkgs, ... }:
-
-{
- services.dunst = {
- enable = true;
- iconTheme = {
- name = "Papirus-Dark";
- package = pkgs.papirus-icon-theme;
- };
- settings = {
- global = {
- rounded = "yes";
- origin = "top-right";
- monitor = "0";
- alignment = "left";
- vertical_alignment = "center";
- width = "400";
- height = "400";
- scale = 0;
- gap_size = 0;
- progress_bar = true;
- transparency = 0;
- text_icon_padding = 0;
- separator_color = "frame";
- sort = "yes";
- idle_threshold = 120;
- line_height = 0;
- markup = "full";
- show_age_threshold = 60;
- ellipsize = "middle";
- ignore_newline = "no";
- stack_duplicates = true;
- sticky_history = "yes";
- history_length = 20;
- always_run_script = true;
- corner_radius = 10;
- follow = "mouse";
- font = "Source Sans Pro 10";
- format = "%s\\n%b"; #format = "%s %p\n%b"
- frame_color = "#232323";
- frame_width = 1;
- offset = "15x15";
- horizontal_padding = 10;
- icon_position = "left";
- indicate_hidden = "yes";
- min_icon_size = 0;
- max_icon_size = 64;
- mouse_left_click = "do_action, close_current";
- mouse_middle_click = "close_current";
- mouse_right_click = "close_all";
- padding = 10;
- plain_text = "no";
- separator_height = 2;
- show_indicators = "yes";
- shrink = "no";
- word_wrap = "yes";
- browser = "/usr/bin/env librewolf -new-tab";
- };
-
- fullscreen_delay_everything = {
- fullscreen = "delay";
- };
-
- urgency_critical = {
- background = "#d64e4e";
- foreground = "#f0e0e0";
- };
- urgency_low = {
- background = "#232323";
- foreground = "#2596be";
- };
- urgency_normal = {
- background = "#1e1e2a";
- foreground = "#2596be";
- };
- };
- };
-}
diff --git a/config/home-manager/desktop/fuzzel.nix b/config/home-manager/desktop/fuzzel.nix
new file mode 100644
index 00000000..044e8b09
--- /dev/null
+++ b/config/home-manager/desktop/fuzzel.nix
@@ -0,0 +1,4 @@
+{ config, pkgs, lib, ... }:
+{
+ home.packages = [ pkgs.fuzzel ];
+}
\ No newline at end of file
diff --git a/config/home-manager/desktop/hyprland/default.nix b/config/home-manager/desktop/hyprland/default.nix
index 29ec73ce..c69e8d28 100644
--- a/config/home-manager/desktop/hyprland/default.nix
+++ b/config/home-manager/desktop/hyprland/default.nix
@@ -10,6 +10,7 @@ in
# TODO: https://github.com/JaKooLit/Ja-ZaneyOS/blob/0bed326404ad90ca6803c0a9096426a36a14a35a/config/hyprland.nix#L83
# TODO: https://github.com/diniamo/niqs/blob/53288d72902365ee8d3bfdd6aff0ec79eb7c1c36/modules/workstation/hyprland.nix
# https://github.com/JaKooLit/Ja-ZaneyOS/blob/0bed326404ad90ca6803c0a9096426a36a14a35a/config/hyprland.nix
+# https://github.com/Serpentian/AlfheimOS/blob/master/user/wm/hyprland/settings.nix
{
imports = [
./settings.nix
@@ -33,12 +34,17 @@ in
# https://wiki.hyprland.org/Nix/Hyprland-on-Home-Manager/
wayland.windowManager.hyprland = {
enable = true;
+ systemd = {
+ enable = true;
+ variables = [ "--all" ];
+ enableXdgAutostart = true;
+ };
settings = {
"monitor" = [ ",preferred,auto,auto" ];
- "$terminal" = "ghostty";
+ "$terminal" = "konsole";
"$fileManager" = "thunar";
- "$menu" = "walker";
+ "$menu" = "fuzzel";
"$browser" = "firefox";
env = [
@@ -55,8 +61,9 @@ in
];
exec-once = [
- "dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP" # Fix long-time to start systemd: https://wiki.hyprland.org/FAQ/#some-of-my-apps-take-a-really-long-time-to-open
- "waybar"
+ "ags -b hypr"
+ #"dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP" # Fix long-time to start systemd: https://wiki.hyprland.org/FAQ/#some-of-my-apps-take-a-really-long-time-to-open
+ #"waybar"
"${lib.getExe pkgs.hyprpaper}"
"${lib.getExe pkgs.udiskie} --tray"
"walker --gapplication-service"
@@ -64,10 +71,5 @@ in
#"${pkgs.networkmanagerapplet}/bin/nm-applet --indicator"
];
};
-
- #systemd = {
- # enable = true;
- # variables = ["--all"];
- #};
};
}
\ No newline at end of file
diff --git a/config/home-manager/desktop/hyprland/rules.nix b/config/home-manager/desktop/hyprland/rules.nix
index ae26e763..5bb1a920 100644
--- a/config/home-manager/desktop/hyprland/rules.nix
+++ b/config/home-manager/desktop/hyprland/rules.nix
@@ -3,13 +3,14 @@
wayland.windowManager.hyprland.settings = lib.mkMerge [
{
windowrulev2 = [
- # "dimaround,floating:1"
+ "dimaround,floating:1"
"bordersize 5,fullscreen:1" # monocle mode
"float,class:(wlroots)" # hyprland debug session
+
# Ignore maximize requests from apps. You'll probably like this.
"suppressevent maximize, class:.*"
- "suppressevent fullscreen, class:.*"
+ # "suppressevent fullscreen, class:.*"
# Save dialog
"float,class:(xdg-desktop-portal-gtk)"
@@ -18,6 +19,7 @@
# Firefox
"float,title:^(About Mozilla Firefox)$"
"float,class:^(firefox)$,title:^(Picture-in-Picture)$"
+ "keepaspectratio,class:^(firefox)$,title:^(Picture-in-Picture)$"
# Misc
"float,class:^(org.pulseaudio.pavucontrol)$"
@@ -27,11 +29,6 @@
}
{
layerrule = [
- # ROFI
- "blur, launcher"
- "blur, waybar"
- "blurpopups, waybar" # Blur waybar popups too!
- "ignorealpha 0.2, waybar" # Make it so transparent parts are ignored
];
}
];
diff --git a/config/home-manager/desktop/hyprland/settings.nix b/config/home-manager/desktop/hyprland/settings.nix
index fd444809..ac9ae85b 100644
--- a/config/home-manager/desktop/hyprland/settings.nix
+++ b/config/home-manager/desktop/hyprland/settings.nix
@@ -10,16 +10,6 @@ in
{
#
wayland.windowManager.hyprland.settings = {
- env = [
- "XDG_SESSION_TYPE,wayland"
- "QT_WAYLAND_DISABLE_WINDOWDECORATION,1"
-
- # Nvidia
- "LIBVA_DRIVER_NAME,nvidia"
- "GBM_BACKEND,nvidia-drm"
- "__GLX_VENDOR_LIBRARY_NAME,nvidia"
- ];
-
general = {
gaps_in = 2;
gaps_out = 0;
@@ -41,7 +31,7 @@ in
rounding = 2;
- dim_inactive = true;
+ dim_inactive = false;
drop_shadow = true;
shadow_range = 4;
diff --git a/config/home-manager/desktop/walker.nix b/config/home-manager/desktop/walker.nix
deleted file mode 100644
index 7217d27a..00000000
--- a/config/home-manager/desktop/walker.nix
+++ /dev/null
@@ -1,5 +0,0 @@
-{ config, pkgs, lib, community, ... }:
-{
- # Alternative that does not require a external flake: https://codeberg.org/dnkl/fuzzel
- home.packages = [ community.pkgs.walker pkgs.fuzzel ];
-}
\ No newline at end of file
diff --git a/config/home-manager/desktop/wlogout.nix b/config/home-manager/desktop/wlogout.nix
deleted file mode 100644
index b041c61f..00000000
--- a/config/home-manager/desktop/wlogout.nix
+++ /dev/null
@@ -1,39 +0,0 @@
-{ pkgs, lib, ... }:
-{
- # Theme? https://github.com/Sum1Code/nixos-dotfile/blob/ce81aab23096e65ea7448a060ddf41b0bb627167/home/apps/wlogout/style.nix
- programs.wlogout = {
- enable = true;
- layout = [
- {
- label = "lock";
- action = "hyprlock";
- text = "Lock";
- keybind = "l";
- }
- {
- label = "logout";
- action = "hyprctl dispatch exit 0";
- text = "Logout";
- keybind = "e";
- }
- {
- label = "shutdown";
- action = "systemctl poweroff";
- text = "Shutdown";
- keybind = "s";
- }
- {
- label = "suspend";
- action = "systemctl suspend";
- text = "Suspend";
- keybind = "u";
- }
- {
- label = "reboot";
- action = "systemctl reboot";
- text = "Reboot";
- keybind = "r";
- }
- ];
- };
-}
\ No newline at end of file
diff --git a/config/nixos/wayland.nix b/config/nixos/wayland.nix
index 923ae107..9785392c 100644
--- a/config/nixos/wayland.nix
+++ b/config/nixos/wayland.nix
@@ -1,23 +1,26 @@
{ pkgs, ... }:
{
- # https://wiki.hyprland.org/Nvidia/
- #environment.sessionVariables = {
- # LIBVA_DRIVER_NAME = "nvidia";
- # XDG_SESSION_TYPE = "wayland";
- # GBM_BACKEND = "nvidia-drm";
- # __GLX_VENDOR_LIBRARY_NAME = "nvidia";
- #};
- # TODO: Can I run this on demand?
+ programs.hyprland.enable = true; # Automates several dependencies. Home-Manager sets custom configuration.
+ xdg.portal.enable = true;
+
+ # Other
programs.nm-applet.enable = true;
- xdg.portal = {
- enable = true;
- extraPortals = with pkgs; [
- xdg-desktop-portal-gtk
- xdg-desktop-portal-hyprland
- ];
- };
+ # TODO: https://github.com/Aylur/dotfiles/blob/main/nixos/system.nix#L44
+
+ environment.systemPackages = with pkgs; [
+ morewaita-icon-theme
+ adwaita-icon-theme
+ qogir-icon-theme
+ gnome-calendar
+ gnome-system-monitor
+ gnome-calculator
- programs.hyprland.enable = true; # Home-Manager sets the rest
+ # Review
+ nautilus
+ brightnessctl
+ konsole # Lets ensure this is around
+ ark # I still like this?
+ ];
}
\ No newline at end of file
diff --git a/flake.lock b/flake.lock
index 4399eb35..62e835d5 100644
--- a/flake.lock
+++ b/flake.lock
@@ -1,5 +1,24 @@
{
"nodes": {
+ "ags": {
+ "inputs": {
+ "nixpkgs": "nixpkgs",
+ "systems": "systems"
+ },
+ "locked": {
+ "lastModified": 1728326430,
+ "narHash": "sha256-tV1ABHuA1HItMdCTuNdA8fMB+qw7LpjvI945VwMSABI=",
+ "owner": "Aylur",
+ "repo": "ags",
+ "rev": "60180a184cfb32b61a1d871c058b31a3b9b0743d",
+ "type": "github"
+ },
+ "original": {
+ "owner": "Aylur",
+ "repo": "ags",
+ "type": "github"
+ }
+ },
"darwin": {
"inputs": {
"nixpkgs": [
@@ -61,30 +80,9 @@
"url": "ssh://git@github.com/bphenriques/dotfiles-private"
}
},
- "flake-parts": {
- "inputs": {
- "nixpkgs-lib": [
- "walker",
- "nixpkgs"
- ]
- },
- "locked": {
- "lastModified": 1719994518,
- "narHash": "sha256-pQMhCCHyQGRzdfAkdJ4cIWiw+JNuWsTX7f0ZYSyz0VY=",
- "owner": "hercules-ci",
- "repo": "flake-parts",
- "rev": "9227223f6d922fee3c7b190b2cc238a99527bbb7",
- "type": "github"
- },
- "original": {
- "owner": "hercules-ci",
- "repo": "flake-parts",
- "type": "github"
- }
- },
"flake-utils": {
"inputs": {
- "systems": "systems"
+ "systems": "systems_2"
},
"locked": {
"lastModified": 1705309234,
@@ -142,16 +140,16 @@
},
"nixpkgs": {
"locked": {
- "lastModified": 1729265718,
- "narHash": "sha256-4HQI+6LsO3kpWTYuVGIzhJs1cetFcwT7quWCk/6rqeo=",
- "owner": "nixos",
+ "lastModified": 1725634671,
+ "narHash": "sha256-v3rIhsJBOMLR8e/RNWxr828tB+WywYIoajrZKFM+0Gg=",
+ "owner": "NixOS",
"repo": "nixpkgs",
- "rev": "ccc0c2126893dd20963580b6478d1a10a4512185",
+ "rev": "574d1eac1c200690e27b8eb4e24887f8df7ac27c",
"type": "github"
},
"original": {
- "owner": "nixos",
- "ref": "nixpkgs-unstable",
+ "owner": "NixOS",
+ "ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
@@ -222,16 +220,16 @@
},
"nixpkgs_2": {
"locked": {
- "lastModified": 1720957393,
- "narHash": "sha256-oedh2RwpjEa+TNxhg5Je9Ch6d3W1NKi7DbRO1ziHemA=",
- "owner": "NixOS",
+ "lastModified": 1729265718,
+ "narHash": "sha256-4HQI+6LsO3kpWTYuVGIzhJs1cetFcwT7quWCk/6rqeo=",
+ "owner": "nixos",
"repo": "nixpkgs",
- "rev": "693bc46d169f5af9c992095736e82c3488bf7dbb",
+ "rev": "ccc0c2126893dd20963580b6478d1a10a4512185",
"type": "github"
},
"original": {
- "owner": "NixOS",
- "ref": "nixos-unstable",
+ "owner": "nixos",
+ "ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
@@ -253,16 +251,16 @@
},
"root": {
"inputs": {
+ "ags": "ags",
"darwin": "darwin",
"disko": "disko",
"dotfiles-private": "dotfiles-private",
"ghostty": "ghostty",
"home-manager": "home-manager",
- "nixpkgs": "nixpkgs",
+ "nixpkgs": "nixpkgs_2",
"nixpkgs-stable": "nixpkgs-stable_2",
"nur": "nur",
- "sops-nix": "sops-nix",
- "walker": "walker"
+ "sops-nix": "sops-nix"
}
},
"sops-nix": {
@@ -288,35 +286,31 @@
},
"systems": {
"locked": {
- "lastModified": 1681028828,
- "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+ "lastModified": 1689347949,
+ "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
"owner": "nix-systems",
- "repo": "default",
- "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+ "repo": "default-linux",
+ "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68",
"type": "github"
},
"original": {
"owner": "nix-systems",
- "repo": "default",
+ "repo": "default-linux",
"type": "github"
}
},
- "walker": {
- "inputs": {
- "flake-parts": "flake-parts",
- "nixpkgs": "nixpkgs_2"
- },
+ "systems_2": {
"locked": {
- "lastModified": 1730878291,
- "narHash": "sha256-TiZcHS/r7RrS+sr19Qhb0UFu+AYYzyR78bzicwMg7qE=",
- "owner": "abenz1267",
- "repo": "walker",
- "rev": "470c43621279b12c9d824909645052ae7b6b8219",
+ "lastModified": 1681028828,
+ "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+ "owner": "nix-systems",
+ "repo": "default",
+ "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
- "owner": "abenz1267",
- "repo": "walker",
+ "owner": "nix-systems",
+ "repo": "default",
"type": "github"
}
},
diff --git a/flake.nix b/flake.nix
index 4e24a47f..53048816 100644
--- a/flake.nix
+++ b/flake.nix
@@ -6,13 +6,11 @@
"https://nix-community.cachix.org"
"https://nixpkgs-wayland.cachix.org"
"https://hyprland.cachix.org"
- "https://walker-git.cachix.org"
];
extra-trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"nixpkgs-wayland.cachix.org-1:3lwxaILxMRkVhehr5StQprHdEo4IrE8sRho9R9HOLYA="
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
- "walker-git.cachix.org-1:vmC0ocfPWh0S/vRAQGtChuiZBTAe4wiKDeyyXM0/7pM="
];
};
@@ -37,7 +35,7 @@
disko.inputs.nixpkgs.follows = "nixpkgs";
nur.url = "github:nix-community/nur"; # Collection of packages. Use it for Firefox extensions
ghostty.url = "git+ssh://git@github.com/mitchellh/ghostty"; # Terminal
- walker.url = "github:abenz1267/walker"; # Application launcher
+ ags.url = "github:Aylur/ags"; # Widgets
};
outputs = inputs @ { nixpkgs, ... }:
@@ -55,8 +53,8 @@
nixosModules = import ./modules/nixos;
# Hosts - Each host defines what it needs from the inputs.
- nixosConfigurations.laptop = import ./hosts/laptop (inputs // { inherit mylib; });
- darwinConfigurations.work-macos = import ./hosts/work-macos (inputs // { inherit mylib; });
+ nixosConfigurations.laptop = import ./hosts/laptop { inherit mylib inputs; };
+ darwinConfigurations.work-macos = import ./hosts/work-macos { inherit mylib inputs; };
# Non standard flake outputs
homeManagerModules = import ./modules/home-manager;
diff --git a/hosts/laptop/config.nix b/hosts/laptop/config.nix
index 91b55dc3..b367a5d0 100644
--- a/hosts/laptop/config.nix
+++ b/hosts/laptop/config.nix
@@ -53,15 +53,17 @@ in
};
# Desktop environment
- services.xserver.enable = true;
- services.desktopManager.plasma6.enable = true;
- services.displayManager.sddm.wayland.enable = true;
- services.displayManager.defaultSession = "plasma";
- environment.plasma6.excludePackages = with pkgs.kdePackages; [ elisa plasma-browser-integration ];
+ # services.xserver.enable = true;
+ #services.desktopManager.plasma6.enable = true;
+ #services.displayManager.defaultSession = "plasma";
+ #environment.plasma6.excludePackages = with pkgs.kdePackages; [ elisa plasma-browser-integration ];
# Login Screen
- services.displayManager.sddm.enable = true;
- services.displayManager.sddm.theme = "sddm-astronaut-theme";
+ services.displayManager.sddm = {
+ enable = true;
+ wayland.enable = true;
+ theme = "sddm-astronaut-theme";
+ };
environment.systemPackages = [
# https://github.com/Keyitdev/sddm-astronaut-theme/blob/master/theme.conf
# It is possible to override the package and set themeConfig. For now, I will iterate like this.
diff --git a/hosts/laptop/default.nix b/hosts/laptop/default.nix
index 5c49bf84..cfb29e6d 100644
--- a/hosts/laptop/default.nix
+++ b/hosts/laptop/default.nix
@@ -1,14 +1,16 @@
-{ self, mylib, nixpkgs, home-manager, sops-nix, disko, nur, walker, ... }:
+{ inputs, mylib, ... }:
let
- inherit (nixpkgs.lib.attrsets) attrValues;
-
- overlays = attrValues self.overlays ++ [ nur.overlay ];
- nixosModules = attrValues self.nixosModules ++ [
- sops-nix.nixosModules.sops
- disko.nixosModules.disko
- home-manager.nixosModules.home-manager
+ inherit (inputs.nixpkgs.lib.attrsets) attrValues;
+ # Ideally modules are imported in the file that uses it. However, it leads to a infinite recursion. Aka, a rabbit-hole to debug.
+ overlays = attrValues inputs.self.overlays ++ [ inputs.nur.overlay ];
+ nixosModules = attrValues inputs.self.nixosModules ++ [
+ inputs.sops-nix.nixosModules.sops
+ inputs.disko.nixosModules.disko
+ inputs.home-manager.nixosModules.home-manager
+ ];
+ hmModules = attrValues inputs.self.homeManagerModules ++ [
+ inputs.ags.homeManagerModules.default
];
- hmModules = attrValues self.homeManagerModules;
in mylib.hosts.mkNixOSHost {
inherit nixosModules hmModules overlays;
extraSpecialArgs = {
diff --git a/hosts/laptop/filesystem/disko.nix b/hosts/laptop/filesystem/disko.nix
index 35e5bbcb..4bcb9cb6 100644
--- a/hosts/laptop/filesystem/disko.nix
+++ b/hosts/laptop/filesystem/disko.nix
@@ -1,4 +1,4 @@
-{ lib, ... }:
+{ lib, inputs, ... }:
{
disko.devices = {
disk = {
diff --git a/lib/hosts.nix b/lib/hosts.nix
index e1e6eff1..92a8dc36 100644
--- a/lib/hosts.nix
+++ b/lib/hosts.nix
@@ -24,7 +24,6 @@ let
};
community.pkgs = {
ghostty = inputs.ghostty.packages.${system}.default;
- walker = inputs.walker.packages.${system}.default;
firefox-addons = inputs.firefox-addons.packages.${system};
};
From c897a3b326f3bbf85d82aa5251ff13a94478e31e Mon Sep 17 00:00:00 2001
From: Bruno Henriques <4727729+bphenriques@users.noreply.github.com>
Date: Fri, 8 Nov 2024 16:00:44 +0000
Subject: [PATCH 04/34] Test committing
---
config/nixos/wayland.nix | 1 -
1 file changed, 1 deletion(-)
diff --git a/config/nixos/wayland.nix b/config/nixos/wayland.nix
index 9785392c..125103a3 100644
--- a/config/nixos/wayland.nix
+++ b/config/nixos/wayland.nix
@@ -8,7 +8,6 @@
programs.nm-applet.enable = true;
# TODO: https://github.com/Aylur/dotfiles/blob/main/nixos/system.nix#L44
-
environment.systemPackages = with pkgs; [
morewaita-icon-theme
adwaita-icon-theme
From 529b0cfc18d7ab18d013e6845654cb0a42e1a199 Mon Sep 17 00:00:00 2001
From: Bruno Henriques <4727729+bphenriques@users.noreply.github.com>
Date: Thu, 21 Nov 2024 10:01:47 +0000
Subject: [PATCH 05/34] iteration
---
config/home-manager/default.nix | 2 +-
.../desktop/ags/config/options.ts | 104 ----------------
.../config/widget/bar/hyprland-workspaces.js | 37 ------
.../{desktop => window-manager}/README.md | 0
.../ags/config/.gitignore | 0
.../config/assets/nix-snowflake-symbolic.svg | 0
.../ags/config/config.js | 0
.../ags/config/main.ts | 39 +++++-
.../ags/config/notification-daemon/battery.ts | 0
.../config/notification-daemon/ignore-list.ts | 0
.../ags/config/notification-daemon/init.ts | 2 +-
.../window-manager/ags/config/options.ts | 54 ++++++++
.../ags/config/services/brightness.js | 46 +++++++
.../ags/config/style/main.scss | 0
.../ags/config/style/style.css | 12 +-
.../ags/config/tsconfig.json | 0
.../ags/config/widget/bar/bar.ts | 23 +++-
.../ags/config/widget/bar/battery.js | 0
.../ags/config/widget/bar/brightness.js | 21 ++++
.../ags/config/widget/bar/clock.js | 0
.../ags/config/widget/bar/hyprland-active.js | 0
.../config/widget/bar/hyprland-workspaces.ts | 36 ++++++
.../ags/config/widget/bar/launcher.ts | 2 +-
.../ags/config/widget/bar/media.ts | 0
.../ags/config/widget/bar/systray.ts | 0
.../ags/config/widget/bar/volume.js | 0
.../ags/config/widget/notification-popup.js | 0
.../ags/default.nix | 0
.../{desktop => window-manager}/default.nix | 15 +--
.../{desktop => window-manager}/fuzzel.nix | 0
.../hyprland/default.nix | 48 +++++++-
.../hyprland/keybindings.nix | 40 +++---
.../hyprland/rules.nix | 0
.../hyprland/scripts/close-active.sh | 0
.../hyprland/scripts/monitor-toggle.sh | 0
.../hyprland/scripts/volume.sh | 0
.../hyprland/scripts/wofi-kanshi-profile.sh | 0
.../hyprland/scripts/wofi-session.sh | 0
.../hyprland/settings.nix | 49 +-------
.../{desktop => window-manager}/kanshi.nix | 2 +-
config/home-manager/window-manager/niri.nix | 3 +
.../waybar/default.nix | 0
.../waybar/menu/power_menu.xml | 0
.../waybar/style.css | 0
.../{desktop => window-manager}/wofi.nix | 0
config/nixos/default.nix | 13 --
config/nixos/display-manager.nix | 4 +
config/nixos/wayland.nix | 36 ++++--
flake.lock | 115 ++++++++----------
flake.nix | 5 +-
hosts/laptop/bphenriques/home.nix | 13 ++
hosts/laptop/config.nix | 2 +-
hosts/laptop/default.nix | 1 +
hosts/laptop/hardware/graphics.nix | 2 +-
hosts/peripherals.nix | 9 ++
lib/hosts.nix | 3 +-
56 files changed, 414 insertions(+), 324 deletions(-)
delete mode 100644 config/home-manager/desktop/ags/config/options.ts
delete mode 100644 config/home-manager/desktop/ags/config/widget/bar/hyprland-workspaces.js
rename config/home-manager/{desktop => window-manager}/README.md (100%)
rename config/home-manager/{desktop => window-manager}/ags/config/.gitignore (100%)
rename config/home-manager/{desktop => window-manager}/ags/config/assets/nix-snowflake-symbolic.svg (100%)
rename config/home-manager/{desktop => window-manager}/ags/config/config.js (100%)
rename config/home-manager/{desktop => window-manager}/ags/config/main.ts (52%)
rename config/home-manager/{desktop => window-manager}/ags/config/notification-daemon/battery.ts (100%)
rename config/home-manager/{desktop => window-manager}/ags/config/notification-daemon/ignore-list.ts (100%)
rename config/home-manager/{desktop => window-manager}/ags/config/notification-daemon/init.ts (94%)
create mode 100644 config/home-manager/window-manager/ags/config/options.ts
create mode 100644 config/home-manager/window-manager/ags/config/services/brightness.js
rename config/home-manager/{desktop => window-manager}/ags/config/style/main.scss (100%)
rename config/home-manager/{desktop => window-manager}/ags/config/style/style.css (91%)
rename config/home-manager/{desktop => window-manager}/ags/config/tsconfig.json (100%)
rename config/home-manager/{desktop => window-manager}/ags/config/widget/bar/bar.ts (60%)
rename config/home-manager/{desktop => window-manager}/ags/config/widget/bar/battery.js (100%)
create mode 100644 config/home-manager/window-manager/ags/config/widget/bar/brightness.js
rename config/home-manager/{desktop => window-manager}/ags/config/widget/bar/clock.js (100%)
rename config/home-manager/{desktop => window-manager}/ags/config/widget/bar/hyprland-active.js (100%)
create mode 100644 config/home-manager/window-manager/ags/config/widget/bar/hyprland-workspaces.ts
rename config/home-manager/{desktop => window-manager}/ags/config/widget/bar/launcher.ts (75%)
rename config/home-manager/{desktop => window-manager}/ags/config/widget/bar/media.ts (100%)
rename config/home-manager/{desktop => window-manager}/ags/config/widget/bar/systray.ts (100%)
rename config/home-manager/{desktop => window-manager}/ags/config/widget/bar/volume.js (100%)
rename config/home-manager/{desktop => window-manager}/ags/config/widget/notification-popup.js (100%)
rename config/home-manager/{desktop => window-manager}/ags/default.nix (100%)
rename config/home-manager/{desktop => window-manager}/default.nix (76%)
rename config/home-manager/{desktop => window-manager}/fuzzel.nix (100%)
rename config/home-manager/{desktop => window-manager}/hyprland/default.nix (61%)
rename config/home-manager/{desktop => window-manager}/hyprland/keybindings.nix (68%)
rename config/home-manager/{desktop => window-manager}/hyprland/rules.nix (100%)
rename config/home-manager/{desktop => window-manager}/hyprland/scripts/close-active.sh (100%)
rename config/home-manager/{desktop => window-manager}/hyprland/scripts/monitor-toggle.sh (100%)
rename config/home-manager/{desktop => window-manager}/hyprland/scripts/volume.sh (100%)
rename config/home-manager/{desktop => window-manager}/hyprland/scripts/wofi-kanshi-profile.sh (100%)
rename config/home-manager/{desktop => window-manager}/hyprland/scripts/wofi-session.sh (100%)
rename config/home-manager/{desktop => window-manager}/hyprland/settings.nix (62%)
rename config/home-manager/{desktop => window-manager}/kanshi.nix (95%)
create mode 100644 config/home-manager/window-manager/niri.nix
rename config/home-manager/{desktop => window-manager}/waybar/default.nix (100%)
rename config/home-manager/{desktop => window-manager}/waybar/menu/power_menu.xml (100%)
rename config/home-manager/{desktop => window-manager}/waybar/style.css (100%)
rename config/home-manager/{desktop => window-manager}/wofi.nix (100%)
create mode 100644 config/nixos/display-manager.nix
create mode 100644 hosts/peripherals.nix
diff --git a/config/home-manager/default.nix b/config/home-manager/default.nix
index 05e819a1..c3fc37ae 100644
--- a/config/home-manager/default.nix
+++ b/config/home-manager/default.nix
@@ -5,7 +5,7 @@
./internet
./media
./terminal
- ./desktop
+ ./window-manager
];
# XDG Compliance to tidy up $HOME.
diff --git a/config/home-manager/desktop/ags/config/options.ts b/config/home-manager/desktop/ags/config/options.ts
deleted file mode 100644
index c0d59225..00000000
--- a/config/home-manager/desktop/ags/config/options.ts
+++ /dev/null
@@ -1,104 +0,0 @@
-import { opt, mkOptions } from "lib/option"
-import { icon } from "lib/utils"
-import icons from "lib/icons"
-
-const nix = JSON.parse(Utils.readFile(Utils.CACHE_DIR + "/options-nix.json") || '{}')
-
-//https://github.com/Serpentian/AlfheimOS/blob/master/non-nix/ags/widget/bar/buttons/Launcher.ts
-//https://github.com/Serpentian/AlfheimOS/blob/master/user/wm/hyprland/ags.nix
-
-const options = mkOptions(OPTIONS, {
- wallpaper: opt(nix?.wallpaper || ""),
-
- font: {
- size: opt(nix?.font?.size || 12),
- name: opt(nix?.font?.name || "Ubuntu Nerd Font"),
- },
-
- bar: {
- layout: {
- start: opt>([
- "launcher",
- "workspaces",
- // "taskbar",
- "media",
- "expander",
- "cava",
- ]),
- center: opt>([
- "date",
- ]),
- end: opt>([
- "cava",
- "expander",
- "submap",
- "battery",
- "systray",
- "system",
- "powermenu",
- ]),
- },
- launcher: {
- icon: {
- colored: opt(false),
- icon: opt(icon(icons.nix.nix, icons.ui.search)),
- },
- label: {
- colored: opt(false),
- label: opt(""),
- },
- action: opt(() => App.toggleWindow("launcher")),
- },
- date: {
- format: opt("%R, %a, %d %b"),
- action: opt(() => App.toggleWindow("datemenu")),
- },
- battery: {
- bar: opt<"hidden" | "regular" | "whole">("hidden"),
- charging: opt("#00D787"),
- percentage: opt(true),
- blocks: opt(7),
- width: opt(50),
- low: opt(30),
- },
- workspaces: {
- workspaces: opt(7),
- },
- taskbar: {
- iconSize: opt(0),
- monochrome: opt(true),
- exclusive: opt(false),
- },
- systray: {
- ignore: opt([
- "KDE Connect Indicator",
- "spotify-client",
- ]),
- },
- media: {
- monochrome: opt(true),
- preferred: opt("spotify"),
- direction: opt<"left" | "right">("right"),
- format: opt(" {artist} - {title} "),
- length: opt(0),
- },
- powermenu: {
- monochrome: opt(false),
- action: opt(() => App.toggleWindow("powermenu")),
- },
- },
-
- powermenu: {
- sleep: opt("systemctl suspend"),
- reboot: opt("systemctl reboot"),
- logout: opt("pkill Hyprland"),
- shutdown: opt("shutdown now"),
- },
-
- notifications: {
- blacklist: opt(["Spotify"]),
- },
-})
-
-globalThis["options"] = options
-export default options
\ No newline at end of file
diff --git a/config/home-manager/desktop/ags/config/widget/bar/hyprland-workspaces.js b/config/home-manager/desktop/ags/config/widget/bar/hyprland-workspaces.js
deleted file mode 100644
index da95559f..00000000
--- a/config/home-manager/desktop/ags/config/widget/bar/hyprland-workspaces.js
+++ /dev/null
@@ -1,37 +0,0 @@
-const hyprland = await Service.import("hyprland")
-
-// Example with scrollable workspaces: https://aylur.github.io/ags-docs/services/hyprland/
-export function Workspaces2() {
- const activeId = hyprland.active.workspace.bind("id")
- const workspaces = hyprland.bind("workspaces")
- .as(ws => ws.map(({ id }) => Widget.Button({
- on_clicked: () => hyprland.messageAsync(`dispatch workspace ${id}`),
- child: Widget.Label(`${id}`),
- class_name: activeId.as(i => `${i === id ? "focused" : ""}`),
- })))
-
- return Widget.Box({
- class_name: "workspaces",
- children: workspaces,
- })
-}
-
-const dispatch = ws => hyprland.messageAsync(`dispatch workspace ${ws}`);
-
-export const Workspaces = () => Widget.EventBox({
- class_name: 'workspaces',
- onScrollUp: () => dispatch('+1'),
- onScrollDown: () => dispatch('-1'),
- child: Widget.Box({
- children: Array.from({ length: 10 }, (_, i) => i + 1).map(i => Widget.Button({
- attribute: i,
- label: `${i}`,
- onClicked: () => dispatch(i),
- })),
-
- // remove this setup hook if you want fixed number of buttons
- setup: self => self.hook(hyprland, () => self.children.forEach(btn => {
- btn.visible = hyprland.workspaces.some(ws => ws.id === btn.attribute);
- })),
- }),
-})
\ No newline at end of file
diff --git a/config/home-manager/desktop/README.md b/config/home-manager/window-manager/README.md
similarity index 100%
rename from config/home-manager/desktop/README.md
rename to config/home-manager/window-manager/README.md
diff --git a/config/home-manager/desktop/ags/config/.gitignore b/config/home-manager/window-manager/ags/config/.gitignore
similarity index 100%
rename from config/home-manager/desktop/ags/config/.gitignore
rename to config/home-manager/window-manager/ags/config/.gitignore
diff --git a/config/home-manager/desktop/ags/config/assets/nix-snowflake-symbolic.svg b/config/home-manager/window-manager/ags/config/assets/nix-snowflake-symbolic.svg
similarity index 100%
rename from config/home-manager/desktop/ags/config/assets/nix-snowflake-symbolic.svg
rename to config/home-manager/window-manager/ags/config/assets/nix-snowflake-symbolic.svg
diff --git a/config/home-manager/desktop/ags/config/config.js b/config/home-manager/window-manager/ags/config/config.js
similarity index 100%
rename from config/home-manager/desktop/ags/config/config.js
rename to config/home-manager/window-manager/ags/config/config.js
diff --git a/config/home-manager/desktop/ags/config/main.ts b/config/home-manager/window-manager/ags/config/main.ts
similarity index 52%
rename from config/home-manager/desktop/ags/config/main.ts
rename to config/home-manager/window-manager/ags/config/main.ts
index 407fbc58..f6bc94d8 100644
--- a/config/home-manager/desktop/ags/config/main.ts
+++ b/config/home-manager/window-manager/ags/config/main.ts
@@ -2,6 +2,10 @@ import { Bar } from "./widget/bar/bar.js"
import { NotificationPopups } from "./widget/notification-popup.js"
import { setupNotificationDaemon } from "./notification-daemon/init.js"
+
+// https://user-images.githubusercontent.com/36706276/192147190-cf9cf4df-94cb-4a3b-b9d8-137ed0c2538f.png
+// https://github.com/fufexan/dotfiles/blob/main/home/services/ags/windows/bar/modules/bluetooth.js
+
// https://aylur.github.io/ags-docs/config/theming/
function debug() {
Utils.monitorFile(
@@ -25,10 +29,43 @@ function debug() {
)
}
-debug()
+/*
+function addWindows(windows) {
+ windows.forEach(win => App.addWindow(win));
+}
+
+ Utils.idle(async () => {
+ addWindows([
+ IndicatorWidget(),
+ Quicksettings(),
+ await Launcher(),
+ PowerMenu(),
+ PopupNotifications(),
+ ]);
+
+ const display = Gdk.Display.get_default();
+ for (let m = 0; m < display?.get_n_monitors(); m++) {
+ const monitor = display?.get_monitor(m);
+ addMonitorWindows(monitor);
+ }
+
+ display?.connect("monitor-added", (disp, monitor) => {
+ addMonitorWindows(monitor);
+ });
+
+ display?.connect("monitor-removed", (disp, monitor) => {
+ App.windows.forEach(win => {
+ if(win.gdkmonitor === monitor) App.removeWindow(win);
+ });
+ });
+
+
+}); */
+
App.addIcons(`${App.configDir}/assets`)
App.config({
onConfigParsed: () => {
+ debug()
setupNotificationDaemon()
},
style: `${App.configDir}/style/style.css`,
diff --git a/config/home-manager/desktop/ags/config/notification-daemon/battery.ts b/config/home-manager/window-manager/ags/config/notification-daemon/battery.ts
similarity index 100%
rename from config/home-manager/desktop/ags/config/notification-daemon/battery.ts
rename to config/home-manager/window-manager/ags/config/notification-daemon/battery.ts
diff --git a/config/home-manager/desktop/ags/config/notification-daemon/ignore-list.ts b/config/home-manager/window-manager/ags/config/notification-daemon/ignore-list.ts
similarity index 100%
rename from config/home-manager/desktop/ags/config/notification-daemon/ignore-list.ts
rename to config/home-manager/window-manager/ags/config/notification-daemon/ignore-list.ts
diff --git a/config/home-manager/desktop/ags/config/notification-daemon/init.ts b/config/home-manager/window-manager/ags/config/notification-daemon/init.ts
similarity index 94%
rename from config/home-manager/desktop/ags/config/notification-daemon/init.ts
rename to config/home-manager/window-manager/ags/config/notification-daemon/init.ts
index dceea547..c49236ec 100644
--- a/config/home-manager/desktop/ags/config/notification-daemon/init.ts
+++ b/config/home-manager/window-manager/ags/config/notification-daemon/init.ts
@@ -15,7 +15,7 @@ function exampleNotification() {
export function setupNotificationDaemon() {
try {
battery()
- exampleNotification()
+ //exampleNotification()
} catch (error) {
logError(error)
}
diff --git a/config/home-manager/window-manager/ags/config/options.ts b/config/home-manager/window-manager/ags/config/options.ts
new file mode 100644
index 00000000..becbacc3
--- /dev/null
+++ b/config/home-manager/window-manager/ags/config/options.ts
@@ -0,0 +1,54 @@
+import { opt, mkOptions } from "lib/option"
+import { icon } from "lib/utils"
+import icons from "lib/icons"
+
+const nix = JSON.parse(Utils.readFile(Utils.CACHE_DIR + "/options-nix.json") || '{}')
+
+//https://github.com/Serpentian/AlfheimOS/blob/master/non-nix/ags/widget/bar/buttons/Launcher.ts
+//https://github.com/Serpentian/AlfheimOS/blob/master/user/wm/hyprland/ags.nix
+
+const options = mkOptions(OPTIONS, {
+ wallpaper: opt(nix?.wallpaper || ""),
+ font: {
+ size: opt(nix?.font?.size || 12),
+ name: opt(nix?.font?.name || "Ubuntu Nerd Font"),
+ },
+
+
+ bar: {
+ launcher: {
+ launcherExe: opt(nix?.launcher || ""),
+ icon: {
+ colored: opt(false),
+ icon: opt(icon(icons.nix.nix, icons.ui.search)),
+ },
+ },
+ workspaces: {
+ workspaces: opt(10),
+ },
+ systray: {
+ ignore: opt([
+ "KDE Connect Indicator",
+ "spotify-client",
+ ]),
+ },
+ media: {
+ format: opt(" {artist} - {title} "),
+ length: opt(0),
+ },
+ },
+
+ powermenu: {
+ sleep: opt("systemctl suspend"),
+ reboot: opt("systemctl reboot"),
+ logout: opt("pkill Hyprland"),
+ shutdown: opt("shutdown now"),
+ },
+
+ notifications: {
+ blacklist: opt(["Spotify"]),
+ },
+})
+
+globalThis["options"] = options
+export default options
\ No newline at end of file
diff --git a/config/home-manager/window-manager/ags/config/services/brightness.js b/config/home-manager/window-manager/ags/config/services/brightness.js
new file mode 100644
index 00000000..6c184980
--- /dev/null
+++ b/config/home-manager/window-manager/ags/config/services/brightness.js
@@ -0,0 +1,46 @@
+class BrightnessService extends Service {
+ static {
+ Service.register(this, { 'screen-changed': ['float'] }, { 'screen-value': ['float', 'rw'] });
+ }
+
+ #interface = Utils.exec("sh -c 'ls -w1 /sys/class/backlight | head -1'");
+ #screenValue = 0;
+ #max = Number(Utils.exec('brightnessctl max'));
+
+ // the getter/setter has to be in snake_case
+ get screen_value() {
+ return this.#screenValue;
+ }
+
+ set screen_value(percent) {
+ if (percent < 0)
+ percent = 0;
+ if (percent > 1)
+ percent = 1;
+
+ Utils.execAsync(`brightnessctl set ${percent * 100}% -q`);
+ }
+
+ constructor() {
+ super();
+ const brightness = `/sys/class/backlight/${this.#interface}/brightness`;
+ Utils.monitorFile(brightness, () => this.#onChange());
+ this.#onChange();
+ }
+
+ #onChange() {
+ this.#screenValue = Number(Utils.exec('brightnessctl get')) / this.#max;
+ this.changed('screen-value');
+ this.emit('screen-changed', this.#screenValue);
+ }
+
+ // overwriting the connect method, let's you
+ // change the default event that widgets connect to
+ connect(event = 'screen-changed', callback) {
+ return super.connect(event, callback);
+ }
+}
+
+// Singleton
+const service = new BrightnessService;
+export default service;
\ No newline at end of file
diff --git a/config/home-manager/desktop/ags/config/style/main.scss b/config/home-manager/window-manager/ags/config/style/main.scss
similarity index 100%
rename from config/home-manager/desktop/ags/config/style/main.scss
rename to config/home-manager/window-manager/ags/config/style/main.scss
diff --git a/config/home-manager/desktop/ags/config/style/style.css b/config/home-manager/window-manager/ags/config/style/style.css
similarity index 91%
rename from config/home-manager/desktop/ags/config/style/style.css
rename to config/home-manager/window-manager/ags/config/style/style.css
index 9a441aeb..775c798e 100644
--- a/config/home-manager/desktop/ags/config/style/style.css
+++ b/config/home-manager/window-manager/ags/config/style/style.css
@@ -34,20 +34,16 @@ button {
color: @content_main;
}
-.workspaces {
- color: transparent;
- margin-right: 1.5px;
- margin-left: 1.5px;
-}
-
.workspaces button {
padding: 3px;
+ padding-left: 10px;
+ padding-right: 10px;
color: @content_inactive;
}
-.workspaces button .focused {
+.workspaces .active {
+ background: @bg_hover;
color: @content_main;
- border-bottom: 3px solid white;
}
.workspaces button:hover {
diff --git a/config/home-manager/desktop/ags/config/tsconfig.json b/config/home-manager/window-manager/ags/config/tsconfig.json
similarity index 100%
rename from config/home-manager/desktop/ags/config/tsconfig.json
rename to config/home-manager/window-manager/ags/config/tsconfig.json
diff --git a/config/home-manager/desktop/ags/config/widget/bar/bar.ts b/config/home-manager/window-manager/ags/config/widget/bar/bar.ts
similarity index 60%
rename from config/home-manager/desktop/ags/config/widget/bar/bar.ts
rename to config/home-manager/window-manager/ags/config/widget/bar/bar.ts
index c4ea8b6f..42993e2e 100644
--- a/config/home-manager/desktop/ags/config/widget/bar/bar.ts
+++ b/config/home-manager/window-manager/ags/config/widget/bar/bar.ts
@@ -1,12 +1,12 @@
import { BatteryLabel } from './battery.js'
import { Clock } from './clock.js'
-import { Workspaces } from './hyprland-workspaces.js'
import { ClientTitle } from './hyprland-active.js' /* FIXME: Use plain titles per window */
import { Volume } from './volume.js'
import { Media } from './media.js'
import { SysTray } from './systray.js'
import { Launcher } from './launcher.js'
-``
+import { Workspaces } from './hyprland-workspaces.js'
+
export function Bar(monitor: number){
return Widget.Window({
name: `bar-${monitor}`,
@@ -14,9 +14,24 @@ export function Bar(monitor: number){
anchor: ["top", "left", "right"],
exclusivity: "exclusive",
child: Widget.CenterBox({
- start_widget: Widget.Box({ spacing: 8, children: [ Launcher(), Workspaces() ] }),
+ start_widget: Widget.Box({
+ spacing: 8,
+ children: [
+ Launcher(),
+ ]
+ }),
center_widget: Widget.Box({ spacing: 8, children: [ Media() ] }),
- end_widget: Widget.Box({ hpack: "end", spacing: 8, children: [ Volume(), BatteryLabel(), Clock(), SysTray() ] }),
+ end_widget: Widget.Box({ hpack: "end", spacing: 8, children: [
+ //Brightness(),
+ Volume(),
+ BatteryLabel(),
+ Clock(),
+ SysTray()
+ ] }),
}),
})
}
+
+// FIXME monitors: https://github.com/kotontrion/dotfiles/blob/main/.config%2Fags%2Fconfig.js#L60-L74
+// FIXME: https://github.com/end-4/dots-hyprland
+// FIXME: https://github.com/kotontrion/dotfiles
\ No newline at end of file
diff --git a/config/home-manager/desktop/ags/config/widget/bar/battery.js b/config/home-manager/window-manager/ags/config/widget/bar/battery.js
similarity index 100%
rename from config/home-manager/desktop/ags/config/widget/bar/battery.js
rename to config/home-manager/window-manager/ags/config/widget/bar/battery.js
diff --git a/config/home-manager/window-manager/ags/config/widget/bar/brightness.js b/config/home-manager/window-manager/ags/config/widget/bar/brightness.js
new file mode 100644
index 00000000..7ad2af8f
--- /dev/null
+++ b/config/home-manager/window-manager/ags/config/widget/bar/brightness.js
@@ -0,0 +1,21 @@
+import brightness from '../../services/brightness.js';
+
+export function Brightness() {
+ return Widget.Label({
+ label: brightness.bind('screen-value').as(v => `${v}`),
+ setup: self => self.hook(brightness, (self, screenValue) => {
+ // screenValue is the passed parameter from the 'screen-changed' signal
+ self.label = screenValue ?? 0;
+
+ // NOTE:
+ // since hooks are run upon construction
+ // the passed screenValue will be undefined the first time
+
+ // all three are valid
+ self.label = `${brightness.screenValue}`;
+ self.label = `${brightness.screen_value}`;
+ self.label = `${brightness['screen-value']}`;
+
+ }, 'screen-changed'),
+ })
+}
\ No newline at end of file
diff --git a/config/home-manager/desktop/ags/config/widget/bar/clock.js b/config/home-manager/window-manager/ags/config/widget/bar/clock.js
similarity index 100%
rename from config/home-manager/desktop/ags/config/widget/bar/clock.js
rename to config/home-manager/window-manager/ags/config/widget/bar/clock.js
diff --git a/config/home-manager/desktop/ags/config/widget/bar/hyprland-active.js b/config/home-manager/window-manager/ags/config/widget/bar/hyprland-active.js
similarity index 100%
rename from config/home-manager/desktop/ags/config/widget/bar/hyprland-active.js
rename to config/home-manager/window-manager/ags/config/widget/bar/hyprland-active.js
diff --git a/config/home-manager/window-manager/ags/config/widget/bar/hyprland-workspaces.ts b/config/home-manager/window-manager/ags/config/widget/bar/hyprland-workspaces.ts
new file mode 100644
index 00000000..94b85e73
--- /dev/null
+++ b/config/home-manager/window-manager/ags/config/widget/bar/hyprland-workspaces.ts
@@ -0,0 +1,36 @@
+import { sh, range } from "lib/utils"
+
+const hyprland = await Service.import("hyprland")
+const dispatch = ws => hyprland.messageAsync(`dispatch workspace ${ws}`);
+
+const CreateWorkspaces = (ws: number) => Widget.Box({
+ children: Array.from({ length: ws }, (_, i) => i + 1).map(i => {
+ const btn = Widget.Button({
+ attribute: i,
+ child: Widget.Label({label: `${i}`}),
+ on_clicked: () => dispatch(i),
+ setup: self => self.hook(hyprland, () => {
+ self.toggleClassName("active", hyprland.active.workspace.id === i)
+ }),
+ })
+ const workspace = hyprland.getWorkspace(i)
+ if (workspace && workspace.initialized) {
+ btn.setup()
+ }
+ return btn
+ }),
+ setup: box => {
+ //box.hook(hyprland.active.workspace, () => box.children.map(btn => {
+ // btn.visible = hyprland.workspaces.some(ws => ws.id === btn.attribute)
+ //}))
+ },
+})
+
+export function Workspaces() {
+ return Widget.EventBox({
+ class_name: "workspaces",
+ on_scroll_up: () => dispatch("+1"),
+ on_scroll_down: () => dispatch("-1"),
+ child: CreateWorkspaces(10),
+ })
+}
\ No newline at end of file
diff --git a/config/home-manager/desktop/ags/config/widget/bar/launcher.ts b/config/home-manager/window-manager/ags/config/widget/bar/launcher.ts
similarity index 75%
rename from config/home-manager/desktop/ags/config/widget/bar/launcher.ts
rename to config/home-manager/window-manager/ags/config/widget/bar/launcher.ts
index 0e03e04d..8ed81ae7 100644
--- a/config/home-manager/desktop/ags/config/widget/bar/launcher.ts
+++ b/config/home-manager/window-manager/ags/config/widget/bar/launcher.ts
@@ -1,7 +1,7 @@
export function Launcher() {
return Widget.Button({
class_name: 'launcher',
- on_primary_click_release: (evt) => Utils.exec("wofi"),
+ on_primary_click_release: (evt) => Utils.exec("fuzzel"),
//child: Widget.Icon({icon: "nix-snowflake-symbolic"}),
child: Widget.Label({label: ""}),
})
diff --git a/config/home-manager/desktop/ags/config/widget/bar/media.ts b/config/home-manager/window-manager/ags/config/widget/bar/media.ts
similarity index 100%
rename from config/home-manager/desktop/ags/config/widget/bar/media.ts
rename to config/home-manager/window-manager/ags/config/widget/bar/media.ts
diff --git a/config/home-manager/desktop/ags/config/widget/bar/systray.ts b/config/home-manager/window-manager/ags/config/widget/bar/systray.ts
similarity index 100%
rename from config/home-manager/desktop/ags/config/widget/bar/systray.ts
rename to config/home-manager/window-manager/ags/config/widget/bar/systray.ts
diff --git a/config/home-manager/desktop/ags/config/widget/bar/volume.js b/config/home-manager/window-manager/ags/config/widget/bar/volume.js
similarity index 100%
rename from config/home-manager/desktop/ags/config/widget/bar/volume.js
rename to config/home-manager/window-manager/ags/config/widget/bar/volume.js
diff --git a/config/home-manager/desktop/ags/config/widget/notification-popup.js b/config/home-manager/window-manager/ags/config/widget/notification-popup.js
similarity index 100%
rename from config/home-manager/desktop/ags/config/widget/notification-popup.js
rename to config/home-manager/window-manager/ags/config/widget/notification-popup.js
diff --git a/config/home-manager/desktop/ags/default.nix b/config/home-manager/window-manager/ags/default.nix
similarity index 100%
rename from config/home-manager/desktop/ags/default.nix
rename to config/home-manager/window-manager/ags/default.nix
diff --git a/config/home-manager/desktop/default.nix b/config/home-manager/window-manager/default.nix
similarity index 76%
rename from config/home-manager/desktop/default.nix
rename to config/home-manager/window-manager/default.nix
index 03f370f0..853c5a62 100644
--- a/config/home-manager/desktop/default.nix
+++ b/config/home-manager/window-manager/default.nix
@@ -56,18 +56,6 @@ in
gtk-error-bell = 0;
};
- # TODO: Replace by xdg directories
- gtk3.bookmarks = [
- "file://${config.home.homeDirectory}/desktop"
- "file://${config.home.homeDirectory}/downloads"
- "file://${config.home.homeDirectory}/games"
- "file://${config.home.homeDirectory}/music"
- "file://${config.home.homeDirectory}/pictures"
- "file://${config.home.homeDirectory}/screenshots"
- "file://${config.home.homeDirectory}/workdir"
- "file://${config.home.homeDirectory}/.config Config"
- ];
-
gtk4.extraConfig = {
gtk-application-prefer-dark-theme = 1;
gtk-error-bell = 0;
@@ -79,4 +67,7 @@ in
enable = true;
platformTheme.name = "kde";
};
+
+ # TODO: MOVE TO NIRI
+ services.gnome-keyring.enable = true;
}
\ No newline at end of file
diff --git a/config/home-manager/desktop/fuzzel.nix b/config/home-manager/window-manager/fuzzel.nix
similarity index 100%
rename from config/home-manager/desktop/fuzzel.nix
rename to config/home-manager/window-manager/fuzzel.nix
diff --git a/config/home-manager/desktop/hyprland/default.nix b/config/home-manager/window-manager/hyprland/default.nix
similarity index 61%
rename from config/home-manager/desktop/hyprland/default.nix
rename to config/home-manager/window-manager/hyprland/default.nix
index c69e8d28..e33de8e7 100644
--- a/config/home-manager/desktop/hyprland/default.nix
+++ b/config/home-manager/window-manager/hyprland/default.nix
@@ -1,4 +1,4 @@
-{ config, lib, pkgs, self, ... }:
+{ inputs, config, lib, pkgs, self, ... }:
let
wallpapersPkg = self.private.wallpapers.override {
selected = [ "lake-fishing-sunset" "mountains" "whale-sunset" "watch-tower" ];
@@ -11,6 +11,11 @@ in
# TODO: https://github.com/diniamo/niqs/blob/53288d72902365ee8d3bfdd6aff0ec79eb7c1c36/modules/workstation/hyprland.nix
# https://github.com/JaKooLit/Ja-ZaneyOS/blob/0bed326404ad90ca6803c0a9096426a36a14a35a/config/hyprland.nix
# https://github.com/Serpentian/AlfheimOS/blob/master/user/wm/hyprland/settings.nix
+
+# Screenshot: https://github.com/iynaix/dotfiles/blob/f0f8918caed8f4c245fa82fc505ae0de09a32f5c/home-manager/hyprland/screenshot.sh
+let
+ openOnWorkspace = workspace: program: "[workspace ${toString workspace} silent] ${program}";
+in
{
imports = [
./settings.nix
@@ -23,6 +28,10 @@ in
networkmanagerapplet
];
+ home.shellAliases = {
+ hypr-log = "hyprctl rollinglog --follow";
+ };
+
services.hyprpaper = {
enable = true;
settings = {
@@ -39,6 +48,11 @@ in
variables = [ "--all" ];
enableXdgAutostart = true;
};
+
+ #settings.bind = [
+ # "SUPER, grave, hyprexpo:expo, toggle"
+ #];
+
settings = {
"monitor" = [ ",preferred,auto,auto" ];
@@ -60,6 +74,38 @@ in
"__GLX_VENDOR_LIBRARY_NAME,nvidia"
];
+ misc = {
+ disable_autoreload = false; # disable auto polling for config file changes
+ animate_mouse_windowdragging = false; # disable dragging animation
+ force_default_wallpaper = -1; # Set to 0 or 1 to disable the anime mascot wallpapers
+ disable_hyprland_logo = false; # If true disables the random hyprland logo / anime girl background. :(
+ };
+
+ input = {
+ # Input - More on https://wiki.archlinux.org/title/Xorg/Keyboard_configuration
+ kb_layout = "us,pt";
+ kb_variant = "euro,";
+ kb_options = builtins.concatStringsSep " " [
+ "caps:ctrl_modifier" # Replace caps-lock for Ctrl
+ "grp:ralt_rshift_toggle" # Right Alt + Right Shift: Switch keyboard layouts. See more using `xkeyboard-config`
+ ];
+
+ follow_mouse = 1;
+
+ sensitivity = 0; # -1.0 - 1.0, 0 means no modification.
+
+ touchpad = {
+ natural_scroll = false;
+ tap_button_map = "lmr";
+ };
+ };
+
+ # touchpad gestures
+ gestures = {
+ workspace_swipe = true;
+ workspace_swipe_forever = true;
+ };
+
exec-once = [
"ags -b hypr"
#"dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP" # Fix long-time to start systemd: https://wiki.hyprland.org/FAQ/#some-of-my-apps-take-a-really-long-time-to-open
diff --git a/config/home-manager/desktop/hyprland/keybindings.nix b/config/home-manager/window-manager/hyprland/keybindings.nix
similarity index 68%
rename from config/home-manager/desktop/hyprland/keybindings.nix
rename to config/home-manager/window-manager/hyprland/keybindings.nix
index b3a076ff..09e18ecc 100644
--- a/config/home-manager/desktop/hyprland/keybindings.nix
+++ b/config/home-manager/window-manager/hyprland/keybindings.nix
@@ -1,11 +1,16 @@
{ lib, config, ... }:
+
+# Check custom scripts: https://github.com/iynaix/dotfiles/blob/fa261818c04e6b1aa7d928a10abd66e2c31c0ed9/packages/dotfiles-rs/dotfiles/src/bin/hypr-pip.rs
+# https://github.com/dileep-kishore/nixos-hyprland/blob/main/home/common/optional/desktops/hyprland/config.nix
+# https://github.com/JaKooLit/Hyprland-Dots/blob/main/config/hypr/configs/Keybinds.conf
+
+# Force Quit active: https://github.com/JaKooLit/Hyprland-Dots/blob/main/config/hypr/configs/Keybinds.conf
+
+# TODO: Alt F4 means keep closing active window until there is none. Then, show list of options.
let
shortcuts = [
- "$mod, Q, exec, $terminal"
- "$mod, E, exec, $fileManager"
- "$mod, R, exec, $menu"
- "$mod, F, exec, $browser"
+ "$mod, SPACE, exec, $menu"
];
focus = [
@@ -48,18 +53,15 @@ let
# Scroll through existing workspaces with mod + scroll
"$mod, mouse_down, workspace, e+1"
"$mod, mouse_up, workspace, e-1"
- ];
- toggle_waybar = {
- bind = [ "$mod, W, exec, pkill -SIGUSR1 waybar" ];
- bindr = [ "$mod, W, exec, pkill -SIGUSR1 waybar" ];
- };
+ # focus the previous / next desktop in the current monitor (DE style)
+ "CTRL_ALT, Left, workspace, m-1"
+ "CTRL_ALT, Right, workspace, m+1"
+ ];
in
{
wayland.windowManager.hyprland.settings = lib.mkMerge [
- {
- bind = [ "$mod, W, exec, pkill -SIGUSR1 waybar" ]; # Toggle waybar
- }
+ #{ bind = [ "$mod, W, exec, pkill -SIGUSR1 waybar" ]; } # Toggle waybar
{
# See https://wiki.hyprland.org/Configuring/Keywords/
"$mod" = "SUPER"; # Sets "Windows" key as main modifier
@@ -74,14 +76,18 @@ in
bind = [
# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more
- "$mod, C, killactive,"
- "$mod, F, fullscreen,"
- "$mod, M, exit,"
- "$mod, V, togglefloating,"
+ "$mod, Q, killactive,"
+ "$mod, F, fullscreen, 0" # Fullscreen entire screen
+ "$mod SHIFT, F, fullscreen, 0" # Fullscreen entire screen but with top bar
+ "$mod CTRL, F, fullscreen, 0 2" # Instruct app to go fullscreen
+ "$mod, P, pin" # Pin screen
+ #"$mod, F, togglefloating,"
+ "$mod_ALT, F4, exit," # Exit Hyprland # FIXME: Do I need it?
"$mod, P, pseudo," # dwindle
"$mod, J, togglesplit," # dwindle
- "Ctrl+Alt, W, exec, killall waybar || waybar" # toggle waybar
+ "ALT, Tab, cyclenext"
+ "ALT_SHIFT, Tab, cyclenext, prev"
] ++ shortcuts ++ focus ++ workspace;
bindel = [
diff --git a/config/home-manager/desktop/hyprland/rules.nix b/config/home-manager/window-manager/hyprland/rules.nix
similarity index 100%
rename from config/home-manager/desktop/hyprland/rules.nix
rename to config/home-manager/window-manager/hyprland/rules.nix
diff --git a/config/home-manager/desktop/hyprland/scripts/close-active.sh b/config/home-manager/window-manager/hyprland/scripts/close-active.sh
similarity index 100%
rename from config/home-manager/desktop/hyprland/scripts/close-active.sh
rename to config/home-manager/window-manager/hyprland/scripts/close-active.sh
diff --git a/config/home-manager/desktop/hyprland/scripts/monitor-toggle.sh b/config/home-manager/window-manager/hyprland/scripts/monitor-toggle.sh
similarity index 100%
rename from config/home-manager/desktop/hyprland/scripts/monitor-toggle.sh
rename to config/home-manager/window-manager/hyprland/scripts/monitor-toggle.sh
diff --git a/config/home-manager/desktop/hyprland/scripts/volume.sh b/config/home-manager/window-manager/hyprland/scripts/volume.sh
similarity index 100%
rename from config/home-manager/desktop/hyprland/scripts/volume.sh
rename to config/home-manager/window-manager/hyprland/scripts/volume.sh
diff --git a/config/home-manager/desktop/hyprland/scripts/wofi-kanshi-profile.sh b/config/home-manager/window-manager/hyprland/scripts/wofi-kanshi-profile.sh
similarity index 100%
rename from config/home-manager/desktop/hyprland/scripts/wofi-kanshi-profile.sh
rename to config/home-manager/window-manager/hyprland/scripts/wofi-kanshi-profile.sh
diff --git a/config/home-manager/desktop/hyprland/scripts/wofi-session.sh b/config/home-manager/window-manager/hyprland/scripts/wofi-session.sh
similarity index 100%
rename from config/home-manager/desktop/hyprland/scripts/wofi-session.sh
rename to config/home-manager/window-manager/hyprland/scripts/wofi-session.sh
diff --git a/config/home-manager/desktop/hyprland/settings.nix b/config/home-manager/window-manager/hyprland/settings.nix
similarity index 62%
rename from config/home-manager/desktop/hyprland/settings.nix
rename to config/home-manager/window-manager/hyprland/settings.nix
index ac9ae85b..27229af2 100644
--- a/config/home-manager/desktop/hyprland/settings.nix
+++ b/config/home-manager/window-manager/hyprland/settings.nix
@@ -30,14 +30,8 @@ in
decoration = {
rounding = 2;
-
dim_inactive = false;
- drop_shadow = true;
- shadow_range = 4;
- shadow_render_power = 3;
- "col.shadow" = "rgba(1a1a1aee)";
-
# https://wiki.hyprland.org/Configuring/Variables/#blur
blur = {
enabled = true;
@@ -88,46 +82,5 @@ in
exec-once = [
"hyprctl setcursor ${cursorName} ${toString pointer.size}"
];
-
- misc = {
- disable_autoreload = false; # disable auto polling for config file changes
- animate_mouse_windowdragging = false; # disable dragging animation
- force_default_wallpaper = -1; # Set to 0 or 1 to disable the anime mascot wallpapers
- disable_hyprland_logo = false; # If true disables the random hyprland logo / anime girl background. :(
- };
-
- input = {
- kb_layout = "us,pt";
- kb_variant = "euro,";
- kb_options = "caps:ctrl_modifier";
-
- follow_mouse = 1;
-
- sensitivity = 0; # -1.0 - 1.0, 0 means no modification.
-
- touchpad = {
- natural_scroll = false;
- tap_button_map = "lmr";
- };
- };
-
- # touchpad gestures
- gestures = {
- workspace_swipe = true;
- workspace_swipe_forever = true;
- };
};
-}
-
-# # Input - More on https://wiki.archlinux.org/title/Xorg/Keyboard_configuration
-# services.xserver = {
-# #exportConfiguration = true; # Do I need this?
-# xkb.layout = "us,pt"; # localectl list-x11-keymap-layouts and
-# xkb.variant = "euro,"; # localectl list-x11-keymap-variants us
-# xkb.options = builtins.concatStringsSep " " [
-# "caps:ctrl_modifier" # Replace caps-lock for Ctrl
-# "grp:ralt_rshift_toggle" # Right Alt + Right Shift: Switch keyboard layouts. See more using `xkeyboard-config`
-# ];
-#
-# excludePackages = [ pkgs.xterm ];
-# };
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/config/home-manager/desktop/kanshi.nix b/config/home-manager/window-manager/kanshi.nix
similarity index 95%
rename from config/home-manager/desktop/kanshi.nix
rename to config/home-manager/window-manager/kanshi.nix
index b7570396..7b2ef89b 100644
--- a/config/home-manager/desktop/kanshi.nix
+++ b/config/home-manager/window-manager/kanshi.nix
@@ -19,7 +19,7 @@ let
disable = screen: screen // { status = "disable"; };
in
{
- home.packages = [ pkgs.kanshi ]; # needed to run `kanshictl switch`
+ #home.packages = [ pkgs.kanshi ]; # needed to run `kanshictl switch`
services.kanshi = {
enable = true;
systemdTarget = "hyprland-session.target";
diff --git a/config/home-manager/window-manager/niri.nix b/config/home-manager/window-manager/niri.nix
new file mode 100644
index 00000000..0d5197ea
--- /dev/null
+++ b/config/home-manager/window-manager/niri.nix
@@ -0,0 +1,3 @@
+{ config, lib, pkgs, ... }: {
+
+}
\ No newline at end of file
diff --git a/config/home-manager/desktop/waybar/default.nix b/config/home-manager/window-manager/waybar/default.nix
similarity index 100%
rename from config/home-manager/desktop/waybar/default.nix
rename to config/home-manager/window-manager/waybar/default.nix
diff --git a/config/home-manager/desktop/waybar/menu/power_menu.xml b/config/home-manager/window-manager/waybar/menu/power_menu.xml
similarity index 100%
rename from config/home-manager/desktop/waybar/menu/power_menu.xml
rename to config/home-manager/window-manager/waybar/menu/power_menu.xml
diff --git a/config/home-manager/desktop/waybar/style.css b/config/home-manager/window-manager/waybar/style.css
similarity index 100%
rename from config/home-manager/desktop/waybar/style.css
rename to config/home-manager/window-manager/waybar/style.css
diff --git a/config/home-manager/desktop/wofi.nix b/config/home-manager/window-manager/wofi.nix
similarity index 100%
rename from config/home-manager/desktop/wofi.nix
rename to config/home-manager/window-manager/wofi.nix
diff --git a/config/nixos/default.nix b/config/nixos/default.nix
index dd241795..4c78cd13 100644
--- a/config/nixos/default.nix
+++ b/config/nixos/default.nix
@@ -39,19 +39,6 @@
'';
};
- # Input - More on https://wiki.archlinux.org/title/Xorg/Keyboard_configuration
- services.xserver = {
- #exportConfiguration = true; # Do I need this?
- xkb.layout = "us,pt"; # localectl list-x11-keymap-layouts and
- xkb.variant = "euro,"; # localectl list-x11-keymap-variants us
- xkb.options = builtins.concatStringsSep " " [
- "caps:ctrl_modifier" # Replace caps-lock for Ctrl
- "grp:ralt_rshift_toggle" # Right Alt + Right Shift: Switch keyboard layouts. See more using `xkeyboard-config`
- ];
-
- excludePackages = [ pkgs.xterm ];
- };
-
# Programs
programs.fish.enable = true; # System level/
programs.fish.vendor.functions.enable = true; # Ensure completions/functions are automatically set.
diff --git a/config/nixos/display-manager.nix b/config/nixos/display-manager.nix
new file mode 100644
index 00000000..1147ce49
--- /dev/null
+++ b/config/nixos/display-manager.nix
@@ -0,0 +1,4 @@
+{ ... }:
+{
+
+}
\ No newline at end of file
diff --git a/config/nixos/wayland.nix b/config/nixos/wayland.nix
index 125103a3..11ce3942 100644
--- a/config/nixos/wayland.nix
+++ b/config/nixos/wayland.nix
@@ -1,25 +1,45 @@
{ pkgs, ... }:
{
+ # https://github.com/sodiboo/niri-flake/blob/main/flake.nix
+ # https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/programs/wayland/wayland-session.nix
+ # https://github.com/nyawox/nixboxes/blob/ecab4559da256b4f1198ca7d39d6e5b1d4442296/home/desktop/niri/general.nix
+ programs.niri.enable = true;
+ security.pam.services.swaylock = {};
+ services.gnome.gnome-keyring.enable = true;
+ programs.xwayland.enable = true;
+ xdg.portal = {
+ enable = true;
+ extraPortals = [
+ pkgs.xdg-desktop-portal-gnome
+ ]; # Required for screencasting/*/
+ };
programs.hyprland.enable = true; # Automates several dependencies. Home-Manager sets custom configuration.
- xdg.portal.enable = true;
# Other
programs.nm-applet.enable = true;
# TODO: https://github.com/Aylur/dotfiles/blob/main/nixos/system.nix#L44
environment.systemPackages = with pkgs; [
+ # Core - Hardware
+ brightnessctl # Manage Brightness
+
+ # Core - Software
+ qt5.qtwayland
+ qt6.qtwayland
+ qt6ct
+
+ xwayland-satellite # X11. See: https://github.com/YaLTeR/niri/wiki/Xwayland
+ nautilus # File Browser
+ konsole # Backup terminal in case something goes wrong
+ ark # KDE package: Manage compressed files
+
+ # Personalization
morewaita-icon-theme
adwaita-icon-theme
qogir-icon-theme
gnome-calendar
gnome-system-monitor
gnome-calculator
-
- # Review
- nautilus
- brightnessctl
- konsole # Lets ensure this is around
- ark # I still like this?
];
-}
\ No newline at end of file
+}
diff --git a/flake.lock b/flake.lock
index 62e835d5..c9f7e60c 100644
--- a/flake.lock
+++ b/flake.lock
@@ -2,15 +2,15 @@
"nodes": {
"ags": {
"inputs": {
- "nixpkgs": "nixpkgs",
- "systems": "systems"
+ "astal": "astal",
+ "nixpkgs": "nixpkgs"
},
"locked": {
- "lastModified": 1728326430,
- "narHash": "sha256-tV1ABHuA1HItMdCTuNdA8fMB+qw7LpjvI945VwMSABI=",
+ "lastModified": 1731966249,
+ "narHash": "sha256-9hDeMy6S2q1wWBFGiJic5yUms19zW8LhAX9MlCtuN6k=",
"owner": "Aylur",
"repo": "ags",
- "rev": "60180a184cfb32b61a1d871c058b31a3b9b0743d",
+ "rev": "12e0bfefd2051c43d7450123fcb095f655b891e8",
"type": "github"
},
"original": {
@@ -19,6 +19,27 @@
"type": "github"
}
},
+ "astal": {
+ "inputs": {
+ "nixpkgs": [
+ "ags",
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1731952585,
+ "narHash": "sha256-Sh1E7sJd8JJM3PCU1ZOei/QWz97OLCENIi2rTRoaniw=",
+ "owner": "aylur",
+ "repo": "astal",
+ "rev": "664c7a4ddfcf48c6e8accd3c33bb94424b0e8609",
+ "type": "github"
+ },
+ "original": {
+ "owner": "aylur",
+ "repo": "astal",
+ "type": "github"
+ }
+ },
"darwin": {
"inputs": {
"nixpkgs": [
@@ -26,11 +47,11 @@
]
},
"locked": {
- "lastModified": 1729382845,
- "narHash": "sha256-REiWck1zIOnZIgGmmOWfwvkQw1f4UrBsxxOSKVSAG4w=",
+ "lastModified": 1732016537,
+ "narHash": "sha256-XwXUK+meYnlhdQz2TVE4Wv+tsx1CkdGbDPt1tRzCNH4=",
"owner": "lnl7",
"repo": "nix-darwin",
- "rev": "a001f44cfc47164839eb61c6b1e7f4288813f7e8",
+ "rev": "61cee20168a3ebb71a9efd70a55adebaadfbe4d4",
"type": "github"
},
"original": {
@@ -47,11 +68,11 @@
]
},
"locked": {
- "lastModified": 1729281548,
- "narHash": "sha256-MuojlSnwAJAwfhgmW8ZtZrwm2Sko4fqubCvReqbUzYw=",
+ "lastModified": 1732030699,
+ "narHash": "sha256-SBosboLvLqDv+7mNgRTIYDQbHE61rDDkXTJWiRX3PPo=",
"owner": "nix-community",
"repo": "disko",
- "rev": "a6a3179ddf396dfc28a078e2f169354d0c137125",
+ "rev": "da52cf40206d7d1a419d07640eb47b2fb9ac2c21",
"type": "github"
},
"original": {
@@ -67,11 +88,11 @@
]
},
"locked": {
- "lastModified": 1726997277,
- "narHash": "sha256-Nw6ty7JDN/ihNECORC1SHhDPZmnkhSaTFYXwxQJ55yA=",
+ "lastModified": 1729850443,
+ "narHash": "sha256-8zZGD9i/P4acfnxA0SZj97b1PkajD3XM7/uRe2+5+uc=",
"ref": "refs/heads/main",
- "rev": "1cf2f395c2d1638cf50322e997aee5a218a1591f",
- "revCount": 11,
+ "rev": "5d4427c5a641d83606cd7cb766fc9ea2d8d2012f",
+ "revCount": 12,
"type": "git",
"url": "ssh://git@github.com/bphenriques/dotfiles-private"
},
@@ -82,7 +103,7 @@
},
"flake-utils": {
"inputs": {
- "systems": "systems_2"
+ "systems": "systems"
},
"locked": {
"lastModified": 1705309234,
@@ -105,11 +126,11 @@
"zig": "zig"
},
"locked": {
- "lastModified": 1729515458,
- "narHash": "sha256-AYLxdLukuWXJREYupBiAXRk9PGX1qA7w/5adKMlNpTo=",
+ "lastModified": 1731971697,
+ "narHash": "sha256-6JNMcpy0z19yOLBRt3eE4Rk4A96kcEsRv5+ym1hkv1c=",
"ref": "refs/heads/main",
- "rev": "c2cbc214d5f6d45cfa171b8ed6ea7a670a5cbdab",
- "revCount": 7762,
+ "rev": "29c3a52e964a97dddaed876ce472aeb167774acf",
+ "revCount": 8021,
"type": "git",
"url": "ssh://git@github.com/mitchellh/ghostty"
},
@@ -125,11 +146,11 @@
]
},
"locked": {
- "lastModified": 1729459288,
- "narHash": "sha256-gBOVJv+q6Mx8jGvwX7cE6J8+sZmi1uxpRVsO7WxvVuQ=",
+ "lastModified": 1732025103,
+ "narHash": "sha256-qjEI64RKvDxRyEarY0jTzrZMa8ebezh2DEZmJJrpVdo=",
"owner": "nix-community",
"repo": "home-manager",
- "rev": "1e27f213d77fc842603628bcf2df6681d7d08f7e",
+ "rev": "a46e702093a5c46e192243edbd977d5749e7f294",
"type": "github"
},
"original": {
@@ -186,22 +207,6 @@
"type": "github"
}
},
- "nixpkgs-stable_3": {
- "locked": {
- "lastModified": 1729357638,
- "narHash": "sha256-66RHecx+zohbZwJVEPF7uuwHeqf8rykZTMCTqIrOew4=",
- "owner": "NixOS",
- "repo": "nixpkgs",
- "rev": "bb8c2cf7ea0dd2e18a52746b2c3a5b0c73b93c22",
- "type": "github"
- },
- "original": {
- "owner": "NixOS",
- "ref": "release-24.05",
- "repo": "nixpkgs",
- "type": "github"
- }
- },
"nixpkgs-unstable": {
"locked": {
"lastModified": 1719082008,
@@ -220,17 +225,17 @@
},
"nixpkgs_2": {
"locked": {
- "lastModified": 1729265718,
- "narHash": "sha256-4HQI+6LsO3kpWTYuVGIzhJs1cetFcwT7quWCk/6rqeo=",
+ "lastModified": 1729558817,
+ "narHash": "sha256-g4L4ERXHZileMif+7wJbtDrEb6NhtE5XJE+uugoWmj4=",
"owner": "nixos",
"repo": "nixpkgs",
- "rev": "ccc0c2126893dd20963580b6478d1a10a4512185",
+ "rev": "942b12cabae1cd4414c7177472d759731de92cb4",
"type": "github"
},
"original": {
"owner": "nixos",
- "ref": "nixpkgs-unstable",
"repo": "nixpkgs",
+ "rev": "942b12cabae1cd4414c7177472d759731de92cb4",
"type": "github"
}
},
@@ -267,15 +272,14 @@
"inputs": {
"nixpkgs": [
"nixpkgs"
- ],
- "nixpkgs-stable": "nixpkgs-stable_3"
+ ]
},
"locked": {
- "lastModified": 1729394972,
- "narHash": "sha256-fADlzOzcSaGsrO+THUZ8SgckMMc7bMQftztKFCLVcFI=",
+ "lastModified": 1731954233,
+ "narHash": "sha256-vvXx1m2Rsw7MkbKJdpcICzz4YPgZPApGKQGhNZfkhOI=",
"owner": "Mic92",
"repo": "sops-nix",
- "rev": "c504fd7ac946d7a1b17944d73b261ca0a0b226a5",
+ "rev": "e39947d0ee8e341fa7108bd02a33cdfa24a1360e",
"type": "github"
},
"original": {
@@ -285,21 +289,6 @@
}
},
"systems": {
- "locked": {
- "lastModified": 1689347949,
- "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
- "owner": "nix-systems",
- "repo": "default-linux",
- "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68",
- "type": "github"
- },
- "original": {
- "owner": "nix-systems",
- "repo": "default-linux",
- "type": "github"
- }
- },
- "systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
diff --git a/flake.nix b/flake.nix
index 53048816..6dd06232 100644
--- a/flake.nix
+++ b/flake.nix
@@ -15,7 +15,8 @@
};
inputs = {
- nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; # Stable(ish) enough. Plus home-manager is _always_ on unstable
+ # FIXME: pin to when NUR is available but I still have 6.10 kernel available. Replace the ref to nixpkgs-unstable
+ nixpkgs.url = "github:nixos/nixpkgs/942b12cabae1cd4414c7177472d759731de92cb4"; # Stable(ish) enough. Plus home-manager is _always_ on unstable
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.05"; # I don't really use it, but leaving it here.
darwin.url = "github:lnl7/nix-darwin/master";
@@ -35,6 +36,8 @@
disko.inputs.nixpkgs.follows = "nixpkgs";
nur.url = "github:nix-community/nur"; # Collection of packages. Use it for Firefox extensions
ghostty.url = "git+ssh://git@github.com/mitchellh/ghostty"; # Terminal
+
+ # Wayland Window Manager
ags.url = "github:Aylur/ags"; # Widgets
};
diff --git a/hosts/laptop/bphenriques/home.nix b/hosts/laptop/bphenriques/home.nix
index 5a13e094..78eec9bc 100644
--- a/hosts/laptop/bphenriques/home.nix
+++ b/hosts/laptop/bphenriques/home.nix
@@ -31,5 +31,18 @@
"d ${config.xdg.userDirs.extraConfig.XDG_SCREENSHOTS_DIR} - - - -"
];
+ gtk.gtk3.bookmarks = [
+ "file://${config.xdg.userDirs.documents}"
+ "file://${config.xdg.userDirs.pictures}"
+ "file://${config.xdg.userDirs.music}"
+ "file://${config.xdg.userDirs.desktop}"
+ "file://${config.xdg.userDirs.download}"
+ "file://${config.xdg.userDirs.extraConfig.XDG_SCREENSHOTS_DIR}"
+
+ # Other
+ "file://${config.home.homeDirectory}/games"
+ "file://${config.home.homeDirectory}/.config Config"
+ ];
+
home.stateVersion = "24.05";
}
\ No newline at end of file
diff --git a/hosts/laptop/config.nix b/hosts/laptop/config.nix
index b367a5d0..6b4646e3 100644
--- a/hosts/laptop/config.nix
+++ b/hosts/laptop/config.nix
@@ -25,7 +25,7 @@ in
enable = true;
efiSupport = true;
efiInstallAsRemovable = true;
- configurationLimit = 5;
+ configurationLimit = 10;
# I have Windows To Go on a external drive. I turn it off when not in use to reduce wear-and-tear.
# 1. `sudo fdisk -l` to get the device where "EFI System" is.
diff --git a/hosts/laptop/default.nix b/hosts/laptop/default.nix
index cfb29e6d..3ddbd8e7 100644
--- a/hosts/laptop/default.nix
+++ b/hosts/laptop/default.nix
@@ -14,6 +14,7 @@ let
in mylib.hosts.mkNixOSHost {
inherit nixosModules hmModules overlays;
extraSpecialArgs = {
+ inherit inputs;
host.webcam = "/dev/video0";
network-devices = import ../network-devices.nix;
};
diff --git a/hosts/laptop/hardware/graphics.nix b/hosts/laptop/hardware/graphics.nix
index 4436057d..b8f834d5 100644
--- a/hosts/laptop/hardware/graphics.nix
+++ b/hosts/laptop/hardware/graphics.nix
@@ -35,5 +35,5 @@
(nvtopPackages.nvidia.override { amd = true; }) # `top` but for GPUs. Very very useful to see which GPU is being used
];
- services.xserver.videoDrivers = [ "nvidia" ];
+ services.xserver.videoDrivers = [ "nvidia" ]; # Load nvidia driver for Xorg and Wayland
}
diff --git a/hosts/peripherals.nix b/hosts/peripherals.nix
new file mode 100644
index 00000000..88f5ad97
--- /dev/null
+++ b/hosts/peripherals.nix
@@ -0,0 +1,9 @@
+{
+ monitors = {
+ office-monitor = {
+ criteria = "Dell Inc. DELL S2721DGF 4P11R83";
+ mode = "2560x1440@120.00Hz";
+ scale = 1.0;
+ };
+ };
+}
diff --git a/lib/hosts.nix b/lib/hosts.nix
index 92a8dc36..42be057f 100644
--- a/lib/hosts.nix
+++ b/lib/hosts.nix
@@ -17,10 +17,11 @@ let
permittedInsecurePackages = [ "electron-27.3.11" "electron-28.3.3" ];
};
+ # TODO: This should not be abstracted the way it is (likely).
mkExtraArgs = system: extraSpecialArgs: {
self = {
pkgs = inputs.self.packages.${system};
- private = inputs.dotfiles-private.packages.${system} // inputs.dotfiles-private.dotfiles-private;
+ private = inputs.dotfiles-private.packages.${system};
};
community.pkgs = {
ghostty = inputs.ghostty.packages.${system}.default;
From 5a93e8623cdaaf1d85387063b4f5a8d175eb72c8 Mon Sep 17 00:00:00 2001
From: Bruno Henriques <4727729+bphenriques@users.noreply.github.com>
Date: Fri, 22 Nov 2024 13:04:19 +0000
Subject: [PATCH 06/34] Broke many things
---
config/home-manager/default.nix | 3 +
.../home-manager/window-manager/default.nix | 17 +-
config/home-manager/window-manager/fuzzel.nix | 18 +-
.../window-manager/hyprland/default.nix | 5 +-
config/home-manager/window-manager/kanshi.nix | 4 +-
config/home-manager/window-manager/niri.nix | 377 +++++++++++++++++-
config/home-manager/window-manager/wofi.nix | 75 ----
config/nixos/default.nix | 33 +-
config/nixos/display-manager.nix | 28 +-
config/nixos/programs.nix | 24 ++
config/nixos/services.nix | 12 +
config/nixos/thunar.nix | 4 +-
config/nixos/wayland.nix | 19 +-
hosts/laptop/config.nix | 28 --
hosts/laptop/default.nix | 14 +-
hosts/peripherals.nix | 9 -
16 files changed, 495 insertions(+), 175 deletions(-)
delete mode 100644 config/home-manager/window-manager/wofi.nix
create mode 100644 config/nixos/programs.nix
create mode 100644 config/nixos/services.nix
delete mode 100644 hosts/peripherals.nix
diff --git a/config/home-manager/default.nix b/config/home-manager/default.nix
index c3fc37ae..9d4a35ff 100644
--- a/config/home-manager/default.nix
+++ b/config/home-manager/default.nix
@@ -28,6 +28,9 @@
unzip
xclip
+ # Other core
+ xdg-user-dirs
+
# Archive
p7zip # 7zip for linux
unrar # Still need it
diff --git a/config/home-manager/window-manager/default.nix b/config/home-manager/window-manager/default.nix
index 853c5a62..0b2af252 100644
--- a/config/home-manager/window-manager/default.nix
+++ b/config/home-manager/window-manager/default.nix
@@ -14,11 +14,12 @@ in
{
# https://github.com/prasanthrangan/hyprdots?tab=readme-ov-file
imports = [
- ./hyprland
- ./kanshi.nix # Display Manager
- ./wofi.nix # Application Launcher
+ ./hyprland # Window Manager
+ ./niri.nix # Window Manager
+
+ ./kanshi.nix # Manage external monitors
./fuzzel.nix # Application Launcher
- ./ags # Top bar, widgets, and notifications. The whole kit.
+ #./ags # Top bar, widgets, and notifications. The whole kit.
];
# Use the following theme: https://github.com/iynaix/dotfiles/blob/56d2d63b3b5f4c621429d79fb2aef8d44fdc25b9/home-manager/gui/gtk.nix#L85
@@ -65,9 +66,7 @@ in
# Double check what this does exactly
qt = {
enable = true;
- platformTheme.name = "kde";
+ platformTheme = "gnome";
+ style = "adw-gtk3-dark";
};
-
- # TODO: MOVE TO NIRI
- services.gnome-keyring.enable = true;
-}
\ No newline at end of file
+}
diff --git a/config/home-manager/window-manager/fuzzel.nix b/config/home-manager/window-manager/fuzzel.nix
index 044e8b09..ec5fe52a 100644
--- a/config/home-manager/window-manager/fuzzel.nix
+++ b/config/home-manager/window-manager/fuzzel.nix
@@ -1,4 +1,18 @@
{ config, pkgs, lib, ... }:
{
- home.packages = [ pkgs.fuzzel ];
-}
\ No newline at end of file
+ programs.fuzzel = {
+ enable = true;
+ settings = {
+ main.font = "JetBrainsMono Nerd Font";
+ colors = {
+ background = "1e1e2edd";
+ text = "cdd6f4ff";
+ match = "f38ba8ff";
+ selection = "585b70ff";
+ selection-match = "f38ba8ff";
+ selection-text = "cdd6f4ff";
+ border = "b4befeff";
+ };
+ };
+ };
+}
diff --git a/config/home-manager/window-manager/hyprland/default.nix b/config/home-manager/window-manager/hyprland/default.nix
index e33de8e7..ffc97e67 100644
--- a/config/home-manager/window-manager/hyprland/default.nix
+++ b/config/home-manager/window-manager/hyprland/default.nix
@@ -107,15 +107,14 @@ in
};
exec-once = [
- "ags -b hypr"
+ #"ags -b hypr"
#"dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP" # Fix long-time to start systemd: https://wiki.hyprland.org/FAQ/#some-of-my-apps-take-a-really-long-time-to-open
#"waybar"
"${lib.getExe pkgs.hyprpaper}"
"${lib.getExe pkgs.udiskie} --tray"
- "walker --gapplication-service"
"${pkgs.blueman}/bin/blueman-applet"
#"${pkgs.networkmanagerapplet}/bin/nm-applet --indicator"
];
};
};
-}
\ No newline at end of file
+}
diff --git a/config/home-manager/window-manager/kanshi.nix b/config/home-manager/window-manager/kanshi.nix
index 7b2ef89b..72ee6796 100644
--- a/config/home-manager/window-manager/kanshi.nix
+++ b/config/home-manager/window-manager/kanshi.nix
@@ -22,7 +22,7 @@ in
#home.packages = [ pkgs.kanshi ]; # needed to run `kanshictl switch`
services.kanshi = {
enable = true;
- systemdTarget = "hyprland-session.target";
+ systemdTarget = "graphical-session.target"; #"hyprland-session.target";
settings = [
{
profile.name = "laptop";
@@ -56,4 +56,4 @@ in
}
];
};
-}
\ No newline at end of file
+}
diff --git a/config/home-manager/window-manager/niri.nix b/config/home-manager/window-manager/niri.nix
index 0d5197ea..d5003f42 100644
--- a/config/home-manager/window-manager/niri.nix
+++ b/config/home-manager/window-manager/niri.nix
@@ -1,3 +1,376 @@
-{ config, lib, pkgs, ... }: {
+{ config, lib, pkgs, ... }:
+# Check custom scripts: https://github.com/iynaix/dotfiles/blob/fa261818c04e6b1aa7d928a10abd66e2c31c0ed9/packages/dotfiles-rs/dotfiles/src/bin/hypr-pip.rs
+# https://github.com/dileep-kishore/nixos-hyprland/blob/main/home/common/optional/desktops/hyprland/config.nix
+# https://github.com/JaKooLit/Hyprland-Dots/blob/main/config/hypr/configs/Keybinds.conf
-}
\ No newline at end of file
+# Force Quit active: https://github.com/JaKooLit/Hyprland-Dots/blob/main/config/hypr/configs/Keybinds.conf
+
+# Logout: https://github.com/wuliuqii/nixos-config/blob/69606b2e0cccb6a135522fc5df188e4da0595e73/home/wm/wlogout.nix
+
+# Consider going back to waybar: https://github.com/nix-community/nur-combined/blob/4d8b064e3cff836ee8c17c48c592874b0209e167/repos/slaier/modules/waybar/mediaplayer.nix
+
+# Sway idle: https://github.com/nyawox/nixboxes/blob/ecab4559da256b4f1198ca7d39d6e5b1d4442296/home/desktop/niri/swayidle.nix
+
+# Login
+# Greetd: https://github.com/linuxmobile/kaku/blob/13eb9e8a19823cb2fa2aed29f7b1f49bea51c4a2/system/services/greetd.nix#L5
+# https://github.com/linuxmobile/kaku/blob/13eb9e8a19823cb2fa2aed29f7b1f49bea51c4a2/system/services/gdm.nix
+# https://github.com/SergioRibera/dotfiles/blob/8e03a755e4e03b26722e6971effa4161c3efd0b6/hosts/common/services.nix#L45
+
+# Setting up auto start: https://github.com/kiike/dotfiles/blob/ff788bae02ba6d15c73632d99654269d2b5fba49/home/features/desktop/tiling/ags.nix
+
+# Battery? https://github.com/linuxmobile/kaku/blob/13eb9e8a19823cb2fa2aed29f7b1f49bea51c4a2/system/services/power.nix
+
+# Seems to be more or less what I want? https://github.com/kiike/dotfiles/blob/ff788bae02ba6d15c73632d99654269d2b5fba49/hosts/balrog/default.nix
+
+# Idle effect: https://github.com/nyawox/nixboxes/blob/ecab4559da256b4f1198ca7d39d6e5b1d4442296/home/desktop/niri/swayidle.nix#L24
+
+# TODO: Alt F4 means keep closing active window until there is none. Then, show list of options.
+let
+ wallpapersPkg = self.private.wallpapers.override {
+ selected = [ "lake-fishing-sunset" "mountains" "whale-sunset" "watch-tower" ];
+ };
+
+ env = {
+ QT_QPA_PLATFORM = "wayland";
+ DISPLAY = ":1";
+ NIXOS_OZONE_WL = "1";
+ XDG_CURRENT_DESKTOP = "niri";
+ XDG_SESSION_TYPE = "wayland";
+ MOZ_ENABLE_WAYLAND = "1";
+ QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
+ # GBM_BACKEND=nvidia-drm
+ # XDG_BACKEND=wayland
+ };
+
+ set-terminal = ''
+ ${pkgs.swww}/bin/swww img "${wallpapersPkg}/share/wallpapers/mountains.png" --transition-type random
+ '';
+
+ # If Share picker doesn’t use the system theme
+ # dbus-update-activation-environment --systemd --all
+ #systemctl --user import-environment QT_QPA_PLATFORMTHEME
+
+ # Ideas
+ # "Mod+Return".action = spawn "${config.profile.terminal}";
+ # "Mod+E".action = spawn "nautilus";
+ # "Mod+Escape".action = spawn "wlogout";
+/*
+ touchpad = {
+ tap = true;
+ dwt = true;
+ accel-profile = "adaptive";
+ accel-speed = 0.0;
+ click-method = "clickfinger";
+ natural-scroll = true;
+ scroll-method = "two-finger";
+ };
+*/
+# Window rules: https://github.com/nyawox/nixboxes/blob/ecab4559da256b4f1198ca7d39d6e5b1d4442296/home/desktop/niri/general.nix#L143
+# Env variables: https://github.com/nyawox/nixboxes/blob/ecab4559da256b4f1198ca7d39d6e5b1d4442296/home/desktop/niri/general.nix#L185
+
+# Funny login audio: https://github.com/nyawox/nixboxes/blob/ecab4559da256b4f1198ca7d39d6e5b1d4442296/home/desktop/niri/general.nix#L201
+in
+{
+ home.packages = with pkgs; [
+ swww
+ # pamixer ?
+ ];
+
+ services.gnome-keyring.enable = true;
+ systemd.user.services = {
+ swww = {
+ Unit = {
+ Description = "Efficient animated wallpaper daemon for wayland";
+ PartOf = [ "graphical-session.target" ];
+ After = [ "graphical-session.target" ];
+ };
+ Install.WantedBy = [ "graphical-session.target" ];
+ Service = {
+ Type = "simple";
+ ExecStart = ''${pkgs.swww}/bin/swww-daemon'';
+ ExecStop = "${pkgs.swww}/bin/swww kill";
+ Restart = "on-failure";
+ };
+ };
+ };
+
+ xdg.configFile."niri/config.kdl".text = ''
+ hotkey-overlay {
+ skip-at-startup
+ }
+
+ environment {
+ DISPLAY ":0"
+ XDG_CURRENT_DESKTOP = "niri";
+ QT_WAYLAND_DISABLE_WINDOWDECORATION "1"
+ QT_QPA_PLATFORM "wayland"
+ NIXOS_OZONE_WL "1"
+ MOZ_ENABLE_WAYLAND "1"
+ }
+
+ spawn-at-startup "xwayland-satellite" ":0"
+
+ input {
+ keyboard {
+ xkb {
+ layout "us,pt";
+ variant = "euro,";
+ options = "caps:ctrl_modifier"
+ }
+ }
+
+ touchpad {
+ tap
+ natural-scroll
+ }
+
+ mouse {
+ }
+
+ // Focus windows and outputs automatically when moving the mouse into them.
+ // Setting max-scroll-amount="0%" makes it work only on windows already fully on screen.
+ // focus-follows-mouse max-scroll-amount="0%"
+ }
+
+ output "eDP-1" {
+ mode "2880x1800@143.91Hz"
+ scale 1.5
+ }
+
+ layout {
+ gaps 8
+
+ // When to center a column when changing focus, options are:
+ // - "never", default behavior, focusing an off-screen column will keep at the left
+ // or right edge of the screen.
+ // - "always", the focused column will always be centered.
+ // - "on-overflow", focusing a column will center it if it doesn't fit
+ // together with the previously focused column.
+ center-focused-column "never"
+
+ preset-column-widths {
+ proportion 0.33333
+ proportion 0.5
+ proportion 0.66667
+ }
+ // preset-window-heights { }
+
+ default-column-width { proportion 0.5; }
+ // default-column-width {}
+
+ // By default focus ring and border are rendered as a solid background rectangle
+ // behind windows. That is, they will show up through semitransparent windows.
+ // This is because windows using client-side decorations can have an arbitrary shape.
+ //
+ // If you don't like that, you should uncomment `prefer-no-csd` below.
+ // Niri will draw focus ring and border *around* windows that agree to omit their
+ // client-side decorations.
+ //
+ // Alternatively, you can override it with a window rule called
+ // `draw-border-with-background`.
+
+ // You can change how the focus ring looks.
+ focus-ring {
+ // How many logical pixels the ring extends out from the windows.
+ width 4
+ active-color "#7fc8ff"
+ inactive-color "#505050"
+ }
+
+ border {
+ off
+ }
+ }
+
+ prefer-no-csd
+
+ // You can change the path where screenshots are saved.
+ // A ~ at the front will be expanded to the home directory.
+ // The path is formatted with strftime(3) to give you the screenshot date and time.
+ screenshot-path "~/Pictures/Screenshots/Screenshot from %Y-%m-%d %H-%M-%S.png"
+
+ animations {
+ }
+
+ binds {
+ // Basic
+ Mod+Q { close-window; }
+ Mod+Shift+Slash { show-hotkey-overlay; }
+ Mod+F { maximize-column; }
+ Mod+Shift+F { fullscreen-window; }
+ Mod+C { center-column; }
+
+
+
+ // Suggested binds for running programs: terminal, app launcher, screen locker.
+ Mod+T { spawn "konsole"; }
+ Mod+Space { spawn "fuzzel"; }
+ Super+Alt+L { spawn "swaylock"; }
+
+
+ // Audio
+ XF86AudioRaiseVolume allow-when-locked=true { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1+"; }
+ XF86AudioLowerVolume allow-when-locked=true { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1-"; }
+ XF86AudioMute allow-when-locked=true { spawn "wpctl" "set-mute" "@DEFAULT_AUDIO_SINK@" "toggle"; }
+ XF86AudioMicMute allow-when-locked=true { spawn "wpctl" "set-mute" "@DEFAULT_AUDIO_SOURCE@" "toggle"; }
+ XF86AudioNext allow-when-locked=true { spawn "playerctl" "next"; }
+ XF86AudioPause allow-when-locked=true { spawn "playerctl" "play-pause"; }
+ XF86AudioPlay allow-when-locked=true { spawn "playerctl" "play-pause"; }
+ XF86AudioPrev allow-when-locked=true { spawn "playerctl" "previous"; }
+
+ // Brightness
+ XF86MonBrightnessUp allow-when-locked=true { spawn "brightnessctl" "s" "10%+"; }
+ XF86MonBrightnessDown allow-when-locked=true { spawn "brightnessctl" "s" "10%-"; }
+
+
+ Mod+Left { focus-column-left; }
+ Mod+Down { focus-window-down; }
+ Mod+Up { focus-window-up; }
+ Mod+Right { focus-column-right; }
+ Mod+H { focus-column-left; }
+ Mod+J { focus-window-down; }
+ Mod+K { focus-window-up; }
+ Mod+L { focus-column-right; }
+
+ Mod+Ctrl+Left { move-column-left; }
+ Mod+Ctrl+Down { move-window-down; }
+ Mod+Ctrl+Up { move-window-up; }
+ Mod+Ctrl+Right { move-column-right; }
+ Mod+Ctrl+H { move-column-left; }
+ Mod+Ctrl+J { move-window-down; }
+ Mod+Ctrl+K { move-window-up; }
+ Mod+Ctrl+L { move-column-right; }
+
+ // Alternative commands that move across workspaces when reaching
+ // the first or last window in a column.
+ // Mod+J { focus-window-or-workspace-down; }
+ // Mod+K { focus-window-or-workspace-up; }
+ // Mod+Ctrl+J { move-window-down-or-to-workspace-down; }
+ // Mod+Ctrl+K { move-window-up-or-to-workspace-up; }
+
+ Mod+Home { focus-column-first; }
+ Mod+End { focus-column-last; }
+ Mod+Ctrl+Home { move-column-to-first; }
+ Mod+Ctrl+End { move-column-to-last; }
+
+ Mod+Shift+Left { focus-monitor-left; }
+ Mod+Shift+Down { focus-monitor-down; }
+ Mod+Shift+Up { focus-monitor-up; }
+ Mod+Shift+Right { focus-monitor-right; }
+ Mod+Shift+H { focus-monitor-left; }
+ Mod+Shift+J { focus-monitor-down; }
+ Mod+Shift+K { focus-monitor-up; }
+ Mod+Shift+L { focus-monitor-right; }
+
+ Mod+Shift+Ctrl+Left { move-column-to-monitor-left; }
+ Mod+Shift+Ctrl+Down { move-column-to-monitor-down; }
+ Mod+Shift+Ctrl+Up { move-column-to-monitor-up; }
+ Mod+Shift+Ctrl+Right { move-column-to-monitor-right; }
+ Mod+Shift+Ctrl+H { move-column-to-monitor-left; }
+ Mod+Shift+Ctrl+J { move-column-to-monitor-down; }
+ Mod+Shift+Ctrl+K { move-column-to-monitor-up; }
+ Mod+Shift+Ctrl+L { move-column-to-monitor-right; }
+
+ Mod+Page_Down { focus-workspace-down; }
+ Mod+Page_Up { focus-workspace-up; }
+ Mod+U { focus-workspace-down; }
+ Mod+I { focus-workspace-up; }
+ Mod+Ctrl+Page_Down { move-column-to-workspace-down; }
+ Mod+Ctrl+Page_Up { move-column-to-workspace-up; }
+ Mod+Ctrl+U { move-column-to-workspace-down; }
+ Mod+Ctrl+I { move-column-to-workspace-up; }
+
+ Mod+Shift+Page_Down { move-workspace-down; }
+ Mod+Shift+Page_Up { move-workspace-up; }
+ Mod+Shift+U { move-workspace-down; }
+ Mod+Shift+I { move-workspace-up; }
+
+ Mod+WheelScrollDown cooldown-ms=150 { focus-workspace-down; }
+ Mod+WheelScrollUp cooldown-ms=150 { focus-workspace-up; }
+ Mod+Ctrl+WheelScrollDown cooldown-ms=150 { move-column-to-workspace-down; }
+ Mod+Ctrl+WheelScrollUp cooldown-ms=150 { move-column-to-workspace-up; }
+
+ Mod+WheelScrollRight { focus-column-right; }
+ Mod+WheelScrollLeft { focus-column-left; }
+ Mod+Ctrl+WheelScrollRight { move-column-right; }
+ Mod+Ctrl+WheelScrollLeft { move-column-left; }
+
+ // Usually scrolling up and down with Shift in applications results in
+ // horizontal scrolling; these binds replicate that.
+ Mod+Shift+WheelScrollDown { focus-column-right; }
+ Mod+Shift+WheelScrollUp { focus-column-left; }
+ Mod+Ctrl+Shift+WheelScrollDown { move-column-right; }
+ Mod+Ctrl+Shift+WheelScrollUp { move-column-left; }
+
+ Mod+1 { focus-workspace 1; }
+ Mod+2 { focus-workspace 2; }
+ Mod+3 { focus-workspace 3; }
+ Mod+4 { focus-workspace 4; }
+ Mod+5 { focus-workspace 5; }
+ Mod+6 { focus-workspace 6; }
+ Mod+7 { focus-workspace 7; }
+ Mod+8 { focus-workspace 8; }
+ Mod+9 { focus-workspace 9; }
+ Mod+Ctrl+1 { move-column-to-workspace 1; }
+ Mod+Ctrl+2 { move-column-to-workspace 2; }
+ Mod+Ctrl+3 { move-column-to-workspace 3; }
+ Mod+Ctrl+4 { move-column-to-workspace 4; }
+ Mod+Ctrl+5 { move-column-to-workspace 5; }
+ Mod+Ctrl+6 { move-column-to-workspace 6; }
+ Mod+Ctrl+7 { move-column-to-workspace 7; }
+ Mod+Ctrl+8 { move-column-to-workspace 8; }
+ Mod+Ctrl+9 { move-column-to-workspace 9; }
+
+ // Alternatively, there are commands to move just a single window:
+ // Mod+Ctrl+1 { move-window-to-workspace 1; }
+
+ // Switches focus between the current and the previous workspace.
+ Mod+Tab { focus-workspace-previous; }
+
+ Mod+Comma { consume-window-into-column; }
+ Mod+Period { expel-window-from-column; }
+
+ // There are also commands that consume or expel a single window to the side.
+ Mod+BracketLeft { consume-or-expel-window-left; }
+ Mod+BracketRight { consume-or-expel-window-right; }
+
+ Mod+R { switch-preset-column-width; }
+ Mod+Shift+R { switch-preset-window-height; }
+ Mod+Ctrl+R { reset-window-height; }
+
+ // Finer width adjustments.
+ // This command can also:
+ // * set width in pixels: "1000"
+ // * adjust width in pixels: "-5" or "+5"
+ // * set width as a percentage of screen width: "25%"
+ // * adjust width as a percentage of screen width: "-10%" or "+10%"
+ // Pixel sizes use logical, or scaled, pixels. I.e. on an output with scale 2.0,
+ // set-column-width "100" will make the column occupy 200 physical screen pixels.
+ Mod+Minus { set-column-width "-10%"; }
+ Mod+Equal { set-column-width "+10%"; }
+
+ // Finer height adjustments when in column with other windows.
+ Mod+Shift+Minus { set-window-height "-10%"; }
+ Mod+Shift+Equal { set-window-height "+10%"; }
+
+ // Actions to switch layouts.
+ // Note: if you uncomment these, make sure you do NOT have
+ // a matching layout switch hotkey configured in xkb options above.
+ // Having both at once on the same hotkey will break the switching,
+ // since it will switch twice upon pressing the hotkey (once by xkb, once by niri).
+ // Mod+Space { switch-layout "next"; }
+ // Mod+Shift+Space { switch-layout "prev"; }
+
+ Print { screenshot; }
+ Ctrl+Print { screenshot-screen; }
+ Alt+Print { screenshot-window; }
+
+ // The quit action will show a confirmation dialog to avoid accidental exits.
+ Mod+Shift+E { quit; }
+
+ // Powers off the monitors. To turn them back on, do any input like
+ // moving the mouse or pressing any other key.
+ Mod+Shift+P { power-off-monitors; }
+ }
+ '';
+}
diff --git a/config/home-manager/window-manager/wofi.nix b/config/home-manager/window-manager/wofi.nix
deleted file mode 100644
index d42239e3..00000000
--- a/config/home-manager/window-manager/wofi.nix
+++ /dev/null
@@ -1,75 +0,0 @@
-{ config, lib, pkgs, ... }:
-# TODO alternative: https://github.com/abenz1267/walker
-
-
-let
- font = {
- variable = "Hack Nerd Font Mono";
- };
- colorScheme = {
- palette = {
- base00 = "#000000";
- base01 = "#100323";
- base02 = "#3C3C3C";
- base03 = "#595959";
- base04 = "#BEBCBF";
- base05 = "#FFFFFF";
- base06 = "#EDEAEF";
- base07 = "#FFFFFF";
- base08 = "#FF8059";
- base09 = "#EF8B50";
- base0A = "#D0BC00";
- base0B = "#44BC44";
- base0C = "#00D3D0";
- base0D = "#2FAFFF";
- base0E = "#FEACD0";
- base0F = "#B6A0FF";
- };
- };
-in
-{
- programs.wofi = {
- enable = pkgs.stdenv.isLinux;
- settings = {
- width = 800;
- height = 400;
- insensitive = true;
- mode = "drun,run";
- };
-
- style = ''
- window {
- border: 2px solid #${colorScheme.palette.base03};
- background-color: #${colorScheme.palette.base00};
- }
-
- #input {
- color: #${colorScheme.palette.base09};
- border: 2px solid #${colorScheme.palette.base03};
- background-color: #${colorScheme.palette.base00};
- font-size: 13px;
- font-family: ${font.variable};
- }
-
- #outer-box {
- margin: 10px;
- }
-
- #scroll {
- margin: 5px 0px;
- font-size: 13px;
- font-family: ${font.variable};
- color: #${colorScheme.palette.base06};
- }
-
- #scroll label {
- margin: 2px 0px;
- }
-
- #entry:selected {
- color: #${colorScheme.palette.base06};
- background-color: #${colorScheme.palette.base00};
- }
- '';
- };
-}
diff --git a/config/nixos/default.nix b/config/nixos/default.nix
index 4c78cd13..af1904c7 100644
--- a/config/nixos/default.nix
+++ b/config/nixos/default.nix
@@ -1,6 +1,9 @@
{ pkgs, lib, network-devices, ... }:
{
imports = [
+ ./programs.nix
+ ./services.nix
+ ./display-manager.nix
./wayland.nix
./thunar.nix
];
@@ -19,6 +22,7 @@
# Not enabling useTmpfs despite having enough RAM. Might consider it.
boot.tmp.cleanOnBoot = true;
+ # Audio
hardware.pulseaudio.enable = false; # Disable PulseAudio: https://nixos.wiki/wiki/PulseAudio
security.rtkit.enable = true; # Recommended for pipewire
services.pipewire = {
@@ -39,22 +43,6 @@
'';
};
- # Programs
- programs.fish.enable = true; # System level/
- programs.fish.vendor.functions.enable = true; # Ensure completions/functions are automatically set.
- programs.partition-manager.enable = true;
- environment.systemPackages = with pkgs; [
- # Suport exFAT and NTFS formatted drives (pendisks + external disks)
- exfat
- ntfs3g
-
- powertop # Check what is consuming too much energy
- usbutils # USB utilities
- ];
-
- # Services
- services.fwupd.enable = true; # Updates firmwares: `fwupdmgr`
-
# Localization
time.timeZone = "Europe/Lisbon";
i18n = {
@@ -72,18 +60,5 @@
};
};
- services.journald.extraConfig = ''
- MaxRetentionSec=1month
- SystemMaxUse=1G
- '';
-
security.sudo.extraConfig = "Defaults lecture=never";
-
- # To install or run some programs, it is easier to this way. The exception.
- # Follow with: flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
- services.flatpak.enable = true;
-
- # Disabling some defaults
- programs.command-not-found.enable = false;
- programs.nano.enable = false;
}
diff --git a/config/nixos/display-manager.nix b/config/nixos/display-manager.nix
index 1147ce49..f06a96ba 100644
--- a/config/nixos/display-manager.nix
+++ b/config/nixos/display-manager.nix
@@ -1,4 +1,26 @@
-{ ... }:
+{ pkgs, self, ... }:
+let
+ wallpapers = self.private.wallpapers.override {
+ selected = [ "lake-fishing-sunset" "mountains" "whale-sunset" "watch-tower" ];
+ };
+in
{
-
-}
\ No newline at end of file
+ # Login Screen
+ services.displayManager.sddm = {
+ enable = true;
+ wayland.enable = true;
+ theme = "sddm-astronaut-theme";
+ };
+ environment.systemPackages = [
+ # https://github.com/Keyitdev/sddm-astronaut-theme/blob/master/theme.conf
+ # It is possible to override the package and set themeConfig. For now, I will iterate like this.
+ pkgs.sddm-astronaut
+ (pkgs.writeTextDir "share/sddm/themes/sddm-astronaut-theme/theme.conf.user" ''
+ [General]
+ background=${wallpapers}/share/wallpapers/watch-tower.png
+ FullBlur="false"
+ PartialBlur="false"
+ FormPosition="center"
+ '')
+ ];
+}
diff --git a/config/nixos/programs.nix b/config/nixos/programs.nix
new file mode 100644
index 00000000..098215a7
--- /dev/null
+++ b/config/nixos/programs.nix
@@ -0,0 +1,24 @@
+{ pkgs, ... }:
+{
+ # Programs
+ programs = {
+ fish = {
+ enable = true; # System level.
+ vendor.functions.enable = true; # Ensure completions/functions are automatically set.
+ };
+ partition-manager.enable = true;
+
+ # Disabling some defaults
+ command-not-found.enable = false;
+ nano.enable = false;
+ };
+
+ environment.systemPackages = with pkgs; [
+ # Suport exFAT and NTFS formatted drives (pendisks + external disks)
+ exfat
+ ntfs3g
+
+ powertop # Check what is consuming too much energy
+ usbutils # USB utilities
+ ];
+}
diff --git a/config/nixos/services.nix b/config/nixos/services.nix
new file mode 100644
index 00000000..0a748893
--- /dev/null
+++ b/config/nixos/services.nix
@@ -0,0 +1,12 @@
+{ pkgs, ... }:
+{
+ services.fwupd.enable = true; # Updates firmwares: `fwupdmgr`
+
+ # To install or run some programs, it is easier to this way.
+ # Follow with: flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
+ services.flatpak.enable = true;
+ services.journald.extraConfig = ''
+ MaxRetentionSec=1month
+ SystemMaxUse=1G
+ '';
+}
diff --git a/config/nixos/thunar.nix b/config/nixos/thunar.nix
index 2e1c26cc..8a74fd55 100644
--- a/config/nixos/thunar.nix
+++ b/config/nixos/thunar.nix
@@ -10,8 +10,8 @@
];
};
- programs.xfconf.enable = true; # Required to persist Thunar settings as we're not running on XFCE
+ programs.xfconf.enable = true; # Required to persist Thunar settings as we're not running on XFCE
services.gvfs.enable = true; # Mount, trash, and other functionalities
services.tumbler.enable = true; # Thumbnail support for images
programs.file-roller.enable = true; # For thunar-archive-plugin
-}
\ No newline at end of file
+}
diff --git a/config/nixos/wayland.nix b/config/nixos/wayland.nix
index 11ce3942..cab89b43 100644
--- a/config/nixos/wayland.nix
+++ b/config/nixos/wayland.nix
@@ -6,28 +6,27 @@
programs.niri.enable = true;
security.pam.services.swaylock = {};
services.gnome.gnome-keyring.enable = true;
- programs.xwayland.enable = true;
xdg.portal = {
enable = true;
extraPortals = [
- pkgs.xdg-desktop-portal-gnome
- ]; # Required for screencasting/*/
+ pkgs.xdg-desktop-portal-gnome # Required for screencasting
+ ];
};
+ programs.nm-applet.enable = true; # Network manager applet
programs.hyprland.enable = true; # Automates several dependencies. Home-Manager sets custom configuration.
# Other
- programs.nm-applet.enable = true;
-
# TODO: https://github.com/Aylur/dotfiles/blob/main/nixos/system.nix#L44
environment.systemPackages = with pkgs; [
- # Core - Hardware
- brightnessctl # Manage Brightness
-
- # Core - Software
+ # Core - Dependencies
qt5.qtwayland
qt6.qtwayland
- qt6ct
+ inotify-tools
+ libnotify
+
+ # Hardware
+ brightnessctl # Manage Brightness
xwayland-satellite # X11. See: https://github.com/YaLTeR/niri/wiki/Xwayland
nautilus # File Browser
diff --git a/hosts/laptop/config.nix b/hosts/laptop/config.nix
index 6b4646e3..669b6c5f 100644
--- a/hosts/laptop/config.nix
+++ b/hosts/laptop/config.nix
@@ -1,9 +1,4 @@
{ config, pkgs, lib, self, ... }:
-let
- wallpapers = self.private.wallpapers.override {
- selected = [ "lake-fishing-sunset" "mountains" "whale-sunset" "watch-tower" ];
- };
-in
{
imports = [
./hardware # CPU, graphics, peripherals, etc
@@ -15,7 +10,6 @@ in
];
networking.hostName = "bphenriques-laptop";
- networking.interfaces.lo.wakeOnLan.enable = true;
# Boot: See what it is taking most time: `systemd-analyze critical-chain`
boot = {
@@ -52,30 +46,8 @@ in
theme = "angular";
};
- # Desktop environment
- # services.xserver.enable = true;
- #services.desktopManager.plasma6.enable = true;
- #services.displayManager.defaultSession = "plasma";
- #environment.plasma6.excludePackages = with pkgs.kdePackages; [ elisa plasma-browser-integration ];
-
# Login Screen
- services.displayManager.sddm = {
- enable = true;
- wayland.enable = true;
- theme = "sddm-astronaut-theme";
- };
environment.systemPackages = [
- # https://github.com/Keyitdev/sddm-astronaut-theme/blob/master/theme.conf
- # It is possible to override the package and set themeConfig. For now, I will iterate like this.
- pkgs.sddm-astronaut
- (pkgs.writeTextDir "share/sddm/themes/sddm-astronaut-theme/theme.conf.user" ''
- [General]
- background=${wallpapers}/share/wallpapers/watch-tower.png
- FullBlur="false"
- PartialBlur="false"
- FormPosition="center"
- '')
-
(pkgs.writeScriptBin "reboot-to-windows" ''
#!${pkgs.stdenv.shell}
sudo grub-reboot "Windows 11" && reboot $@
diff --git a/hosts/laptop/default.nix b/hosts/laptop/default.nix
index 3ddbd8e7..b4fc611b 100644
--- a/hosts/laptop/default.nix
+++ b/hosts/laptop/default.nix
@@ -15,8 +15,20 @@ in mylib.hosts.mkNixOSHost {
inherit nixosModules hmModules overlays;
extraSpecialArgs = {
inherit inputs;
- host.webcam = "/dev/video0";
+ host.webcam = "/dev/video0"; # FIXME: This only needed once, let's move mvp to a module and make this a parameter.
network-devices = import ../network-devices.nix;
+ monitors = {
+ "eDP-1" = {
+ description = "built-in";
+ mode = "2880x1800@143.91Hz";
+ scale = 1.5;
+ };
+ "Dell Inc. DELL S2721DGF 4P11R83" = {
+ description = "Office Monitor";
+ mode = "2560x1440@120.00Hz";
+ scale = 1.0;
+ };
+ };
};
hostModule = ./config.nix;
}
diff --git a/hosts/peripherals.nix b/hosts/peripherals.nix
deleted file mode 100644
index 88f5ad97..00000000
--- a/hosts/peripherals.nix
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- monitors = {
- office-monitor = {
- criteria = "Dell Inc. DELL S2721DGF 4P11R83";
- mode = "2560x1440@120.00Hz";
- scale = 1.0;
- };
- };
-}
From e2eac3a5d3d62d5433a7bd2b7e32524af2f4947d Mon Sep 17 00:00:00 2001
From: Bruno Henriques <4727729+bphenriques@users.noreply.github.com>
Date: Fri, 22 Nov 2024 13:06:07 +0000
Subject: [PATCH 07/34] WIP
---
config/home-manager/window-manager/niri.nix | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/config/home-manager/window-manager/niri.nix b/config/home-manager/window-manager/niri.nix
index d5003f42..aed656b7 100644
--- a/config/home-manager/window-manager/niri.nix
+++ b/config/home-manager/window-manager/niri.nix
@@ -1,4 +1,4 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, pkgs, self, ... }:
# Check custom scripts: https://github.com/iynaix/dotfiles/blob/fa261818c04e6b1aa7d928a10abd66e2c31c0ed9/packages/dotfiles-rs/dotfiles/src/bin/hypr-pip.rs
# https://github.com/dileep-kishore/nixos-hyprland/blob/main/home/common/optional/desktops/hyprland/config.nix
# https://github.com/JaKooLit/Hyprland-Dots/blob/main/config/hypr/configs/Keybinds.conf
From 14ae635a179e546e1cf97f754ae18b3bbbb39f62 Mon Sep 17 00:00:00 2001
From: Bruno Henriques <4727729+bphenriques@users.noreply.github.com>
Date: Fri, 22 Nov 2024 13:08:27 +0000
Subject: [PATCH 08/34] WIP
---
config/home-manager/window-manager/default.nix | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/config/home-manager/window-manager/default.nix b/config/home-manager/window-manager/default.nix
index 0b2af252..fcc18c0b 100644
--- a/config/home-manager/window-manager/default.nix
+++ b/config/home-manager/window-manager/default.nix
@@ -66,7 +66,8 @@ in
# Double check what this does exactly
qt = {
enable = true;
- platformTheme = "gnome";
- style = "adw-gtk3-dark";
+ package = pkgs.adwaita-qt;
+ style.name = "adwaita-dark";
+ platformTheme.name = "adwaita";
};
}
From 1366e73d7bd10a630f7fc047d5e788c3a101eecd Mon Sep 17 00:00:00 2001
From: Bruno Henriques <4727729+bphenriques@users.noreply.github.com>
Date: Fri, 22 Nov 2024 13:09:37 +0000
Subject: [PATCH 09/34] WIP
---
config/home-manager/window-manager/default.nix | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/config/home-manager/window-manager/default.nix b/config/home-manager/window-manager/default.nix
index fcc18c0b..75c78f33 100644
--- a/config/home-manager/window-manager/default.nix
+++ b/config/home-manager/window-manager/default.nix
@@ -67,7 +67,9 @@ in
qt = {
enable = true;
package = pkgs.adwaita-qt;
- style.name = "adwaita-dark";
+ style = {
+ name = "adwaita-dark";
+ };
platformTheme.name = "adwaita";
};
}
From 5d8e2ea9204596bb10c9e315bb495191faf6eac9 Mon Sep 17 00:00:00 2001
From: Bruno Henriques <4727729+bphenriques@users.noreply.github.com>
Date: Fri, 22 Nov 2024 13:10:44 +0000
Subject: [PATCH 10/34] WIP
---
config/home-manager/window-manager/default.nix | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/config/home-manager/window-manager/default.nix b/config/home-manager/window-manager/default.nix
index 75c78f33..1f799c10 100644
--- a/config/home-manager/window-manager/default.nix
+++ b/config/home-manager/window-manager/default.nix
@@ -66,10 +66,8 @@ in
# Double check what this does exactly
qt = {
enable = true;
- package = pkgs.adwaita-qt;
- style = {
- name = "adwaita-dark";
- };
- platformTheme.name = "adwaita";
+ style.name = "adwaita-dark";
+ style.package = pkgs.adwaita-qt;
+ # platformTheme.name = "adwaita";
};
}
From f5f8845732549c2c033911ea59ac83075113f793 Mon Sep 17 00:00:00 2001
From: Bruno Henriques <4727729+bphenriques@users.noreply.github.com>
Date: Fri, 22 Nov 2024 13:12:52 +0000
Subject: [PATCH 11/34] WIP
---
config/home-manager/window-manager/default.nix | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/config/home-manager/window-manager/default.nix b/config/home-manager/window-manager/default.nix
index 1f799c10..8e60d01a 100644
--- a/config/home-manager/window-manager/default.nix
+++ b/config/home-manager/window-manager/default.nix
@@ -68,6 +68,6 @@ in
enable = true;
style.name = "adwaita-dark";
style.package = pkgs.adwaita-qt;
- # platformTheme.name = "adwaita";
+ platformTheme.name = "adwaita-dark";
};
}
From 1544ea18775b8bf946cda2250b0a039563cbf8d2 Mon Sep 17 00:00:00 2001
From: Bruno Henriques <4727729+bphenriques@users.noreply.github.com>
Date: Fri, 22 Nov 2024 13:14:36 +0000
Subject: [PATCH 12/34] WIP
---
config/nixos/wayland.nix | 1 +
1 file changed, 1 insertion(+)
diff --git a/config/nixos/wayland.nix b/config/nixos/wayland.nix
index cab89b43..cf96f4df 100644
--- a/config/nixos/wayland.nix
+++ b/config/nixos/wayland.nix
@@ -13,6 +13,7 @@
];
};
programs.nm-applet.enable = true; # Network manager applet
+ programs.xwayland.enable = true;
programs.hyprland.enable = true; # Automates several dependencies. Home-Manager sets custom configuration.
From a3194a3648c63f8e8baaba80e6f291e06d219147 Mon Sep 17 00:00:00 2001
From: Bruno Henriques <4727729+bphenriques@users.noreply.github.com>
Date: Fri, 22 Nov 2024 13:47:23 +0000
Subject: [PATCH 13/34] fixes
---
config/home-manager/window-manager/niri.nix | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/config/home-manager/window-manager/niri.nix b/config/home-manager/window-manager/niri.nix
index aed656b7..6918f012 100644
--- a/config/home-manager/window-manager/niri.nix
+++ b/config/home-manager/window-manager/niri.nix
@@ -101,7 +101,7 @@ in
environment {
DISPLAY ":0"
- XDG_CURRENT_DESKTOP = "niri";
+ XDG_CURRENT_DESKTOP "niri"
QT_WAYLAND_DISABLE_WINDOWDECORATION "1"
QT_QPA_PLATFORM "wayland"
NIXOS_OZONE_WL "1"
@@ -114,8 +114,8 @@ in
keyboard {
xkb {
layout "us,pt";
- variant = "euro,";
- options = "caps:ctrl_modifier"
+ variant "euro,";
+ options "caps:ctrl_modifier"
}
}
@@ -133,8 +133,8 @@ in
}
output "eDP-1" {
- mode "2880x1800@143.91Hz"
- scale 1.5
+ mode "2880x1800@120.001"
+ scale 1.75
}
layout {
From 423b6af37c3a3f91d05ceda97d25152aadf729c5 Mon Sep 17 00:00:00 2001
From: Bruno Henriques <4727729+bphenriques@users.noreply.github.com>
Date: Fri, 22 Nov 2024 14:16:42 +0000
Subject: [PATCH 14/34] Updates
---
config/home-manager/window-manager/niri.nix | 13 ++++++-------
config/nixos/default.nix | 3 +++
config/nixos/nautilus.nix | 9 +++++++++
config/nixos/wayland.nix | 1 -
4 files changed, 18 insertions(+), 8 deletions(-)
create mode 100644 config/nixos/nautilus.nix
diff --git a/config/home-manager/window-manager/niri.nix b/config/home-manager/window-manager/niri.nix
index 6918f012..6eae8522 100644
--- a/config/home-manager/window-manager/niri.nix
+++ b/config/home-manager/window-manager/niri.nix
@@ -96,11 +96,11 @@ in
xdg.configFile."niri/config.kdl".text = ''
hotkey-overlay {
- skip-at-startup
+ skip-at-startup
}
environment {
- DISPLAY ":0"
+ DISPLAY ":21"
XDG_CURRENT_DESKTOP "niri"
QT_WAYLAND_DISABLE_WINDOWDECORATION "1"
QT_QPA_PLATFORM "wayland"
@@ -108,7 +108,8 @@ in
MOZ_ENABLE_WAYLAND "1"
}
- spawn-at-startup "xwayland-satellite" ":0"
+ spawn-at-startup "${pkgs.swww}/bin/swww" "img" "${wallpapersPkg}/share/wallpapers/mountains.png" "--transition-type" "random"
+ spawn-at-startup "xwayland-satellite" ":21"
input {
keyboard {
@@ -172,7 +173,7 @@ in
// You can change how the focus ring looks.
focus-ring {
// How many logical pixels the ring extends out from the windows.
- width 4
+ width 2
active-color "#7fc8ff"
inactive-color "#505050"
}
@@ -200,14 +201,12 @@ in
Mod+Shift+F { fullscreen-window; }
Mod+C { center-column; }
-
-
// Suggested binds for running programs: terminal, app launcher, screen locker.
+ Mod+Return { spawn "konsole"; }
Mod+T { spawn "konsole"; }
Mod+Space { spawn "fuzzel"; }
Super+Alt+L { spawn "swaylock"; }
-
// Audio
XF86AudioRaiseVolume allow-when-locked=true { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1+"; }
XF86AudioLowerVolume allow-when-locked=true { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1-"; }
diff --git a/config/nixos/default.nix b/config/nixos/default.nix
index af1904c7..3c2cd7af 100644
--- a/config/nixos/default.nix
+++ b/config/nixos/default.nix
@@ -5,7 +5,10 @@
./services.nix
./display-manager.nix
./wayland.nix
+
+ # Choose one file browser
./thunar.nix
+ ./nautilus.nix
];
nix = {
diff --git a/config/nixos/nautilus.nix b/config/nixos/nautilus.nix
new file mode 100644
index 00000000..dca35593
--- /dev/null
+++ b/config/nixos/nautilus.nix
@@ -0,0 +1,9 @@
+{ pkgs, ... }:
+{
+ environment.systemPackages = [
+ pkgs.nautilus # File Browser
+ pkgs.gnome.sushi # thumbnails in nautilus
+ ];
+
+ services.gvfs.enable = true; # Mount, trash, and other functionalities
+}
diff --git a/config/nixos/wayland.nix b/config/nixos/wayland.nix
index cf96f4df..3ba462f6 100644
--- a/config/nixos/wayland.nix
+++ b/config/nixos/wayland.nix
@@ -30,7 +30,6 @@
brightnessctl # Manage Brightness
xwayland-satellite # X11. See: https://github.com/YaLTeR/niri/wiki/Xwayland
- nautilus # File Browser
konsole # Backup terminal in case something goes wrong
ark # KDE package: Manage compressed files
From b65729585c75ab2387d8f1e3f679de388bcebeda Mon Sep 17 00:00:00 2001
From: Bruno Henriques <4727729+bphenriques@users.noreply.github.com>
Date: Fri, 22 Nov 2024 14:41:03 +0000
Subject: [PATCH 15/34] Disable hyprland in favor of niri
---
.../home-manager/window-manager/default.nix | 1 -
.../hyprland/scripts/wofi-kanshi-profile.sh | 0
.../hyprland/scripts/wofi-session.sh | 34 -------------------
config/home-manager/window-manager/niri.nix | 4 +--
config/nixos/nautilus.nix | 4 +--
config/nixos/programs.nix | 4 +++
config/nixos/wayland.nix | 3 --
flake.nix | 2 --
8 files changed, 8 insertions(+), 44 deletions(-)
delete mode 100644 config/home-manager/window-manager/hyprland/scripts/wofi-kanshi-profile.sh
delete mode 100644 config/home-manager/window-manager/hyprland/scripts/wofi-session.sh
diff --git a/config/home-manager/window-manager/default.nix b/config/home-manager/window-manager/default.nix
index 8e60d01a..7dca0273 100644
--- a/config/home-manager/window-manager/default.nix
+++ b/config/home-manager/window-manager/default.nix
@@ -14,7 +14,6 @@ in
{
# https://github.com/prasanthrangan/hyprdots?tab=readme-ov-file
imports = [
- ./hyprland # Window Manager
./niri.nix # Window Manager
./kanshi.nix # Manage external monitors
diff --git a/config/home-manager/window-manager/hyprland/scripts/wofi-kanshi-profile.sh b/config/home-manager/window-manager/hyprland/scripts/wofi-kanshi-profile.sh
deleted file mode 100644
index e69de29b..00000000
diff --git a/config/home-manager/window-manager/hyprland/scripts/wofi-session.sh b/config/home-manager/window-manager/hyprland/scripts/wofi-session.sh
deleted file mode 100644
index b5c5f4e8..00000000
--- a/config/home-manager/window-manager/hyprland/scripts/wofi-session.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/bash
-
-# options to be displayed
-option0="lock"
-option1="logout"
-option2="suspend"
-option3="scheduled suspend (10min)"
-option4="scheduled suspend (20min)"
-option5="scheduled suspend (30min)"
-option6="reboot"
-option7="shutdown"
-
-# options passed into variable
-options="$option0\n$option1\n$option2\n$option3\n$option4\n$option5\n$option6\n$option7"
-
-chosen="$(echo -e "$options" | wofi -lines 8 -dmenu -p "power")"
-case $chosen in
- $option0)
- i3lock;;
- $option1)
- i3-msg exit;;
- $option2)
- systemctl suspend;;
- $option3)
- sleep 600 && systemctl suspend;;
- $option4)
- sleep 1200 && systemctl suspend;;
- $option5)
- sleep 1800 && systemctl suspend;;
- $option6)
- systemctl reboot;;
- $option7)
- systemctl poweroff;;
-esac
\ No newline at end of file
diff --git a/config/home-manager/window-manager/niri.nix b/config/home-manager/window-manager/niri.nix
index 6eae8522..61b21566 100644
--- a/config/home-manager/window-manager/niri.nix
+++ b/config/home-manager/window-manager/niri.nix
@@ -43,7 +43,7 @@ let
};
set-terminal = ''
- ${pkgs.swww}/bin/swww img "${wallpapersPkg}/share/wallpapers/mountains.png" --transition-type random
+ ${pkgs.swww}/bin/swww img "${wallpapersPkg}/share/wallpapers/mountains.png"
'';
# If Share picker doesn’t use the system theme
@@ -108,7 +108,7 @@ in
MOZ_ENABLE_WAYLAND "1"
}
- spawn-at-startup "${pkgs.swww}/bin/swww" "img" "${wallpapersPkg}/share/wallpapers/mountains.png" "--transition-type" "random"
+ spawn-at-startup "${pkgs.swww}/bin/swww" "img" "${wallpapersPkg}/share/wallpapers/mountains.png"
spawn-at-startup "xwayland-satellite" ":21"
input {
diff --git a/config/nixos/nautilus.nix b/config/nixos/nautilus.nix
index dca35593..95b4e45d 100644
--- a/config/nixos/nautilus.nix
+++ b/config/nixos/nautilus.nix
@@ -1,8 +1,8 @@
{ pkgs, ... }:
{
environment.systemPackages = [
- pkgs.nautilus # File Browser
- pkgs.gnome.sushi # thumbnails in nautilus
+ pkgs.nautilus # File Browser
+ pkgs.sushi # thumbnails in nautilus
];
services.gvfs.enable = true; # Mount, trash, and other functionalities
diff --git a/config/nixos/programs.nix b/config/nixos/programs.nix
index 098215a7..47548944 100644
--- a/config/nixos/programs.nix
+++ b/config/nixos/programs.nix
@@ -20,5 +20,9 @@
powertop # Check what is consuming too much energy
usbutils # USB utilities
+
+ # Other
+ cheese # Webcam
+ # amberol? blanket?
];
}
diff --git a/config/nixos/wayland.nix b/config/nixos/wayland.nix
index 3ba462f6..b7b6a58d 100644
--- a/config/nixos/wayland.nix
+++ b/config/nixos/wayland.nix
@@ -13,9 +13,6 @@
];
};
programs.nm-applet.enable = true; # Network manager applet
- programs.xwayland.enable = true;
-
- programs.hyprland.enable = true; # Automates several dependencies. Home-Manager sets custom configuration.
# Other
# TODO: https://github.com/Aylur/dotfiles/blob/main/nixos/system.nix#L44
diff --git a/flake.nix b/flake.nix
index 6dd06232..1af46235 100644
--- a/flake.nix
+++ b/flake.nix
@@ -5,12 +5,10 @@
extra-substituters = [
"https://nix-community.cachix.org"
"https://nixpkgs-wayland.cachix.org"
- "https://hyprland.cachix.org"
];
extra-trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"nixpkgs-wayland.cachix.org-1:3lwxaILxMRkVhehr5StQprHdEo4IrE8sRho9R9HOLYA="
- "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
];
};
From 24642c6e18f8eaf621fd8354293d000c167422ae Mon Sep 17 00:00:00 2001
From: Bruno Henriques <4727729+bphenriques@users.noreply.github.com>
Date: Fri, 22 Nov 2024 17:11:18 +0000
Subject: [PATCH 16/34] more updates
---
config/nixos/wayland.nix | 1 +
1 file changed, 1 insertion(+)
diff --git a/config/nixos/wayland.nix b/config/nixos/wayland.nix
index b7b6a58d..780815d2 100644
--- a/config/nixos/wayland.nix
+++ b/config/nixos/wayland.nix
@@ -25,6 +25,7 @@
# Hardware
brightnessctl # Manage Brightness
+ pavucontrol # Manage audio
xwayland-satellite # X11. See: https://github.com/YaLTeR/niri/wiki/Xwayland
konsole # Backup terminal in case something goes wrong
From 61602fef96d422c782c8e998bc1743d732c6adc2 Mon Sep 17 00:00:00 2001
From: Bruno Henriques <4727729+bphenriques@users.noreply.github.com>
Date: Mon, 25 Nov 2024 19:10:15 +0000
Subject: [PATCH 17/34] iteration
---
config/home-manager/terminal/ghostty.nix | 22 +--
.../window-manager/ags/config/.gitignore | 5 -
.../config/assets/nix-snowflake-symbolic.svg | 155 ------------------
.../window-manager/ags/config/config.js | 14 --
.../window-manager/ags/config/main.ts | 76 ---------
.../ags/config/notification-daemon/battery.ts | 14 --
.../config/notification-daemon/ignore-list.ts | 16 --
.../ags/config/notification-daemon/init.ts | 22 ---
.../window-manager/ags/config/options.ts | 54 ------
.../ags/config/services/brightness.js | 46 ------
.../window-manager/ags/config/style/main.scss | 0
.../window-manager/ags/config/style/style.css | 114 -------------
.../window-manager/ags/config/tsconfig.json | 18 --
.../ags/config/widget/bar/bar.ts | 37 -----
.../ags/config/widget/bar/battery.js | 13 --
.../ags/config/widget/bar/brightness.js | 21 ---
.../ags/config/widget/bar/clock.js | 10 --
.../ags/config/widget/bar/hyprland-active.js | 9 -
.../config/widget/bar/hyprland-workspaces.ts | 36 ----
.../ags/config/widget/bar/launcher.ts | 8 -
.../ags/config/widget/bar/media.ts | 20 ---
.../ags/config/widget/bar/systray.ts | 15 --
.../ags/config/widget/bar/volume.js | 22 ---
.../ags/config/widget/notification-popup.js | 130 ---------------
.../window-manager/ags/default.nix | 19 ---
.../home-manager/window-manager/default.nix | 8 +-
config/home-manager/window-manager/dunst.nix | 76 +++++++++
config/home-manager/window-manager/kanshi.nix | 4 +-
config/home-manager/window-manager/niri.nix | 4 +-
.../window-manager/waybar/default.nix | 72 ++++----
.../window-manager/waybar/style.css | 4 +-
config/nixos/wayland.nix | 1 +
flake.lock | 42 +----
flake.nix | 6 +-
34 files changed, 130 insertions(+), 983 deletions(-)
delete mode 100644 config/home-manager/window-manager/ags/config/.gitignore
delete mode 100644 config/home-manager/window-manager/ags/config/assets/nix-snowflake-symbolic.svg
delete mode 100644 config/home-manager/window-manager/ags/config/config.js
delete mode 100644 config/home-manager/window-manager/ags/config/main.ts
delete mode 100644 config/home-manager/window-manager/ags/config/notification-daemon/battery.ts
delete mode 100644 config/home-manager/window-manager/ags/config/notification-daemon/ignore-list.ts
delete mode 100644 config/home-manager/window-manager/ags/config/notification-daemon/init.ts
delete mode 100644 config/home-manager/window-manager/ags/config/options.ts
delete mode 100644 config/home-manager/window-manager/ags/config/services/brightness.js
delete mode 100644 config/home-manager/window-manager/ags/config/style/main.scss
delete mode 100644 config/home-manager/window-manager/ags/config/style/style.css
delete mode 100644 config/home-manager/window-manager/ags/config/tsconfig.json
delete mode 100644 config/home-manager/window-manager/ags/config/widget/bar/bar.ts
delete mode 100644 config/home-manager/window-manager/ags/config/widget/bar/battery.js
delete mode 100644 config/home-manager/window-manager/ags/config/widget/bar/brightness.js
delete mode 100644 config/home-manager/window-manager/ags/config/widget/bar/clock.js
delete mode 100644 config/home-manager/window-manager/ags/config/widget/bar/hyprland-active.js
delete mode 100644 config/home-manager/window-manager/ags/config/widget/bar/hyprland-workspaces.ts
delete mode 100644 config/home-manager/window-manager/ags/config/widget/bar/launcher.ts
delete mode 100644 config/home-manager/window-manager/ags/config/widget/bar/media.ts
delete mode 100644 config/home-manager/window-manager/ags/config/widget/bar/systray.ts
delete mode 100644 config/home-manager/window-manager/ags/config/widget/bar/volume.js
delete mode 100644 config/home-manager/window-manager/ags/config/widget/notification-popup.js
delete mode 100644 config/home-manager/window-manager/ags/default.nix
create mode 100644 config/home-manager/window-manager/dunst.nix
diff --git a/config/home-manager/terminal/ghostty.nix b/config/home-manager/terminal/ghostty.nix
index ba10aaaf..3439acc2 100644
--- a/config/home-manager/terminal/ghostty.nix
+++ b/config/home-manager/terminal/ghostty.nix
@@ -1,5 +1,4 @@
{ config, pkgs, lib, community, ... }:
-
let
font = {
name = "Hack Nerd Font Mono";
@@ -21,7 +20,7 @@ let
# Red
color1 = "#ff6c6b";
- color9 = "#ff6655";
+ color9 = "#ff6655";#
# Green
color2 = "#98be65";
@@ -51,23 +50,13 @@ in
{
# MacOS requires installation by hand for now: https://github.com/ghostty-org/ghostty/releases/tag/tip
home.packages = lib.optionals pkgs.stdenv.isLinux [
- # Fixes issues with GTK, need to sort this out separately
community.pkgs.ghostty
- (pkgs.writeScriptBin "ghostty-x11" ''
- #!${pkgs.stdenv.shell}
- GDK_BACKEND=x11 exec ${community.pkgs.ghostty}/bin/ghostty "$@"
- '')
-
- (pkgs.makeDesktopItem {
- name = "Ghostty-X11";
- desktopName = "Ghostty-X11";
- categories = [ "Utility" "Development" ];
- exec = "GDK_BACKEND=x11 exec ${community.pkgs.ghostty}/bin/ghostty";
- })
];
- xdg.mimeApps.defaultApplications."x-scheme-handler/terminal" = [ "Ghostty.desktop" ];
- xdg.mimeApps.defaultApplications."x-scheme-handler/x-executable" = [ "Ghostty.desktop" ];
+ xdg.mimeApps.defaultApplications = {
+ "x-scheme-handler/terminal" = [ "Ghostty.desktop" ];
+ "x-scheme-handler/x-executable" = [ "Ghostty.desktop" ];
+ };
programs.fish.interactiveShellInit = lib.optionalString pkgs.stdenv.isDarwin ''
fish_add_path --append --move ${config.home.homeDirectory}/Applications/Ghostty.app/Contents/MacOS
@@ -110,7 +99,6 @@ in
palette = 15=${colors.color15}
copy-on-select = clipboard
-
''+ lib.optionalString pkgs.stdenv.isLinux ''
gtk-single-instance = true
window-decoration = true
diff --git a/config/home-manager/window-manager/ags/config/.gitignore b/config/home-manager/window-manager/ags/config/.gitignore
deleted file mode 100644
index f9346ea5..00000000
--- a/config/home-manager/window-manager/ags/config/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-node_modules
-types
-package-lock.json
-bun.lockb
-.weather
\ No newline at end of file
diff --git a/config/home-manager/window-manager/ags/config/assets/nix-snowflake-symbolic.svg b/config/home-manager/window-manager/ags/config/assets/nix-snowflake-symbolic.svg
deleted file mode 100644
index 7bb42edd..00000000
--- a/config/home-manager/window-manager/ags/config/assets/nix-snowflake-symbolic.svg
+++ /dev/null
@@ -1,155 +0,0 @@
-
-
diff --git a/config/home-manager/window-manager/ags/config/config.js b/config/home-manager/window-manager/ags/config/config.js
deleted file mode 100644
index 2f1be32b..00000000
--- a/config/home-manager/window-manager/ags/config/config.js
+++ /dev/null
@@ -1,14 +0,0 @@
-const entry = App.configDir + '/main.ts'
-const outdir = '/tmp/ags/js'
-
-try {
- await Utils.execAsync([
- 'bun', 'build', entry,
- '--outdir', outdir,
- '--external', 'resource://*',
- '--external', 'gi://*',
- ])
- await import(`file://${outdir}/main.js`)
-} catch (error) {
- console.error(error)
-}
\ No newline at end of file
diff --git a/config/home-manager/window-manager/ags/config/main.ts b/config/home-manager/window-manager/ags/config/main.ts
deleted file mode 100644
index f6bc94d8..00000000
--- a/config/home-manager/window-manager/ags/config/main.ts
+++ /dev/null
@@ -1,76 +0,0 @@
-import { Bar } from "./widget/bar/bar.js"
-import { NotificationPopups } from "./widget/notification-popup.js"
-import { setupNotificationDaemon } from "./notification-daemon/init.js"
-
-
-// https://user-images.githubusercontent.com/36706276/192147190-cf9cf4df-94cb-4a3b-b9d8-137ed0c2538f.png
-// https://github.com/fufexan/dotfiles/blob/main/home/services/ags/windows/bar/modules/bluetooth.js
-
-// https://aylur.github.io/ags-docs/config/theming/
-function debug() {
- Utils.monitorFile(
- // directory that contains the scss files
- `${App.configDir}/style`,
-
- // reload function
- function() {
- // main scss file
- //const scss = `${App.configDir}/style.scss`
-
- // target css file
- //const css = `/tmp/my-style.css`
- console.log("reloading")
- const css = `${App.configDir}/style/style.css`
- // compile, reset, apply
- //Utils.exec(`sassc ${scss} ${css}`)
- App.resetCss()
- App.applyCss(css)
- },
- )
-}
-
-/*
-function addWindows(windows) {
- windows.forEach(win => App.addWindow(win));
-}
-
- Utils.idle(async () => {
- addWindows([
- IndicatorWidget(),
- Quicksettings(),
- await Launcher(),
- PowerMenu(),
- PopupNotifications(),
- ]);
-
- const display = Gdk.Display.get_default();
- for (let m = 0; m < display?.get_n_monitors(); m++) {
- const monitor = display?.get_monitor(m);
- addMonitorWindows(monitor);
- }
-
- display?.connect("monitor-added", (disp, monitor) => {
- addMonitorWindows(monitor);
- });
-
- display?.connect("monitor-removed", (disp, monitor) => {
- App.windows.forEach(win => {
- if(win.gdkmonitor === monitor) App.removeWindow(win);
- });
- });
-
-
-}); */
-
-App.addIcons(`${App.configDir}/assets`)
-App.config({
- onConfigParsed: () => {
- debug()
- setupNotificationDaemon()
- },
- style: `${App.configDir}/style/style.css`,
- windows: [
- NotificationPopups(),
- Bar(0)
- ]
-})
\ No newline at end of file
diff --git a/config/home-manager/window-manager/ags/config/notification-daemon/battery.ts b/config/home-manager/window-manager/ags/config/notification-daemon/battery.ts
deleted file mode 100644
index dbb5dd71..00000000
--- a/config/home-manager/window-manager/ags/config/notification-daemon/battery.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-const bat = await Service.import("battery")
-
-export default async function init() {
- bat.connect("notify::percent", ({ percent, charging }) => {
- const low = 30
- if (percent !== low || percent !== low / 2 || !charging)
- return
-
- Utils.notify({
- summary: `${percent}% Battery Percentage`,
- urgency: "critical",
- })
- })
-}
\ No newline at end of file
diff --git a/config/home-manager/window-manager/ags/config/notification-daemon/ignore-list.ts b/config/home-manager/window-manager/ags/config/notification-daemon/ignore-list.ts
deleted file mode 100644
index 4a4e2ff7..00000000
--- a/config/home-manager/window-manager/ags/config/notification-daemon/ignore-list.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-import options from "options"
-const notifs = await Service.import("notifications")
-
-// TODO: consider adding this to upstream
-
-// const { blacklist } = options.notifications
-
-export default function init() {
- const notify = notifs.constructor.prototype.Notify.bind(notifs)
- notifs.constructor.prototype.Notify = function(appName: string, ...rest: unknown[]) {
- if (blacklist.value.includes(appName))
- return Number.MAX_SAFE_INTEGER
-
- return notify(appName, ...rest)
- }
-}
\ No newline at end of file
diff --git a/config/home-manager/window-manager/ags/config/notification-daemon/init.ts b/config/home-manager/window-manager/ags/config/notification-daemon/init.ts
deleted file mode 100644
index c49236ec..00000000
--- a/config/home-manager/window-manager/ags/config/notification-daemon/init.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-import battery from "./battery"
-
-function exampleNotification() {
- Utils.timeout(100, () => Utils.notify({
- summary: "Notification Popup Example",
- iconName: "info-symbolic",
- body: "Lorem ipsum dolor sit amet, qui minim labore adipisicing "
- + "minim sint cillum sint consectetur cupidatat.",
- actions: {
- "Cool": () => print("pressed Cool"),
- },
- }))
-}
-
-export function setupNotificationDaemon() {
- try {
- battery()
- //exampleNotification()
- } catch (error) {
- logError(error)
- }
-}
\ No newline at end of file
diff --git a/config/home-manager/window-manager/ags/config/options.ts b/config/home-manager/window-manager/ags/config/options.ts
deleted file mode 100644
index becbacc3..00000000
--- a/config/home-manager/window-manager/ags/config/options.ts
+++ /dev/null
@@ -1,54 +0,0 @@
-import { opt, mkOptions } from "lib/option"
-import { icon } from "lib/utils"
-import icons from "lib/icons"
-
-const nix = JSON.parse(Utils.readFile(Utils.CACHE_DIR + "/options-nix.json") || '{}')
-
-//https://github.com/Serpentian/AlfheimOS/blob/master/non-nix/ags/widget/bar/buttons/Launcher.ts
-//https://github.com/Serpentian/AlfheimOS/blob/master/user/wm/hyprland/ags.nix
-
-const options = mkOptions(OPTIONS, {
- wallpaper: opt(nix?.wallpaper || ""),
- font: {
- size: opt(nix?.font?.size || 12),
- name: opt(nix?.font?.name || "Ubuntu Nerd Font"),
- },
-
-
- bar: {
- launcher: {
- launcherExe: opt(nix?.launcher || ""),
- icon: {
- colored: opt(false),
- icon: opt(icon(icons.nix.nix, icons.ui.search)),
- },
- },
- workspaces: {
- workspaces: opt(10),
- },
- systray: {
- ignore: opt([
- "KDE Connect Indicator",
- "spotify-client",
- ]),
- },
- media: {
- format: opt(" {artist} - {title} "),
- length: opt(0),
- },
- },
-
- powermenu: {
- sleep: opt("systemctl suspend"),
- reboot: opt("systemctl reboot"),
- logout: opt("pkill Hyprland"),
- shutdown: opt("shutdown now"),
- },
-
- notifications: {
- blacklist: opt(["Spotify"]),
- },
-})
-
-globalThis["options"] = options
-export default options
\ No newline at end of file
diff --git a/config/home-manager/window-manager/ags/config/services/brightness.js b/config/home-manager/window-manager/ags/config/services/brightness.js
deleted file mode 100644
index 6c184980..00000000
--- a/config/home-manager/window-manager/ags/config/services/brightness.js
+++ /dev/null
@@ -1,46 +0,0 @@
-class BrightnessService extends Service {
- static {
- Service.register(this, { 'screen-changed': ['float'] }, { 'screen-value': ['float', 'rw'] });
- }
-
- #interface = Utils.exec("sh -c 'ls -w1 /sys/class/backlight | head -1'");
- #screenValue = 0;
- #max = Number(Utils.exec('brightnessctl max'));
-
- // the getter/setter has to be in snake_case
- get screen_value() {
- return this.#screenValue;
- }
-
- set screen_value(percent) {
- if (percent < 0)
- percent = 0;
- if (percent > 1)
- percent = 1;
-
- Utils.execAsync(`brightnessctl set ${percent * 100}% -q`);
- }
-
- constructor() {
- super();
- const brightness = `/sys/class/backlight/${this.#interface}/brightness`;
- Utils.monitorFile(brightness, () => this.#onChange());
- this.#onChange();
- }
-
- #onChange() {
- this.#screenValue = Number(Utils.exec('brightnessctl get')) / this.#max;
- this.changed('screen-value');
- this.emit('screen-changed', this.#screenValue);
- }
-
- // overwriting the connect method, let's you
- // change the default event that widgets connect to
- connect(event = 'screen-changed', callback) {
- return super.connect(event, callback);
- }
-}
-
-// Singleton
-const service = new BrightnessService;
-export default service;
\ No newline at end of file
diff --git a/config/home-manager/window-manager/ags/config/style/main.scss b/config/home-manager/window-manager/ags/config/style/main.scss
deleted file mode 100644
index e69de29b..00000000
diff --git a/config/home-manager/window-manager/ags/config/style/style.css b/config/home-manager/window-manager/ags/config/style/style.css
deleted file mode 100644
index 775c798e..00000000
--- a/config/home-manager/window-manager/ags/config/style/style.css
+++ /dev/null
@@ -1,114 +0,0 @@
-@define-color bg_hover rgba(200, 200, 200, 0.3);
-@define-color content_main white;
-@define-color content_inactive rgba(255, 255, 255, 0.25);
-
-* {
- font-size: 15px;
-}
-
-/* reset default settings */
-button {
- all: unset;
-}
-
-.bar {
- background-color: rgba(30, 30, 46, 0.75);
- color: #cdd6f4;
-}
-
-.launcher {
- background-color: transparent;
- margin-bottom: 2px;
- margin-top: 2px;
-}
-
-.launcher label {
- font-family: "JetBrainsMono Nerd Font";
- font-size: 20px;
- padding-left: 8px;
- padding-right: 15px;
-}
-
-.launcher:hover {
- background: @bg_hover;
- color: @content_main;
-}
-
-.workspaces button {
- padding: 3px;
- padding-left: 10px;
- padding-right: 10px;
- color: @content_inactive;
-}
-
-.workspaces .active {
- background: @bg_hover;
- color: @content_main;
-}
-
-.workspaces button:hover {
- background: @bg_hover;
- color: @content_main;
-}
-
-
-window.notification-popups box.notifications {
- padding: .5em;
-}
-
-.icon {
- min-width: 68px;
- min-height: 68px;
- margin-right: 1em;
-}
-
-.icon image {
- font-size: 58px;
- /* to center the icon */
- margin: 5px;
- color: @theme_fg_color;
-}
-
-.icon box {
- min-width: 68px;
- min-height: 68px;
- border-radius: 7px;
-}
-
-.volume {
-}
-
-.notification {
- min-width: 350px;
- border-radius: 11px;
- padding: 1em;
- margin: .5em;
- border: 1px solid @wm_borders_edge;
- background-color: @theme_bg_color;
-}
-
-.notification.critical {
- border: 1px solid lightcoral;
-}
-
-.title {
- color: @theme_fg_color;
- font-size: 1.4em;
-}
-
-.body {
- color: @theme_unfocused_fg_color;
-}
-
-.actions .action-button {
- margin: 0 .4em;
- margin-top: .8em;
-}
-
-.actions .action-button:first-child {
- margin-left: 0;
-}
-
-.actions .action-button:last-child {
- margin-right: 0;
-}
\ No newline at end of file
diff --git a/config/home-manager/window-manager/ags/config/tsconfig.json b/config/home-manager/window-manager/ags/config/tsconfig.json
deleted file mode 100644
index f03f2d12..00000000
--- a/config/home-manager/window-manager/ags/config/tsconfig.json
+++ /dev/null
@@ -1,18 +0,0 @@
-{
- "compilerOptions": {
- "target": "ES2022",
- "module": "ES2022",
- "lib": [
- "ES2022"
- ],
- "allowJs": true,
- "checkJs": true,
- "strict": true,
- "noImplicitAny": false,
- "baseUrl": ".",
- "typeRoots": [
- "./types"
- ],
- "skipLibCheck": true
- }
-}
\ No newline at end of file
diff --git a/config/home-manager/window-manager/ags/config/widget/bar/bar.ts b/config/home-manager/window-manager/ags/config/widget/bar/bar.ts
deleted file mode 100644
index 42993e2e..00000000
--- a/config/home-manager/window-manager/ags/config/widget/bar/bar.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-import { BatteryLabel } from './battery.js'
-import { Clock } from './clock.js'
-import { ClientTitle } from './hyprland-active.js' /* FIXME: Use plain titles per window */
-import { Volume } from './volume.js'
-import { Media } from './media.js'
-import { SysTray } from './systray.js'
-import { Launcher } from './launcher.js'
-import { Workspaces } from './hyprland-workspaces.js'
-
-export function Bar(monitor: number){
- return Widget.Window({
- name: `bar-${monitor}`,
- class_name: "bar",
- anchor: ["top", "left", "right"],
- exclusivity: "exclusive",
- child: Widget.CenterBox({
- start_widget: Widget.Box({
- spacing: 8,
- children: [
- Launcher(),
- ]
- }),
- center_widget: Widget.Box({ spacing: 8, children: [ Media() ] }),
- end_widget: Widget.Box({ hpack: "end", spacing: 8, children: [
- //Brightness(),
- Volume(),
- BatteryLabel(),
- Clock(),
- SysTray()
- ] }),
- }),
- })
-}
-
-// FIXME monitors: https://github.com/kotontrion/dotfiles/blob/main/.config%2Fags%2Fconfig.js#L60-L74
-// FIXME: https://github.com/end-4/dots-hyprland
-// FIXME: https://github.com/kotontrion/dotfiles
\ No newline at end of file
diff --git a/config/home-manager/window-manager/ags/config/widget/bar/battery.js b/config/home-manager/window-manager/ags/config/widget/bar/battery.js
deleted file mode 100644
index 4e3f9657..00000000
--- a/config/home-manager/window-manager/ags/config/widget/bar/battery.js
+++ /dev/null
@@ -1,13 +0,0 @@
-const battery = await Service.import('battery')
-
-export function BatteryLabel() {
- const icon = battery.bind("percent").as(p => `battery-level-${Math.floor(p / 10) * 10}-symbolic`)
-
- return Widget.Box({
- class_name: "battery",
- visible: battery.bind("available"),
- children: [
- Widget.Icon({ icon }),
- ],
- })
-}
\ No newline at end of file
diff --git a/config/home-manager/window-manager/ags/config/widget/bar/brightness.js b/config/home-manager/window-manager/ags/config/widget/bar/brightness.js
deleted file mode 100644
index 7ad2af8f..00000000
--- a/config/home-manager/window-manager/ags/config/widget/bar/brightness.js
+++ /dev/null
@@ -1,21 +0,0 @@
-import brightness from '../../services/brightness.js';
-
-export function Brightness() {
- return Widget.Label({
- label: brightness.bind('screen-value').as(v => `${v}`),
- setup: self => self.hook(brightness, (self, screenValue) => {
- // screenValue is the passed parameter from the 'screen-changed' signal
- self.label = screenValue ?? 0;
-
- // NOTE:
- // since hooks are run upon construction
- // the passed screenValue will be undefined the first time
-
- // all three are valid
- self.label = `${brightness.screenValue}`;
- self.label = `${brightness.screen_value}`;
- self.label = `${brightness['screen-value']}`;
-
- }, 'screen-changed'),
- })
-}
\ No newline at end of file
diff --git a/config/home-manager/window-manager/ags/config/widget/bar/clock.js b/config/home-manager/window-manager/ags/config/widget/bar/clock.js
deleted file mode 100644
index fb0eca31..00000000
--- a/config/home-manager/window-manager/ags/config/widget/bar/clock.js
+++ /dev/null
@@ -1,10 +0,0 @@
-const date = Variable("", {
- poll: [1000, 'date "+%a%e %b %H:%M"'],
-})
-
-export function Clock() {
- return Widget.Label({
- class_name: "clock",
- label: date.bind(),
- })
-}
diff --git a/config/home-manager/window-manager/ags/config/widget/bar/hyprland-active.js b/config/home-manager/window-manager/ags/config/widget/bar/hyprland-active.js
deleted file mode 100644
index 5c7e50a6..00000000
--- a/config/home-manager/window-manager/ags/config/widget/bar/hyprland-active.js
+++ /dev/null
@@ -1,9 +0,0 @@
-// FIXME: Is it bad having this imported multiple times?
-const hyprland = await Service.import("hyprland")
-
-export function ClientTitle() {
- return Widget.Label({
- class_name: "client-title",
- label: hyprland.active.client.bind("title"),
- })
-}
\ No newline at end of file
diff --git a/config/home-manager/window-manager/ags/config/widget/bar/hyprland-workspaces.ts b/config/home-manager/window-manager/ags/config/widget/bar/hyprland-workspaces.ts
deleted file mode 100644
index 94b85e73..00000000
--- a/config/home-manager/window-manager/ags/config/widget/bar/hyprland-workspaces.ts
+++ /dev/null
@@ -1,36 +0,0 @@
-import { sh, range } from "lib/utils"
-
-const hyprland = await Service.import("hyprland")
-const dispatch = ws => hyprland.messageAsync(`dispatch workspace ${ws}`);
-
-const CreateWorkspaces = (ws: number) => Widget.Box({
- children: Array.from({ length: ws }, (_, i) => i + 1).map(i => {
- const btn = Widget.Button({
- attribute: i,
- child: Widget.Label({label: `${i}`}),
- on_clicked: () => dispatch(i),
- setup: self => self.hook(hyprland, () => {
- self.toggleClassName("active", hyprland.active.workspace.id === i)
- }),
- })
- const workspace = hyprland.getWorkspace(i)
- if (workspace && workspace.initialized) {
- btn.setup()
- }
- return btn
- }),
- setup: box => {
- //box.hook(hyprland.active.workspace, () => box.children.map(btn => {
- // btn.visible = hyprland.workspaces.some(ws => ws.id === btn.attribute)
- //}))
- },
-})
-
-export function Workspaces() {
- return Widget.EventBox({
- class_name: "workspaces",
- on_scroll_up: () => dispatch("+1"),
- on_scroll_down: () => dispatch("-1"),
- child: CreateWorkspaces(10),
- })
-}
\ No newline at end of file
diff --git a/config/home-manager/window-manager/ags/config/widget/bar/launcher.ts b/config/home-manager/window-manager/ags/config/widget/bar/launcher.ts
deleted file mode 100644
index 8ed81ae7..00000000
--- a/config/home-manager/window-manager/ags/config/widget/bar/launcher.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-export function Launcher() {
- return Widget.Button({
- class_name: 'launcher',
- on_primary_click_release: (evt) => Utils.exec("fuzzel"),
- //child: Widget.Icon({icon: "nix-snowflake-symbolic"}),
- child: Widget.Label({label: ""}),
- })
-}
\ No newline at end of file
diff --git a/config/home-manager/window-manager/ags/config/widget/bar/media.ts b/config/home-manager/window-manager/ags/config/widget/bar/media.ts
deleted file mode 100644
index c00adec5..00000000
--- a/config/home-manager/window-manager/ags/config/widget/bar/media.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-const mpris = await Service.import("mpris")
-
-export function Media() {
- const label = Utils.watch("", mpris, "player-changed", () => {
- if (mpris.players[0]) {
- const { track_artists, track_title } = mpris.players[0]
- return `${track_artists.join(", ")} - ${track_title}`
- } else {
- return "Nothing is playing"
- }
- })
-
- return Widget.Button({
- class_name: "media",
- on_primary_click: () => mpris.getPlayer("")?.playPause(),
- on_scroll_up: () => mpris.getPlayer("")?.next(),
- on_scroll_down: () => mpris.getPlayer("")?.previous(),
- child: Widget.Label({ label }),
- })
-}
\ No newline at end of file
diff --git a/config/home-manager/window-manager/ags/config/widget/bar/systray.ts b/config/home-manager/window-manager/ags/config/widget/bar/systray.ts
deleted file mode 100644
index 6de24e0e..00000000
--- a/config/home-manager/window-manager/ags/config/widget/bar/systray.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-const systemtray = await Service.import("systemtray")
-
-export function SysTray() {
- const items = systemtray.bind("items")
- .as(items => items.map(item => Widget.Button({
- child: Widget.Icon({ icon: item.bind("icon") }),
- on_primary_click: (_, event) => item.activate(event),
- on_secondary_click: (_, event) => item.openMenu(event),
- tooltip_markup: item.bind("tooltip_markup"),
- })))
-
- return Widget.Box({
- children: items,
- })
-}
\ No newline at end of file
diff --git a/config/home-manager/window-manager/ags/config/widget/bar/volume.js b/config/home-manager/window-manager/ags/config/widget/bar/volume.js
deleted file mode 100644
index 829ec8f2..00000000
--- a/config/home-manager/window-manager/ags/config/widget/bar/volume.js
+++ /dev/null
@@ -1,22 +0,0 @@
-const audio = await Service.import("audio")
-
-const icons = {
- 101: "overamplified",
- 67: "high",
- 34: "medium",
- 1: "low",
- 0: "muted",
-}
-
-function getIcon() {
- const icon = audio.speaker.is_muted ? 0 : [101, 67, 34, 1, 0].find(threshold => threshold <= audio.speaker.volume * 100)
- return `audio-volume-${icons[icon]}-symbolic`
-}
-
-export function Volume() {
- return Widget.Button({
- class_name: "volume",
- on_primary_click_release: (evt) => Utils.exec("pavucontrol"),
- child: Widget.Icon({ icon: Utils.watch(getIcon(), audio.speaker, getIcon) }),
- })
-}
\ No newline at end of file
diff --git a/config/home-manager/window-manager/ags/config/widget/notification-popup.js b/config/home-manager/window-manager/ags/config/widget/notification-popup.js
deleted file mode 100644
index 4c63d740..00000000
--- a/config/home-manager/window-manager/ags/config/widget/notification-popup.js
+++ /dev/null
@@ -1,130 +0,0 @@
-const notifications = await Service.import("notifications")
-
-/** @param {import('resource:///com/github/Aylur/ags/service/notifications.js').Notification} n */
-function NotificationIcon({ app_entry, app_icon, image }) {
- if (image) {
- return Widget.Box({
- css: `background-image: url("${image}");`
- + "background-size: contain;"
- + "background-repeat: no-repeat;"
- + "background-position: center;",
- })
- }
-
- let icon = "dialog-information-symbolic"
- if (Utils.lookUpIcon(app_icon))
- icon = app_icon
-
- if (app_entry && Utils.lookUpIcon(app_entry))
- icon = app_entry
-
- return Widget.Box({
- child: Widget.Icon(icon),
- })
-}
-
-/** @param {import('resource:///com/github/Aylur/ags/service/notifications.js').Notification} n */
-function Notification(n) {
- const icon = Widget.Box({
- vpack: "start",
- class_name: "icon",
- child: NotificationIcon(n),
- })
-
- const title = Widget.Label({
- class_name: "title",
- xalign: 0,
- justification: "left",
- hexpand: true,
- max_width_chars: 24,
- truncate: "end",
- wrap: true,
- label: n.summary,
- use_markup: true,
- })
-
- const body = Widget.Label({
- class_name: "body",
- hexpand: true,
- use_markup: true,
- xalign: 0,
- justification: "left",
- label: n.body,
- wrap: true,
- })
-
- const actions = Widget.Box({
- class_name: "actions",
- children: n.actions.map(({ id, label }) => Widget.Button({
- class_name: "action-button",
- on_clicked: () => {
- n.invoke(id)
- n.dismiss()
- },
- hexpand: true,
- child: Widget.Label(label),
- })),
- })
-
- return Widget.EventBox(
- {
- attribute: { id: n.id },
- on_primary_click: n.dismiss,
- },
- Widget.Box(
- {
- class_name: `notification ${n.urgency}`,
- vertical: true,
- },
- Widget.Box([
- icon,
- Widget.Box(
- { vertical: true },
- title,
- body,
- ),
- ]),
- actions,
- ),
- )
-}
-
-export function NotificationPopups(monitor = 0) {
- const list = Widget.Box({
- vertical: true,
- children: notifications.popups.map(Notification),
- })
-
- function onNotified(_, /** @type {number} */ id) {
- const n = notifications.getNotification(id)
- if (n)
- list.children = [Notification(n), ...list.children]
- }
-
- function onDismissed(_, /** @type {number} */ id) {
- list.children.find(n => n.attribute.id === id)?.destroy()
- }
-
- list.hook(notifications, onNotified, "notified")
- .hook(notifications, onDismissed, "dismissed")
-
- return Widget.Window({
- monitor,
- name: `notifications${monitor}`,
- class_name: "notification-popups",
- anchor: ["top", "right"],
- child: Widget.Box({
- css: "min-width: 2px; min-height: 2px;",
- class_name: "notifications",
- vertical: true,
- child: list,
-
- /** this is a simple one liner that could be used instead of
- hooking into the 'notified' and 'dismissed' signals.
- but its not very optimized becuase it will recreate
- the whole list everytime a notification is added or dismissed */
- // children: notifications.bind('popups')
- // .as(popups => popups.map(Notification))
- }),
- })
-}
\ No newline at end of file
diff --git a/config/home-manager/window-manager/ags/default.nix b/config/home-manager/window-manager/ags/default.nix
deleted file mode 100644
index 453004ce..00000000
--- a/config/home-manager/window-manager/ags/default.nix
+++ /dev/null
@@ -1,19 +0,0 @@
-{ pkgs, lib, inputs, ... }:
-
-# https://github.com/Serpentian/AlfheimOS/blob/master/user/wm/hyprland/ags.nix
-{
- home.packages = [
- pkgs.bun
- pkgs.pavucontrol
- ];
-
- programs.ags = {
- enable = true;
- configDir = ./config; # Init types using ags --init ./config.js
- extraPackages = with pkgs; [
- gtksourceview
- webkitgtk
- accountsservice
- ];
- };
-}
\ No newline at end of file
diff --git a/config/home-manager/window-manager/default.nix b/config/home-manager/window-manager/default.nix
index 7dca0273..b4d82aa3 100644
--- a/config/home-manager/window-manager/default.nix
+++ b/config/home-manager/window-manager/default.nix
@@ -15,10 +15,10 @@ in
# https://github.com/prasanthrangan/hyprdots?tab=readme-ov-file
imports = [
./niri.nix # Window Manager
-
+ ./waybar # Top-bar. There are fancier solutions out-there.
+ ./dunst.nix # Notifications
./kanshi.nix # Manage external monitors
./fuzzel.nix # Application Launcher
- #./ags # Top bar, widgets, and notifications. The whole kit.
];
# Use the following theme: https://github.com/iynaix/dotfiles/blob/56d2d63b3b5f4c621429d79fb2aef8d44fdc25b9/home-manager/gui/gtk.nix#L85
@@ -29,9 +29,6 @@ in
size = 16;
};
- # KDE seems to force the replacemente of this file. TODO: remove once we move away from KDE.
- home.file.${config.gtk.gtk2.configLocation}.force = true;
-
gtk = {
enable = true;
theme = {
@@ -62,7 +59,6 @@ in
};
};
- # Double check what this does exactly
qt = {
enable = true;
style.name = "adwaita-dark";
diff --git a/config/home-manager/window-manager/dunst.nix b/config/home-manager/window-manager/dunst.nix
new file mode 100644
index 00000000..24a6eb3a
--- /dev/null
+++ b/config/home-manager/window-manager/dunst.nix
@@ -0,0 +1,76 @@
+{ config, lib, pkgs, ... }:
+
+{
+ services.dunst = {
+ enable = true;
+ iconTheme = {
+ name = "Papirus-Dark";
+ package = pkgs.papirus-icon-theme;
+ };
+ settings = {
+ global = {
+ rounded = "yes";
+ origin = "top-right";
+ monitor = "0";
+ alignment = "left";
+ vertical_alignment = "center";
+ width = "400";
+ height = "400";
+ scale = 0;
+ gap_size = 0;
+ progress_bar = true;
+ transparency = 0;
+ text_icon_padding = 0;
+ separator_color = "frame";
+ sort = "yes";
+ idle_threshold = 120;
+ line_height = 0;
+ markup = "full";
+ show_age_threshold = 60;
+ ellipsize = "middle";
+ ignore_newline = "no";
+ stack_duplicates = true;
+ sticky_history = "yes";
+ history_length = 20;
+ always_run_script = true;
+ corner_radius = 10;
+ follow = "mouse";
+ font = "Source Sans Pro 10";
+ format = "%s\\n%b"; #format = "%s %p\n%b"
+ frame_color = "#232323";
+ frame_width = 1;
+ offset = "15x15";
+ horizontal_padding = 10;
+ icon_position = "left";
+ indicate_hidden = "yes";
+ min_icon_size = 0;
+ max_icon_size = 64;
+ mouse_left_click = "do_action, close_current";
+ mouse_middle_click = "close_current";
+ mouse_right_click = "close_all";
+ padding = 10;
+ plain_text = "no";
+ separator_height = 2;
+ show_indicators = "yes";
+ shrink = "no";
+ word_wrap = "yes";
+ browser = "/usr/bin/env librewolf -new-tab";
+ };
+
+ fullscreen_delay_everything = {fullscreen = "delay";};
+
+ urgency_critical = {
+ background = "#d64e4e";
+ foreground = "#f0e0e0";
+ };
+ urgency_low = {
+ background = "#232323";
+ foreground = "#2596be";
+ };
+ urgency_normal = {
+ background = "#1e1e2a";
+ foreground = "#2596be";
+ };
+ };
+ };
+}
\ No newline at end of file
diff --git a/config/home-manager/window-manager/kanshi.nix b/config/home-manager/window-manager/kanshi.nix
index 72ee6796..47fe334e 100644
--- a/config/home-manager/window-manager/kanshi.nix
+++ b/config/home-manager/window-manager/kanshi.nix
@@ -19,13 +19,12 @@ let
disable = screen: screen // { status = "disable"; };
in
{
- #home.packages = [ pkgs.kanshi ]; # needed to run `kanshictl switch`
services.kanshi = {
enable = true;
systemdTarget = "graphical-session.target"; #"hyprland-session.target";
settings = [
{
- profile.name = "laptop";
+ profile.name = "internal";
profile.outputs = [
(enable laptopScreen)
(disable dellScreen)
@@ -38,7 +37,6 @@ in
(enable dellScreen)
];
}
-
# FIXME
{
profile.name = "docked-extend";
diff --git a/config/home-manager/window-manager/niri.nix b/config/home-manager/window-manager/niri.nix
index 61b21566..539b2f6e 100644
--- a/config/home-manager/window-manager/niri.nix
+++ b/config/home-manager/window-manager/niri.nix
@@ -108,8 +108,9 @@ in
MOZ_ENABLE_WAYLAND "1"
}
- spawn-at-startup "${pkgs.swww}/bin/swww" "img" "${wallpapersPkg}/share/wallpapers/mountains.png"
+ spawn-at-startup "${lib.getExe pkgs.swww}" "img" "${wallpapersPkg}/share/wallpapers/mountains.png"
spawn-at-startup "xwayland-satellite" ":21"
+ spawn-at-startup "${lib.getExe pkgs.waybar}"
input {
keyboard {
@@ -200,6 +201,7 @@ in
Mod+F { maximize-column; }
Mod+Shift+F { fullscreen-window; }
Mod+C { center-column; }
+ Mod+W { spawn "pkill -SIGUSR1 waybar"; }
// Suggested binds for running programs: terminal, app launcher, screen locker.
Mod+Return { spawn "konsole"; }
diff --git a/config/home-manager/window-manager/waybar/default.nix b/config/home-manager/window-manager/waybar/default.nix
index 06518a33..6316cf00 100644
--- a/config/home-manager/window-manager/waybar/default.nix
+++ b/config/home-manager/window-manager/waybar/default.nix
@@ -27,16 +27,15 @@
modules-left = [
"custom/os"
- "hyprland/workspaces"
+ "niri/workspaces"
];
modules-center = [
- "hyprland/window"
];
modules-right = [
"tray"
"pulseaudio"
"battery"
- "hyprland/language"
+ #"hyprland/language" # FIXME: for niri
"network"
# List of unsure widgets
@@ -56,7 +55,7 @@
"custom/os" = {
format = "";
- on-click = "wofi --show drun";
+ on-click = "fuzzel";
tooltip = false;
#menu = "on-click";
#menu-file = ./menu/power_menu.xml;
@@ -81,14 +80,14 @@
exec = "$HOME/.config/waybar/mediaplayer.py 2> /dev/null"; # // Script in resources/custom_modules folder
};
- "wlr/taskbar" = {
- all-outputs = false;
- format = "{icon}";
- icon-size = 13;
- tooltip = true;
- tooltip-format = "{title}";
- active-first = false;
- };
+ #"wlr/taskbar" = {
+ # all-outputs = false;
+ # format = "{icon}";
+ # icon-size = 13;
+ # tooltip = true;
+ # tooltip-format = "{title}";
+ # active-first = false;
+ #};
cpu = {
format = "{usage}% ";
@@ -170,33 +169,30 @@
};
};
-
tray = {
icon-size = 18;
spacing = 10;
};
- "hyprland/workspaces" = {
- icon-size = 32;
- spacing = 16;
- disable-scroll = false;
- all-outputs = false;
- active-only = false;
- on-scroll-up = "hyprctl dispatch workspace e+1";
- on-scroll-down = "hyprctl dispatch workspace e-1";
- format = "{icon}";
- format-icons = {
- "1" = "1";
- "2" = "2";
- "3" = "3";
- "4" = "4";
- "5" = "5";
- "6" = "6";
- "7" = "7";
- "8" = "8";
- "9" = "9";
- urgent = " ";
- };
+ "niri/workspaces" = {
+ icon-size = 32;
+ spacing = 16;
+ all-outputs = false;
+ on-scroll-up = "hyprctl dispatch workspace e+1";
+ on-scroll-down = "hyprctl dispatch workspace e-1";
+ format = "{icon}";
+ format-icons = {
+ "1" = "1";
+ "2" = "2";
+ "3" = "3";
+ "4" = "4";
+ "5" = "5";
+ "6" = "6";
+ "7" = "7";
+ "8" = "8";
+ "9" = "9";
+ urgent = " ";
+ };
};
power-profiles-daemon = {
@@ -212,14 +208,6 @@
min-length = 6;
};
- "hyprland/window" = {
- max-length = 50;
- format = "{title}";
- separate-outputs = true;
- icon = true;
- icon-size = 13;
- };
-
network = {
format-wifi = " {icon}";
format-ethernet = " ";
diff --git a/config/home-manager/window-manager/waybar/style.css b/config/home-manager/window-manager/waybar/style.css
index fd5af26d..5a63027d 100644
--- a/config/home-manager/window-manager/waybar/style.css
+++ b/config/home-manager/window-manager/waybar/style.css
@@ -79,11 +79,9 @@
transition: all 0.25s cubic-bezier(0.165, 0.84, 0.44, 1);
}
#workspaces button.active {
- color: @content_main;
- border-bottom: 3px solid white;
+ color: @bg_active;
}
#workspaces button.focused {
- color: @bg_active;
}
#workspaces button.urgent {
background: rgba(255, 200, 0, 0.35);
diff --git a/config/nixos/wayland.nix b/config/nixos/wayland.nix
index 780815d2..d544d5d9 100644
--- a/config/nixos/wayland.nix
+++ b/config/nixos/wayland.nix
@@ -22,6 +22,7 @@
qt6.qtwayland
inotify-tools
libnotify
+ # egl-wayland # E.g., Ghostty on Wayland
# Hardware
brightnessctl # Manage Brightness
diff --git a/flake.lock b/flake.lock
index c9f7e60c..bd86375b 100644
--- a/flake.lock
+++ b/flake.lock
@@ -121,8 +121,12 @@
},
"ghostty": {
"inputs": {
- "nixpkgs-stable": "nixpkgs-stable",
- "nixpkgs-unstable": "nixpkgs-unstable",
+ "nixpkgs-stable": [
+ "nixpkgs"
+ ],
+ "nixpkgs-unstable": [
+ "nixpkgs"
+ ],
"zig": "zig"
},
"locked": {
@@ -176,22 +180,6 @@
}
},
"nixpkgs-stable": {
- "locked": {
- "lastModified": 1726062281,
- "narHash": "sha256-PyFVySdGj3enKqm8RQuo4v1KLJLmNLOq2yYOHsI6e2Q=",
- "owner": "nixos",
- "repo": "nixpkgs",
- "rev": "e65aa8301ba4f0ab8cb98f944c14aa9da07394f8",
- "type": "github"
- },
- "original": {
- "owner": "nixos",
- "ref": "release-24.05",
- "repo": "nixpkgs",
- "type": "github"
- }
- },
- "nixpkgs-stable_2": {
"locked": {
"lastModified": 1729307008,
"narHash": "sha256-QUvb6epgKi9pCu9CttRQW4y5NqJ+snKr1FZpG/x3Wtc=",
@@ -207,22 +195,6 @@
"type": "github"
}
},
- "nixpkgs-unstable": {
- "locked": {
- "lastModified": 1719082008,
- "narHash": "sha256-jHJSUH619zBQ6WdC21fFAlDxHErKVDJ5fpN0Hgx4sjs=",
- "owner": "nixos",
- "repo": "nixpkgs",
- "rev": "9693852a2070b398ee123a329e68f0dab5526681",
- "type": "github"
- },
- "original": {
- "owner": "nixos",
- "ref": "nixpkgs-unstable",
- "repo": "nixpkgs",
- "type": "github"
- }
- },
"nixpkgs_2": {
"locked": {
"lastModified": 1729558817,
@@ -263,7 +235,7 @@
"ghostty": "ghostty",
"home-manager": "home-manager",
"nixpkgs": "nixpkgs_2",
- "nixpkgs-stable": "nixpkgs-stable_2",
+ "nixpkgs-stable": "nixpkgs-stable",
"nur": "nur",
"sops-nix": "sops-nix"
}
diff --git a/flake.nix b/flake.nix
index 1af46235..bc9d60d4 100644
--- a/flake.nix
+++ b/flake.nix
@@ -13,8 +13,8 @@
};
inputs = {
- # FIXME: pin to when NUR is available but I still have 6.10 kernel available. Replace the ref to nixpkgs-unstable
- nixpkgs.url = "github:nixos/nixpkgs/942b12cabae1cd4414c7177472d759731de92cb4"; # Stable(ish) enough. Plus home-manager is _always_ on unstable
+ # FIXME: pin to when NUR is available but I still have 6.10 kernel available. Replace the ref with "github:nixos/nixpkgs/nixpkgs-unstable"
+ nixpkgs.url = "github:nixos/nixpkgs/942b12cabae1cd4414c7177472d759731de92cb4"; # Stable(ish) enough. Plus home-manager is _always_ on unstable.
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.05"; # I don't really use it, but leaving it here.
darwin.url = "github:lnl7/nix-darwin/master";
@@ -34,6 +34,8 @@
disko.inputs.nixpkgs.follows = "nixpkgs";
nur.url = "github:nix-community/nur"; # Collection of packages. Use it for Firefox extensions
ghostty.url = "git+ssh://git@github.com/mitchellh/ghostty"; # Terminal
+ ghostty.inputs.nixpkgs-stable.follows = "nixpkgs"; # Fix OpenGL
+ ghostty.inputs.nixpkgs-unstable.follows = "nixpkgs"; # Fix OpenGL
# Wayland Window Manager
ags.url = "github:Aylur/ags"; # Widgets
From 949a06b3f2229c045b01a3531d86ae8b556169a2 Mon Sep 17 00:00:00 2001
From: Bruno Henriques <4727729+bphenriques@users.noreply.github.com>
Date: Sat, 30 Nov 2024 17:37:47 +0000
Subject: [PATCH 18/34] iteration - dont need much from waybar as it will be
mostly off
---
config/home-manager/window-manager/niri.nix | 168 ++++--------------
.../window-manager/waybar/default.nix | 45 +----
2 files changed, 38 insertions(+), 175 deletions(-)
diff --git a/config/home-manager/window-manager/niri.nix b/config/home-manager/window-manager/niri.nix
index 539b2f6e..5db69245 100644
--- a/config/home-manager/window-manager/niri.nix
+++ b/config/home-manager/window-manager/niri.nix
@@ -72,7 +72,6 @@ let
in
{
home.packages = with pkgs; [
- swww
# pamixer ?
];
@@ -95,6 +94,27 @@ in
};
xdg.configFile."niri/config.kdl".text = ''
+ workspace "coding"
+ workspace "browsing"
+ workspace "gaming"
+
+ window-rule {
+ match at-startup=true app-id="com.mitchellh.ghostty"
+ match at-startup=true app-id="jetbrains-idea-ce"
+ open-on-workspace "coding"
+ }
+
+ window-rule {
+ match at-startup=true app-id="firefox"
+ open-on-workspace "browsing"
+ }
+
+ window-rule {
+ match at-startup=true app-id="steam$"
+ match at-startup=true app-id=r#"^steam_app_[0-9]+$"#
+ open-on-workspace "gaming"
+ }
+
hotkey-overlay {
skip-at-startup
}
@@ -140,41 +160,17 @@ in
}
layout {
- gaps 8
-
- // When to center a column when changing focus, options are:
- // - "never", default behavior, focusing an off-screen column will keep at the left
- // or right edge of the screen.
- // - "always", the focused column will always be centered.
- // - "on-overflow", focusing a column will center it if it doesn't fit
- // together with the previously focused column.
- center-focused-column "never"
-
+ gaps 6
+ center-focused-column "on-overflow"
preset-column-widths {
proportion 0.33333
proportion 0.5
proportion 0.66667
+ proportion 1.0
}
- // preset-window-heights { }
-
- default-column-width { proportion 0.5; }
- // default-column-width {}
-
- // By default focus ring and border are rendered as a solid background rectangle
- // behind windows. That is, they will show up through semitransparent windows.
- // This is because windows using client-side decorations can have an arbitrary shape.
- //
- // If you don't like that, you should uncomment `prefer-no-csd` below.
- // Niri will draw focus ring and border *around* windows that agree to omit their
- // client-side decorations.
- //
- // Alternatively, you can override it with a window rule called
- // `draw-border-with-background`.
-
- // You can change how the focus ring looks.
+ default-column-width { proportion 0.75; }
focus-ring {
- // How many logical pixels the ring extends out from the windows.
- width 2
+ width 3
active-color "#7fc8ff"
inactive-color "#505050"
}
@@ -186,10 +182,7 @@ in
prefer-no-csd
- // You can change the path where screenshots are saved.
- // A ~ at the front will be expanded to the home directory.
- // The path is formatted with strftime(3) to give you the screenshot date and time.
- screenshot-path "~/Pictures/Screenshots/Screenshot from %Y-%m-%d %H-%M-%S.png"
+ screenshot-path "${config.xdg.userDirs.extraConfig.XDG_SCREENSHOTS_DIR}/%Y-%m-%d %H-%M-%S.png"
animations {
}
@@ -201,11 +194,16 @@ in
Mod+F { maximize-column; }
Mod+Shift+F { fullscreen-window; }
Mod+C { center-column; }
- Mod+W { spawn "pkill -SIGUSR1 waybar"; }
+ Mod+W { spawn "pkill" "-SIGUSR1" "waybar"; }
+
+ Print { screenshot; }
+ Ctrl+Print { screenshot-screen; }
+ Alt+Print { screenshot-window; }
+
+ Mod+Shift+E { quit; }
// Suggested binds for running programs: terminal, app launcher, screen locker.
Mod+Return { spawn "konsole"; }
- Mod+T { spawn "konsole"; }
Mod+Space { spawn "fuzzel"; }
Super+Alt+L { spawn "swaylock"; }
@@ -223,85 +221,18 @@ in
XF86MonBrightnessUp allow-when-locked=true { spawn "brightnessctl" "s" "10%+"; }
XF86MonBrightnessDown allow-when-locked=true { spawn "brightnessctl" "s" "10%-"; }
-
Mod+Left { focus-column-left; }
Mod+Down { focus-window-down; }
Mod+Up { focus-window-up; }
Mod+Right { focus-column-right; }
- Mod+H { focus-column-left; }
- Mod+J { focus-window-down; }
- Mod+K { focus-window-up; }
- Mod+L { focus-column-right; }
Mod+Ctrl+Left { move-column-left; }
Mod+Ctrl+Down { move-window-down; }
Mod+Ctrl+Up { move-window-up; }
Mod+Ctrl+Right { move-column-right; }
- Mod+Ctrl+H { move-column-left; }
- Mod+Ctrl+J { move-window-down; }
- Mod+Ctrl+K { move-window-up; }
- Mod+Ctrl+L { move-column-right; }
-
- // Alternative commands that move across workspaces when reaching
- // the first or last window in a column.
- // Mod+J { focus-window-or-workspace-down; }
- // Mod+K { focus-window-or-workspace-up; }
- // Mod+Ctrl+J { move-window-down-or-to-workspace-down; }
- // Mod+Ctrl+K { move-window-up-or-to-workspace-up; }
-
- Mod+Home { focus-column-first; }
- Mod+End { focus-column-last; }
- Mod+Ctrl+Home { move-column-to-first; }
- Mod+Ctrl+End { move-column-to-last; }
-
- Mod+Shift+Left { focus-monitor-left; }
- Mod+Shift+Down { focus-monitor-down; }
- Mod+Shift+Up { focus-monitor-up; }
- Mod+Shift+Right { focus-monitor-right; }
- Mod+Shift+H { focus-monitor-left; }
- Mod+Shift+J { focus-monitor-down; }
- Mod+Shift+K { focus-monitor-up; }
- Mod+Shift+L { focus-monitor-right; }
-
- Mod+Shift+Ctrl+Left { move-column-to-monitor-left; }
- Mod+Shift+Ctrl+Down { move-column-to-monitor-down; }
- Mod+Shift+Ctrl+Up { move-column-to-monitor-up; }
- Mod+Shift+Ctrl+Right { move-column-to-monitor-right; }
- Mod+Shift+Ctrl+H { move-column-to-monitor-left; }
- Mod+Shift+Ctrl+J { move-column-to-monitor-down; }
- Mod+Shift+Ctrl+K { move-column-to-monitor-up; }
- Mod+Shift+Ctrl+L { move-column-to-monitor-right; }
-
- Mod+Page_Down { focus-workspace-down; }
- Mod+Page_Up { focus-workspace-up; }
- Mod+U { focus-workspace-down; }
- Mod+I { focus-workspace-up; }
- Mod+Ctrl+Page_Down { move-column-to-workspace-down; }
- Mod+Ctrl+Page_Up { move-column-to-workspace-up; }
- Mod+Ctrl+U { move-column-to-workspace-down; }
- Mod+Ctrl+I { move-column-to-workspace-up; }
-
- Mod+Shift+Page_Down { move-workspace-down; }
- Mod+Shift+Page_Up { move-workspace-up; }
- Mod+Shift+U { move-workspace-down; }
- Mod+Shift+I { move-workspace-up; }
-
- Mod+WheelScrollDown cooldown-ms=150 { focus-workspace-down; }
- Mod+WheelScrollUp cooldown-ms=150 { focus-workspace-up; }
- Mod+Ctrl+WheelScrollDown cooldown-ms=150 { move-column-to-workspace-down; }
- Mod+Ctrl+WheelScrollUp cooldown-ms=150 { move-column-to-workspace-up; }
-
- Mod+WheelScrollRight { focus-column-right; }
- Mod+WheelScrollLeft { focus-column-left; }
- Mod+Ctrl+WheelScrollRight { move-column-right; }
- Mod+Ctrl+WheelScrollLeft { move-column-left; }
-
- // Usually scrolling up and down with Shift in applications results in
- // horizontal scrolling; these binds replicate that.
- Mod+Shift+WheelScrollDown { focus-column-right; }
- Mod+Shift+WheelScrollUp { focus-column-left; }
- Mod+Ctrl+Shift+WheelScrollDown { move-column-right; }
- Mod+Ctrl+Shift+WheelScrollUp { move-column-left; }
+
+ Mod+Shift+Down { focus-workspace-down; }
+ Mod+Shift+Up { focus-workspace-up; }
Mod+1 { focus-workspace 1; }
Mod+2 { focus-workspace 2; }
@@ -322,9 +253,6 @@ in
Mod+Ctrl+8 { move-column-to-workspace 8; }
Mod+Ctrl+9 { move-column-to-workspace 9; }
- // Alternatively, there are commands to move just a single window:
- // Mod+Ctrl+1 { move-window-to-workspace 1; }
-
// Switches focus between the current and the previous workspace.
Mod+Tab { focus-workspace-previous; }
@@ -339,21 +267,6 @@ in
Mod+Shift+R { switch-preset-window-height; }
Mod+Ctrl+R { reset-window-height; }
- // Finer width adjustments.
- // This command can also:
- // * set width in pixels: "1000"
- // * adjust width in pixels: "-5" or "+5"
- // * set width as a percentage of screen width: "25%"
- // * adjust width as a percentage of screen width: "-10%" or "+10%"
- // Pixel sizes use logical, or scaled, pixels. I.e. on an output with scale 2.0,
- // set-column-width "100" will make the column occupy 200 physical screen pixels.
- Mod+Minus { set-column-width "-10%"; }
- Mod+Equal { set-column-width "+10%"; }
-
- // Finer height adjustments when in column with other windows.
- Mod+Shift+Minus { set-window-height "-10%"; }
- Mod+Shift+Equal { set-window-height "+10%"; }
-
// Actions to switch layouts.
// Note: if you uncomment these, make sure you do NOT have
// a matching layout switch hotkey configured in xkb options above.
@@ -362,13 +275,6 @@ in
// Mod+Space { switch-layout "next"; }
// Mod+Shift+Space { switch-layout "prev"; }
- Print { screenshot; }
- Ctrl+Print { screenshot-screen; }
- Alt+Print { screenshot-window; }
-
- // The quit action will show a confirmation dialog to avoid accidental exits.
- Mod+Shift+E { quit; }
-
// Powers off the monitors. To turn them back on, do any input like
// moving the mouse or pressing any other key.
Mod+Shift+P { power-off-monitors; }
diff --git a/config/home-manager/window-manager/waybar/default.nix b/config/home-manager/window-manager/waybar/default.nix
index 6316cf00..5a6265b7 100644
--- a/config/home-manager/window-manager/waybar/default.nix
+++ b/config/home-manager/window-manager/waybar/default.nix
@@ -24,12 +24,10 @@
margin-bottom = 0;
spacing = 2;
-
modules-left = [
- "custom/os"
- "niri/workspaces"
];
modules-center = [
+ "custom/media"
];
modules-right = [
"tray"
@@ -48,25 +46,6 @@
"clock"
];
- "hyprland/language" = {
- format-en = "US";
- format-pt = "PT";
- };
-
- "custom/os" = {
- format = "";
- on-click = "fuzzel";
- tooltip = false;
- #menu = "on-click";
- #menu-file = ./menu/power_menu.xml;
- #menu-actions = {
- # shutdown = "shutdown";
- # reboot = "reboot";
- # suspend = "systemctl suspend";
- # hibernate = "systemctl hibernate";
- #};
- };
-
"custom/media" = {
format = "{icon} {}";
escape = true;
@@ -174,27 +153,6 @@
spacing = 10;
};
- "niri/workspaces" = {
- icon-size = 32;
- spacing = 16;
- all-outputs = false;
- on-scroll-up = "hyprctl dispatch workspace e+1";
- on-scroll-down = "hyprctl dispatch workspace e-1";
- format = "{icon}";
- format-icons = {
- "1" = "1";
- "2" = "2";
- "3" = "3";
- "4" = "4";
- "5" = "5";
- "6" = "6";
- "7" = "7";
- "8" = "8";
- "9" = "9";
- urgent = " ";
- };
- };
-
power-profiles-daemon = {
format = "{icon}";
tooltip-format = "Power profile: {profile}\nDriver: {driver}";
@@ -222,7 +180,6 @@
on-click-right = "nmtui"; #FIXME
};
-
# See more: https://github.com/prasanthrangan/hyprdots/blob/main/Configs/.config/waybar/modules/pulseaudio.jsonc
pulseaudio = {
format = "{icon}";
From 7c0dd0766b206232ea027a32c3a952070e9e0b02 Mon Sep 17 00:00:00 2001
From: Bruno Henriques <4727729+bphenriques@users.noreply.github.com>
Date: Sat, 7 Dec 2024 18:38:24 +0000
Subject: [PATCH 19/34] Major iteration. Settled with dunst as sway
notification center seems sluggish here
---
README.md | 3 +-
.../home-manager/window-manager/default.nix | 6 +-
config/home-manager/window-manager/dunst.nix | 23 +-
.../window-manager/hyprland/default.nix | 120 ------
.../window-manager/hyprland/keybindings.nix | 112 -----
.../window-manager/hyprland/rules.nix | 43 --
.../hyprland/scripts/close-active.sh | 7 -
.../hyprland/scripts/monitor-toggle.sh | 60 ---
.../window-manager/hyprland/settings.nix | 86 ----
config/home-manager/window-manager/niri.nix | 48 +--
.../window-manager/waybar/default.nix | 394 +++++++++---------
.../window-manager/waybar/menu/power_menu.xml | 28 --
.../window-manager/waybar/style.css | 170 ++------
config/nixos/default.nix | 3 +-
.../{wayland.nix => wayland/default.nix} | 7 +-
.../nixos/{ => wayland}/display-manager.nix | 0
modules/home-manager/default.nix | 11 +-
.../wayland/notifications/default.nix | 84 ++++
.../wayland/notifications/dunst.nix | 88 ++++
.../wayland/notifications}/scripts/volume.sh | 0
modules/home-manager/wayland/swww.nix | 32 ++
packages/default.nix | 35 +-
packages/dunst-brightness/default.nix | 9 +
.../dunst-brightness/src/dunst-brightness.sh | 42 ++
packages/dunst-volume/default.nix | 9 +
packages/dunst-volume/src/dunst-volume.sh | 59 +++
26 files changed, 617 insertions(+), 862 deletions(-)
delete mode 100644 config/home-manager/window-manager/hyprland/default.nix
delete mode 100644 config/home-manager/window-manager/hyprland/keybindings.nix
delete mode 100644 config/home-manager/window-manager/hyprland/rules.nix
delete mode 100644 config/home-manager/window-manager/hyprland/scripts/close-active.sh
delete mode 100644 config/home-manager/window-manager/hyprland/scripts/monitor-toggle.sh
delete mode 100644 config/home-manager/window-manager/hyprland/settings.nix
delete mode 100644 config/home-manager/window-manager/waybar/menu/power_menu.xml
rename config/nixos/{wayland.nix => wayland/default.nix} (93%)
rename config/nixos/{ => wayland}/display-manager.nix (100%)
create mode 100644 modules/home-manager/wayland/notifications/default.nix
create mode 100644 modules/home-manager/wayland/notifications/dunst.nix
rename {config/home-manager/window-manager/hyprland => modules/home-manager/wayland/notifications}/scripts/volume.sh (100%)
create mode 100644 modules/home-manager/wayland/swww.nix
create mode 100644 packages/dunst-brightness/default.nix
create mode 100755 packages/dunst-brightness/src/dunst-brightness.sh
create mode 100644 packages/dunst-volume/default.nix
create mode 100755 packages/dunst-volume/src/dunst-volume.sh
diff --git a/README.md b/README.md
index e0e022d4..82bb904e 100644
--- a/README.md
+++ b/README.md
@@ -29,10 +29,11 @@ Listing only the most relevant outputs. See the source-code for more details.
- `fzf-rg`: [`fzf`](https://github.com/junegunn/fzf) + [`ripgrep`](https://github.com/BurntSushi/ripgrep). Includes `fish` widget.
- `fzf-fd`: [`fzf`](https://github.com/junegunn/fzf) + [`fd`](https://github.com/sharkdp/fd). Includes `fish` widget.
- `preview`: Custom _barebones_ terminal file previewer to together with the other widgets. I really like [`yazi`](https://yazi-rs.github.io/) previewer but can't use it in isolation.
+- `dunst-volume`: Custom wrapper to send notifications whenever I set the volume.
Tryout using:
```shell
-nix run github:bphenriques/dotfiles#{package}
+nix run github:bphenriques/dotfiles#{package} -- {args}
```
### [Home Manager](https://github.com/nix-community/home-manager) modules
diff --git a/config/home-manager/window-manager/default.nix b/config/home-manager/window-manager/default.nix
index b4d82aa3..fc985532 100644
--- a/config/home-manager/window-manager/default.nix
+++ b/config/home-manager/window-manager/default.nix
@@ -1,4 +1,6 @@
{ config, lib, pkgs, ... }:
+# TODO: pre-script for gaming: https://github.com/diniamo/niqs/blob/53288d72902365ee8d3bfdd6aff0ec79eb7c1c36/modules/workstation/gaming.nix#L16
+
let
nerdfonts = pkgs.nerdfonts.override {
fonts = [
@@ -16,11 +18,13 @@ in
imports = [
./niri.nix # Window Manager
./waybar # Top-bar. There are fancier solutions out-there.
- ./dunst.nix # Notifications
+ ./dunst.nix # Notification Daemon
./kanshi.nix # Manage external monitors
./fuzzel.nix # Application Launcher
];
+ custom.services.swww.enable = true;
+
# Use the following theme: https://github.com/iynaix/dotfiles/blob/56d2d63b3b5f4c621429d79fb2aef8d44fdc25b9/home-manager/gui/gtk.nix#L85
home.pointerCursor = {
gtk.enable = true;
diff --git a/config/home-manager/window-manager/dunst.nix b/config/home-manager/window-manager/dunst.nix
index 24a6eb3a..08b851a3 100644
--- a/config/home-manager/window-manager/dunst.nix
+++ b/config/home-manager/window-manager/dunst.nix
@@ -1,5 +1,4 @@
{ config, lib, pkgs, ... }:
-
{
services.dunst = {
enable = true;
@@ -9,18 +8,13 @@
};
settings = {
global = {
- rounded = "yes";
- origin = "top-right";
- monitor = "0";
- alignment = "left";
- vertical_alignment = "center";
+ enable_recursive_icon_lookup = true;
+ rounded = true;
width = "400";
height = "400";
- scale = 0;
- gap_size = 0;
- progress_bar = true;
- transparency = 0;
- text_icon_padding = 0;
+ gap_size = 2;
+ progress_bar_corner_radius = 2;
+
separator_color = "frame";
sort = "yes";
idle_threshold = 120;
@@ -43,7 +37,7 @@
horizontal_padding = 10;
icon_position = "left";
indicate_hidden = "yes";
- min_icon_size = 0;
+ min_icon_size = 22;
max_icon_size = 64;
mouse_left_click = "do_action, close_current";
mouse_middle_click = "close_current";
@@ -54,10 +48,11 @@
show_indicators = "yes";
shrink = "no";
word_wrap = "yes";
- browser = "/usr/bin/env librewolf -new-tab";
};
- fullscreen_delay_everything = {fullscreen = "delay";};
+ fullscreen_delay_everything = {
+ fullscreen = "delay";
+ };
urgency_critical = {
background = "#d64e4e";
diff --git a/config/home-manager/window-manager/hyprland/default.nix b/config/home-manager/window-manager/hyprland/default.nix
deleted file mode 100644
index ffc97e67..00000000
--- a/config/home-manager/window-manager/hyprland/default.nix
+++ /dev/null
@@ -1,120 +0,0 @@
-{ inputs, config, lib, pkgs, self, ... }:
-let
- wallpapersPkg = self.private.wallpapers.override {
- selected = [ "lake-fishing-sunset" "mountains" "whale-sunset" "watch-tower" ];
- };
-in
-
-# https://github.com/Remedan/dotfiles/blob/9c0007afb4b2c7b2dd419db598ef58a44cb92e8b/modules/user/hyprland.nix#L347 ?
-# TODO: https://github.com/ErikReider/SwayOSD
-# TODO: https://github.com/JaKooLit/Ja-ZaneyOS/blob/0bed326404ad90ca6803c0a9096426a36a14a35a/config/hyprland.nix#L83
-# TODO: https://github.com/diniamo/niqs/blob/53288d72902365ee8d3bfdd6aff0ec79eb7c1c36/modules/workstation/hyprland.nix
-# https://github.com/JaKooLit/Ja-ZaneyOS/blob/0bed326404ad90ca6803c0a9096426a36a14a35a/config/hyprland.nix
-# https://github.com/Serpentian/AlfheimOS/blob/master/user/wm/hyprland/settings.nix
-
-# Screenshot: https://github.com/iynaix/dotfiles/blob/f0f8918caed8f4c245fa82fc505ae0de09a32f5c/home-manager/hyprland/screenshot.sh
-let
- openOnWorkspace = workspace: program: "[workspace ${toString workspace} silent] ${program}";
-in
-{
- imports = [
- ./settings.nix
- ./keybindings.nix
- ./rules.nix
- ];
-
- home.packages = with pkgs; [
- hyprpaper
- networkmanagerapplet
- ];
-
- home.shellAliases = {
- hypr-log = "hyprctl rollinglog --follow";
- };
-
- services.hyprpaper = {
- enable = true;
- settings = {
- preload = [ "${wallpapersPkg}/share/wallpapers/mountains.png" ];
- wallpaper = [ ",${wallpapersPkg}/share/wallpapers/mountains.png" ];
- };
- };
-
- # https://wiki.hyprland.org/Nix/Hyprland-on-Home-Manager/
- wayland.windowManager.hyprland = {
- enable = true;
- systemd = {
- enable = true;
- variables = [ "--all" ];
- enableXdgAutostart = true;
- };
-
- #settings.bind = [
- # "SUPER, grave, hyprexpo:expo, toggle"
- #];
-
- settings = {
- "monitor" = [ ",preferred,auto,auto" ];
-
- "$terminal" = "konsole";
- "$fileManager" = "thunar";
- "$menu" = "fuzzel";
- "$browser" = "firefox";
-
- env = [
- "XDG_SESSION_TYPE,wayland"
- "QT_WAYLAND_DISABLE_WINDOWDECORATION,1"
-
- # Specific for my laptop with dual gpu. lspci | grep -E 'VGA|3D' -> ls -l /dev/dri/by-path shows that card1 is the iGPU which will take precedence.
- "AQ_DRM_DEVICES,/dev/dri/card1:/dev/dri/card0"
-
- # Nvidia
- "LIBVA_DRIVER_NAME,nvidia"
- "GBM_BACKEND,nvidia-drm"
- "__GLX_VENDOR_LIBRARY_NAME,nvidia"
- ];
-
- misc = {
- disable_autoreload = false; # disable auto polling for config file changes
- animate_mouse_windowdragging = false; # disable dragging animation
- force_default_wallpaper = -1; # Set to 0 or 1 to disable the anime mascot wallpapers
- disable_hyprland_logo = false; # If true disables the random hyprland logo / anime girl background. :(
- };
-
- input = {
- # Input - More on https://wiki.archlinux.org/title/Xorg/Keyboard_configuration
- kb_layout = "us,pt";
- kb_variant = "euro,";
- kb_options = builtins.concatStringsSep " " [
- "caps:ctrl_modifier" # Replace caps-lock for Ctrl
- "grp:ralt_rshift_toggle" # Right Alt + Right Shift: Switch keyboard layouts. See more using `xkeyboard-config`
- ];
-
- follow_mouse = 1;
-
- sensitivity = 0; # -1.0 - 1.0, 0 means no modification.
-
- touchpad = {
- natural_scroll = false;
- tap_button_map = "lmr";
- };
- };
-
- # touchpad gestures
- gestures = {
- workspace_swipe = true;
- workspace_swipe_forever = true;
- };
-
- exec-once = [
- #"ags -b hypr"
- #"dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP" # Fix long-time to start systemd: https://wiki.hyprland.org/FAQ/#some-of-my-apps-take-a-really-long-time-to-open
- #"waybar"
- "${lib.getExe pkgs.hyprpaper}"
- "${lib.getExe pkgs.udiskie} --tray"
- "${pkgs.blueman}/bin/blueman-applet"
- #"${pkgs.networkmanagerapplet}/bin/nm-applet --indicator"
- ];
- };
- };
-}
diff --git a/config/home-manager/window-manager/hyprland/keybindings.nix b/config/home-manager/window-manager/hyprland/keybindings.nix
deleted file mode 100644
index 09e18ecc..00000000
--- a/config/home-manager/window-manager/hyprland/keybindings.nix
+++ /dev/null
@@ -1,112 +0,0 @@
-{ lib, config, ... }:
-
-
-# Check custom scripts: https://github.com/iynaix/dotfiles/blob/fa261818c04e6b1aa7d928a10abd66e2c31c0ed9/packages/dotfiles-rs/dotfiles/src/bin/hypr-pip.rs
-# https://github.com/dileep-kishore/nixos-hyprland/blob/main/home/common/optional/desktops/hyprland/config.nix
-# https://github.com/JaKooLit/Hyprland-Dots/blob/main/config/hypr/configs/Keybinds.conf
-
-# Force Quit active: https://github.com/JaKooLit/Hyprland-Dots/blob/main/config/hypr/configs/Keybinds.conf
-
-# TODO: Alt F4 means keep closing active window until there is none. Then, show list of options.
-let
- shortcuts = [
- "$mod, SPACE, exec, $menu"
- ];
-
- focus = [
- # Move focus with mod + arrow keys
- "$mod, left, movefocus, l"
- "$mod, right, movefocus, r"
- "$mod, up, movefocus, u"
- "$mod, down, movefocus, d"
- ];
-
- workspace = [
- # Switch workspaces with mod + [0-9]
- "$mod, 1, workspace, 1"
- "$mod, 2, workspace, 2"
- "$mod, 3, workspace, 3"
- "$mod, 4, workspace, 4"
- "$mod, 5, workspace, 5"
- "$mod, 6, workspace, 6"
- "$mod, 7, workspace, 7"
- "$mod, 8, workspace, 8"
- "$mod, 9, workspace, 9"
- "$mod, 0, workspace, 10"
-
- # Move active window to a workspace with mod + SHIFT + [0-9]
- "$mod SHIFT, 1, movetoworkspace, 1"
- "$mod SHIFT, 2, movetoworkspace, 2"
- "$mod SHIFT, 3, movetoworkspace, 3"
- "$mod SHIFT, 4, movetoworkspace, 4"
- "$mod SHIFT, 5, movetoworkspace, 5"
- "$mod SHIFT, 6, movetoworkspace, 6"
- "$mod SHIFT, 7, movetoworkspace, 7"
- "$mod SHIFT, 8, movetoworkspace, 8"
- "$mod SHIFT, 9, movetoworkspace, 9"
- "$mod SHIFT, 0, movetoworkspace, 10"
-
- # Example special workspace (scratchpad)
- "$mod, S, togglespecialworkspace, magic"
- "$mod SHIFT, S, movetoworkspace, special:magic"
-
- # Scroll through existing workspaces with mod + scroll
- "$mod, mouse_down, workspace, e+1"
- "$mod, mouse_up, workspace, e-1"
-
- # focus the previous / next desktop in the current monitor (DE style)
- "CTRL_ALT, Left, workspace, m-1"
- "CTRL_ALT, Right, workspace, m+1"
- ];
-in
-{
- wayland.windowManager.hyprland.settings = lib.mkMerge [
- #{ bind = [ "$mod, W, exec, pkill -SIGUSR1 waybar" ]; } # Toggle waybar
- {
- # See https://wiki.hyprland.org/Configuring/Keywords/
- "$mod" = "SUPER"; # Sets "Windows" key as main modifier
-
- # Mouse bindings
- bindm = [
- # Move/resize windows with mod + LMB/RMB and dragging
- "bindm = $mod, mouse:272, movewindow"
- "bindm = $mod, mouse:273, resizewindow"
- ];
-
-
- bind = [
- # Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more
- "$mod, Q, killactive,"
- "$mod, F, fullscreen, 0" # Fullscreen entire screen
- "$mod SHIFT, F, fullscreen, 0" # Fullscreen entire screen but with top bar
- "$mod CTRL, F, fullscreen, 0 2" # Instruct app to go fullscreen
- "$mod, P, pin" # Pin screen
- #"$mod, F, togglefloating,"
- "$mod_ALT, F4, exit," # Exit Hyprland # FIXME: Do I need it?
- "$mod, P, pseudo," # dwindle
- "$mod, J, togglesplit," # dwindle
-
- "ALT, Tab, cyclenext"
- "ALT_SHIFT, Tab, cyclenext, prev"
- ] ++ shortcuts ++ focus ++ workspace;
-
- bindel = [
- # Laptop multimedia keys for volume and LCD brightness
- ",XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+"
- ",XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"
- ",XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"
- ",XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"
- ",XF86MonBrightnessUp, exec, brightnessctl s 10%+"
- ",XF86MonBrightnessDown, exec, brightnessctl s 10%-"
- ];
-
- # Requires playerctl
- bindl = [
- ", XF86AudioNext, exec, playerctl next"
- ", XF86AudioPause, exec, playerctl play-pause"
- ", XF86AudioPlay, exec, playerctl play-pause"
- ", XF86AudioPrev, exec, playerctl previous"
- ];
- }
- ];
-}
diff --git a/config/home-manager/window-manager/hyprland/rules.nix b/config/home-manager/window-manager/hyprland/rules.nix
deleted file mode 100644
index 5bb1a920..00000000
--- a/config/home-manager/window-manager/hyprland/rules.nix
+++ /dev/null
@@ -1,43 +0,0 @@
-{ lib, config, ... }:
-{
- wayland.windowManager.hyprland.settings = lib.mkMerge [
- {
- windowrulev2 = [
- "dimaround,floating:1"
- "bordersize 5,fullscreen:1" # monocle mode
- "float,class:(wlroots)" # hyprland debug session
-
-
- # Ignore maximize requests from apps. You'll probably like this.
- "suppressevent maximize, class:.*"
- # "suppressevent fullscreen, class:.*"
-
- # Save dialog
- "float,class:(xdg-desktop-portal-gtk)"
- "size <50% <50%,class:(xdg-desktop-portal-gtk)"
-
- # Firefox
- "float,title:^(About Mozilla Firefox)$"
- "float,class:^(firefox)$,title:^(Picture-in-Picture)$"
- "keepaspectratio,class:^(firefox)$,title:^(Picture-in-Picture)$"
-
- # Misc
- "float,class:^(org.pulseaudio.pavucontrol)$"
- "float,class:^(nm-connection-editor)$"
- "float,class:^(nblueman-manager)$"
- ];
- }
- {
- layerrule = [
- ];
- }
- ];
-}
-
-#"blur,notifications"
-#"ignorezero,notifications"
-#"blur,swaync-notification-window"
-#"ignorezero,swaync-notification-window"
-#"blur,swaync-control-center"
-#"ignorezero,swaync-control-center"
-#"blur,logout_dialog"
diff --git a/config/home-manager/window-manager/hyprland/scripts/close-active.sh b/config/home-manager/window-manager/hyprland/scripts/close-active.sh
deleted file mode 100644
index 598e5d7b..00000000
--- a/config/home-manager/window-manager/hyprland/scripts/close-active.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-
-if [ "$(hyprctl activewindow -j | jq -r ".class")" = "Steam" ]; then
- xdotool getactivewindow windowunmap
-else
- hyprctl dispatch killactive ""
-fi
\ No newline at end of file
diff --git a/config/home-manager/window-manager/hyprland/scripts/monitor-toggle.sh b/config/home-manager/window-manager/hyprland/scripts/monitor-toggle.sh
deleted file mode 100644
index 8c099888..00000000
--- a/config/home-manager/window-manager/hyprland/scripts/monitor-toggle.sh
+++ /dev/null
@@ -1,60 +0,0 @@
-#! /usr/bin/env sh
-
-# A hyprland script for a laptop-external-monitor setup, toggling between which is in use
-
-# Launch at startup to make hyprland disable the internal monitor if an external monitor is detected and enabled
-# Additionally it's called with a keybind to switch between a laptop monitor and an external display
-# Ideally the conditional monitor behaviour was instead done directly in hyprland.conf, but I'm not sure whether that's possible
-#
-# Relevant info:
-# - hyprctl monitors: identifies currently enabled monitors
-# - hyprctl monitors all: identifies ALL connected monitors - including those not in use
-#
-# Suggested use:
-# Add this line somewhere after the regular monitor configuration in hyprland.conf:
-# exec = /path/to/hyprland-monitors-toggle.sh
-# Add a keybind to run this script on demand:
-# bind =,SomeKeyHere, exec, /path/to/hyprland-monitors-toggle.sh
-
-move_all_workspaces_to_monitor() {
- TARGET_MONITOR="$1"
-
- hyprctl workspaces | grep ^workspace | cut --delimiter ' ' --fields 3 | xargs -I '{}' hyprctl dispatch moveworkspacetomonitor '{}' "$TARGET_MONITOR"
-
- # Previous approach
- #hyprctl swapactiveworkspaces $EXTERNAL_MONITOR $INTERNAL_MONITOR
-}
-
-# TODO: Detect these instead of hardcoding them
-INTERNAL_MONITOR="ADD YOUR INTERNAL MONITOR NAME HERE"
-EXTERNAL_MONITOR="ADD YOUR EXTERNAL MONITOR NAME HERE"
-
-NUM_MONITORS=$(hyprctl monitors all | grep --count Monitor)
-NUM_MONITORS_ACTIVE=$(hyprctl monitors | grep --count Monitor)
-
-# For initial startup if you use hyprland's default monitor settings:
-# Turn off the laptop monitor if it + another monitor is active
-if [ "$NUM_MONITORS_ACTIVE" -ge 2 ] && hyprctl monitors | cut --delimiter ' ' --fields 2 | grep --quiet ^$INTERNAL_MONITOR; then
- # Doing this I hopefully end up on workspace 1 on the external monitor rather than 2 at startup
- move_all_workspaces_to_monitor $EXTERNAL_MONITOR
- hyprctl keyword monitor "$INTERNAL_MONITOR, disable"
- # Alternate fix to ensure I start on workspace 1
- #hyprctl dispatch workspace 1
- exit
-fi
-
-# For dynamically toggling which monitor is active later via a keybind
-if [ "$NUM_MONITORS" -gt 1 ]; then # Handling multiple monitors
- if hyprctl monitors | cut --delimiter ' ' --fields 2 | grep --quiet ^$EXTERNAL_MONITOR; then
- hyprctl keyword monitor $INTERNAL_MONITOR,preferred,0x0,1
- move_all_workspaces_to_monitor $INTERNAL_MONITOR
- hyprctl keyword monitor "$EXTERNAL_MONITOR, disable"
- else
- hyprctl keyword monitor $EXTERNAL_MONITOR,preferred,0x0,1
- move_all_workspaces_to_monitor $EXTERNAL_MONITOR
- hyprctl keyword monitor "$INTERNAL_MONITOR, disable"
- fi
-else # If the external monitor is disconnected without running this script first, it might become the case that no monitor is on - therefore turn on the laptop monitor!
- hyprctl keyword monitor $INTERNAL_MONITOR,preferred,0x0,1
- move_all_workspaces_to_monitor $INTERNAL_MONITOR
-fi
\ No newline at end of file
diff --git a/config/home-manager/window-manager/hyprland/settings.nix b/config/home-manager/window-manager/hyprland/settings.nix
deleted file mode 100644
index 27229af2..00000000
--- a/config/home-manager/window-manager/hyprland/settings.nix
+++ /dev/null
@@ -1,86 +0,0 @@
-{ pkgs, lib, config, ... }:
-
-let
- pointer = config.home.pointerCursor;
- cursorName = "Bibata-Modern-Classic-Hyprcursor";
-in
-
-# https://github.com/hyprwm/Hyprland/blob/main/example/hyprland.conf
-# https://github.com/iynaix/dotfiles/blob/f0f8918caed8f4c245fa82fc505ae0de09a32f5c/home-manager/hyprland/default.nix
-{
- #
- wayland.windowManager.hyprland.settings = {
- general = {
- gaps_in = 2;
- gaps_out = 0;
- border_size = 1;
- layout = "master";
- no_border_on_floating = true;
-
- # https://wiki.hyprland.org/Configuring/Variables/#variable-types for info about colors
- "col.active_border" = "rgba(33ccffee) rgba(00ff99ee) 45deg";
- "col.inactive_border" = "rgba(595959aa)";
-
- resize_on_border = true;
-
- # Please see https://wiki.hyprland.org/Configuring/Tearing/ before you turn this on
- allow_tearing = false;
- };
-
- decoration = {
- rounding = 2;
-
- dim_inactive = false;
-
- # https://wiki.hyprland.org/Configuring/Variables/#blur
- blur = {
- enabled = true;
- size = 2;
- passes = 3;
- new_optimizations = true;
- };
-
- # Disable shadows? I honstly dont care much about blur
- };
-
- # https://wiki.hyprland.org/Configuring/Variables/#animations
- animations = {
- enabled = true;
-
- # Default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more
- bezier = [
- "overshot, 0.05, 0.9, 0.1, 1.05"
- "smoothOut, 0.36, 0, 0.66, -0.56"
- "smoothIn, 0.25, 1, 0.5, 1"
- ];
-
- animation = [
- "windows, 1, 5, overshot, slide"
- "windowsOut, 1, 4, smoothOut, slide"
- "windowsMove, 1, 4, smoothIn, slide"
- "layers, 1, 5, default, popin 80%"
- "border, 1, 5, default"
- # 1 loop every 5 minutes
- "borderangle, 1, ${toString (10 * 60 * 5)}, default, loop"
- "fade, 1, 5, smoothIn"
- "fadeDim, 1, 5, smoothIn"
- "workspaces, 1, 6, default"
- ];
- };
-
- # See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more
- dwindle = {
- pseudotile = true; # Master switch for pseudotiling. Enabling is bound to mod + P in the keybinds section below
- preserve_split = true; # You probably want this
- };
-
- # See https://wiki.hyprland.org/Configuring/Master-Layout/ for more
- master = {
- new_status = "master";
- };
-
- exec-once = [
- "hyprctl setcursor ${cursorName} ${toString pointer.size}"
- ];
- };
-}
\ No newline at end of file
diff --git a/config/home-manager/window-manager/niri.nix b/config/home-manager/window-manager/niri.nix
index 5db69245..58b11f7b 100644
--- a/config/home-manager/window-manager/niri.nix
+++ b/config/home-manager/window-manager/niri.nix
@@ -1,4 +1,4 @@
-{ config, lib, pkgs, self, ... }:
+{ config, lib, pkgs, self, community, ... }:
# Check custom scripts: https://github.com/iynaix/dotfiles/blob/fa261818c04e6b1aa7d928a10abd66e2c31c0ed9/packages/dotfiles-rs/dotfiles/src/bin/hypr-pip.rs
# https://github.com/dileep-kishore/nixos-hyprland/blob/main/home/common/optional/desktops/hyprland/config.nix
# https://github.com/JaKooLit/Hyprland-Dots/blob/main/config/hypr/configs/Keybinds.conf
@@ -24,8 +24,16 @@
# Idle effect: https://github.com/nyawox/nixboxes/blob/ecab4559da256b4f1198ca7d39d6e5b1d4442296/home/desktop/niri/swayidle.nix#L24
+# Screencast? https://github.com/maximbaz/dotfiles/blob/98ff8b69370e86879faf57b29d07cfcb6aff4306/modules/linux/xdg.nix#L2
+
# TODO: Alt F4 means keep closing active window until there is none. Then, show list of options.
let
+
+ # nix repl
+ # then :lf .
+ # then inputs.nixpkgs.lib.strings.concatMapStringsSep " " (x: ''"${x}"'') inputs.nixpkgs.lib.strings.splitString " " "please run this command"
+ # run-cmd = cmd: lib.strings.concatMapStringsSep " " (x: ''"${x}"'') lib.strings.splitString " " cmd;
+
wallpapersPkg = self.private.wallpapers.override {
selected = [ "lake-fishing-sunset" "mountains" "whale-sunset" "watch-tower" ];
};
@@ -76,22 +84,6 @@ in
];
services.gnome-keyring.enable = true;
- systemd.user.services = {
- swww = {
- Unit = {
- Description = "Efficient animated wallpaper daemon for wayland";
- PartOf = [ "graphical-session.target" ];
- After = [ "graphical-session.target" ];
- };
- Install.WantedBy = [ "graphical-session.target" ];
- Service = {
- Type = "simple";
- ExecStart = ''${pkgs.swww}/bin/swww-daemon'';
- ExecStop = "${pkgs.swww}/bin/swww kill";
- Restart = "on-failure";
- };
- };
- };
xdg.configFile."niri/config.kdl".text = ''
workspace "coding"
@@ -128,7 +120,7 @@ in
MOZ_ENABLE_WAYLAND "1"
}
- spawn-at-startup "${lib.getExe pkgs.swww}" "img" "${wallpapersPkg}/share/wallpapers/mountains.png"
+ spawn-at-startup "${lib.getExe pkgs.swww}" "img" "--transition-type" "none" "${wallpapersPkg}/share/wallpapers/mountains.png"
spawn-at-startup "xwayland-satellite" ":21"
spawn-at-startup "${lib.getExe pkgs.waybar}"
@@ -148,10 +140,6 @@ in
mouse {
}
-
- // Focus windows and outputs automatically when moving the mouse into them.
- // Setting max-scroll-amount="0%" makes it work only on windows already fully on screen.
- // focus-follows-mouse max-scroll-amount="0%"
}
output "eDP-1" {
@@ -168,7 +156,7 @@ in
proportion 0.66667
proportion 1.0
}
- default-column-width { proportion 0.75; }
+ default-column-width { proportion 1.00; }
focus-ring {
width 3
active-color "#7fc8ff"
@@ -203,14 +191,14 @@ in
Mod+Shift+E { quit; }
// Suggested binds for running programs: terminal, app launcher, screen locker.
- Mod+Return { spawn "konsole"; }
- Mod+Space { spawn "fuzzel"; }
+ Mod+Return { spawn "${lib.getExe community.pkgs.ghostty}"; }
+ Mod+Space { spawn "${lib.getExe pkgs.fuzzel}"; }
Super+Alt+L { spawn "swaylock"; }
// Audio
- XF86AudioRaiseVolume allow-when-locked=true { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1+"; }
- XF86AudioLowerVolume allow-when-locked=true { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1-"; }
- XF86AudioMute allow-when-locked=true { spawn "wpctl" "set-mute" "@DEFAULT_AUDIO_SINK@" "toggle"; }
+ XF86AudioRaiseVolume allow-when-locked=true { spawn "${self.pkgs.dunst-volume}" "increase"; }
+ XF86AudioLowerVolume allow-when-locked=true { spawn "${self.pkgs.dunst-volume}" "decrease"; }
+ XF86AudioMute allow-when-locked=true { spawn "${self.pkgs.dunst-volume}" "toggle-mute"; }
XF86AudioMicMute allow-when-locked=true { spawn "wpctl" "set-mute" "@DEFAULT_AUDIO_SOURCE@" "toggle"; }
XF86AudioNext allow-when-locked=true { spawn "playerctl" "next"; }
XF86AudioPause allow-when-locked=true { spawn "playerctl" "play-pause"; }
@@ -218,8 +206,8 @@ in
XF86AudioPrev allow-when-locked=true { spawn "playerctl" "previous"; }
// Brightness
- XF86MonBrightnessUp allow-when-locked=true { spawn "brightnessctl" "s" "10%+"; }
- XF86MonBrightnessDown allow-when-locked=true { spawn "brightnessctl" "s" "10%-"; }
+ XF86MonBrightnessUp allow-when-locked=true { spawn "${self.pkgs.dunst-brightness}" "increase"; }
+ XF86MonBrightnessDown allow-when-locked=true { spawn "${self.pkgs.dunst-brightness}" "decrease"; }
Mod+Left { focus-column-left; }
Mod+Down { focus-window-down; }
diff --git a/config/home-manager/window-manager/waybar/default.nix b/config/home-manager/window-manager/waybar/default.nix
index 5a6265b7..74a8f421 100644
--- a/config/home-manager/window-manager/waybar/default.nix
+++ b/config/home-manager/window-manager/waybar/default.nix
@@ -1,208 +1,208 @@
{ lib, config, pkgs, ... }:
-# https://codeberg.org/explosion-mental/wallust generates colors autoamtically.
# https://github.com/bitSheriff/dotfiles/blob/master/configuration/.config/waybar/modules/modules.jsonc
-# Notification: https://github.com/prasanthrangan/hyprdots/blob/main/Configs/.config/waybar/modules/notifications.jsonc
+# TODO: Notification: https://github.com/prasanthrangan/hyprdots/blob/main/Configs/.config/waybar/modules/notifications.jsonc
+let
+ modules = {
+ cpu = {
+ format = "{usage}% ";
+ };
+ temperature = {
+ thermal-zone = 2;
+ critical-threshold = 80;
+ format = "{icon} {temperatureC}°C";
+ format-icons = ["" "" "" "" ""];
+ };
-# pkill waybar && hyprctl dispatch exec waybar
-{
- # https://github.com/nix-community/home-manager/issues/3599
- # do not use the systemd service as it is flaky and unreliable
+ # FIXME: Does not work with ZFS
+ disk = {
+ interval = 30;
+ format = " {percentage_used}%";
+ path = "/";
+ tooltip = true;
+ unit = "GB";
+ tooltip-format = "Available {free} of {total}";
+ };
+
+ memory = {
+ interval = 30;
+ format = " {usage}%";
+ max-length = 10;
+ tooltip = true;
+ tooltip-format = " {used:0.1f}GB/{total:0.1f}GB";
+ };
- programs.waybar = {
- enable = true;
- style = ./style.css;
- settings = {
- "bar" = {
- #output = ["eDP-1" "HDMI-A-1"];
- reload_style_on_change = true;
- layer = "top";
- position = "top";
- margin-left = 0;
- margin-right = 0;
- margin-top = 0;
- margin-bottom = 0;
- spacing = 2;
-
- modules-left = [
- ];
- modules-center = [
- "custom/media"
- ];
- modules-right = [
- "tray"
- "pulseaudio"
- "battery"
- #"hyprland/language" # FIXME: for niri
- "network"
-
- # List of unsure widgets
- "memory"
- "cpu"
- "disk"
- "backlight"
- "power-profiles-daemon"
-
- "clock"
- ];
-
- "custom/media" = {
- format = "{icon} {}";
- escape = true;
- return-type = "json";
- max-length = 40;
- on-click = "playerctl play-pause";
- on-click-right = "playerctl stop";
- smooth-scrolling-threshold = 10; # // This value was tested using a trackpad, it should be lowered if using a mouse.
- on-scroll-up = "playerctl next";
- on-scroll-down = "playerctl previous";
- exec = "$HOME/.config/waybar/mediaplayer.py 2> /dev/null"; # // Script in resources/custom_modules folder
- };
-
- #"wlr/taskbar" = {
- # all-outputs = false;
- # format = "{icon}";
- # icon-size = 13;
- # tooltip = true;
- # tooltip-format = "{title}";
- # active-first = false;
- #};
-
- cpu = {
- format = "{usage}% ";
- tooltip = false;
- };
-
- temperature = {
- thermal-zone = 2;
- critical-threshold = 80;
- format = "{temperatureC}°C ";
- };
-
- disk = {
- interval = 30;
- format = " {percentage_used}%";
- path = "/";
- tooltip = true;
- unit = "GB";
- tooltip-format = "Available {free} of {total}";
+ # FIXME: mkIf laptop
+ battery = {
+ states = {
+ good = 95;
+ warning = 30;
+ critical = 20;
+ };
+ format = "{icon} {capacity}%";
+ format-charging = " {capacity}%";
+ format-plugged = " {capacity}%";
+ format-alt = "{time} {icon}";
+ format-icons = [ "" "" "" "" "" ];
+ format-time = "{H}h {M}min";
+ # on-click = "${lib.getExe pkgs.wlogout} &"; FIXME
+ };
+
+ # FIXME: mkIf laptop
+ backlight = {
+ format = "{icon} {percent}%";
+ format-icons = ["" "" "" "" "" "" "" "" ""];
+ on-scroll-up = "${lib.getExe pkgs.brightnessctl} s +1%";
+ on-scroll-down = "${lib.getExe pkgs.brightnessctl} s 1%-";
+ min-length = 6;
+ # "on-click": "wdisplays"
+ };
+
+ # FIXME: mkIf laptop
+ power-profiles-daemon = {
+ format = "{icon}";
+ tooltip-format = "{profile}";
+ tooltip = true;
+ format-icons = {
+ default = "";
+ performance = "";
+ balanced = "";
+ power-saver = "";
+ };
+ min-length = 6;
+ };
+
+ "custom/os" = {
+ format = "";
+ on-click = "${lib.getExe pkgs.fuzzel}";
+ };
+
+ "niri/language" = {
+ format-en = " US";
+ format-pt = " PT";
+ on-click-release = "${lib.getExe pkgs.niri} msg action switch-layout next";
+ };
+
+ "custom/media" = {
+ format = "{icon} {}";
+ escape = true;
+ return-type = "json";
+ max-length = 40;
+ on-click = "playerctl play-pause";
+ on-click-right = "playerctl stop";
+ smooth-scrolling-threshold = 10;
+ on-scroll-up = "playerctl next";
+ on-scroll-down = "playerctl previous";
+ };
+
+ network = {
+ format-wifi = " {icon}";
+ format-ethernet = " ";
+ format-disconnected = "";
+ format-icons = [ " " " " " " " " " " ];
+ tooltip = true;
+ tooltip-format = ''
+ IP: {ipaddr}/{cidr}
+ Gateway: {gwaddr}'';
+
+ on-click = "${config.xdg.configHome}/rofi/rofi-wifi-menu"; # FIXME
+ on-click-right = "nmtui"; #FIXME
+ };
+
+ clock = {
+ format = "{:%a %d %b %H:%M}";
+ interval = 10;
+ tooltip-format = "{calendar}";
+ calendar = {
+ mode = "year";
+ mode-mon-col = 3;
+ weeks-pos = "right" ;
+ on-scroll = 1;
+ on-click-right = "mode";
+ format = {
+ months = "{}";
+ days = "{}";
+ weeks = "W{}";
+ weekdays = "{}";
+ today = "{}";
};
+ };
+ actions = {
+ on-click-right = "mode";
+ on-click-forward = "tz_up";
+ on-click-backward = "tz_down";
+ on-scroll-up = "shift_up";
+ on-scroll-down = "shift_down";
+ };
+ };
+
+ tray = {
+ icon-size = 18;
+ spacing = 10;
+ };
- memory = {
- interval = 30;
- format = " {usage}%";
- max-length = 10;
- tooltip = true;
- tooltip-format = " {used:0.1f}GB/{total:0.1f}GB";
- };
-
- backlight = {
- format = "{icon} {percent}%";
- format-icons = ["" "" "" "" "" "" "" "" ""];
- on-scroll-up = "${lib.getExe pkgs.brightnessctl} s +1%";
- on-scroll-down = "${lib.getExe pkgs.brightnessctl} s 1%-";
- min-length = 6;
- };
-
- battery = {
- states = {
- good = 95;
- warning = 30;
- critical = 20;
- };
- format = "{icon} {capacity}%";
- format-charging = " {capacity}%";
- format-plugged = " {capacity}%";
- format-alt = "{time} {icon}";
- format-icons = [ "" "" "" "" "" ];
- format-time = "{H}h {M}min";
- on-click = "${lib.getExe pkgs.wlogout} &";
- };
-
- # TODO: bluetooth
-
- clock = {
- format = "{:%a %d %b %H:%M}";
- interval = 10;
- tooltip-format = "{calendar}";
- calendar = {
- mode = "year";
- mode-mon-col = 3;
- weeks-pos = "right" ;
- on-scroll = 1;
- on-click-right = "mode";
- format = {
- months = "{}";
- days = "{}";
- weeks = "W{}";
- weekdays = "{}";
- today = "{}";
- };
- };
- actions = {
- on-click-right = "mode";
- on-click-forward = "tz_up";
- on-click-backward = "tz_down";
- on-scroll-up = "shift_up";
- on-scroll-down = "shift_down";
- };
- };
-
- tray = {
- icon-size = 18;
- spacing = 10;
- };
-
- power-profiles-daemon = {
- format = "{icon}";
- tooltip-format = "Power profile: {profile}\nDriver: {driver}";
- tooltip = true;
- format-icons = {
- default = "";
- performance = "";
- balanced = "";
- power-saver = "";
- };
- min-length = 6;
- };
-
- network = {
- format-wifi = " {icon}";
- format-ethernet = " ";
- format-disconnected = "";
- format-icons = [ " " " " " " " " " " ];
- tooltip = true;
- tooltip-format = ''
- IP: {ipaddr}/{cidr}
- Gateway: {gwaddr}'';
-
- on-click = "${config.xdg.configHome}/rofi/rofi-wifi-menu"; # FIXME
- on-click-right = "nmtui"; #FIXME
- };
-
- # See more: https://github.com/prasanthrangan/hyprdots/blob/main/Configs/.config/waybar/modules/pulseaudio.jsonc
- pulseaudio = {
- format = "{icon}";
- format-bluetooth = "{icon}";
- format-bluetooth-muted = " {icon}";
- #format-muted = " {format_source}";
- format-source = "";
- format-source-muted = "";
- format-icons = {
- headphone = "";
- hands-free = "";
- headset = "";
- phone = "";
- portable = "";
- car = "";
- default = ["" "" ""];
- };
- on-click = "${lib.getExe pkgs.pavucontrol}";
-
- tooltip = true;
- tooltip-format = ''{icon} {volume}% - {desc}'';
- };
+ # See more: https://github.com/prasanthrangan/hyprdots/blob/main/Configs/.config/waybar/modules/pulseaudio.jsonc
+ pulseaudio = {
+ format = "{icon}";
+ format-bluetooth = "{icon}";
+ format-bluetooth-muted = " {icon}";
+ format-source = " {volume}%";
+ format-source-muted = " {desc}";
+ format-icons = {
+ headphone = "";
+ hands-free = "";
+ headset = "";
+ phone = "";
+ portable = "";
+ car = "";
+ default = ["" "" ""];
};
+ on-click = "${lib.getExe pkgs.pavucontrol}";
+
+ tooltip = true;
+ tooltip-format = ''
+ Audio: {desc}
+ Mic: {format_source}
+ '';
+ };
+ };
+
+ groups = {
+ "group/stats" = {
+ orientation = "inherit";
+ modules = [ "disk" "memory" "cpu" "temperature" ];
+ };
+ "group/toggles" = {
+ orientation = "inherit";
+ modules = [ "niri/language" "power-profiles-daemon" "pulseaudio" "network" "battery" ];
+ };
+ };
+in
+{
+ programs.waybar = {
+ enable = true;
+ systemd.enable = false; # Run manually as it seems flaky: https://github.com/nix-community/home-manager/issues/3599
+ style = ./style.css; # Not using pkgs.writeText as having the file is handy to debug: waybar -s style.css
+ settings = {
+ default = lib.attrsets.mergeAttrsList [
+ modules
+ groups
+ {
+ reload_style_on_change = true;
+
+ layer = "top";
+ position = "top";
+ margin-left = 5;
+ margin-right = 5;
+ margin-top = 5;
+ margin-bottom = 0;
+ spacing = 5;
+
+ modules-left = [ "custom/os" ];
+ modules-center = [ "custom/media" ];
+ modules-right = [ "group/toggles" "clock" ];
+ }
+ ];
};
};
}
diff --git a/config/home-manager/window-manager/waybar/menu/power_menu.xml b/config/home-manager/window-manager/waybar/menu/power_menu.xml
deleted file mode 100644
index 49c75e35..00000000
--- a/config/home-manager/window-manager/waybar/menu/power_menu.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/config/home-manager/window-manager/waybar/style.css b/config/home-manager/window-manager/waybar/style.css
index 5a63027d..f61369d3 100644
--- a/config/home-manager/window-manager/waybar/style.css
+++ b/config/home-manager/window-manager/waybar/style.css
@@ -1,165 +1,43 @@
-/* Catppuccin Mocha color scheme */
-@define-color rosewater #f5e0dc;
-@define-color flamingo #f2cdcd;
-@define-color pink #f5c2e7;
-@define-color mauve #cba6f7;
-@define-color red #f38ba8;
-@define-color maroon #eba0ac;
-@define-color peach #fab387;
-@define-color yellow #f9e2af;
-@define-color green #a6e3a1;
-@define-color teal #94e2d5;
-@define-color sky #89dceb;
-@define-color sapphire #74c7ec;
-@define-color blue #89b4fa;
-@define-color lavender #b4befe;
-@define-color text #cdd6f4;
-@define-color subtext1 #bac2de;
-@define-color subtext0 #a6adc8;
-@define-color overlay2 #9399b2;
-@define-color overlay1 #7f849c;
-@define-color overlay0 #6c7086;
-@define-color surface2 #585b70;
-@define-color surface1 #45475a;
-@define-color surface0 #313244;
-@define-color base #1e1e2e;
-@define-color mantle #181825;
-@define-color crust #11111b;
-
-
-
-@define-color bg_main rgba(25, 25, 25, 0.65);
-@define-color bg_main_tooltip rgba(0, 0, 0, 0.7);
-
-
-/*base background color of selections */
-@define-color bg_hover rgba(200, 200, 200, 0.3);
-/*base background color of active elements */
-@define-color bg_active rgba(100, 100, 100, 0.5);
-
-/*base border color*/
-@define-color border_main rgba(255, 255, 255, 0.2);
-/*text color for entries, views and content in general */
-@define-color content_main white;
-/*text color for entries that are unselected */
-@define-color content_inactive rgba(255, 255, 255, 0.25);
-
+@define-color text white;
* {
- font-family: "Maple Mono", "CaskaydiaCove NF";
- font-size: 15px;
- min-height: 0;
+ border: none;
+ border-radius: 0;
+ font-family: "Ubuntu Nerd Font";
+ font-size: 15px;
+ min-height: 0;
}
#waybar {
- background: rgba(30, 30, 46, 0.75);
+ background: transparent;
color: @text;
}
+#toggles,
+#clock,
#custom-os {
- font-family: "JetBrainsMono Nerd Font";
- font-size: 20px;
- padding-left: 12px;
- padding-right: 20px;
- transition: all 0.25s cubic-bezier(0.165, 0.84, 0.44, 1);
-}
-#custom-os_button:hover {
- background: @bg_hover;
- color: @content_main;
-}
-
-#workspaces {
- color: transparent;
- margin-right: 1.5px;
- margin-left: 1.5px;
-}
-#workspaces button {
- padding: 3px;
- color: @content_inactive;
- transition: all 0.25s cubic-bezier(0.165, 0.84, 0.44, 1);
-}
-#workspaces button.active {
- color: @bg_active;
-}
-#workspaces button.focused {
-}
-#workspaces button.urgent {
- background: rgba(255, 200, 0, 0.35);
- border-bottom: 3px dashed @warning_color;
- color: @warning_color;
-}
-#workspaces button:hover {
- background: @bg_hover;
- color: @content_main;
-}
-
-window#waybar.fullscreen,
-window#waybar.swallowing {
- color: @red;
+ padding: 0.4rem 0.7rem;
+ border-radius: 6px;
+ background: rgba(30, 30, 46, 0.75);
}
+#power-profiles-daemon,
+#pulseaudio,
#network,
-#idle_inhibitor,
-#cpu,
-#memory,
-#backlight,
-#battery,
-#pulseaudio {
- padding: 0.1rem 0.7rem;
- margin: 5px 5px;
+#keyboard,
+#battery
+{
+ margin-left: 0.7rem;
+ margin-right: 0.7rem;
}
-#network {
- color: @text;
+#keyboard {
margin-left: 0px;
- margin-right: 0px;
}
-
-#cpu {
- color: @pink;
-}
-
-#memory {
- color: @yellow;
-}
-
-#clock {
- color: @mauve;
- margin: 5px 5px;
-}
-
#battery {
- color: @pink;
-}
-
-#language {
- margin: 5px 5px;
- padding: 0.1rem 0.7rem;
- border-radius: 5px;
- border: 1px solid white;
-}
-
-#battery.charging {
- color: @pink;
-}
-
-#battery.warning:not(.charging) {
- color: @mauve;
-}
-
-#backlight {
- color: @yellow;
-}
-
-#backlight,
-#battery {
- color: @pink;
-}
-
-#pulseaudio {
- color: @green;
+ margin-right: 0px;
}
-
-#tray {
- padding: 0.1rem 0.7rem;
+#power-profiles-daemon {
+ margin-left: -5px;
+ margin-right: -5px;
}
\ No newline at end of file
diff --git a/config/nixos/default.nix b/config/nixos/default.nix
index 3c2cd7af..b5195784 100644
--- a/config/nixos/default.nix
+++ b/config/nixos/default.nix
@@ -3,8 +3,7 @@
imports = [
./programs.nix
./services.nix
- ./display-manager.nix
- ./wayland.nix
+ ./wayland
# Choose one file browser
./thunar.nix
diff --git a/config/nixos/wayland.nix b/config/nixos/wayland/default.nix
similarity index 93%
rename from config/nixos/wayland.nix
rename to config/nixos/wayland/default.nix
index d544d5d9..61bff6a0 100644
--- a/config/nixos/wayland.nix
+++ b/config/nixos/wayland/default.nix
@@ -1,5 +1,9 @@
-{ pkgs, ... }:
+{ pkgs, lib, network-devices, ... }:
{
+ imports = [
+ ./display-manager.nix
+ ];
+
# https://github.com/sodiboo/niri-flake/blob/main/flake.nix
# https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/programs/wayland/wayland-session.nix
# https://github.com/nyawox/nixboxes/blob/ecab4559da256b4f1198ca7d39d6e5b1d4442296/home/desktop/niri/general.nix
@@ -40,4 +44,5 @@
gnome-system-monitor
gnome-calculator
];
+
}
diff --git a/config/nixos/display-manager.nix b/config/nixos/wayland/display-manager.nix
similarity index 100%
rename from config/nixos/display-manager.nix
rename to config/nixos/wayland/display-manager.nix
diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix
index 51fd803e..883718ef 100644
--- a/modules/home-manager/default.nix
+++ b/modules/home-manager/default.nix
@@ -1,7 +1,8 @@
{
- programs-dotfiles = ./programs/dotfiles.nix;
- programs-project = ./programs/project.nix;
- programs-fzf-fd = ./programs/fzf-fd.nix;
- programs-fzf-rg = ./programs/fzf-rg.nix;
- xdg-mime-apps = ./xdg-mime-apps.nix;
+ programs-dotfiles = ./programs/dotfiles.nix;
+ programs-project = ./programs/project.nix;
+ programs-fzf-fd = ./programs/fzf-fd.nix;
+ programs-fzf-rg = ./programs/fzf-rg.nix;
+ programs-swww = ./wayland/swww.nix;
+ xdg-mime-apps = ./xdg-mime-apps.nix;
}
diff --git a/modules/home-manager/wayland/notifications/default.nix b/modules/home-manager/wayland/notifications/default.nix
new file mode 100644
index 00000000..63f2b026
--- /dev/null
+++ b/modules/home-manager/wayland/notifications/default.nix
@@ -0,0 +1,84 @@
+{ config, lib, pkgs, ... }:
+let
+ cfg = config.custom.services.swww;
+in
+{
+ options.custom.services.notification-daemon = {
+ enable = mkEnableOption ''notification-daemon service.'';
+ };
+
+ config = mkIf cfg.enable {
+ services.dunst = {
+ enable = true;
+ iconTheme = {
+ name = "Papirus-Dark";
+ package = pkgs.papirus-icon-theme;
+ };
+ settings = {
+ global = {
+ rounded = "yes";
+ origin = "top-right";
+ monitor = "0";
+ alignment = "left";
+ vertical_alignment = "center";
+ width = "400";
+ height = "400";
+ scale = 0;
+ gap_size = 0;
+ progress_bar = true;
+ transparency = 0;
+ text_icon_padding = 0;
+ separator_color = "frame";
+ sort = "yes";
+ idle_threshold = 120;
+ line_height = 0;
+ markup = "full";
+ show_age_threshold = 60;
+ ellipsize = "middle";
+ ignore_newline = "no";
+ stack_duplicates = true;
+ sticky_history = "yes";
+ history_length = 20;
+ always_run_script = true;
+ corner_radius = 10;
+ follow = "mouse";
+ font = "Source Sans Pro 10";
+ format = "%s\\n%b"; #format = "%s %p\n%b"
+ frame_color = "#232323";
+ frame_width = 1;
+ offset = "15x15";
+ horizontal_padding = 10;
+ icon_position = "left";
+ indicate_hidden = "yes";
+ min_icon_size = 0;
+ max_icon_size = 64;
+ mouse_left_click = "do_action, close_current";
+ mouse_middle_click = "close_current";
+ mouse_right_click = "close_all";
+ padding = 10;
+ plain_text = "no";
+ separator_height = 2;
+ show_indicators = "yes";
+ shrink = "no";
+ word_wrap = "yes";
+ browser = "/usr/bin/env librewolf -new-tab";
+ };
+
+ fullscreen_delay_everything = {fullscreen = "delay";};
+
+ urgency_critical = {
+ background = "#d64e4e";
+ foreground = "#f0e0e0";
+ };
+ urgency_low = {
+ background = "#232323";
+ foreground = "#2596be";
+ };
+ urgency_normal = {
+ background = "#1e1e2a";
+ foreground = "#2596be";
+ };
+ };
+ };
+ };
+}
\ No newline at end of file
diff --git a/modules/home-manager/wayland/notifications/dunst.nix b/modules/home-manager/wayland/notifications/dunst.nix
new file mode 100644
index 00000000..0ca022fc
--- /dev/null
+++ b/modules/home-manager/wayland/notifications/dunst.nix
@@ -0,0 +1,88 @@
+{ config, lib, pkgs, ... }:
+let
+ cfg = config.custom.services.swww;
+in
+{
+ options.custom.services.swww = {
+ enable = mkEnableOption ''swww service.'';
+ };
+
+ config = mkIf cfg.enable {
+ services.avizo.enable = false; # Media notifications
+ services.swayosd.enable = false; # notifications bindings at https://github.com/Frost-Phoenix/nixos-config/blob/92cb97590b06f6e5da9c893c64e8fb12cf723567/modules/home/swayosd.nix#L3
+ services.swaync.enable = true; # General notifications TODO: fix the fact the service does not run
+
+ services.dunst = {
+ enable = false;
+ iconTheme = {
+ name = "Papirus-Dark";
+ package = pkgs.papirus-icon-theme;
+ };
+ settings = {
+ global = {
+ rounded = "yes";
+ origin = "top-right";
+ monitor = "0";
+ alignment = "left";
+ vertical_alignment = "center";
+ width = "400";
+ height = "400";
+ scale = 0;
+ gap_size = 0;
+ progress_bar = true;
+ transparency = 0;
+ text_icon_padding = 0;
+ separator_color = "frame";
+ sort = "yes";
+ idle_threshold = 120;
+ line_height = 0;
+ markup = "full";
+ show_age_threshold = 60;
+ ellipsize = "middle";
+ ignore_newline = "no";
+ stack_duplicates = true;
+ sticky_history = "yes";
+ history_length = 20;
+ always_run_script = true;
+ corner_radius = 10;
+ follow = "mouse";
+ font = "Source Sans Pro 10";
+ format = "%s\\n%b"; #format = "%s %p\n%b"
+ frame_color = "#232323";
+ frame_width = 1;
+ offset = "15x15";
+ horizontal_padding = 10;
+ icon_position = "left";
+ indicate_hidden = "yes";
+ min_icon_size = 0;
+ max_icon_size = 64;
+ mouse_left_click = "do_action, close_current";
+ mouse_middle_click = "close_current";
+ mouse_right_click = "close_all";
+ padding = 10;
+ plain_text = "no";
+ separator_height = 2;
+ show_indicators = "yes";
+ shrink = "no";
+ word_wrap = "yes";
+ browser = "/usr/bin/env librewolf -new-tab";
+ };
+
+ fullscreen_delay_everything = {fullscreen = "delay";};
+
+ urgency_critical = {
+ background = "#d64e4e";
+ foreground = "#f0e0e0";
+ };
+ urgency_low = {
+ background = "#232323";
+ foreground = "#2596be";
+ };
+ urgency_normal = {
+ background = "#1e1e2a";
+ foreground = "#2596be";
+ };
+ };
+ };
+ };
+}
\ No newline at end of file
diff --git a/config/home-manager/window-manager/hyprland/scripts/volume.sh b/modules/home-manager/wayland/notifications/scripts/volume.sh
similarity index 100%
rename from config/home-manager/window-manager/hyprland/scripts/volume.sh
rename to modules/home-manager/wayland/notifications/scripts/volume.sh
diff --git a/modules/home-manager/wayland/swww.nix b/modules/home-manager/wayland/swww.nix
new file mode 100644
index 00000000..d9cd5236
--- /dev/null
+++ b/modules/home-manager/wayland/swww.nix
@@ -0,0 +1,32 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+let
+ cfg = config.custom.services.swww;
+in
+{
+ options.custom.services.swww = {
+ enable = mkEnableOption ''swww service.'';
+ };
+
+ config = mkIf cfg.enable {
+ # TODO: move to a module
+ systemd.user.services = {
+ swww = {
+ Unit = {
+ Description = "Efficient animated wallpaper daemon for wayland";
+ PartOf = [ "graphical-session.target" ];
+ After = [ "graphical-session.target" ];
+ };
+ Install.WantedBy = [ "graphical-session.target" ];
+ Service = {
+ Type = "simple";
+ ExecStart = ''${pkgs.swww}/bin/swww-daemon'';
+ ExecStop = "${pkgs.swww}/bin/swww kill";
+ Restart = "on-failure";
+ };
+ };
+ };
+ home.packages = [ pkgs.swww ];
+ };
+}
diff --git a/packages/default.nix b/packages/default.nix
index bc311c73..a2810e9d 100644
--- a/packages/default.nix
+++ b/packages/default.nix
@@ -1,11 +1,28 @@
{ nixpkgs, mylib }:
-mylib.builders.forAllSystems (system:
- let pkgs = nixpkgs.legacyPackages.${system};
- in rec {
- dotfiles = pkgs.callPackage ./dotfiles { };
- preview = pkgs.callPackage ./preview { };
- fzf-rg = pkgs.callPackage ./fzf-rg { };
- fzf-fd = pkgs.callPackage ./fzf-fd { inherit preview; };
- project = pkgs.callPackage ./project { inherit preview; };
- }
+
+let
+ inherit (mylib.builders) forAllSystems forLinuxSystems;
+ crossPlatform = forAllSystems (system:
+ let pkgs = nixpkgs.legacyPackages.${system};
+ in rec {
+ dotfiles = pkgs.callPackage ./dotfiles { };
+ preview = pkgs.callPackage ./preview { };
+ fzf-rg = pkgs.callPackage ./fzf-rg { };
+ fzf-fd = pkgs.callPackage ./fzf-fd { inherit preview; };
+ project = pkgs.callPackage ./project { inherit preview; };
+ }
+ );
+
+ linux = forLinuxSystems (system:
+ let pkgs = nixpkgs.legacyPackages.${system};
+ in {
+ dunst-volume = pkgs.callPackage ./dunst-volume { };
+ dunst-brightness = pkgs.callPackage ./dunst-brightness { };
+ }
+ );
+in forAllSystems (system:
+ nixpkgs.lib.attrsets.mergeAttrsList [
+ crossPlatform.${system}
+ (linux.${system} or { })
+ ]
)
diff --git a/packages/dunst-brightness/default.nix b/packages/dunst-brightness/default.nix
new file mode 100644
index 00000000..289c1701
--- /dev/null
+++ b/packages/dunst-brightness/default.nix
@@ -0,0 +1,9 @@
+{ lib, pkgs, ... }:
+pkgs.writeShellApplication {
+ name = "dunst-brightness";
+ runtimeInputs = with pkgs; [ dunst brightnessctl ];
+ text = lib.fileContents ./src/dunst-brightness.sh;
+}
+
+# FIXME: use absolute path as the scripts implicitly depend on the home-manager configuration
+# FIXME: configurable ICON?
\ No newline at end of file
diff --git a/packages/dunst-brightness/src/dunst-brightness.sh b/packages/dunst-brightness/src/dunst-brightness.sh
new file mode 100755
index 00000000..2bdaed4d
--- /dev/null
+++ b/packages/dunst-brightness/src/dunst-brightness.sh
@@ -0,0 +1,42 @@
+#shellcheck shell=sh
+
+# Default from Qogir
+OFF_ICON="${DUNST_BRIGHTNESS_OFF_ICON:-display-brightness-off-symbolic}"
+LOW_ICON="${DUNST_BRIGHTNESS_LOW_ICON:-display-brightness-low-symbolic}"
+MEDIUM_ICON="${DUNST_BRIGHTNESS_MEDIUM_ICON:-display-brightness-medium-symbolic}"
+HIGH_ICON="${DUNST_BRIGHTNESS_HIGH_ICON:-display-brightness-high-symbolic}"
+
+get_percentage() { brightnessctl -m | awk -F, '{print $4}' | tr -d %; }
+delta() { brightnessctl set "$1" > /dev/null; }
+
+notify() {
+ percentage="$(get_percentage)"
+ icon=
+ if [ "$percentage" -eq 0 ]; then
+ icon="$OFF_ICON"
+ progress=0
+ elif [ "$percentage" -lt 30 ]; then
+ icon="$LOW_ICON"
+ progress="$percentage"
+ elif [ "$percentage" -lt 70 ]; then
+ icon="$MEDIUM_ICON"
+ progress="$percentage"
+ else
+ icon="$HIGH_ICON"
+ progress="$percentage"
+ fi
+
+ dunstify \
+ --timeout 1500 \
+ --appname "brightness-osd" \
+ --hints string:x-canonical-private-synchronous:brightness \
+ --hints string:x-dunst-stack-tag:brightness \
+ --hints int:value:"$progress" \
+ --icon "$icon" \
+ "Brightness: $progress%"
+}
+
+case "${1:-}" in
+ increase) shift 1 && delta "+${1:-10}%" && notify ;;
+ decrease) shift 1 && delta "${1:-10}-%" && notify ;;
+esac
diff --git a/packages/dunst-volume/default.nix b/packages/dunst-volume/default.nix
new file mode 100644
index 00000000..ac8f07ba
--- /dev/null
+++ b/packages/dunst-volume/default.nix
@@ -0,0 +1,9 @@
+{ lib, pkgs, ... }:
+pkgs.writeShellApplication {
+ name = "dunst-volume";
+ runtimeInputs = with pkgs; [ dunst ponymix ];
+ text = lib.fileContents ./src/dunst-volume.sh;
+}
+
+# FIXME: use absolute path as the scripts implicitly depend on the home-manager configuration
+# FIXME: configurable ICON?
\ No newline at end of file
diff --git a/packages/dunst-volume/src/dunst-volume.sh b/packages/dunst-volume/src/dunst-volume.sh
new file mode 100755
index 00000000..b74ba628
--- /dev/null
+++ b/packages/dunst-volume/src/dunst-volume.sh
@@ -0,0 +1,59 @@
+#shellcheck shell=sh
+
+# From Adwaita
+MUTED_ICON="${DUNST_VOLUME_MUTED_ICON:-audio-volume-muted-symbolic}"
+LOW_ICON="${DUNST_VOLUME_LOW_ICON:-audio-volume-low-symbolic}"
+MEDIUM_ICON="${DUNST_VOLUME_MEDIUM_ICON:-audio-volume-medium-symbolic}"
+HIGH_ICON="${DUNST_VOLUME_HIGH_ICON:-audio-volume-high-symbolic}"
+
+
+
+# XF86AudioRaiseVolume allow-when-locked=true { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1+"; }
+# XF86AudioLowerVolume allow-when-locked=true { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1-"; }
+# XF86AudioMute allow-when-locked=true { spawn "wpctl" "set-mute" "@DEFAULT_AUDIO_SINK@" "toggle"; }
+# XF86AudioMicMute allow-when-locked=true { spawn "wpctl" "set-mute" "@DEFAULT_AUDIO_SOURCE@" "toggle"; }
+
+
+get_percentage() { ponymix get-volume; }
+is_muted() { ponymix is-muted; }
+increase() { ponymix increase "$1"; }
+decrease() { ponymix decrease "$1"; }
+mute() { ponymix mute; }
+unmute() { ponymix unmute; }
+toggle_mute() { ponymix toggle; }
+
+notify() {
+ percentage="$(get_percentage)"
+ icon=
+ if is_muted || [ "$percentage" -eq 0 ]; then
+ icon="$MUTED_ICON"
+ progress=0
+ elif [ "$percentage" -lt 30 ]; then
+ icon="$LOW_ICON"
+ progress="$percentage"
+ elif [ "$percentage" -lt 70 ]; then
+ icon="$MEDIUM_ICON"
+ progress="$percentage"
+ else
+ icon="$HIGH_ICON"
+ progress="$percentage"
+ fi
+
+ dunstify \
+ --timeout 1500 \
+ --appname "volume-osd" \
+ --hints string:x-canonical-private-synchronous:volume \
+ --hints string:x-dunst-stack-tag:volume \
+ --hints int:value:"$progress" \
+ --icon "$icon" \
+ "Volume: $progress%"
+}
+
+case "${1:-}" in
+ mute) mute && notify ;;
+ unmute) unmute && notify ;;
+ toggle-mute) toggle_mute && notify ;;
+ increase) shift 1 && increase "${1:-10}" && notify ;;
+ decrease) shift 1 && decrease "${1:-10}" && notify ;;
+ switch) ;;
+esac
\ No newline at end of file
From 261cd7dd44245c3f088cbb53787bb99fb3d0b3ee Mon Sep 17 00:00:00 2001
From: Bruno Henriques <4727729+bphenriques@users.noreply.github.com>
Date: Sat, 7 Dec 2024 18:43:21 +0000
Subject: [PATCH 20/34] fix exe file
---
config/home-manager/window-manager/niri.nix | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/config/home-manager/window-manager/niri.nix b/config/home-manager/window-manager/niri.nix
index 58b11f7b..d13a37e5 100644
--- a/config/home-manager/window-manager/niri.nix
+++ b/config/home-manager/window-manager/niri.nix
@@ -196,9 +196,9 @@ in
Super+Alt+L { spawn "swaylock"; }
// Audio
- XF86AudioRaiseVolume allow-when-locked=true { spawn "${self.pkgs.dunst-volume}" "increase"; }
- XF86AudioLowerVolume allow-when-locked=true { spawn "${self.pkgs.dunst-volume}" "decrease"; }
- XF86AudioMute allow-when-locked=true { spawn "${self.pkgs.dunst-volume}" "toggle-mute"; }
+ XF86AudioRaiseVolume allow-when-locked=true { spawn "${lib.getExe self.pkgs.dunst-volume}" "increase"; }
+ XF86AudioLowerVolume allow-when-locked=true { spawn "${lib.getExe self.pkgs.dunst-volume}" "decrease"; }
+ XF86AudioMute allow-when-locked=true { spawn "${lib.getExe self.pkgs.dunst-volume}" "toggle-mute"; }
XF86AudioMicMute allow-when-locked=true { spawn "wpctl" "set-mute" "@DEFAULT_AUDIO_SOURCE@" "toggle"; }
XF86AudioNext allow-when-locked=true { spawn "playerctl" "next"; }
XF86AudioPause allow-when-locked=true { spawn "playerctl" "play-pause"; }
@@ -206,8 +206,8 @@ in
XF86AudioPrev allow-when-locked=true { spawn "playerctl" "previous"; }
// Brightness
- XF86MonBrightnessUp allow-when-locked=true { spawn "${self.pkgs.dunst-brightness}" "increase"; }
- XF86MonBrightnessDown allow-when-locked=true { spawn "${self.pkgs.dunst-brightness}" "decrease"; }
+ XF86MonBrightnessUp allow-when-locked=true { spawn "${lib.getExe self.pkgs.dunst-brightness}" "increase"; }
+ XF86MonBrightnessDown allow-when-locked=true { spawn "${lib.getExe self.pkgs.dunst-brightness}" "decrease"; }
Mod+Left { focus-column-left; }
Mod+Down { focus-window-down; }
From 282943e894ec851d1baad6808e9fe486b804b9ac Mon Sep 17 00:00:00 2001
From: Bruno Henriques <4727729+bphenriques@users.noreply.github.com>
Date: Mon, 9 Dec 2024 16:39:57 +0000
Subject: [PATCH 21/34] fixes
---
config/home-manager/window-manager/dunst.nix | 24 +--
config/home-manager/window-manager/niri.nix | 152 ++++++++++--------
.../window-manager/waybar/default.nix | 44 ++++-
hosts/laptop/default.nix | 8 +-
packages/dunst-brightness/default.nix | 16 +-
.../dunst-brightness/src/dunst-brightness.sh | 17 +-
packages/dunst-volume/default.nix | 15 +-
packages/dunst-volume/src/dunst-volume.sh | 31 ++--
packages/niri-display-manager/default.nix | 6 +
.../src/niri-display-layout.sh | 13 ++
10 files changed, 189 insertions(+), 137 deletions(-)
create mode 100644 packages/niri-display-manager/default.nix
create mode 100755 packages/niri-display-manager/src/niri-display-layout.sh
diff --git a/config/home-manager/window-manager/dunst.nix b/config/home-manager/window-manager/dunst.nix
index 08b851a3..98ceac43 100644
--- a/config/home-manager/window-manager/dunst.nix
+++ b/config/home-manager/window-manager/dunst.nix
@@ -14,40 +14,18 @@
height = "400";
gap_size = 2;
progress_bar_corner_radius = 2;
-
- separator_color = "frame";
- sort = "yes";
idle_threshold = 120;
- line_height = 0;
markup = "full";
- show_age_threshold = 60;
- ellipsize = "middle";
- ignore_newline = "no";
- stack_duplicates = true;
- sticky_history = "yes";
- history_length = 20;
- always_run_script = true;
corner_radius = 10;
follow = "mouse";
+
font = "Source Sans Pro 10";
- format = "%s\\n%b"; #format = "%s %p\n%b"
frame_color = "#232323";
frame_width = 1;
offset = "15x15";
- horizontal_padding = 10;
- icon_position = "left";
- indicate_hidden = "yes";
- min_icon_size = 22;
- max_icon_size = 64;
mouse_left_click = "do_action, close_current";
mouse_middle_click = "close_current";
mouse_right_click = "close_all";
- padding = 10;
- plain_text = "no";
- separator_height = 2;
- show_indicators = "yes";
- shrink = "no";
- word_wrap = "yes";
};
fullscreen_delay_everything = {
diff --git a/config/home-manager/window-manager/niri.nix b/config/home-manager/window-manager/niri.nix
index d13a37e5..6a2c2308 100644
--- a/config/home-manager/window-manager/niri.nix
+++ b/config/home-manager/window-manager/niri.nix
@@ -16,7 +16,6 @@
# https://github.com/linuxmobile/kaku/blob/13eb9e8a19823cb2fa2aed29f7b1f49bea51c4a2/system/services/gdm.nix
# https://github.com/SergioRibera/dotfiles/blob/8e03a755e4e03b26722e6971effa4161c3efd0b6/hosts/common/services.nix#L45
-# Setting up auto start: https://github.com/kiike/dotfiles/blob/ff788bae02ba6d15c73632d99654269d2b5fba49/home/features/desktop/tiling/ags.nix
# Battery? https://github.com/linuxmobile/kaku/blob/13eb9e8a19823cb2fa2aed29f7b1f49bea51c4a2/system/services/power.nix
@@ -26,7 +25,25 @@
# Screencast? https://github.com/maximbaz/dotfiles/blob/98ff8b69370e86879faf57b29d07cfcb6aff4306/modules/linux/xdg.nix#L2
+# https://github.com/nyawox/nixboxes/blob/ecab4559da256b4f1198ca7d39d6e5b1d4442296/home/desktop/niri/general.nix
+
+ # If Share picker doesn’t use the system theme
+ # dbus-update-activation-environment --systemd --all
+ #systemctl --user import-environment QT_QPA_PLATFORMTHEME
+
+ # Ideas
+ # "Mod+Return".action = spawn "${config.profile.terminal}";
+ # "Mod+E".action = spawn "nautilus";
+ # "Mod+Escape".action = spawn "wlogout";
+/*
+*/
+# Window rules: https://github.com/nyawox/nixboxes/blob/ecab4559da256b4f1198ca7d39d6e5b1d4442296/home/desktop/niri/general.nix#L143
+# Env variables: https://github.com/nyawox/nixboxes/blob/ecab4559da256b4f1198ca7d39d6e5b1d4442296/home/desktop/niri/general.nix#L185
+
+# Funny login audio: https://github.com/nyawox/nixboxes/blob/ecab4559da256b4f1198ca7d39d6e5b1d4442296/home/desktop/niri/general.nix#L201
+
# TODO: Alt F4 means keep closing active window until there is none. Then, show list of options.
+# TODO: Script at startup that figures out the right layout
let
# nix repl
@@ -50,33 +67,70 @@ let
# XDG_BACKEND=wayland
};
- set-terminal = ''
- ${pkgs.swww}/bin/swww img "${wallpapersPkg}/share/wallpapers/mountains.png"
+ on-startup = ''
+ spawn-at-startup "${lib.getExe pkgs.swww}" "img" "--transition-type" "none" "${wallpapersPkg}/share/wallpapers/mountains.png"
+ spawn-at-startup "xwayland-satellite" ":21"
+ spawn-at-startup "${lib.getExe pkgs.waybar}"
'';
- # If Share picker doesn’t use the system theme
- # dbus-update-activation-environment --systemd --all
- #systemctl --user import-environment QT_QPA_PLATFORMTHEME
+ input = ''
+ input {
+ keyboard {
+ xkb {
+ layout "us,pt";
+ variant "euro,";
+ options "caps:ctrl_modifier"
+ }
+ }
- # Ideas
- # "Mod+Return".action = spawn "${config.profile.terminal}";
- # "Mod+E".action = spawn "nautilus";
- # "Mod+Escape".action = spawn "wlogout";
-/*
- touchpad = {
- tap = true;
- dwt = true;
- accel-profile = "adaptive";
- accel-speed = 0.0;
- click-method = "clickfinger";
- natural-scroll = true;
- scroll-method = "two-finger";
- };
-*/
-# Window rules: https://github.com/nyawox/nixboxes/blob/ecab4559da256b4f1198ca7d39d6e5b1d4442296/home/desktop/niri/general.nix#L143
-# Env variables: https://github.com/nyawox/nixboxes/blob/ecab4559da256b4f1198ca7d39d6e5b1d4442296/home/desktop/niri/general.nix#L185
+ touchpad {
+ tap
+ natural-scroll
+ }
-# Funny login audio: https://github.com/nyawox/nixboxes/blob/ecab4559da256b4f1198ca7d39d6e5b1d4442296/home/desktop/niri/general.nix#L201
+ mouse {
+ }
+ }
+ '';
+ outputs = ''
+ output "Samsung Display Corp. 0x4188 Unknown" {
+ mode "2880x1800@120.001"
+ scale 1.75
+ }
+
+ output "Dell Inc. DELL S2721DGF 4P11R83" {
+ off
+ mode "2560x1440@143.912"
+ scale 1.0
+ }
+ '';
+
+ layout = ''
+ layout {
+ gaps 6
+ center-focused-column "on-overflow"
+ preset-column-widths {
+ proportion 0.33333
+ proportion 0.5
+ proportion 0.66667
+ proportion 1.0
+ }
+ default-column-width { proportion 1.00; }
+ focus-ring {
+ width 3
+ active-color "#7fc8ff"
+ inactive-color "#505050"
+ }
+
+ border {
+ off
+ }
+ }
+ '';
+
+ set-terminal = ''
+ ${pkgs.swww}/bin/swww img "${wallpapersPkg}/share/wallpapers/mountains.png"
+ '';
in
{
home.packages = with pkgs; [
@@ -120,53 +174,11 @@ in
MOZ_ENABLE_WAYLAND "1"
}
- spawn-at-startup "${lib.getExe pkgs.swww}" "img" "--transition-type" "none" "${wallpapersPkg}/share/wallpapers/mountains.png"
- spawn-at-startup "xwayland-satellite" ":21"
- spawn-at-startup "${lib.getExe pkgs.waybar}"
-
- input {
- keyboard {
- xkb {
- layout "us,pt";
- variant "euro,";
- options "caps:ctrl_modifier"
- }
- }
-
- touchpad {
- tap
- natural-scroll
- }
-
- mouse {
- }
- }
-
- output "eDP-1" {
- mode "2880x1800@120.001"
- scale 1.75
- }
-
- layout {
- gaps 6
- center-focused-column "on-overflow"
- preset-column-widths {
- proportion 0.33333
- proportion 0.5
- proportion 0.66667
- proportion 1.0
- }
- default-column-width { proportion 1.00; }
- focus-ring {
- width 3
- active-color "#7fc8ff"
- inactive-color "#505050"
- }
+ ${on-startup}
+ ${input}
+ ${outputs}
+ ${layout}
- border {
- off
- }
- }
prefer-no-csd
diff --git a/config/home-manager/window-manager/waybar/default.nix b/config/home-manager/window-manager/waybar/default.nix
index 74a8f421..62594bf3 100644
--- a/config/home-manager/window-manager/waybar/default.nix
+++ b/config/home-manager/window-manager/waybar/default.nix
@@ -1,7 +1,34 @@
{ lib, config, pkgs, ... }:
# https://github.com/bitSheriff/dotfiles/blob/master/configuration/.config/waybar/modules/modules.jsonc
+# https://github.com/nix-community/nur-combined/blob/4d8b064e3cff836ee8c17c48c592874b0209e167/repos/slaier/modules/waybar/mediaplayer.nix
# TODO: Notification: https://github.com/prasanthrangan/hyprdots/blob/main/Configs/.config/waybar/modules/notifications.jsonc
let
+ audio = {
+ headset = {
+ name = "alsa_output.usb-SteelSeries_SteelSeries_Arctis_7-00.stereo-game";
+ icon = "";
+ icon-muted = "";
+ };
+
+ external-speaker = {
+ name = "alsa_output.pci-0000_01_00.1.hdmi-stereo";
+ icon = "";
+ icon-muted = "";
+ };
+
+ internal-speaker = {
+ name = "alsa_output.pci-0000_06_00.6.analog-stereo";
+ icon = "";
+ icon-muted = "";
+ };
+ };
+
+ display = {
+ external-only = "";
+ internal-aptop = "";
+ extended = "";
+ };
+
modules = {
cpu = {
format = "{usage}% ";
@@ -143,11 +170,11 @@ let
# See more: https://github.com/prasanthrangan/hyprdots/blob/main/Configs/.config/waybar/modules/pulseaudio.jsonc
pulseaudio = {
- format = "{icon}";
+ format = "{icon} {volume}%";
format-bluetooth = "{icon}";
format-bluetooth-muted = " {icon}";
format-source = " {volume}%";
- format-source-muted = " {desc}";
+ format-source-muted = " ";
format-icons = {
headphone = "";
hands-free = "";
@@ -156,14 +183,19 @@ let
portable = "";
car = "";
default = ["" "" ""];
+
+ "${audio.headset.name}" = audio.headset.icon;
+ "${audio.headset.name}-muted" = audio.headset.icon-muted;
+ "${audio.external-speaker.name}" = audio.external-speaker.icon;
+ "${audio.external-speaker.name}-muted" = audio.external-speaker.icon-muted;
+ "${audio.internal-speaker.name}" = audio.internal-speaker.icon;
+ "${audio.internal-speaker.name}-muted" = audio.internal-speaker.icon-muted;
};
on-click = "${lib.getExe pkgs.pavucontrol}";
+ #on-right-click = "${lib.getExe self.pkgs.dunst-volume} set alsa_output.usb-SteelSeries_SteelSeries_Arctis_7-00.stereo-game";
tooltip = true;
- tooltip-format = ''
- Audio: {desc}
- Mic: {format_source}
- '';
+ tooltip-format = "{desc}";
};
};
diff --git a/hosts/laptop/default.nix b/hosts/laptop/default.nix
index b4fc611b..6fa2b67d 100644
--- a/hosts/laptop/default.nix
+++ b/hosts/laptop/default.nix
@@ -18,14 +18,16 @@ in mylib.hosts.mkNixOSHost {
host.webcam = "/dev/video0"; # FIXME: This only needed once, let's move mvp to a module and make this a parameter.
network-devices = import ../network-devices.nix;
monitors = {
- "eDP-1" = {
+ "Samsung Display Corp. 0x4188 Unknown" = {
+ connector = "eDP-1";
description = "built-in";
- mode = "2880x1800@143.91Hz";
+ mode = "2880x1800@120.001Hz";
scale = 1.5;
};
"Dell Inc. DELL S2721DGF 4P11R83" = {
+ name = "Dell Inc. DELL S2721DGF 4P11R83";
description = "Office Monitor";
- mode = "2560x1440@120.00Hz";
+ mode = "2560x1440@143.912Hz";
scale = 1.0;
};
};
diff --git a/packages/dunst-brightness/default.nix b/packages/dunst-brightness/default.nix
index 289c1701..a8b22464 100644
--- a/packages/dunst-brightness/default.nix
+++ b/packages/dunst-brightness/default.nix
@@ -2,8 +2,16 @@
pkgs.writeShellApplication {
name = "dunst-brightness";
runtimeInputs = with pkgs; [ dunst brightnessctl ];
- text = lib.fileContents ./src/dunst-brightness.sh;
-}
+ text = let
+ iconBasePath = "${pkgs.pkgs.papirus-icon-theme}/share/icons/Papirus-Dark/symbolic/status";
+ in
+ # FIXME: This is not really configurable. Do something else about this.
+ ''
+ DUNST_BRIGHTNESS_OFF_ICON="${iconBasePath}/display-brightness-off-symbolic.svg"
+ DUNST_BRIGHTNESS_LOW_ICON="${iconBasePath}/display-brightness-low-symbolic.svg"
+ DUNST_BRIGHTNESS_MEDIUM_ICON="${iconBasePath}/display-brightness-medium-symbolic.svg"
+ DUNST_BRIGHTNESS_HIGH_ICON="${iconBasePath}/display-brightness-high-symbolic.svg"
-# FIXME: use absolute path as the scripts implicitly depend on the home-manager configuration
-# FIXME: configurable ICON?
\ No newline at end of file
+ ${lib.fileContents ./src/dunst-brightness.sh}
+ '';
+}
\ No newline at end of file
diff --git a/packages/dunst-brightness/src/dunst-brightness.sh b/packages/dunst-brightness/src/dunst-brightness.sh
index 2bdaed4d..1533dccd 100755
--- a/packages/dunst-brightness/src/dunst-brightness.sh
+++ b/packages/dunst-brightness/src/dunst-brightness.sh
@@ -1,10 +1,9 @@
#shellcheck shell=sh
-# Default from Qogir
-OFF_ICON="${DUNST_BRIGHTNESS_OFF_ICON:-display-brightness-off-symbolic}"
-LOW_ICON="${DUNST_BRIGHTNESS_LOW_ICON:-display-brightness-low-symbolic}"
-MEDIUM_ICON="${DUNST_BRIGHTNESS_MEDIUM_ICON:-display-brightness-medium-symbolic}"
-HIGH_ICON="${DUNST_BRIGHTNESS_HIGH_ICON:-display-brightness-high-symbolic}"
+DUNST_BRIGHTNESS_OFF_ICON="${DUNST_BRIGHTNESS_OFF_ICON:-}"
+DUNST_BRIGHTNESS_LOW_ICON="${DUNST_BRIGHTNESS_LOW_ICON:-}"
+DUNST_BRIGHTNESS_MEDIUM_ICON="${DUNST_BRIGHTNESS_MEDIUM_ICON:-}"
+DUNST_BRIGHTNESS_HIGH_ICON="${DUNST_BRIGHTNESS_HIGH_ICON:-}"
get_percentage() { brightnessctl -m | awk -F, '{print $4}' | tr -d %; }
delta() { brightnessctl set "$1" > /dev/null; }
@@ -13,16 +12,16 @@ notify() {
percentage="$(get_percentage)"
icon=
if [ "$percentage" -eq 0 ]; then
- icon="$OFF_ICON"
+ icon="$DUNST_BRIGHTNESS_OFF_ICON"
progress=0
elif [ "$percentage" -lt 30 ]; then
- icon="$LOW_ICON"
+ icon="$DUNST_BRIGHTNESS_LOW_ICON"
progress="$percentage"
elif [ "$percentage" -lt 70 ]; then
- icon="$MEDIUM_ICON"
+ icon="$DUNST_BRIGHTNESS_MEDIUM_ICON"
progress="$percentage"
else
- icon="$HIGH_ICON"
+ icon="$DUNST_BRIGHTNESS_HIGH_ICON"
progress="$percentage"
fi
diff --git a/packages/dunst-volume/default.nix b/packages/dunst-volume/default.nix
index ac8f07ba..c1af8ed5 100644
--- a/packages/dunst-volume/default.nix
+++ b/packages/dunst-volume/default.nix
@@ -2,8 +2,15 @@
pkgs.writeShellApplication {
name = "dunst-volume";
runtimeInputs = with pkgs; [ dunst ponymix ];
- text = lib.fileContents ./src/dunst-volume.sh;
-}
+ text = let
+ iconBasePath = "${pkgs.papirus-icon-theme}/share/icons/Papirus-Dark/symbolic/status";
+ in
+ ''
+ DUNST_VOLUME_MUTED_ICON="${iconBasePath}/audio-volume-muted-symbolic.svg"
+ DUNST_VOLUME_LOW_ICON="${iconBasePath}/audio-volume-low-symbolic.svg"
+ DUNST_VOLUME_MEDIUM_ICON="${iconBasePath}/audio-volume-medium-symbolic.svg"
+ DUNST_VOLUME_HIGH_ICON="${iconBasePath}/audio-volume-high-symbolic.svg"
-# FIXME: use absolute path as the scripts implicitly depend on the home-manager configuration
-# FIXME: configurable ICON?
\ No newline at end of file
+ ${lib.fileContents ./src/dunst-volume.sh}
+ '';
+}
\ No newline at end of file
diff --git a/packages/dunst-volume/src/dunst-volume.sh b/packages/dunst-volume/src/dunst-volume.sh
index b74ba628..7eb5c3eb 100755
--- a/packages/dunst-volume/src/dunst-volume.sh
+++ b/packages/dunst-volume/src/dunst-volume.sh
@@ -1,18 +1,9 @@
#shellcheck shell=sh
-# From Adwaita
-MUTED_ICON="${DUNST_VOLUME_MUTED_ICON:-audio-volume-muted-symbolic}"
-LOW_ICON="${DUNST_VOLUME_LOW_ICON:-audio-volume-low-symbolic}"
-MEDIUM_ICON="${DUNST_VOLUME_MEDIUM_ICON:-audio-volume-medium-symbolic}"
-HIGH_ICON="${DUNST_VOLUME_HIGH_ICON:-audio-volume-high-symbolic}"
-
-
-
-# XF86AudioRaiseVolume allow-when-locked=true { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1+"; }
-# XF86AudioLowerVolume allow-when-locked=true { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1-"; }
-# XF86AudioMute allow-when-locked=true { spawn "wpctl" "set-mute" "@DEFAULT_AUDIO_SINK@" "toggle"; }
-# XF86AudioMicMute allow-when-locked=true { spawn "wpctl" "set-mute" "@DEFAULT_AUDIO_SOURCE@" "toggle"; }
-
+DUNST_VOLUME_MUTED_ICON="${DUNST_VOLUME_MUTED_ICON:-}"
+DUNST_VOLUME_LOW_ICON="${DUNST_VOLUME_LOW_ICON:-}"
+DUNST_VOLUME_MEDIUM_ICON="${DUNST_VOLUME_MEDIUM_ICON:-}"
+DUNST_VOLUME_HIGH_ICON="${DUNST_VOLUME_HIGH_ICON:-}"
get_percentage() { ponymix get-volume; }
is_muted() { ponymix is-muted; }
@@ -21,21 +12,24 @@ decrease() { ponymix decrease "$1"; }
mute() { ponymix mute; }
unmute() { ponymix unmute; }
toggle_mute() { ponymix toggle; }
+list() { ponymix list; }
+set_default() { ponymix set-default -d "$1"; }
+get_default_sink_name() { ponymix default | grep sink | awk '{print $3; }'; }
notify() {
percentage="$(get_percentage)"
icon=
if is_muted || [ "$percentage" -eq 0 ]; then
- icon="$MUTED_ICON"
+ icon="$DUNST_VOLUME_MUTED_ICON"
progress=0
elif [ "$percentage" -lt 30 ]; then
- icon="$LOW_ICON"
+ icon="$DUNST_VOLUME_LOW_ICON"
progress="$percentage"
elif [ "$percentage" -lt 70 ]; then
- icon="$MEDIUM_ICON"
+ icon="$DUNST_VOLUME_MEDIUM_ICON"
progress="$percentage"
else
- icon="$HIGH_ICON"
+ icon="$DUNST_VOLUME_HIGH_ICON"
progress="$percentage"
fi
@@ -55,5 +49,6 @@ case "${1:-}" in
toggle-mute) toggle_mute && notify ;;
increase) shift 1 && increase "${1:-10}" && notify ;;
decrease) shift 1 && decrease "${1:-10}" && notify ;;
- switch) ;;
+ list) shift 1 && list "$1" ;;
+ set) shift 1 && set_default "$1" ;;
esac
\ No newline at end of file
diff --git a/packages/niri-display-manager/default.nix b/packages/niri-display-manager/default.nix
new file mode 100644
index 00000000..8706fc77
--- /dev/null
+++ b/packages/niri-display-manager/default.nix
@@ -0,0 +1,6 @@
+{ lib, pkgs, ... }:
+pkgs.writeShellApplication {
+ name = "niri-display-layout";
+ runtimeInputs = with pkgs; [ niri libnotify ];
+ text = lib.fileContents ./src/niri-display-layout.sh;
+}
\ No newline at end of file
diff --git a/packages/niri-display-manager/src/niri-display-layout.sh b/packages/niri-display-manager/src/niri-display-layout.sh
new file mode 100755
index 00000000..27f18335
--- /dev/null
+++ b/packages/niri-display-manager/src/niri-display-layout.sh
@@ -0,0 +1,13 @@
+#shellcheck shell=sh
+list() {
+ echo "list"
+}
+
+set() {
+ echo ""
+}
+
+case "${1:-}" in
+ list) shift 1 && delta "+${1:-10}%" && notify ;;
+ set) shift 1 && delta "${1:-10}-%" && notify ;;
+esac
From 0d1013819507b7fe96df2b8fcb1d0a1f13636c94 Mon Sep 17 00:00:00 2001
From: Bruno Henriques <4727729+bphenriques@users.noreply.github.com>
Date: Tue, 10 Dec 2024 12:55:04 +0000
Subject: [PATCH 22/34] Fix macos installation
---
config/home-manager/default.nix | 1 -
config/nixos/default.nix | 1 +
hosts/laptop/bphenriques/home.nix | 3 ++-
hosts/work-macos/default.nix | 8 ++++----
lib/hosts.nix | 2 +-
5 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/config/home-manager/default.nix b/config/home-manager/default.nix
index 9d4a35ff..1b8feb2e 100644
--- a/config/home-manager/default.nix
+++ b/config/home-manager/default.nix
@@ -5,7 +5,6 @@
./internet
./media
./terminal
- ./window-manager
];
# XDG Compliance to tidy up $HOME.
diff --git a/config/nixos/default.nix b/config/nixos/default.nix
index b5195784..73372248 100644
--- a/config/nixos/default.nix
+++ b/config/nixos/default.nix
@@ -11,6 +11,7 @@
];
nix = {
+ settings.auto-optimise-store = true; # Optimise the store when building.
gc = {
automatic = true;
dates = "weekly";
diff --git a/hosts/laptop/bphenriques/home.nix b/hosts/laptop/bphenriques/home.nix
index 78eec9bc..6b18d992 100644
--- a/hosts/laptop/bphenriques/home.nix
+++ b/hosts/laptop/bphenriques/home.nix
@@ -3,6 +3,7 @@
imports = [
../../../config/home-manager
../../../config/home-manager/gaming
+ ../../../config/home-manager/window-manageqqr
./input-remapper
];
@@ -45,4 +46,4 @@
];
home.stateVersion = "24.05";
-}
\ No newline at end of file
+}
diff --git a/hosts/work-macos/default.nix b/hosts/work-macos/default.nix
index d6971137..7664be64 100644
--- a/hosts/work-macos/default.nix
+++ b/hosts/work-macos/default.nix
@@ -1,9 +1,9 @@
-{ self, mylib, nixpkgs, home-manager, ... }:
+{ inputs, mylib, ... }:
let
- inherit (nixpkgs.lib.attrsets) attrValues;
+ inherit (inputs.nixpkgs.lib.attrsets) attrValues;
- darwinModules = attrValues self.darwinModules ++ [ home-manager.darwinModules.home-manager ];
- hmModules = attrValues self.homeManagerModules;
+ darwinModules = attrValues inputs.self.darwinModules ++ [ inputs.home-manager.darwinModules.home-manager ];
+ hmModules = attrValues inputs.self.homeManagerModules;
in mylib.hosts.mkMacOSHost {
inherit darwinModules hmModules;
hostModule = ./config.nix;
diff --git a/lib/hosts.nix b/lib/hosts.nix
index 42be057f..92ac1700 100644
--- a/lib/hosts.nix
+++ b/lib/hosts.nix
@@ -1,9 +1,9 @@
{ lib, inputs, ... }:
let
nixConfig = {
+ optimise.automatic = true;
settings = {
experimental-features = [ "nix-command" "flakes" ]; # Enable nix flakes.
- auto-optimise-store = true; # Optimise the store when building.
use-xdg-base-directories = true; # Hide ~/.nix-profile and ~/.nix-defexpr
warn-dirty = false; # I know...
};
From e1f8efd62d4ea1da4ba495d0359b763dd29a81e9 Mon Sep 17 00:00:00 2001
From: Bruno Henriques <4727729+bphenriques@users.noreply.github.com>
Date: Tue, 10 Dec 2024 18:57:52 +0000
Subject: [PATCH 23/34] Remove kanshi
---
.../home-manager/window-manager/default.nix | 1 -
config/home-manager/window-manager/kanshi.nix | 57 -------------------
2 files changed, 58 deletions(-)
delete mode 100644 config/home-manager/window-manager/kanshi.nix
diff --git a/config/home-manager/window-manager/default.nix b/config/home-manager/window-manager/default.nix
index fc985532..4126e320 100644
--- a/config/home-manager/window-manager/default.nix
+++ b/config/home-manager/window-manager/default.nix
@@ -19,7 +19,6 @@ in
./niri.nix # Window Manager
./waybar # Top-bar. There are fancier solutions out-there.
./dunst.nix # Notification Daemon
- ./kanshi.nix # Manage external monitors
./fuzzel.nix # Application Launcher
];
diff --git a/config/home-manager/window-manager/kanshi.nix b/config/home-manager/window-manager/kanshi.nix
deleted file mode 100644
index 47fe334e..00000000
--- a/config/home-manager/window-manager/kanshi.nix
+++ /dev/null
@@ -1,57 +0,0 @@
-{ pkgs, config, ... }:
-# More examples:
-# - https://github.com/colemickens/nixcfg/blob/f28e80177328a7e005bea96d0931a0f1a98d9df5/mixins/kanshi.nix#L21
-# - https://github.com/MatthewCroughan/nixcfg/blob/afab322e6da20cc038d8577dd4a365673702d183/users/matthew/modules/kanshi.nix#L2
-# - Check: https://www.reddit.com/r/hyprland/comments/12bv4ps/comment/jho4gko/
-let
- laptopScreen = {
- criteria = "eDP-1";
- mode = "2880x1800@143.91Hz";
- scale = 1.5;
- };
- dellScreen = {
- criteria = "Dell Inc. DELL S2721DGF 4P11R83";
- mode = "2560x1440@120.00Hz";
- scale = 1.0;
- };
-
- enable = screen: screen // { status = "enable"; };
- disable = screen: screen // { status = "disable"; };
-in
-{
- services.kanshi = {
- enable = true;
- systemdTarget = "graphical-session.target"; #"hyprland-session.target";
- settings = [
- {
- profile.name = "internal";
- profile.outputs = [
- (enable laptopScreen)
- (disable dellScreen)
- ];
- }
- {
- profile.name = "docked-office";
- profile.outputs = [
- (disable laptopScreen)
- (enable dellScreen)
- ];
- }
- # FIXME
- {
- profile.name = "docked-extend";
- profile.outputs = [
- (disable laptopScreen)
- (enable dellScreen)
- ];
- }
- {
- profile.name = "living-room";
- profile.outputs = [
- (disable laptopScreen)
- (enable dellScreen)
- ];
- }
- ];
- };
-}
From 75228d947b9540d8e09a3a2efab7b64a519e2dc9 Mon Sep 17 00:00:00 2001
From: Bruno Henriques <4727729+bphenriques@users.noreply.github.com>
Date: Thu, 12 Dec 2024 19:41:43 +0000
Subject: [PATCH 24/34] iteration with output config
---
config/home-manager/media/video.nix | 1 +
config/home-manager/window-manager/niri.nix | 2 +
hosts/laptop/bphenriques/home.nix | 2 +-
packages/default.nix | 1 +
packages/dunst-volume/src/dunst-volume.sh | 2 +
packages/niri-display-manager/default.nix | 6 ---
.../src/niri-display-layout.sh | 13 -----
.../niri-output-configuration/default.nix | 6 +++
.../src/niri-output-configuration.sh | 48 +++++++++++++++++++
.../src/window-swithcher.fish | 8 ++++
10 files changed, 69 insertions(+), 20 deletions(-)
delete mode 100644 packages/niri-display-manager/default.nix
delete mode 100755 packages/niri-display-manager/src/niri-display-layout.sh
create mode 100644 packages/niri-output-configuration/default.nix
create mode 100755 packages/niri-output-configuration/src/niri-output-configuration.sh
create mode 100644 packages/niri-output-configuration/src/window-swithcher.fish
diff --git a/config/home-manager/media/video.nix b/config/home-manager/media/video.nix
index 1e861bd5..2e3cbd13 100644
--- a/config/home-manager/media/video.nix
+++ b/config/home-manager/media/video.nix
@@ -1,6 +1,7 @@
{ pkgs, lib, config, host, ... }:
# TODO: Check https://github.com/iynaix/dotfiles/blob/f0f8918caed8f4c245fa82fc505ae0de09a32f5c/home-manager/programs/mpv.nix
# TODO: https://github.com/diniamo/niqs/blob/53288d72902365ee8d3bfdd6aff0ec79eb7c1c36/home/mpv/anime.nix
+# https://github.com/Samillion/ModernZ
let
# Interesting guides:
# - https://kokomins.wordpress.com/2019/10/14/mpv-config-guide/
diff --git a/config/home-manager/window-manager/niri.nix b/config/home-manager/window-manager/niri.nix
index 6a2c2308..546d21d4 100644
--- a/config/home-manager/window-manager/niri.nix
+++ b/config/home-manager/window-manager/niri.nix
@@ -71,6 +71,7 @@ let
spawn-at-startup "${lib.getExe pkgs.swww}" "img" "--transition-type" "none" "${wallpapersPkg}/share/wallpapers/mountains.png"
spawn-at-startup "xwayland-satellite" ":21"
spawn-at-startup "${lib.getExe pkgs.waybar}"
+ spawn-at-startup "${lib.getExe self.pkgs.niri-output-configuration}" "default"
'';
input = ''
@@ -102,6 +103,7 @@ let
off
mode "2560x1440@143.912"
scale 1.0
+ variable-refresh-rate on-demand=true
}
'';
diff --git a/hosts/laptop/bphenriques/home.nix b/hosts/laptop/bphenriques/home.nix
index 6b18d992..4ca2256b 100644
--- a/hosts/laptop/bphenriques/home.nix
+++ b/hosts/laptop/bphenriques/home.nix
@@ -3,7 +3,7 @@
imports = [
../../../config/home-manager
../../../config/home-manager/gaming
- ../../../config/home-manager/window-manageqqr
+ ../../../config/home-manager/window-manager
./input-remapper
];
diff --git a/packages/default.nix b/packages/default.nix
index a2810e9d..b2599594 100644
--- a/packages/default.nix
+++ b/packages/default.nix
@@ -18,6 +18,7 @@ let
in {
dunst-volume = pkgs.callPackage ./dunst-volume { };
dunst-brightness = pkgs.callPackage ./dunst-brightness { };
+ niri-output-configuration = pkgs.callPackage ./dunst-brightness { };
}
);
in forAllSystems (system:
diff --git a/packages/dunst-volume/src/dunst-volume.sh b/packages/dunst-volume/src/dunst-volume.sh
index 7eb5c3eb..7bb66193 100755
--- a/packages/dunst-volume/src/dunst-volume.sh
+++ b/packages/dunst-volume/src/dunst-volume.sh
@@ -1,5 +1,7 @@
#shellcheck shell=sh
+# TODO review: https://askubuntu.com/questions/1267949/how-do-i-automatically-switch-pulseaudio-input-to-headset-upon-connection
+
DUNST_VOLUME_MUTED_ICON="${DUNST_VOLUME_MUTED_ICON:-}"
DUNST_VOLUME_LOW_ICON="${DUNST_VOLUME_LOW_ICON:-}"
DUNST_VOLUME_MEDIUM_ICON="${DUNST_VOLUME_MEDIUM_ICON:-}"
diff --git a/packages/niri-display-manager/default.nix b/packages/niri-display-manager/default.nix
deleted file mode 100644
index 8706fc77..00000000
--- a/packages/niri-display-manager/default.nix
+++ /dev/null
@@ -1,6 +0,0 @@
-{ lib, pkgs, ... }:
-pkgs.writeShellApplication {
- name = "niri-display-layout";
- runtimeInputs = with pkgs; [ niri libnotify ];
- text = lib.fileContents ./src/niri-display-layout.sh;
-}
\ No newline at end of file
diff --git a/packages/niri-display-manager/src/niri-display-layout.sh b/packages/niri-display-manager/src/niri-display-layout.sh
deleted file mode 100755
index 27f18335..00000000
--- a/packages/niri-display-manager/src/niri-display-layout.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#shellcheck shell=sh
-list() {
- echo "list"
-}
-
-set() {
- echo ""
-}
-
-case "${1:-}" in
- list) shift 1 && delta "+${1:-10}%" && notify ;;
- set) shift 1 && delta "${1:-10}-%" && notify ;;
-esac
diff --git a/packages/niri-output-configuration/default.nix b/packages/niri-output-configuration/default.nix
new file mode 100644
index 00000000..87e14c5a
--- /dev/null
+++ b/packages/niri-output-configuration/default.nix
@@ -0,0 +1,6 @@
+{ lib, pkgs, ... }:
+pkgs.writeShellApplication {
+ name = "niri-output-configuration";
+ runtimeInputs = with pkgs; [ niri libnotify ];
+ text = lib.fileContents ./src/niri-output-configuration.sh;
+}
\ No newline at end of file
diff --git a/packages/niri-output-configuration/src/niri-output-configuration.sh b/packages/niri-output-configuration/src/niri-output-configuration.sh
new file mode 100755
index 00000000..f5b119ba
--- /dev/null
+++ b/packages/niri-output-configuration/src/niri-output-configuration.sh
@@ -0,0 +1,48 @@
+#shellcheck shell=bash
+
+# Functions that depend on the window manager
+dmenu() { options | fuzzel --dmenu --placeholder "Output Configuration" --lines 3; }
+notify() { notify-send "Output Configuration" "$1"; }
+exists_display() { niri msg --json outputs | jq --exit-status --arg DISPLAY "$1" '.[$DISPLAY]' > /dev/null; }
+is_display_on() { niri msg --json outputs | jq --exit-status --arg DISPLAY "$1" '.[$DISPLAY] | .current_mode' > /dev/null; }
+enable_output() { exists_display "$1" && niri msg output "$1" on; } # checking first, as niri sends the msg once connected
+disable_output() { exists_display "$1" && niri msg output "$1" off; } # checking first, as niri sends the msg once connected
+disable_output_not() {
+ export -f disable_output
+ niri msg --json outputs \
+ | jq -r --exit-status --arg DISPLAY "$1" 'keys | .[] | select(. != $DISPLAY)' \
+ | xargs -I{} sh -c 'disable_output {}'
+}
+
+# Utility functions
+profile_internal_name() { echo "Internal display"; }
+profile_internal_valid() { exists_display eDP-1; }
+profile_internal_set() { profile_internal_valid && disable_output_not eDP-1 && enable_output eDP-1 && profile_internal_name; }
+
+profile_external_name() { echo "External display"; }
+profile_external_valid() { exists_display HDMI-A-1; }
+profile_external_set() { profile_external_valid && disable_output_not HDMI-A-1 && enable_output HDMI-A-1 && profile_external_name; }
+
+profile_extend_name() { echo "Extend displays"; }
+profile_extend_valid() { exists_display eDP-1 && exists_display HDMI-A-1; }
+profile_extend_set() { profile_extend_valid && enable_output eDP-1 && enable_output HDMI-A-1 && profile_extend_name; }
+
+profile_default_set() { profile_external_set || profile_internal_set; }
+
+# shellcheck disable=SC2005
+options() {
+ profile_internal_valid && echo "$(profile_internal_name)"
+ profile_external_valid && echo "$(profile_external_name)"
+ profile_extend_valid && echo "$(profile_extend_name)"
+}
+
+case "${1:-}" in
+ dmenu)
+ case "$(dmenu)" in
+ "$(profile_internal_name)") notify "$(profile_internal_set)" ;;
+ "$(profile_external_name)") notify "$(profile_external_set)" ;;
+ "$(profile_extend_name)") notify "$(profile_extend_set)" ;;
+ esac
+ ;;
+ default) notify "$(profile_default_set)" ;;
+esac
diff --git a/packages/niri-output-configuration/src/window-swithcher.fish b/packages/niri-output-configuration/src/window-swithcher.fish
new file mode 100644
index 00000000..305404a0
--- /dev/null
+++ b/packages/niri-output-configuration/src/window-swithcher.fish
@@ -0,0 +1,8 @@
+#!/usr/bin/env fish
+set windows (niri msg --json windows)
+and set id (echo $windows |
+ jq -r '.[] | "\(.id): \(.title)\u0000icon\u001f\(.app_id)"' |
+ string replace -ar [·—] - | # fuzzel ignores lines containing these characters for some reason
+ fuzzel --dmenu --counter --width 65 --lines (echo $windows | jq length) |
+ string split : -f 1)
+and niri msg action focus-window --id $id
\ No newline at end of file
From c892ebb954e0e467330d26c0e76b41283d4d3077 Mon Sep 17 00:00:00 2001
From: Bruno Henriques <4727729+bphenriques@users.noreply.github.com>
Date: Fri, 13 Dec 2024 16:08:52 +0000
Subject: [PATCH 25/34] sevral improvements
---
config/home-manager/window-manager/niri.nix | 21 ++++++----
.../window-manager/waybar/default.nix | 9 ++--
packages/default.nix | 7 ++--
packages/dunst-brightness/default.nix | 17 --------
.../dunst-brightness/src/dunst-brightness.sh | 41 -------------------
packages/dunst-volume/default.nix | 16 --------
.../src/niri-output-configuration.sh | 34 ++++++++-------
.../src/window-swithcher.fish | 8 ----
packages/niri-window-dmenu/default.nix | 6 +++
.../src/niri-window-dmenu.sh | 10 +++++
packages/osd-brightness/default.nix | 17 ++++++++
packages/osd-brightness/src/osd-brightness.sh | 41 +++++++++++++++++++
packages/osd-volume/default.nix | 16 ++++++++
.../src/osd-volume.sh} | 28 ++++++-------
14 files changed, 146 insertions(+), 125 deletions(-)
delete mode 100644 packages/dunst-brightness/default.nix
delete mode 100755 packages/dunst-brightness/src/dunst-brightness.sh
delete mode 100644 packages/dunst-volume/default.nix
delete mode 100644 packages/niri-output-configuration/src/window-swithcher.fish
create mode 100644 packages/niri-window-dmenu/default.nix
create mode 100644 packages/niri-window-dmenu/src/niri-window-dmenu.sh
create mode 100644 packages/osd-brightness/default.nix
create mode 100755 packages/osd-brightness/src/osd-brightness.sh
create mode 100644 packages/osd-volume/default.nix
rename packages/{dunst-volume/src/dunst-volume.sh => osd-volume/src/osd-volume.sh} (70%)
diff --git a/config/home-manager/window-manager/niri.nix b/config/home-manager/window-manager/niri.nix
index 546d21d4..39af4201 100644
--- a/config/home-manager/window-manager/niri.nix
+++ b/config/home-manager/window-manager/niri.nix
@@ -42,8 +42,11 @@
# Funny login audio: https://github.com/nyawox/nixboxes/blob/ecab4559da256b4f1198ca7d39d6e5b1d4442296/home/desktop/niri/general.nix#L201
+# https://gitlab.com/scientiac/einstein.nixos/-/tree/main/home/niriwm?ref_type=heads
+
# TODO: Alt F4 means keep closing active window until there is none. Then, show list of options.
# TODO: Script at startup that figures out the right layout
+
let
# nix repl
@@ -181,7 +184,6 @@ in
${outputs}
${layout}
-
prefer-no-csd
screenshot-path "${config.xdg.userDirs.extraConfig.XDG_SCREENSHOTS_DIR}/%Y-%m-%d %H-%M-%S.png"
@@ -204,15 +206,18 @@ in
Mod+Shift+E { quit; }
+ Mod+Period { spawn "${lib.getExe pkgs.bemoji}"; }
+ Alt+Tab { spawn "${lib.getExe self.pkgs.niri-window-dmenu}"; }
+
// Suggested binds for running programs: terminal, app launcher, screen locker.
Mod+Return { spawn "${lib.getExe community.pkgs.ghostty}"; }
Mod+Space { spawn "${lib.getExe pkgs.fuzzel}"; }
Super+Alt+L { spawn "swaylock"; }
// Audio
- XF86AudioRaiseVolume allow-when-locked=true { spawn "${lib.getExe self.pkgs.dunst-volume}" "increase"; }
- XF86AudioLowerVolume allow-when-locked=true { spawn "${lib.getExe self.pkgs.dunst-volume}" "decrease"; }
- XF86AudioMute allow-when-locked=true { spawn "${lib.getExe self.pkgs.dunst-volume}" "toggle-mute"; }
+ XF86AudioRaiseVolume allow-when-locked=true { spawn "${lib.getExe self.pkgs.osd-volume}" "increase"; }
+ XF86AudioLowerVolume allow-when-locked=true { spawn "${lib.getExe self.pkgs.osd-volume}" "decrease"; }
+ XF86AudioMute allow-when-locked=true { spawn "${lib.getExe self.pkgs.osd-volume}" "toggle-mute"; }
XF86AudioMicMute allow-when-locked=true { spawn "wpctl" "set-mute" "@DEFAULT_AUDIO_SOURCE@" "toggle"; }
XF86AudioNext allow-when-locked=true { spawn "playerctl" "next"; }
XF86AudioPause allow-when-locked=true { spawn "playerctl" "play-pause"; }
@@ -220,8 +225,8 @@ in
XF86AudioPrev allow-when-locked=true { spawn "playerctl" "previous"; }
// Brightness
- XF86MonBrightnessUp allow-when-locked=true { spawn "${lib.getExe self.pkgs.dunst-brightness}" "increase"; }
- XF86MonBrightnessDown allow-when-locked=true { spawn "${lib.getExe self.pkgs.dunst-brightness}" "decrease"; }
+ XF86MonBrightnessUp allow-when-locked=true { spawn "${lib.getExe self.pkgs.osd-brightness}" "increase"; }
+ XF86MonBrightnessDown allow-when-locked=true { spawn "${lib.getExe self.pkgs.osd-brightness}" "decrease"; }
Mod+Left { focus-column-left; }
Mod+Down { focus-window-down; }
@@ -258,8 +263,8 @@ in
// Switches focus between the current and the previous workspace.
Mod+Tab { focus-workspace-previous; }
- Mod+Comma { consume-window-into-column; }
- Mod+Period { expel-window-from-column; }
+ // Mod+Comma { consume-window-into-column; }
+ // Mod+Period { expel-window-from-column; }
// There are also commands that consume or expel a single window to the side.
Mod+BracketLeft { consume-or-expel-window-left; }
diff --git a/config/home-manager/window-manager/waybar/default.nix b/config/home-manager/window-manager/waybar/default.nix
index 62594bf3..91d9f4bc 100644
--- a/config/home-manager/window-manager/waybar/default.nix
+++ b/config/home-manager/window-manager/waybar/default.nix
@@ -1,4 +1,4 @@
-{ lib, config, pkgs, ... }:
+{ lib, config, pkgs, self, ... }:
# https://github.com/bitSheriff/dotfiles/blob/master/configuration/.config/waybar/modules/modules.jsonc
# https://github.com/nix-community/nur-combined/blob/4d8b064e3cff836ee8c17c48c592874b0209e167/repos/slaier/modules/waybar/mediaplayer.nix
# TODO: Notification: https://github.com/prasanthrangan/hyprdots/blob/main/Configs/.config/waybar/modules/notifications.jsonc
@@ -79,8 +79,8 @@ let
backlight = {
format = "{icon} {percent}%";
format-icons = ["" "" "" "" "" "" "" "" ""];
- on-scroll-up = "${lib.getExe pkgs.brightnessctl} s +1%";
- on-scroll-down = "${lib.getExe pkgs.brightnessctl} s 1%-";
+ on-scroll-up = "${lib.getExe self.pkgs.osd-brightness} increase";
+ on-scroll-down ="${lib.getExe self.pkgs.osd-brightness} decrease";
min-length = 6;
# "on-click": "wdisplays"
};
@@ -194,6 +194,9 @@ let
on-click = "${lib.getExe pkgs.pavucontrol}";
#on-right-click = "${lib.getExe self.pkgs.dunst-volume} set alsa_output.usb-SteelSeries_SteelSeries_Arctis_7-00.stereo-game";
+ on-scroll-up = "${lib.getExe self.pkgs.osd-volume} increase";
+ on-scroll-down ="${lib.getExe self.pkgs.osd-volume} decrease";
+
tooltip = true;
tooltip-format = "{desc}";
};
diff --git a/packages/default.nix b/packages/default.nix
index b2599594..292f43e1 100644
--- a/packages/default.nix
+++ b/packages/default.nix
@@ -16,9 +16,10 @@ let
linux = forLinuxSystems (system:
let pkgs = nixpkgs.legacyPackages.${system};
in {
- dunst-volume = pkgs.callPackage ./dunst-volume { };
- dunst-brightness = pkgs.callPackage ./dunst-brightness { };
- niri-output-configuration = pkgs.callPackage ./dunst-brightness { };
+ osd-volume = pkgs.callPackage ./osd-volume { };
+ osd-brightness = pkgs.callPackage ./osd-brightness { };
+ niri-output-configuration = pkgs.callPackage ./niri-output-configuration { };
+ niri-window-dmenu = pkgs.callPackage ./niri-window-dmenu { };
}
);
in forAllSystems (system:
diff --git a/packages/dunst-brightness/default.nix b/packages/dunst-brightness/default.nix
deleted file mode 100644
index a8b22464..00000000
--- a/packages/dunst-brightness/default.nix
+++ /dev/null
@@ -1,17 +0,0 @@
-{ lib, pkgs, ... }:
-pkgs.writeShellApplication {
- name = "dunst-brightness";
- runtimeInputs = with pkgs; [ dunst brightnessctl ];
- text = let
- iconBasePath = "${pkgs.pkgs.papirus-icon-theme}/share/icons/Papirus-Dark/symbolic/status";
- in
- # FIXME: This is not really configurable. Do something else about this.
- ''
- DUNST_BRIGHTNESS_OFF_ICON="${iconBasePath}/display-brightness-off-symbolic.svg"
- DUNST_BRIGHTNESS_LOW_ICON="${iconBasePath}/display-brightness-low-symbolic.svg"
- DUNST_BRIGHTNESS_MEDIUM_ICON="${iconBasePath}/display-brightness-medium-symbolic.svg"
- DUNST_BRIGHTNESS_HIGH_ICON="${iconBasePath}/display-brightness-high-symbolic.svg"
-
- ${lib.fileContents ./src/dunst-brightness.sh}
- '';
-}
\ No newline at end of file
diff --git a/packages/dunst-brightness/src/dunst-brightness.sh b/packages/dunst-brightness/src/dunst-brightness.sh
deleted file mode 100755
index 1533dccd..00000000
--- a/packages/dunst-brightness/src/dunst-brightness.sh
+++ /dev/null
@@ -1,41 +0,0 @@
-#shellcheck shell=sh
-
-DUNST_BRIGHTNESS_OFF_ICON="${DUNST_BRIGHTNESS_OFF_ICON:-}"
-DUNST_BRIGHTNESS_LOW_ICON="${DUNST_BRIGHTNESS_LOW_ICON:-}"
-DUNST_BRIGHTNESS_MEDIUM_ICON="${DUNST_BRIGHTNESS_MEDIUM_ICON:-}"
-DUNST_BRIGHTNESS_HIGH_ICON="${DUNST_BRIGHTNESS_HIGH_ICON:-}"
-
-get_percentage() { brightnessctl -m | awk -F, '{print $4}' | tr -d %; }
-delta() { brightnessctl set "$1" > /dev/null; }
-
-notify() {
- percentage="$(get_percentage)"
- icon=
- if [ "$percentage" -eq 0 ]; then
- icon="$DUNST_BRIGHTNESS_OFF_ICON"
- progress=0
- elif [ "$percentage" -lt 30 ]; then
- icon="$DUNST_BRIGHTNESS_LOW_ICON"
- progress="$percentage"
- elif [ "$percentage" -lt 70 ]; then
- icon="$DUNST_BRIGHTNESS_MEDIUM_ICON"
- progress="$percentage"
- else
- icon="$DUNST_BRIGHTNESS_HIGH_ICON"
- progress="$percentage"
- fi
-
- dunstify \
- --timeout 1500 \
- --appname "brightness-osd" \
- --hints string:x-canonical-private-synchronous:brightness \
- --hints string:x-dunst-stack-tag:brightness \
- --hints int:value:"$progress" \
- --icon "$icon" \
- "Brightness: $progress%"
-}
-
-case "${1:-}" in
- increase) shift 1 && delta "+${1:-10}%" && notify ;;
- decrease) shift 1 && delta "${1:-10}-%" && notify ;;
-esac
diff --git a/packages/dunst-volume/default.nix b/packages/dunst-volume/default.nix
deleted file mode 100644
index c1af8ed5..00000000
--- a/packages/dunst-volume/default.nix
+++ /dev/null
@@ -1,16 +0,0 @@
-{ lib, pkgs, ... }:
-pkgs.writeShellApplication {
- name = "dunst-volume";
- runtimeInputs = with pkgs; [ dunst ponymix ];
- text = let
- iconBasePath = "${pkgs.papirus-icon-theme}/share/icons/Papirus-Dark/symbolic/status";
- in
- ''
- DUNST_VOLUME_MUTED_ICON="${iconBasePath}/audio-volume-muted-symbolic.svg"
- DUNST_VOLUME_LOW_ICON="${iconBasePath}/audio-volume-low-symbolic.svg"
- DUNST_VOLUME_MEDIUM_ICON="${iconBasePath}/audio-volume-medium-symbolic.svg"
- DUNST_VOLUME_HIGH_ICON="${iconBasePath}/audio-volume-high-symbolic.svg"
-
- ${lib.fileContents ./src/dunst-volume.sh}
- '';
-}
\ No newline at end of file
diff --git a/packages/niri-output-configuration/src/niri-output-configuration.sh b/packages/niri-output-configuration/src/niri-output-configuration.sh
index f5b119ba..ffb1995f 100755
--- a/packages/niri-output-configuration/src/niri-output-configuration.sh
+++ b/packages/niri-output-configuration/src/niri-output-configuration.sh
@@ -1,36 +1,39 @@
#shellcheck shell=bash
+# TODO: Explore with icons: echo -en 'Bananas\0icon\x1f/nix/store/sch5j89n8dzipmsazl302qa87606f9br-papirus-icon-theme-20240501/share/icons/Papirus/symbolic/devices/video-display-symbolic.svg' | fuzzel --dmenu^
+
# Functions that depend on the window manager
-dmenu() { options | fuzzel --dmenu --placeholder "Output Configuration" --lines 3; }
+dmenu() { fuzzel --dmenu --placeholder "Output Configuration" --lines 3; }
notify() { notify-send "Output Configuration" "$1"; }
exists_display() { niri msg --json outputs | jq --exit-status --arg DISPLAY "$1" '.[$DISPLAY]' > /dev/null; }
-is_display_on() { niri msg --json outputs | jq --exit-status --arg DISPLAY "$1" '.[$DISPLAY] | .current_mode' > /dev/null; }
-enable_output() { exists_display "$1" && niri msg output "$1" on; } # checking first, as niri sends the msg once connected
-disable_output() { exists_display "$1" && niri msg output "$1" off; } # checking first, as niri sends the msg once connected
-disable_output_not() {
- export -f disable_output
+
+enable_output() { exists_display "$1" && niri msg output "$1" on; } # assert first as niri sets the state once connected
+disable_output() { exists_display "$1" && niri msg output "$1" off; } # assert first as niri sets the state once connected
+enable_single_output() {
+ export -f disable_output exists_display
niri msg --json outputs \
| jq -r --exit-status --arg DISPLAY "$1" 'keys | .[] | select(. != $DISPLAY)' \
| xargs -I{} sh -c 'disable_output {}'
+ enable_output "$1"
}
-# Utility functions
+# Profile functions
+profile_default_set() { profile_external_set || profile_internal_set; }
+
profile_internal_name() { echo "Internal display"; }
profile_internal_valid() { exists_display eDP-1; }
-profile_internal_set() { profile_internal_valid && disable_output_not eDP-1 && enable_output eDP-1 && profile_internal_name; }
+profile_internal_set() { profile_internal_valid && enable_single_output eDP-1 && profile_internal_name; }
profile_external_name() { echo "External display"; }
profile_external_valid() { exists_display HDMI-A-1; }
-profile_external_set() { profile_external_valid && disable_output_not HDMI-A-1 && enable_output HDMI-A-1 && profile_external_name; }
+profile_external_set() { profile_external_valid && enable_single_output HDMI-A-1 && profile_external_name; }
profile_extend_name() { echo "Extend displays"; }
profile_extend_valid() { exists_display eDP-1 && exists_display HDMI-A-1; }
profile_extend_set() { profile_extend_valid && enable_output eDP-1 && enable_output HDMI-A-1 && profile_extend_name; }
-profile_default_set() { profile_external_set || profile_internal_set; }
-
# shellcheck disable=SC2005
-options() {
+profile_list() {
profile_internal_valid && echo "$(profile_internal_name)"
profile_external_valid && echo "$(profile_external_name)"
profile_extend_valid && echo "$(profile_extend_name)"
@@ -38,11 +41,12 @@ options() {
case "${1:-}" in
dmenu)
- case "$(dmenu)" in
+ case "$(profile_list | dmenu)" in
"$(profile_internal_name)") notify "$(profile_internal_set)" ;;
"$(profile_external_name)") notify "$(profile_external_set)" ;;
"$(profile_extend_name)") notify "$(profile_extend_set)" ;;
esac
;;
- default) notify "$(profile_default_set)" ;;
-esac
+ default) notify "$(profile_default_set)" ;;
+ safemode) notify "$(profile_internal_set)" ;;
+esac
\ No newline at end of file
diff --git a/packages/niri-output-configuration/src/window-swithcher.fish b/packages/niri-output-configuration/src/window-swithcher.fish
deleted file mode 100644
index 305404a0..00000000
--- a/packages/niri-output-configuration/src/window-swithcher.fish
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/usr/bin/env fish
-set windows (niri msg --json windows)
-and set id (echo $windows |
- jq -r '.[] | "\(.id): \(.title)\u0000icon\u001f\(.app_id)"' |
- string replace -ar [·—] - | # fuzzel ignores lines containing these characters for some reason
- fuzzel --dmenu --counter --width 65 --lines (echo $windows | jq length) |
- string split : -f 1)
-and niri msg action focus-window --id $id
\ No newline at end of file
diff --git a/packages/niri-window-dmenu/default.nix b/packages/niri-window-dmenu/default.nix
new file mode 100644
index 00000000..b002ee32
--- /dev/null
+++ b/packages/niri-window-dmenu/default.nix
@@ -0,0 +1,6 @@
+{ lib, pkgs, ... }:
+pkgs.writeShellApplication {
+ name = "niri-window-dmenu";
+ runtimeInputs = with pkgs; [ niri fuzzel jq ];
+ text = lib.fileContents ./src/niri-window-dmenu.sh;
+}
\ No newline at end of file
diff --git a/packages/niri-window-dmenu/src/niri-window-dmenu.sh b/packages/niri-window-dmenu/src/niri-window-dmenu.sh
new file mode 100644
index 00000000..1e324692
--- /dev/null
+++ b/packages/niri-window-dmenu/src/niri-window-dmenu.sh
@@ -0,0 +1,10 @@
+#shellcheck shell=bash
+windows="$(niri msg --json windows)"
+selection="$(echo "${windows}" \
+ | jq -r '.[] | "\(.app_id) - \(.title)\u0000icon\u001f\(.app_id)"' \
+ | fuzzel --counter --dmenu --index --width 65 --lines "$(echo "$windows" | jq length)"
+)"
+
+if [ "$selection" != -1 ]; then
+ niri msg action focus-window --id "$(echo "${windows}" | jq -c --arg INDEX "$selection" '.[$INDEX | tonumber].id')"
+fi
\ No newline at end of file
diff --git a/packages/osd-brightness/default.nix b/packages/osd-brightness/default.nix
new file mode 100644
index 00000000..c11bdca8
--- /dev/null
+++ b/packages/osd-brightness/default.nix
@@ -0,0 +1,17 @@
+{ lib, pkgs, ... }:
+pkgs.writeShellApplication {
+ name = "osd-brightness";
+ runtimeInputs = with pkgs; [ libnotify brightnessctl ];
+ text = let
+ iconBasePath = "${pkgs.pkgs.papirus-icon-theme}/share/icons/Papirus-Dark/symbolic/status";
+ in
+ # FIXME: This is not really configurable. Do something else about this.
+ ''
+ OSD_BRIGHTNESS_OFF_ICON="${iconBasePath}/display-brightness-off-symbolic.svg"
+ OSD_BRIGHTNESS_LOW_ICON="${iconBasePath}/display-brightness-low-symbolic.svg"
+ OSD_BRIGHTNESS_MEDIUM_ICON="${iconBasePath}/display-brightness-medium-symbolic.svg"
+ OSD_BRIGHTNESS_HIGH_ICON="${iconBasePath}/display-brightness-high-symbolic.svg"
+
+ ${lib.fileContents ./src/osd-brightness.sh}
+ '';
+}
\ No newline at end of file
diff --git a/packages/osd-brightness/src/osd-brightness.sh b/packages/osd-brightness/src/osd-brightness.sh
new file mode 100755
index 00000000..514a0486
--- /dev/null
+++ b/packages/osd-brightness/src/osd-brightness.sh
@@ -0,0 +1,41 @@
+#shellcheck shell=sh
+
+OSD_BRIGHTNESS_OFF_ICON="${OSD_BRIGHTNESS_OFF_ICON:-}"
+OSD_BRIGHTNESS_LOW_ICON="${OSD_BRIGHTNESS_LOW_ICON:-}"
+OSD_BRIGHTNESS_MEDIUM_ICON="${OSD_BRIGHTNESS_MEDIUM_ICON:-}"
+OSD_BRIGHTNESS_HIGH_ICON="${OSD_BRIGHTNESS_HIGH_ICON:-}"
+
+get_percentage() { brightnessctl -m | awk -F, '{print $4}' | tr -d %; }
+delta() { brightnessctl set "$1" > /dev/null; }
+
+notify() {
+ percentage="$(get_percentage)"
+ icon=
+ if [ "$percentage" -eq 0 ]; then
+ icon="$OSD_BRIGHTNESS_OFF_ICON"
+ progress=0
+ elif [ "$percentage" -lt 30 ]; then
+ icon="$OSD_BRIGHTNESS_LOW_ICON"
+ progress="$percentage"
+ elif [ "$percentage" -lt 70 ]; then
+ icon="$OSD_BRIGHTNESS_MEDIUM_ICON"
+ progress="$percentage"
+ else
+ icon="$OSD_BRIGHTNESS_HIGH_ICON"
+ progress="$percentage"
+ fi
+
+ notify-send \
+ --expire-time 1500 \
+ --icon "$icon" \
+ --category "brightness-osd" \
+ --hint string:x-canonical-private-synchronous:brightness \
+ --hint string:x-dunst-stack-tag:brightness \
+ --hint int:value:"$progress" \
+ "Brightness: $progress%"
+}
+
+case "${1:-}" in
+ increase) shift 1 && delta "+${1:-10}%" && notify ;;
+ decrease) shift 1 && delta "${1:-10}-%" && notify ;;
+esac
diff --git a/packages/osd-volume/default.nix b/packages/osd-volume/default.nix
new file mode 100644
index 00000000..024ed8fa
--- /dev/null
+++ b/packages/osd-volume/default.nix
@@ -0,0 +1,16 @@
+{ lib, pkgs, ... }:
+pkgs.writeShellApplication {
+ name = "osd-volume";
+ runtimeInputs = with pkgs; [ libnotify ponymix ];
+ text = let
+ iconBasePath = "${pkgs.papirus-icon-theme}/share/icons/Papirus-Dark/symbolic/status";
+ in
+ ''
+ OSD_VOLUME_MUTED_ICON="${iconBasePath}/audio-volume-muted-symbolic.svg"
+ OSD_VOLUME_LOW_ICON="${iconBasePath}/audio-volume-low-symbolic.svg"
+ OSD_VOLUME_MEDIUM_ICON="${iconBasePath}/audio-volume-medium-symbolic.svg"
+ OSD_VOLUME_HIGH_ICON="${iconBasePath}/audio-volume-high-symbolic.svg"
+
+ ${lib.fileContents ./src/osd-volume.sh}
+ '';
+}
\ No newline at end of file
diff --git a/packages/dunst-volume/src/dunst-volume.sh b/packages/osd-volume/src/osd-volume.sh
similarity index 70%
rename from packages/dunst-volume/src/dunst-volume.sh
rename to packages/osd-volume/src/osd-volume.sh
index 7bb66193..27d0109b 100755
--- a/packages/dunst-volume/src/dunst-volume.sh
+++ b/packages/osd-volume/src/osd-volume.sh
@@ -2,10 +2,10 @@
# TODO review: https://askubuntu.com/questions/1267949/how-do-i-automatically-switch-pulseaudio-input-to-headset-upon-connection
-DUNST_VOLUME_MUTED_ICON="${DUNST_VOLUME_MUTED_ICON:-}"
-DUNST_VOLUME_LOW_ICON="${DUNST_VOLUME_LOW_ICON:-}"
-DUNST_VOLUME_MEDIUM_ICON="${DUNST_VOLUME_MEDIUM_ICON:-}"
-DUNST_VOLUME_HIGH_ICON="${DUNST_VOLUME_HIGH_ICON:-}"
+OSD_VOLUME_MUTED_ICON="${OSD_VOLUME_MUTED_ICON:-}"
+OSD_VOLUME_LOW_ICON="${OSD_VOLUME_LOW_ICON:-}"
+OSD_VOLUME_MEDIUM_ICON="${OSD_VOLUME_MEDIUM_ICON:-}"
+OSD_VOLUME_HIGH_ICON="${OSD_VOLUME_HIGH_ICON:-}"
get_percentage() { ponymix get-volume; }
is_muted() { ponymix is-muted; }
@@ -22,26 +22,26 @@ notify() {
percentage="$(get_percentage)"
icon=
if is_muted || [ "$percentage" -eq 0 ]; then
- icon="$DUNST_VOLUME_MUTED_ICON"
+ icon="$OSD_VOLUME_MUTED_ICON"
progress=0
elif [ "$percentage" -lt 30 ]; then
- icon="$DUNST_VOLUME_LOW_ICON"
+ icon="$OSD_VOLUME_LOW_ICON"
progress="$percentage"
elif [ "$percentage" -lt 70 ]; then
- icon="$DUNST_VOLUME_MEDIUM_ICON"
+ icon="$OSD_VOLUME_MEDIUM_ICON"
progress="$percentage"
else
- icon="$DUNST_VOLUME_HIGH_ICON"
+ icon="$OSD_VOLUME_HIGH_ICON"
progress="$percentage"
fi
- dunstify \
- --timeout 1500 \
- --appname "volume-osd" \
- --hints string:x-canonical-private-synchronous:volume \
- --hints string:x-dunst-stack-tag:volume \
- --hints int:value:"$progress" \
+ notify-send \
+ --expire-time 1500 \
--icon "$icon" \
+ --category "volume-osd" \
+ --hint string:x-canonical-private-synchronous:volume \
+ --hint string:x-dunst-stack-tag:volume \
+ --hint int:value:"$progress" \
"Volume: $progress%"
}
From 2d8f6657994cac20f963ee4a75831f7378469e16 Mon Sep 17 00:00:00 2001
From: Bruno Henriques <4727729+bphenriques@users.noreply.github.com>
Date: Fri, 13 Dec 2024 20:50:51 +0000
Subject: [PATCH 26/34] iteration
---
config/home-manager/window-manager/dunst.nix | 3 +-
config/home-manager/window-manager/niri.nix | 31 +++----------
.../home-manager/window-manager/swayidle.nix | 16 +++++++
config/nixos/wayland/display-manager2.nix | 24 +++++++++++
packages/media-player/default.nix | 43 +++++++++++++++++++
packages/rofi-wifi-menu/default.nix | 42 ++++++++++++++++++
6 files changed, 132 insertions(+), 27 deletions(-)
create mode 100644 config/home-manager/window-manager/swayidle.nix
create mode 100644 config/nixos/wayland/display-manager2.nix
create mode 100644 packages/media-player/default.nix
create mode 100644 packages/rofi-wifi-menu/default.nix
diff --git a/config/home-manager/window-manager/dunst.nix b/config/home-manager/window-manager/dunst.nix
index 98ceac43..bc2961f5 100644
--- a/config/home-manager/window-manager/dunst.nix
+++ b/config/home-manager/window-manager/dunst.nix
@@ -1,7 +1,8 @@
{ config, lib, pkgs, ... }:
{
+ services.mako.enable = true;
services.dunst = {
- enable = true;
+ enable = false;
iconTheme = {
name = "Papirus-Dark";
package = pkgs.papirus-icon-theme;
diff --git a/config/home-manager/window-manager/niri.nix b/config/home-manager/window-manager/niri.nix
index 39af4201..bfe7a34e 100644
--- a/config/home-manager/window-manager/niri.nix
+++ b/config/home-manager/window-manager/niri.nix
@@ -1,15 +1,6 @@
{ config, lib, pkgs, self, community, ... }:
-# Check custom scripts: https://github.com/iynaix/dotfiles/blob/fa261818c04e6b1aa7d928a10abd66e2c31c0ed9/packages/dotfiles-rs/dotfiles/src/bin/hypr-pip.rs
-# https://github.com/dileep-kishore/nixos-hyprland/blob/main/home/common/optional/desktops/hyprland/config.nix
-# https://github.com/JaKooLit/Hyprland-Dots/blob/main/config/hypr/configs/Keybinds.conf
-
-# Force Quit active: https://github.com/JaKooLit/Hyprland-Dots/blob/main/config/hypr/configs/Keybinds.conf
-
# Logout: https://github.com/wuliuqii/nixos-config/blob/69606b2e0cccb6a135522fc5df188e4da0595e73/home/wm/wlogout.nix
-
-# Consider going back to waybar: https://github.com/nix-community/nur-combined/blob/4d8b064e3cff836ee8c17c48c592874b0209e167/repos/slaier/modules/waybar/mediaplayer.nix
-
-# Sway idle: https://github.com/nyawox/nixboxes/blob/ecab4559da256b4f1198ca7d39d6e5b1d4442296/home/desktop/niri/swayidle.nix
+# TODO: Alt F4 means keep closing active window until there is none. Then, show list of options.
# Login
# Greetd: https://github.com/linuxmobile/kaku/blob/13eb9e8a19823cb2fa2aed29f7b1f49bea51c4a2/system/services/greetd.nix#L5
@@ -27,13 +18,8 @@
# https://github.com/nyawox/nixboxes/blob/ecab4559da256b4f1198ca7d39d6e5b1d4442296/home/desktop/niri/general.nix
- # If Share picker doesn’t use the system theme
- # dbus-update-activation-environment --systemd --all
- #systemctl --user import-environment QT_QPA_PLATFORMTHEME
# Ideas
- # "Mod+Return".action = spawn "${config.profile.terminal}";
- # "Mod+E".action = spawn "nautilus";
# "Mod+Escape".action = spawn "wlogout";
/*
*/
@@ -44,9 +30,6 @@
# https://gitlab.com/scientiac/einstein.nixos/-/tree/main/home/niriwm?ref_type=heads
-# TODO: Alt F4 means keep closing active window until there is none. Then, show list of options.
-# TODO: Script at startup that figures out the right layout
-
let
# nix repl
@@ -62,9 +45,7 @@ let
QT_QPA_PLATFORM = "wayland";
DISPLAY = ":1";
NIXOS_OZONE_WL = "1";
- XDG_CURRENT_DESKTOP = "niri";
- XDG_SESSION_TYPE = "wayland";
- MOZ_ENABLE_WAYLAND = "1";
+ # MOZ_ENABLE_WAYLAND = "1";
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
# GBM_BACKEND=nvidia-drm
# XDG_BACKEND=wayland
@@ -72,7 +53,7 @@ let
on-startup = ''
spawn-at-startup "${lib.getExe pkgs.swww}" "img" "--transition-type" "none" "${wallpapersPkg}/share/wallpapers/mountains.png"
- spawn-at-startup "xwayland-satellite" ":21"
+ spawn-at-startup "${lib.getExe pkgs.xwayland-satellite}" ":21"
spawn-at-startup "${lib.getExe pkgs.waybar}"
spawn-at-startup "${lib.getExe self.pkgs.niri-output-configuration}" "default"
'';
@@ -207,7 +188,8 @@ in
Mod+Shift+E { quit; }
Mod+Period { spawn "${lib.getExe pkgs.bemoji}"; }
- Alt+Tab { spawn "${lib.getExe self.pkgs.niri-window-dmenu}"; }
+ Mod+Shift+Tab { focus-workspace-previous; }
+ Mod+Tab { spawn "${lib.getExe self.pkgs.niri-window-dmenu}"; }
// Suggested binds for running programs: terminal, app launcher, screen locker.
Mod+Return { spawn "${lib.getExe community.pkgs.ghostty}"; }
@@ -260,9 +242,6 @@ in
Mod+Ctrl+8 { move-column-to-workspace 8; }
Mod+Ctrl+9 { move-column-to-workspace 9; }
- // Switches focus between the current and the previous workspace.
- Mod+Tab { focus-workspace-previous; }
-
// Mod+Comma { consume-window-into-column; }
// Mod+Period { expel-window-from-column; }
diff --git a/config/home-manager/window-manager/swayidle.nix b/config/home-manager/window-manager/swayidle.nix
new file mode 100644
index 00000000..240eb446
--- /dev/null
+++ b/config/home-manager/window-manager/swayidle.nix
@@ -0,0 +1,16 @@
+{ pkgs, lib, ... }:
+{
+ services.swayidle = {
+ enable = true;
+ timeouts = [
+ {
+ timeout = 60 * 10;
+ command = "${lib.getExe pkgs.niri} msg action power-off-monitors";
+ }
+ {
+ timeout = 600;
+ command = "${lib.getExe pkgs.swaylock-effects} --screenshots --clock --indicator --indicator-radius 100 --indicator-thickness 7 --effect-blur 7x5 --effect-vignette 0.5:0.5 --ring-color f5c2e7 --text-color cdd6f4 --key-hl-color fab387 --line-color 00000000 --inside-color 1e1e2e88 --separator-color 00000000 --grace 2 --fade-in 0.2";
+ }
+ ];
+ };
+}
\ No newline at end of file
diff --git a/config/nixos/wayland/display-manager2.nix b/config/nixos/wayland/display-manager2.nix
new file mode 100644
index 00000000..159e58b2
--- /dev/null
+++ b/config/nixos/wayland/display-manager2.nix
@@ -0,0 +1,24 @@
+{ pkgs, lib, self, ... }:
+let
+ wallpapers = self.private.wallpapers.override {
+ selected = [ "lake-fishing-sunset" "mountains" "whale-sunset" "watch-tower" ];
+ };
+in
+{
+ # greetd display manager
+ services.greetd = let
+ session = {
+ command = "${lib.getExe pkgs.greetd.tuigreet} --time --cmd niri-session";
+ };
+ in {
+ enable = true;
+ settings = {
+ terminal.vt = 1;
+ default_session = session;
+ initial_session = session;
+ };
+ };
+
+ # unlock GPG keyring on login
+ security.pam.services.greetd.enableGnomeKeyring = true;
+}
diff --git a/packages/media-player/default.nix b/packages/media-player/default.nix
new file mode 100644
index 00000000..2c9a856e
--- /dev/null
+++ b/packages/media-player/default.nix
@@ -0,0 +1,43 @@
+{ lib
+, stdenv
+, wrapGAppsHook
+, gobject-introspection
+, glib
+, playerctl
+, python3
+}:
+
+stdenv.mkDerivation {
+ pname = "waybar-mediaplayer";
+ version = "0.1.0";
+
+ src = lib.sourceFilesBySuffices ./. [ ".py" ];
+
+ nativeBuildInputs = [
+ wrapGAppsHook
+ gobject-introspection
+ ];
+
+ propagatedBuildInputs = [
+ glib
+ playerctl
+ python3.pkgs.pygobject3
+ ];
+
+ strictDeps = false;
+
+ installPhase = ''
+ mkdir -p $out/bin
+ cp $src/mediaplayer.py $out/bin/waybar-mediaplayer.py
+ wrapProgram $out/bin/waybar-mediaplayer.py \
+ --prefix PYTHONPATH : "$PYTHONPATH:$out/${python3.sitePackages}"
+ '';
+
+ meta = with lib; {
+ description = "Generic MediaPlayer for waybar";
+ license = licenses.mit;
+ platforms = platforms.unix;
+ mainProgram = "waybar-mediaplayer.py";
+ homepage = "https://github.com/Alexays/Waybar/blob/master/resources/custom_modules/mediaplayer.py";
+ };
+}
\ No newline at end of file
diff --git a/packages/rofi-wifi-menu/default.nix b/packages/rofi-wifi-menu/default.nix
new file mode 100644
index 00000000..68e22ac0
--- /dev/null
+++ b/packages/rofi-wifi-menu/default.nix
@@ -0,0 +1,42 @@
+{
+ lib,
+ fetchFromGitHub,
+ stdenvNoCC,
+ makeWrapper,
+ libnotify,
+ networkmanager,
+}:
+stdenvNoCC.mkDerivation {
+ pname = "rofi-wifi-menu";
+ version = "unstable-2023-11-23";
+
+ src = fetchFromGitHub {
+ owner = "ericmurphyxyz";
+ repo = "rofi-wifi-menu";
+ rev = "d6debde6e302f68d8235ced690d12719124ff18e";
+ hash = "sha256-H+vBRdGcSDMKGLHhPB7imV148O8GRTMj1tZ+PLQUVG4=";
+ };
+
+ nativeBuildInputs = [ makeWrapper ];
+
+ postInstall = ''
+ install -D ./rofi-wifi-menu.sh $out/bin/rofi-wifi-menu
+
+ wrapProgram $out/bin/rofi-wifi-menu \
+ --prefix PATH : ${
+ lib.makeBinPath [
+ libnotify
+ networkmanager
+ ]
+ }
+ '';
+
+ meta = {
+ description = "A bash script using nmcli and rofi to make a wifi menu for your favorite window manager";
+ homepage = "https://github.com/ericmurphyxyz/rofi-wifi-menu";
+ license = lib.licenses.unfree; # nix-init did not find a license
+ maintainers = with lib.maintainers; [ iynaix ];
+ mainProgram = "rofi-wifi-menu";
+ platforms = lib.platforms.all;
+ };
+}
\ No newline at end of file
From 931a9c02705f5aead0a7d9e8f2eb57b644b9e61d Mon Sep 17 00:00:00 2001
From: Bruno Henriques <4727729+bphenriques@users.noreply.github.com>
Date: Mon, 16 Dec 2024 11:39:57 +0000
Subject: [PATCH 27/34] Cleanup
---
config/darwin/default.nix | 2 +
config/home-manager/default.nix | 2 +
config/home-manager/media/video.nix | 6 +-
config/home-manager/window-manager/niri.nix | 219 ++++++++----------
config/nixos/default.nix | 16 +-
config/nixos/desktop.nix | 16 ++
config/nixos/greetd.nix | 20 ++
config/nixos/nautilus.nix | 9 -
config/nixos/programs.nix | 22 +-
config/nixos/services.nix | 12 -
config/nixos/thunar.nix | 17 --
.../{wayland/default.nix => wayland.nix} | 16 +-
config/nixos/wayland/display-manager.nix | 26 ---
config/nixos/wayland/display-manager2.nix | 24 --
flake.lock | 156 +++++++------
flake.nix | 5 +-
hosts/laptop/default.nix | 39 ++--
hosts/peripherals.nix | 18 ++
hosts/work-macos/default.nix | 12 +-
lib/hosts.nix | 26 +--
modules/nixos/system/boot-theme.nix | 3 +-
packages/default.nix | 1 +
.../src/niri-output-configuration.sh | 2 +-
packages/swww-util/default.nix | 6 +
packages/swww-util/swww-util.sh | 8 +
25 files changed, 302 insertions(+), 381 deletions(-)
create mode 100644 config/nixos/desktop.nix
create mode 100644 config/nixos/greetd.nix
delete mode 100644 config/nixos/nautilus.nix
delete mode 100644 config/nixos/services.nix
delete mode 100644 config/nixos/thunar.nix
rename config/nixos/{wayland/default.nix => wayland.nix} (64%)
delete mode 100644 config/nixos/wayland/display-manager.nix
delete mode 100644 config/nixos/wayland/display-manager2.nix
create mode 100644 hosts/peripherals.nix
create mode 100644 packages/swww-util/default.nix
create mode 100644 packages/swww-util/swww-util.sh
diff --git a/config/darwin/default.nix b/config/darwin/default.nix
index 6cd20ebb..151f3d91 100644
--- a/config/darwin/default.nix
+++ b/config/darwin/default.nix
@@ -96,6 +96,8 @@
# Fonts (system-wide)
fonts.packages = with pkgs; [
+ # pkgs.nerd-fonts.hack
+ # pkgs.nerd-fonts.jetbrains-mono
(nerdfonts.override { fonts = [ "Hack" "JetBrainsMono" ]; })
];
diff --git a/config/home-manager/default.nix b/config/home-manager/default.nix
index 1b8feb2e..1e6942ed 100644
--- a/config/home-manager/default.nix
+++ b/config/home-manager/default.nix
@@ -34,6 +34,8 @@
p7zip # 7zip for linux
unrar # Still need it
] ++ lib.optionals pkgs.stdenv.isLinux [
+ # pkgs.nerd-fonts.hack
+ # pkgs.nerd-fonts.jetbrains-mono
(nerdfonts.override { fonts = [ "Hack" "JetBrainsMono" ]; })
baobab # Visual disk space analyzer
];
diff --git a/config/home-manager/media/video.nix b/config/home-manager/media/video.nix
index 2e3cbd13..9a9f52aa 100644
--- a/config/home-manager/media/video.nix
+++ b/config/home-manager/media/video.nix
@@ -1,4 +1,4 @@
-{ pkgs, lib, config, host, ... }:
+{ pkgs, lib, config, ... }:
# TODO: Check https://github.com/iynaix/dotfiles/blob/f0f8918caed8f4c245fa82fc505ae0de09a32f5c/home-manager/programs/mpv.nix
# TODO: https://github.com/diniamo/niqs/blob/53288d72902365ee8d3bfdd6aff0ec79eb7c1c36/home/mpv/anime.nix
# https://github.com/Samillion/ModernZ
@@ -98,9 +98,7 @@ in
home.shellAliases = lib.optionalAttrs (pkgs.stdenv.isLinux) {
"mpv360" = "${lib.getExe config.programs.mpv.package} --script-opts=360plugin-enabled=yes";
- } // (lib.optionalAttrs (pkgs.stdenv.isLinux && (host ? webcam)) {
- "webcam" = "${lib.getExe config.programs.mpv.package} --profile=low-latency --untimed -vf=hflip ${host.webcam}";
- });
+ };
custom.xdgDefaultApps.video = lib.mkBefore [ "mpv.desktop" ];
custom.xdgDefaultApps.audio = lib.mkBefore [ "mpv.desktop" ];
diff --git a/config/home-manager/window-manager/niri.nix b/config/home-manager/window-manager/niri.nix
index bfe7a34e..42173aac 100644
--- a/config/home-manager/window-manager/niri.nix
+++ b/config/home-manager/window-manager/niri.nix
@@ -1,37 +1,19 @@
{ config, lib, pkgs, self, community, ... }:
# Logout: https://github.com/wuliuqii/nixos-config/blob/69606b2e0cccb6a135522fc5df188e4da0595e73/home/wm/wlogout.nix
# TODO: Alt F4 means keep closing active window until there is none. Then, show list of options.
-
-# Login
-# Greetd: https://github.com/linuxmobile/kaku/blob/13eb9e8a19823cb2fa2aed29f7b1f49bea51c4a2/system/services/greetd.nix#L5
-# https://github.com/linuxmobile/kaku/blob/13eb9e8a19823cb2fa2aed29f7b1f49bea51c4a2/system/services/gdm.nix
-# https://github.com/SergioRibera/dotfiles/blob/8e03a755e4e03b26722e6971effa4161c3efd0b6/hosts/common/services.nix#L45
-
+# TODO: "Mod+Escape".action = spawn "wlogout";
# Battery? https://github.com/linuxmobile/kaku/blob/13eb9e8a19823cb2fa2aed29f7b1f49bea51c4a2/system/services/power.nix
-
# Seems to be more or less what I want? https://github.com/kiike/dotfiles/blob/ff788bae02ba6d15c73632d99654269d2b5fba49/hosts/balrog/default.nix
-
# Idle effect: https://github.com/nyawox/nixboxes/blob/ecab4559da256b4f1198ca7d39d6e5b1d4442296/home/desktop/niri/swayidle.nix#L24
-
# Screencast? https://github.com/maximbaz/dotfiles/blob/98ff8b69370e86879faf57b29d07cfcb6aff4306/modules/linux/xdg.nix#L2
-
# https://github.com/nyawox/nixboxes/blob/ecab4559da256b4f1198ca7d39d6e5b1d4442296/home/desktop/niri/general.nix
-
- # Ideas
- # "Mod+Escape".action = spawn "wlogout";
-/*
-*/
# Window rules: https://github.com/nyawox/nixboxes/blob/ecab4559da256b4f1198ca7d39d6e5b1d4442296/home/desktop/niri/general.nix#L143
# Env variables: https://github.com/nyawox/nixboxes/blob/ecab4559da256b4f1198ca7d39d6e5b1d4442296/home/desktop/niri/general.nix#L185
-
# Funny login audio: https://github.com/nyawox/nixboxes/blob/ecab4559da256b4f1198ca7d39d6e5b1d4442296/home/desktop/niri/general.nix#L201
-
# https://gitlab.com/scientiac/einstein.nixos/-/tree/main/home/niriwm?ref_type=heads
-
let
-
# nix repl
# then :lf .
# then inputs.nixpkgs.lib.strings.concatMapStringsSep " " (x: ''"${x}"'') inputs.nixpkgs.lib.strings.splitString " " "please run this command"
@@ -42,20 +24,17 @@ let
};
env = {
+ DISPLAY = ":21";
+ NIXOS_OZONE_WL = "1"; # Electron?
QT_QPA_PLATFORM = "wayland";
- DISPLAY = ":1";
- NIXOS_OZONE_WL = "1";
- # MOZ_ENABLE_WAYLAND = "1";
- QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
- # GBM_BACKEND=nvidia-drm
- # XDG_BACKEND=wayland
+ QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; # Signal QT windows to remove their window decorations
};
on-startup = ''
- spawn-at-startup "${lib.getExe pkgs.swww}" "img" "--transition-type" "none" "${wallpapersPkg}/share/wallpapers/mountains.png"
+ spawn-at-startup "${lib.getExe self.pkgs.swww-util}" "random" "${wallpapersPkg}/share/wallpapers"
spawn-at-startup "${lib.getExe pkgs.xwayland-satellite}" ":21"
spawn-at-startup "${lib.getExe pkgs.waybar}"
- spawn-at-startup "${lib.getExe self.pkgs.niri-output-configuration}" "default"
+ spawn-at-startup "${lib.getExe self.pkgs.niri-output-configuration}" "startup"
'';
input = ''
@@ -113,17 +92,9 @@ let
}
}
'';
-
- set-terminal = ''
- ${pkgs.swww}/bin/swww img "${wallpapersPkg}/share/wallpapers/mountains.png"
- '';
in
{
- home.packages = with pkgs; [
- # pamixer ?
- ];
-
- services.gnome-keyring.enable = true;
+ #services.gnome-keyring.enable = true; # Redundant as done in nixos?
xdg.configFile."niri/config.kdl".text = ''
workspace "coding"
@@ -173,97 +144,91 @@ in
}
binds {
- // Basic
- Mod+Q { close-window; }
- Mod+Shift+Slash { show-hotkey-overlay; }
- Mod+F { maximize-column; }
- Mod+Shift+F { fullscreen-window; }
- Mod+C { center-column; }
- Mod+W { spawn "pkill" "-SIGUSR1" "waybar"; }
-
- Print { screenshot; }
- Ctrl+Print { screenshot-screen; }
- Alt+Print { screenshot-window; }
-
- Mod+Shift+E { quit; }
-
- Mod+Period { spawn "${lib.getExe pkgs.bemoji}"; }
- Mod+Shift+Tab { focus-workspace-previous; }
- Mod+Tab { spawn "${lib.getExe self.pkgs.niri-window-dmenu}"; }
-
- // Suggested binds for running programs: terminal, app launcher, screen locker.
- Mod+Return { spawn "${lib.getExe community.pkgs.ghostty}"; }
- Mod+Space { spawn "${lib.getExe pkgs.fuzzel}"; }
- Super+Alt+L { spawn "swaylock"; }
-
- // Audio
- XF86AudioRaiseVolume allow-when-locked=true { spawn "${lib.getExe self.pkgs.osd-volume}" "increase"; }
- XF86AudioLowerVolume allow-when-locked=true { spawn "${lib.getExe self.pkgs.osd-volume}" "decrease"; }
- XF86AudioMute allow-when-locked=true { spawn "${lib.getExe self.pkgs.osd-volume}" "toggle-mute"; }
- XF86AudioMicMute allow-when-locked=true { spawn "wpctl" "set-mute" "@DEFAULT_AUDIO_SOURCE@" "toggle"; }
- XF86AudioNext allow-when-locked=true { spawn "playerctl" "next"; }
- XF86AudioPause allow-when-locked=true { spawn "playerctl" "play-pause"; }
- XF86AudioPlay allow-when-locked=true { spawn "playerctl" "play-pause"; }
- XF86AudioPrev allow-when-locked=true { spawn "playerctl" "previous"; }
-
- // Brightness
- XF86MonBrightnessUp allow-when-locked=true { spawn "${lib.getExe self.pkgs.osd-brightness}" "increase"; }
- XF86MonBrightnessDown allow-when-locked=true { spawn "${lib.getExe self.pkgs.osd-brightness}" "decrease"; }
-
- Mod+Left { focus-column-left; }
- Mod+Down { focus-window-down; }
- Mod+Up { focus-window-up; }
- Mod+Right { focus-column-right; }
-
- Mod+Ctrl+Left { move-column-left; }
- Mod+Ctrl+Down { move-window-down; }
- Mod+Ctrl+Up { move-window-up; }
- Mod+Ctrl+Right { move-column-right; }
-
- Mod+Shift+Down { focus-workspace-down; }
- Mod+Shift+Up { focus-workspace-up; }
-
- Mod+1 { focus-workspace 1; }
- Mod+2 { focus-workspace 2; }
- Mod+3 { focus-workspace 3; }
- Mod+4 { focus-workspace 4; }
- Mod+5 { focus-workspace 5; }
- Mod+6 { focus-workspace 6; }
- Mod+7 { focus-workspace 7; }
- Mod+8 { focus-workspace 8; }
- Mod+9 { focus-workspace 9; }
- Mod+Ctrl+1 { move-column-to-workspace 1; }
- Mod+Ctrl+2 { move-column-to-workspace 2; }
- Mod+Ctrl+3 { move-column-to-workspace 3; }
- Mod+Ctrl+4 { move-column-to-workspace 4; }
- Mod+Ctrl+5 { move-column-to-workspace 5; }
- Mod+Ctrl+6 { move-column-to-workspace 6; }
- Mod+Ctrl+7 { move-column-to-workspace 7; }
- Mod+Ctrl+8 { move-column-to-workspace 8; }
- Mod+Ctrl+9 { move-column-to-workspace 9; }
-
- // Mod+Comma { consume-window-into-column; }
- // Mod+Period { expel-window-from-column; }
-
- // There are also commands that consume or expel a single window to the side.
- Mod+BracketLeft { consume-or-expel-window-left; }
- Mod+BracketRight { consume-or-expel-window-right; }
-
- Mod+R { switch-preset-column-width; }
- Mod+Shift+R { switch-preset-window-height; }
- Mod+Ctrl+R { reset-window-height; }
-
- // Actions to switch layouts.
- // Note: if you uncomment these, make sure you do NOT have
- // a matching layout switch hotkey configured in xkb options above.
- // Having both at once on the same hotkey will break the switching,
- // since it will switch twice upon pressing the hotkey (once by xkb, once by niri).
- // Mod+Space { switch-layout "next"; }
- // Mod+Shift+Space { switch-layout "prev"; }
-
- // Powers off the monitors. To turn them back on, do any input like
- // moving the mouse or pressing any other key.
- Mod+Shift+P { power-off-monitors; }
+ // Basic
+ Mod+Q { close-window; }
+ Mod+Shift+Slash { show-hotkey-overlay; }
+ Mod+F { maximize-column; }
+ Mod+Shift+F { fullscreen-window; }
+ Mod+C { center-column; }
+ Mod+W { spawn "pkill" "-SIGUSR1" "waybar"; }
+
+ Print { screenshot; }
+ Ctrl+Print { screenshot-screen; }
+ Alt+Print { screenshot-window; }
+
+ Mod+Shift+E { quit; }
+
+ Mod+Period { spawn "${lib.getExe pkgs.bemoji}"; }
+ Mod+Shift+Tab { focus-workspace-previous; }
+ Mod+Tab { spawn "${lib.getExe self.pkgs.niri-window-dmenu}"; }
+
+ // Suggested binds for running programs: terminal, app launcher, screen locker.
+ Mod+Return { spawn "${lib.getExe community.pkgs.ghostty}"; }
+ Mod+Space { spawn "${lib.getExe pkgs.fuzzel}"; }
+ Super+Alt+L { spawn "swaylock"; }
+
+ // Audio
+ XF86AudioRaiseVolume allow-when-locked=true { spawn "${lib.getExe self.pkgs.osd-volume}" "increase"; }
+ XF86AudioLowerVolume allow-when-locked=true { spawn "${lib.getExe self.pkgs.osd-volume}" "decrease"; }
+ XF86AudioMute allow-when-locked=true { spawn "${lib.getExe self.pkgs.osd-volume}" "toggle-mute"; }
+ XF86AudioMicMute allow-when-locked=true { spawn "wpctl" "set-mute" "@DEFAULT_AUDIO_SOURCE@" "toggle"; }
+ XF86AudioNext allow-when-locked=true { spawn "playerctl" "next"; }
+ XF86AudioPause allow-when-locked=true { spawn "playerctl" "play-pause"; }
+ XF86AudioPlay allow-when-locked=true { spawn "playerctl" "play-pause"; }
+ XF86AudioPrev allow-when-locked=true { spawn "playerctl" "previous"; }
+
+ // Brightness
+ XF86MonBrightnessUp allow-when-locked=true { spawn "${lib.getExe self.pkgs.osd-brightness}" "increase"; }
+ XF86MonBrightnessDown allow-when-locked=true { spawn "${lib.getExe self.pkgs.osd-brightness}" "decrease"; }
+
+ Mod+Left { focus-column-left; }
+ Mod+Down { focus-window-down; }
+ Mod+Up { focus-window-up; }
+ Mod+Right { focus-column-right; }
+
+ Mod+Ctrl+Left { move-column-left; }
+ Mod+Ctrl+Down { move-window-down; }
+ Mod+Ctrl+Up { move-window-up; }
+ Mod+Ctrl+Right { move-column-right; }
+
+ Mod+Shift+Down { focus-workspace-down; }
+ Mod+Shift+Up { focus-workspace-up; }
+
+ Mod+1 { focus-workspace 1; }
+ Mod+2 { focus-workspace 2; }
+ Mod+3 { focus-workspace 3; }
+ Mod+4 { focus-workspace 4; }
+ Mod+5 { focus-workspace 5; }
+ Mod+6 { focus-workspace 6; }
+ Mod+7 { focus-workspace 7; }
+ Mod+8 { focus-workspace 8; }
+ Mod+9 { focus-workspace 9; }
+ Mod+Ctrl+1 { move-column-to-workspace 1; }
+ Mod+Ctrl+2 { move-column-to-workspace 2; }
+ Mod+Ctrl+3 { move-column-to-workspace 3; }
+ Mod+Ctrl+4 { move-column-to-workspace 4; }
+ Mod+Ctrl+5 { move-column-to-workspace 5; }
+ Mod+Ctrl+6 { move-column-to-workspace 6; }
+ Mod+Ctrl+7 { move-column-to-workspace 7; }
+ Mod+Ctrl+8 { move-column-to-workspace 8; }
+ Mod+Ctrl+9 { move-column-to-workspace 9; }
+
+ // Mod+Comma { consume-window-into-column; }
+ // Mod+Period { expel-window-from-column; }
+
+ // There are also commands that consume or expel a single window to the side.
+ Mod+BracketLeft { consume-or-expel-window-left; }
+ Mod+BracketRight { consume-or-expel-window-right; }
+
+ Mod+R { switch-preset-column-width; }
+ Mod+Shift+R { switch-preset-window-height; }
+ Mod+Ctrl+R { reset-window-height; }
+
+ Alt+Mod+Space { switch-layout "next"; }
+
+ // Powers off the monitors. To turn them back on, do any input like
+ // moving the mouse or pressing any other key.
+ Mod+Shift+P { power-off-monitors; }
}
'';
}
diff --git a/config/nixos/default.nix b/config/nixos/default.nix
index 73372248..1f627bcb 100644
--- a/config/nixos/default.nix
+++ b/config/nixos/default.nix
@@ -1,13 +1,10 @@
{ pkgs, lib, network-devices, ... }:
{
imports = [
+ ./greetd.nix # X11/Wayland agnostic display manager
+ ./wayland.nix # Wayland compositor
./programs.nix
- ./services.nix
- ./wayland
-
- # Choose one file browser
- ./thunar.nix
- ./nautilus.nix
+ ./desktop.nix
];
nix = {
@@ -63,5 +60,12 @@
};
};
+ services.fwupd.enable = true; # Updates firmwares: `fwupdmgr`
+
+ # Security related
+ services.journald.extraConfig = ''
+ MaxRetentionSec=1month
+ SystemMaxUse=1G
+ '';
security.sudo.extraConfig = "Defaults lecture=never";
}
diff --git a/config/nixos/desktop.nix b/config/nixos/desktop.nix
new file mode 100644
index 00000000..e344ed0c
--- /dev/null
+++ b/config/nixos/desktop.nix
@@ -0,0 +1,16 @@
+{ pkgs, ... }:
+{
+ environment.systemPackages = [
+ pkgs.nautilus # File Browser
+ pkgs.cheese # Webcam
+ ];
+
+ services = {
+ # TODO: https://github.com/ners/trilby/blob/7dd41d0704ebf75f8f705da066184f5ed6168441/modules/home/dconf.nix#L44
+ gnome.sushi.enable = true; # Nautilus: previews
+ gvfs.enable = true; # Nautilus: Mount, trash, and other functionalities
+ flatpak.enable = true; # Easier to run some programs. Setup afterwards: flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
+ };
+
+ programs.partition-manager.enable = true;
+}
diff --git a/config/nixos/greetd.nix b/config/nixos/greetd.nix
new file mode 100644
index 00000000..9e9b124d
--- /dev/null
+++ b/config/nixos/greetd.nix
@@ -0,0 +1,20 @@
+{ pkgs, config, lib, ... }:
+{
+ services.greetd = let
+ theme = "--theme border=magenta;text=cyan;prompt=green;time=red;action=blue;button=yellow;container=black;input=red";
+ options = ''--user-menu --asterisks --time --asterisks --greeting "Hi!" --remember --remember-session'';
+ session = {
+ command = ''${lib.getExe pkgs.greetd.tuigreet} ${theme} ${options} --cmd niri-session''; # FIXME: Hardcoded?
+ user = config.users.users.bphenriques.name; # FIXME: Hardcoded?
+ };
+ in {
+ enable = true;
+ settings = {
+ terminal.vt = 1;
+ default_session = session;
+ initial_session = session;
+ };
+ };
+
+ security.pam.services.greetd.enableGnomeKeyring = true; # unlock GPG keyring on login
+}
diff --git a/config/nixos/nautilus.nix b/config/nixos/nautilus.nix
deleted file mode 100644
index 95b4e45d..00000000
--- a/config/nixos/nautilus.nix
+++ /dev/null
@@ -1,9 +0,0 @@
-{ pkgs, ... }:
-{
- environment.systemPackages = [
- pkgs.nautilus # File Browser
- pkgs.sushi # thumbnails in nautilus
- ];
-
- services.gvfs.enable = true; # Mount, trash, and other functionalities
-}
diff --git a/config/nixos/programs.nix b/config/nixos/programs.nix
index 47548944..6f4e3f35 100644
--- a/config/nixos/programs.nix
+++ b/config/nixos/programs.nix
@@ -1,28 +1,22 @@
{ pkgs, ... }:
{
+ environment.systemPackages = let
+ filesystems = [ pkgs.exfat pkgs.ntfs3g ]; # Suport exFAT and NTFS formatted drives (pendisks + external disks)
+ hardware = [
+ pkgs.powertop # Check what is consuming too much energy
+ pkgs.usbutils # USB utilities
+ ];
+ in filesystems ++ hardware;
+
# Programs
programs = {
fish = {
enable = true; # System level.
vendor.functions.enable = true; # Ensure completions/functions are automatically set.
};
- partition-manager.enable = true;
# Disabling some defaults
command-not-found.enable = false;
nano.enable = false;
};
-
- environment.systemPackages = with pkgs; [
- # Suport exFAT and NTFS formatted drives (pendisks + external disks)
- exfat
- ntfs3g
-
- powertop # Check what is consuming too much energy
- usbutils # USB utilities
-
- # Other
- cheese # Webcam
- # amberol? blanket?
- ];
}
diff --git a/config/nixos/services.nix b/config/nixos/services.nix
deleted file mode 100644
index 0a748893..00000000
--- a/config/nixos/services.nix
+++ /dev/null
@@ -1,12 +0,0 @@
-{ pkgs, ... }:
-{
- services.fwupd.enable = true; # Updates firmwares: `fwupdmgr`
-
- # To install or run some programs, it is easier to this way.
- # Follow with: flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
- services.flatpak.enable = true;
- services.journald.extraConfig = ''
- MaxRetentionSec=1month
- SystemMaxUse=1G
- '';
-}
diff --git a/config/nixos/thunar.nix b/config/nixos/thunar.nix
deleted file mode 100644
index 8a74fd55..00000000
--- a/config/nixos/thunar.nix
+++ /dev/null
@@ -1,17 +0,0 @@
-{ pkgs, ... }:
-{
- # https://wiki.archlinux.org/title/Thunar
- programs.thunar = {
- enable = true;
- plugins = with pkgs.xfce; [
- exo
- thunar-archive-plugin # Unarchive filess more easily
- thunar-volman # Removable media
- ];
- };
-
- programs.xfconf.enable = true; # Required to persist Thunar settings as we're not running on XFCE
- services.gvfs.enable = true; # Mount, trash, and other functionalities
- services.tumbler.enable = true; # Thumbnail support for images
- programs.file-roller.enable = true; # For thunar-archive-plugin
-}
diff --git a/config/nixos/wayland/default.nix b/config/nixos/wayland.nix
similarity index 64%
rename from config/nixos/wayland/default.nix
rename to config/nixos/wayland.nix
index 61bff6a0..cf4cd364 100644
--- a/config/nixos/wayland/default.nix
+++ b/config/nixos/wayland.nix
@@ -1,12 +1,5 @@
{ pkgs, lib, network-devices, ... }:
{
- imports = [
- ./display-manager.nix
- ];
-
- # https://github.com/sodiboo/niri-flake/blob/main/flake.nix
- # https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/programs/wayland/wayland-session.nix
- # https://github.com/nyawox/nixboxes/blob/ecab4559da256b4f1198ca7d39d6e5b1d4442296/home/desktop/niri/general.nix
programs.niri.enable = true;
security.pam.services.swaylock = {};
services.gnome.gnome-keyring.enable = true;
@@ -24,13 +17,7 @@
# Core - Dependencies
qt5.qtwayland
qt6.qtwayland
- inotify-tools
libnotify
- # egl-wayland # E.g., Ghostty on Wayland
-
- # Hardware
- brightnessctl # Manage Brightness
- pavucontrol # Manage audio
xwayland-satellite # X11. See: https://github.com/YaLTeR/niri/wiki/Xwayland
konsole # Backup terminal in case something goes wrong
@@ -42,7 +29,6 @@
qogir-icon-theme
gnome-calendar
gnome-system-monitor
- gnome-calculator
+ gnome-calculator # Replace with launcher
];
-
}
diff --git a/config/nixos/wayland/display-manager.nix b/config/nixos/wayland/display-manager.nix
deleted file mode 100644
index f06a96ba..00000000
--- a/config/nixos/wayland/display-manager.nix
+++ /dev/null
@@ -1,26 +0,0 @@
-{ pkgs, self, ... }:
-let
- wallpapers = self.private.wallpapers.override {
- selected = [ "lake-fishing-sunset" "mountains" "whale-sunset" "watch-tower" ];
- };
-in
-{
- # Login Screen
- services.displayManager.sddm = {
- enable = true;
- wayland.enable = true;
- theme = "sddm-astronaut-theme";
- };
- environment.systemPackages = [
- # https://github.com/Keyitdev/sddm-astronaut-theme/blob/master/theme.conf
- # It is possible to override the package and set themeConfig. For now, I will iterate like this.
- pkgs.sddm-astronaut
- (pkgs.writeTextDir "share/sddm/themes/sddm-astronaut-theme/theme.conf.user" ''
- [General]
- background=${wallpapers}/share/wallpapers/watch-tower.png
- FullBlur="false"
- PartialBlur="false"
- FormPosition="center"
- '')
- ];
-}
diff --git a/config/nixos/wayland/display-manager2.nix b/config/nixos/wayland/display-manager2.nix
deleted file mode 100644
index 159e58b2..00000000
--- a/config/nixos/wayland/display-manager2.nix
+++ /dev/null
@@ -1,24 +0,0 @@
-{ pkgs, lib, self, ... }:
-let
- wallpapers = self.private.wallpapers.override {
- selected = [ "lake-fishing-sunset" "mountains" "whale-sunset" "watch-tower" ];
- };
-in
-{
- # greetd display manager
- services.greetd = let
- session = {
- command = "${lib.getExe pkgs.greetd.tuigreet} --time --cmd niri-session";
- };
- in {
- enable = true;
- settings = {
- terminal.vt = 1;
- default_session = session;
- initial_session = session;
- };
- };
-
- # unlock GPG keyring on login
- security.pam.services.greetd.enableGnomeKeyring = true;
-}
diff --git a/flake.lock b/flake.lock
index bd86375b..a48f9a3c 100644
--- a/flake.lock
+++ b/flake.lock
@@ -1,45 +1,5 @@
{
"nodes": {
- "ags": {
- "inputs": {
- "astal": "astal",
- "nixpkgs": "nixpkgs"
- },
- "locked": {
- "lastModified": 1731966249,
- "narHash": "sha256-9hDeMy6S2q1wWBFGiJic5yUms19zW8LhAX9MlCtuN6k=",
- "owner": "Aylur",
- "repo": "ags",
- "rev": "12e0bfefd2051c43d7450123fcb095f655b891e8",
- "type": "github"
- },
- "original": {
- "owner": "Aylur",
- "repo": "ags",
- "type": "github"
- }
- },
- "astal": {
- "inputs": {
- "nixpkgs": [
- "ags",
- "nixpkgs"
- ]
- },
- "locked": {
- "lastModified": 1731952585,
- "narHash": "sha256-Sh1E7sJd8JJM3PCU1ZOei/QWz97OLCENIi2rTRoaniw=",
- "owner": "aylur",
- "repo": "astal",
- "rev": "664c7a4ddfcf48c6e8accd3c33bb94424b0e8609",
- "type": "github"
- },
- "original": {
- "owner": "aylur",
- "repo": "astal",
- "type": "github"
- }
- },
"darwin": {
"inputs": {
"nixpkgs": [
@@ -47,11 +7,11 @@
]
},
"locked": {
- "lastModified": 1732016537,
- "narHash": "sha256-XwXUK+meYnlhdQz2TVE4Wv+tsx1CkdGbDPt1tRzCNH4=",
+ "lastModified": 1733570843,
+ "narHash": "sha256-sQJAxY1TYWD1UyibN/FnN97paTFuwBw3Vp3DNCyKsMk=",
"owner": "lnl7",
"repo": "nix-darwin",
- "rev": "61cee20168a3ebb71a9efd70a55adebaadfbe4d4",
+ "rev": "a35b08d09efda83625bef267eb24347b446c80b8",
"type": "github"
},
"original": {
@@ -68,11 +28,11 @@
]
},
"locked": {
- "lastModified": 1732030699,
- "narHash": "sha256-SBosboLvLqDv+7mNgRTIYDQbHE61rDDkXTJWiRX3PPo=",
+ "lastModified": 1734088167,
+ "narHash": "sha256-OIitVU+IstPbX/NWn2jLF+/sT9dVKcO2FKeRAzlyX6c=",
"owner": "nix-community",
"repo": "disko",
- "rev": "da52cf40206d7d1a419d07640eb47b2fb9ac2c21",
+ "rev": "d32f2d1750d61a476a236526b725ec5a32e16342",
"type": "github"
},
"original": {
@@ -101,6 +61,27 @@
"url": "ssh://git@github.com/bphenriques/dotfiles-private"
}
},
+ "flake-parts": {
+ "inputs": {
+ "nixpkgs-lib": [
+ "nur",
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1733312601,
+ "narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=",
+ "owner": "hercules-ci",
+ "repo": "flake-parts",
+ "rev": "205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9",
+ "type": "github"
+ },
+ "original": {
+ "owner": "hercules-ci",
+ "repo": "flake-parts",
+ "type": "github"
+ }
+ },
"flake-utils": {
"inputs": {
"systems": "systems"
@@ -130,11 +111,11 @@
"zig": "zig"
},
"locked": {
- "lastModified": 1731971697,
- "narHash": "sha256-6JNMcpy0z19yOLBRt3eE4Rk4A96kcEsRv5+ym1hkv1c=",
+ "lastModified": 1734193420,
+ "narHash": "sha256-FoD35icQTH0i/c7sGsYeJ4noP39wGv2tJO4FKpxtA/o=",
"ref": "refs/heads/main",
- "rev": "29c3a52e964a97dddaed876ce472aeb167774acf",
- "revCount": 8021,
+ "rev": "fba10a442cbe745cd837cc86b3da4f5c31af6ee7",
+ "revCount": 8267,
"type": "git",
"url": "ssh://git@github.com/mitchellh/ghostty"
},
@@ -150,11 +131,11 @@
]
},
"locked": {
- "lastModified": 1732025103,
- "narHash": "sha256-qjEI64RKvDxRyEarY0jTzrZMa8ebezh2DEZmJJrpVdo=",
+ "lastModified": 1734093295,
+ "narHash": "sha256-hSwgGpcZtdDsk1dnzA0xj5cNaHgN9A99hRF/mxMtwS4=",
"owner": "nix-community",
"repo": "home-manager",
- "rev": "a46e702093a5c46e192243edbd977d5749e7f294",
+ "rev": "66c5d8b62818ec4c1edb3e941f55ef78df8141a8",
"type": "github"
},
"original": {
@@ -165,59 +146,64 @@
},
"nixpkgs": {
"locked": {
- "lastModified": 1725634671,
- "narHash": "sha256-v3rIhsJBOMLR8e/RNWxr828tB+WywYIoajrZKFM+0Gg=",
- "owner": "NixOS",
+ "lastModified": 1729558817,
+ "narHash": "sha256-g4L4ERXHZileMif+7wJbtDrEb6NhtE5XJE+uugoWmj4=",
+ "owner": "nixos",
"repo": "nixpkgs",
- "rev": "574d1eac1c200690e27b8eb4e24887f8df7ac27c",
+ "rev": "942b12cabae1cd4414c7177472d759731de92cb4",
"type": "github"
},
"original": {
- "owner": "NixOS",
- "ref": "nixos-unstable",
+ "owner": "nixos",
"repo": "nixpkgs",
+ "rev": "942b12cabae1cd4414c7177472d759731de92cb4",
"type": "github"
}
},
"nixpkgs-stable": {
"locked": {
- "lastModified": 1729307008,
- "narHash": "sha256-QUvb6epgKi9pCu9CttRQW4y5NqJ+snKr1FZpG/x3Wtc=",
+ "lastModified": 1734083684,
+ "narHash": "sha256-5fNndbndxSx5d+C/D0p/VF32xDiJCJzyOqorOYW4JEo=",
"owner": "nixos",
"repo": "nixpkgs",
- "rev": "a9b86fc2290b69375c5542b622088eb6eca2a7c3",
+ "rev": "314e12ba369ccdb9b352a4db26ff419f7c49fa84",
"type": "github"
},
"original": {
"owner": "nixos",
- "ref": "nixos-24.05",
+ "ref": "nixos-24.11",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
- "lastModified": 1729558817,
- "narHash": "sha256-g4L4ERXHZileMif+7wJbtDrEb6NhtE5XJE+uugoWmj4=",
+ "lastModified": 1733940404,
+ "narHash": "sha256-Pj39hSoUA86ZePPF/UXiYHHM7hMIkios8TYG29kQT4g=",
"owner": "nixos",
"repo": "nixpkgs",
- "rev": "942b12cabae1cd4414c7177472d759731de92cb4",
+ "rev": "5d67ea6b4b63378b9c13be21e2ec9d1afc921713",
"type": "github"
},
"original": {
"owner": "nixos",
+ "ref": "nixos-unstable",
"repo": "nixpkgs",
- "rev": "942b12cabae1cd4414c7177472d759731de92cb4",
"type": "github"
}
},
"nur": {
+ "inputs": {
+ "flake-parts": "flake-parts",
+ "nixpkgs": "nixpkgs_2",
+ "treefmt-nix": "treefmt-nix"
+ },
"locked": {
- "lastModified": 1729525671,
- "narHash": "sha256-/pZSi3LBtztMfOJti72FOj3OBJvsCb1N/d9Jl5L04fI=",
+ "lastModified": 1734196117,
+ "narHash": "sha256-sCNL2O3vVkstnJiaf4v7GyGi7ynxkuNe707IkL0rNwc=",
"owner": "nix-community",
"repo": "nur",
- "rev": "305d127d2f03fb412de348455a3175df9e66cd04",
+ "rev": "f2d6c9fd0abce648bf52cfb0348bf6afbf7fe733",
"type": "github"
},
"original": {
@@ -228,13 +214,12 @@
},
"root": {
"inputs": {
- "ags": "ags",
"darwin": "darwin",
"disko": "disko",
"dotfiles-private": "dotfiles-private",
"ghostty": "ghostty",
"home-manager": "home-manager",
- "nixpkgs": "nixpkgs_2",
+ "nixpkgs": "nixpkgs",
"nixpkgs-stable": "nixpkgs-stable",
"nur": "nur",
"sops-nix": "sops-nix"
@@ -247,11 +232,11 @@
]
},
"locked": {
- "lastModified": 1731954233,
- "narHash": "sha256-vvXx1m2Rsw7MkbKJdpcICzz4YPgZPApGKQGhNZfkhOI=",
+ "lastModified": 1733965552,
+ "narHash": "sha256-GZ4YtqkfyTjJFVCub5yAFWsHknG1nS/zfk7MuHht4Fs=",
"owner": "Mic92",
"repo": "sops-nix",
- "rev": "e39947d0ee8e341fa7108bd02a33cdfa24a1360e",
+ "rev": "2d73fc6ac4eba4b9a83d3cb8275096fbb7ab4004",
"type": "github"
},
"original": {
@@ -275,6 +260,27 @@
"type": "github"
}
},
+ "treefmt-nix": {
+ "inputs": {
+ "nixpkgs": [
+ "nur",
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1733222881,
+ "narHash": "sha256-JIPcz1PrpXUCbaccEnrcUS8jjEb/1vJbZz5KkobyFdM=",
+ "owner": "numtide",
+ "repo": "treefmt-nix",
+ "rev": "49717b5af6f80172275d47a418c9719a31a78b53",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "treefmt-nix",
+ "type": "github"
+ }
+ },
"zig": {
"inputs": {
"flake-compat": [
diff --git a/flake.nix b/flake.nix
index bc9d60d4..92efd9b1 100644
--- a/flake.nix
+++ b/flake.nix
@@ -15,7 +15,7 @@
inputs = {
# FIXME: pin to when NUR is available but I still have 6.10 kernel available. Replace the ref with "github:nixos/nixpkgs/nixpkgs-unstable"
nixpkgs.url = "github:nixos/nixpkgs/942b12cabae1cd4414c7177472d759731de92cb4"; # Stable(ish) enough. Plus home-manager is _always_ on unstable.
- nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.05"; # I don't really use it, but leaving it here.
+ nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.11"; # I don't really use it, but leaving it here.
darwin.url = "github:lnl7/nix-darwin/master";
darwin.inputs.nixpkgs.follows = "nixpkgs";
@@ -36,9 +36,6 @@
ghostty.url = "git+ssh://git@github.com/mitchellh/ghostty"; # Terminal
ghostty.inputs.nixpkgs-stable.follows = "nixpkgs"; # Fix OpenGL
ghostty.inputs.nixpkgs-unstable.follows = "nixpkgs"; # Fix OpenGL
-
- # Wayland Window Manager
- ags.url = "github:Aylur/ags"; # Widgets
};
outputs = inputs @ { nixpkgs, ... }:
diff --git a/hosts/laptop/default.nix b/hosts/laptop/default.nix
index 6fa2b67d..d501c1a5 100644
--- a/hosts/laptop/default.nix
+++ b/hosts/laptop/default.nix
@@ -1,36 +1,29 @@
{ inputs, mylib, ... }:
let
inherit (inputs.nixpkgs.lib.attrsets) attrValues;
- # Ideally modules are imported in the file that uses it. However, it leads to a infinite recursion. Aka, a rabbit-hole to debug.
+ system = "x86_64-linux";
+ # Ideally modules are imported in the file that uses it. However, it leads to a infinite recursion. A rabbit-hole to debug.
overlays = attrValues inputs.self.overlays ++ [ inputs.nur.overlay ];
nixosModules = attrValues inputs.self.nixosModules ++ [
inputs.sops-nix.nixosModules.sops
inputs.disko.nixosModules.disko
inputs.home-manager.nixosModules.home-manager
];
- hmModules = attrValues inputs.self.homeManagerModules ++ [
- inputs.ags.homeManagerModules.default
- ];
-in mylib.hosts.mkNixOSHost {
- inherit nixosModules hmModules overlays;
- extraSpecialArgs = {
- inherit inputs;
- host.webcam = "/dev/video0"; # FIXME: This only needed once, let's move mvp to a module and make this a parameter.
- network-devices = import ../network-devices.nix;
- monitors = {
- "Samsung Display Corp. 0x4188 Unknown" = {
- connector = "eDP-1";
- description = "built-in";
- mode = "2880x1800@120.001Hz";
- scale = 1.5;
- };
- "Dell Inc. DELL S2721DGF 4P11R83" = {
- name = "Dell Inc. DELL S2721DGF 4P11R83";
- description = "Office Monitor";
- mode = "2560x1440@143.912Hz";
- scale = 1.0;
- };
+ hmModules = attrValues inputs.self.homeManagerModules;
+ specialArgs = {
+ self = {
+ pkgs = inputs.self.packages.${system};
+ private = inputs.dotfiles-private.packages.${system};
};
+ community.pkgs = {
+ ghostty = inputs.ghostty.packages.${system}.default;
+ firefox-addons = inputs.firefox-addons.packages.${system};
+ };
+ network-devices = import ../network-devices.nix;
};
+in mylib.hosts.mkNixOSHost {
+ inherit system nixosModules hmModules overlays;
+ nixosSpecialArgs = specialArgs;
+ hmSpecialArgs = specialArgs;
hostModule = ./config.nix;
}
diff --git a/hosts/peripherals.nix b/hosts/peripherals.nix
new file mode 100644
index 00000000..42ab2e86
--- /dev/null
+++ b/hosts/peripherals.nix
@@ -0,0 +1,18 @@
+{
+ monitors = {
+ # FIXME: This should be insde `laptop`
+ "Samsung Display Corp. 0x4188 Unknown" = {
+ description = "built-in";
+ resolution = "2880x1800";
+ refresh_rate = "120.001";
+ scale = 1.5;
+ };
+ "Dell Inc. DELL S2721DGF 4P11R83" = {
+ name = "Dell Inc. DELL S2721DGF 4P11R83";
+ description = "Office Monitor";
+ resolution = "2560x1440";
+ refresh_rate = "143.912";
+ scale = 1.0;
+ };
+ };
+}
\ No newline at end of file
diff --git a/hosts/work-macos/default.nix b/hosts/work-macos/default.nix
index 7664be64..16cfbc5e 100644
--- a/hosts/work-macos/default.nix
+++ b/hosts/work-macos/default.nix
@@ -4,10 +4,16 @@ let
darwinModules = attrValues inputs.self.darwinModules ++ [ inputs.home-manager.darwinModules.home-manager ];
hmModules = attrValues inputs.self.homeManagerModules;
+ specialArgs = {
+ self = {
+ pkgs = inputs.self.packages.${system};
+ private = inputs.dotfiles-private.packages.${system};
+ };
+ network-devices = import ../network-devices.nix;
+ };
in mylib.hosts.mkMacOSHost {
inherit darwinModules hmModules;
hostModule = ./config.nix;
- extraSpecialArgs = {
- network-devices = import ../network-devices.nix;
- };
+ darwinSpecialArgs = specialArgs;
+ hmSpecialArgs = specialArgs;
}
diff --git a/lib/hosts.nix b/lib/hosts.nix
index 92ac1700..c4e4e21b 100644
--- a/lib/hosts.nix
+++ b/lib/hosts.nix
@@ -16,25 +16,11 @@ let
allowUnfree = true; # I was maintaining a list.. because it was _nicer_ and _explicit_ but.. I am lazy.
permittedInsecurePackages = [ "electron-27.3.11" "electron-28.3.3" ];
};
-
- # TODO: This should not be abstracted the way it is (likely).
- mkExtraArgs = system: extraSpecialArgs: {
- self = {
- pkgs = inputs.self.packages.${system};
- private = inputs.dotfiles-private.packages.${system};
- };
- community.pkgs = {
- ghostty = inputs.ghostty.packages.${system}.default;
- firefox-addons = inputs.firefox-addons.packages.${system};
- };
-
- host = { }; # Intentionally empty, each host sets as required. This just ensures the root config 'host' is available.
- } // extraSpecialArgs;
in
{
- mkNixOSHost = { system ? "x86_64-linux", overlays ? [ ], nixosModules, hmModules, hostModule, extraSpecialArgs ? { } }:
+ mkNixOSHost = { system, overlays ? [ ], nixosModules, hmModules, hostModule, nixosSpecialArgs ? { }, hmSpecialArgs ? { } }:
let
- specialArgs = (mkExtraArgs system extraSpecialArgs);
+ specialArgs = nixosSpecialArgs;
commonConfig = {
nix = nixConfig;
nixpkgs = {
@@ -43,7 +29,7 @@ in
};
home-manager = {
sharedModules = hmModules;
- extraSpecialArgs = specialArgs;
+ extraSpecialArgs = hmSpecialArgs;
};
};
in inputs.nixpkgs.lib.nixosSystem {
@@ -51,9 +37,9 @@ in
modules = nixosModules ++ [ commonConfig hostModule ];
};
- mkMacOSHost = { system ? "aarch64-darwin", overlays ? [ ], darwinModules, hmModules, hostModule, extraSpecialArgs ? { } }:
+ mkMacOSHost = { system ? "aarch64-darwin", overlays ? [ ], darwinModules, hmModules, hostModule, darwinSpecialArgs ? { }, hmSpecialArgs ? { } }:
let
- specialArgs = (mkExtraArgs system extraSpecialArgs);
+ specialArgs = darwinSpecialArgs;
commonConfig = {
nix = nixConfig;
nixpkgs = {
@@ -63,7 +49,7 @@ in
};
home-manager = {
sharedModules = hmModules;
- extraSpecialArgs = specialArgs;
+ extraSpecialArgs = hmSpecialArgs;
};
};
in inputs.darwin.lib.darwinSystem {
diff --git a/modules/nixos/system/boot-theme.nix b/modules/nixos/system/boot-theme.nix
index 363604b6..5fd3598c 100644
--- a/modules/nixos/system/boot-theme.nix
+++ b/modules/nixos/system/boot-theme.nix
@@ -45,7 +45,8 @@ in
loader.timeout = 0;
loader.grub = lib.mkIf config.boot.loader.grub.enable {
timeoutStyle = "hidden";
- font = "${pkgs.nerdfonts}/share/fonts/truetype/NerdFonts/HackNerdFontMono-Regular.ttf";
+ # FIXME
+ # font = "${pkgs.nerdfonts}/share/fonts/truetype/NerdFonts/HackNerdFontMono-Regular.ttf";
fontSize = 36;
backgroundColor = "#000000";
splashImage = null;
diff --git a/packages/default.nix b/packages/default.nix
index 292f43e1..88eeae03 100644
--- a/packages/default.nix
+++ b/packages/default.nix
@@ -20,6 +20,7 @@ let
osd-brightness = pkgs.callPackage ./osd-brightness { };
niri-output-configuration = pkgs.callPackage ./niri-output-configuration { };
niri-window-dmenu = pkgs.callPackage ./niri-window-dmenu { };
+ swww-util = pkgs.callPackage ./swww-util { };
}
);
in forAllSystems (system:
diff --git a/packages/niri-output-configuration/src/niri-output-configuration.sh b/packages/niri-output-configuration/src/niri-output-configuration.sh
index ffb1995f..34180bab 100755
--- a/packages/niri-output-configuration/src/niri-output-configuration.sh
+++ b/packages/niri-output-configuration/src/niri-output-configuration.sh
@@ -47,6 +47,6 @@ case "${1:-}" in
"$(profile_extend_name)") notify "$(profile_extend_set)" ;;
esac
;;
- default) notify "$(profile_default_set)" ;;
+ startup) profile_default_set ;;
safemode) notify "$(profile_internal_set)" ;;
esac
\ No newline at end of file
diff --git a/packages/swww-util/default.nix b/packages/swww-util/default.nix
new file mode 100644
index 00000000..b990676a
--- /dev/null
+++ b/packages/swww-util/default.nix
@@ -0,0 +1,6 @@
+{ lib, pkgs, ... }:
+pkgs.writeShellApplication {
+ name = "swww-util";
+ runtimeInputs = with pkgs; [ swww ];
+ text = lib.fileContents ./swww-util.sh;
+}
\ No newline at end of file
diff --git a/packages/swww-util/swww-util.sh b/packages/swww-util/swww-util.sh
new file mode 100644
index 00000000..22921ac6
--- /dev/null
+++ b/packages/swww-util/swww-util.sh
@@ -0,0 +1,8 @@
+#shellcheck shell=bash
+set_wallpaper() { test -f "$1" && swww img --transition-type none "$1"; }
+random_file() { find "$1" -type f | sort -R | head -1 ; }
+
+case "${1:-}" in
+ random) shift 1 && set_wallpaper "$(random_file "$1")" ;;
+ one) shift 1 && set_wallpaper "$1" ;;
+esac
From 1fa8748b6d3872a07dfeddd981a8167d0b3dc296 Mon Sep 17 00:00:00 2001
From: Bruno Henriques <4727729+bphenriques@users.noreply.github.com>
Date: Mon, 16 Dec 2024 12:00:45 +0000
Subject: [PATCH 28/34] Bump and upgrade to kernel 6.12
---
config/darwin/default.nix | 5 ++---
config/home-manager/default.nix | 5 ++---
config/home-manager/window-manager/default.nix | 14 +-------------
flake.lock | 8 ++++----
flake.nix | 3 +--
hosts/laptop/config.nix | 2 +-
6 files changed, 11 insertions(+), 26 deletions(-)
diff --git a/config/darwin/default.nix b/config/darwin/default.nix
index 151f3d91..61eadbc4 100644
--- a/config/darwin/default.nix
+++ b/config/darwin/default.nix
@@ -96,9 +96,8 @@
# Fonts (system-wide)
fonts.packages = with pkgs; [
- # pkgs.nerd-fonts.hack
- # pkgs.nerd-fonts.jetbrains-mono
- (nerdfonts.override { fonts = [ "Hack" "JetBrainsMono" ]; })
+ pkgs.nerd-fonts.hack
+ pkgs.nerd-fonts.jetbrains-mono
];
homebrew = {
diff --git a/config/home-manager/default.nix b/config/home-manager/default.nix
index 1e6942ed..bbe130f4 100644
--- a/config/home-manager/default.nix
+++ b/config/home-manager/default.nix
@@ -34,9 +34,8 @@
p7zip # 7zip for linux
unrar # Still need it
] ++ lib.optionals pkgs.stdenv.isLinux [
- # pkgs.nerd-fonts.hack
- # pkgs.nerd-fonts.jetbrains-mono
- (nerdfonts.override { fonts = [ "Hack" "JetBrainsMono" ]; })
+ pkgs.nerd-fonts.hack
+ pkgs.nerd-fonts.jetbrains-mono
baobab # Visual disk space analyzer
];
fonts.fontconfig.enable = true;
diff --git a/config/home-manager/window-manager/default.nix b/config/home-manager/window-manager/default.nix
index 4126e320..23a346af 100644
--- a/config/home-manager/window-manager/default.nix
+++ b/config/home-manager/window-manager/default.nix
@@ -1,18 +1,6 @@
{ config, lib, pkgs, ... }:
# TODO: pre-script for gaming: https://github.com/diniamo/niqs/blob/53288d72902365ee8d3bfdd6aff0ec79eb7c1c36/modules/workstation/gaming.nix#L16
-let
- nerdfonts = pkgs.nerdfonts.override {
- fonts = [
- "Ubuntu"
- "UbuntuMono"
- "CascadiaCode"
- "FantasqueSansMono"
- "FiraCode"
- "Mononoki"
- ];
- };
-in
{
# https://github.com/prasanthrangan/hyprdots?tab=readme-ov-file
imports = [
@@ -46,7 +34,7 @@ in
font = {
name = "Ubuntu Nerd Font";
- package = nerdfonts;
+ package = pkgs.nerd-fonts.ubuntu;
size = 11;
};
diff --git a/flake.lock b/flake.lock
index a48f9a3c..62bde81b 100644
--- a/flake.lock
+++ b/flake.lock
@@ -146,17 +146,17 @@
},
"nixpkgs": {
"locked": {
- "lastModified": 1729558817,
- "narHash": "sha256-g4L4ERXHZileMif+7wJbtDrEb6NhtE5XJE+uugoWmj4=",
+ "lastModified": 1734126203,
+ "narHash": "sha256-0XovF7BYP50rTD2v4r55tR5MuBLet7q4xIz6Rgh3BBU=",
"owner": "nixos",
"repo": "nixpkgs",
- "rev": "942b12cabae1cd4414c7177472d759731de92cb4",
+ "rev": "71a6392e367b08525ee710a93af2e80083b5b3e2",
"type": "github"
},
"original": {
"owner": "nixos",
+ "ref": "nixpkgs-unstable",
"repo": "nixpkgs",
- "rev": "942b12cabae1cd4414c7177472d759731de92cb4",
"type": "github"
}
},
diff --git a/flake.nix b/flake.nix
index 92efd9b1..e25375ef 100644
--- a/flake.nix
+++ b/flake.nix
@@ -13,8 +13,7 @@
};
inputs = {
- # FIXME: pin to when NUR is available but I still have 6.10 kernel available. Replace the ref with "github:nixos/nixpkgs/nixpkgs-unstable"
- nixpkgs.url = "github:nixos/nixpkgs/942b12cabae1cd4414c7177472d759731de92cb4"; # Stable(ish) enough. Plus home-manager is _always_ on unstable.
+ nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; # Stable(ish) enough. Plus home-manager is _always_ on unstable.
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.11"; # I don't really use it, but leaving it here.
darwin.url = "github:lnl7/nix-darwin/master";
diff --git a/hosts/laptop/config.nix b/hosts/laptop/config.nix
index 669b6c5f..8eeffcca 100644
--- a/hosts/laptop/config.nix
+++ b/hosts/laptop/config.nix
@@ -14,7 +14,7 @@
# Boot: See what it is taking most time: `systemd-analyze critical-chain`
boot = {
supportedFilesystems.zfs = true;
- kernelPackages = pkgs.linuxPackages_6_10;
+ kernelPackages = pkgs.linuxPackages_6_12;
loader.grub = {
enable = true;
efiSupport = true;
From 10da95107e19f8a8a1abfeedb806e82e25cbdfd0 Mon Sep 17 00:00:00 2001
From: Bruno Henriques <4727729+bphenriques@users.noreply.github.com>
Date: Tue, 17 Dec 2024 12:04:29 +0000
Subject: [PATCH 29/34] Fix macos stuff
---
hosts/work-macos/brunohenriques.nix | 2 +-
hosts/work-macos/config.nix | 9 +++++----
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/hosts/work-macos/brunohenriques.nix b/hosts/work-macos/brunohenriques.nix
index 9ca41480..70fc36b8 100644
--- a/hosts/work-macos/brunohenriques.nix
+++ b/hosts/work-macos/brunohenriques.nix
@@ -11,7 +11,7 @@
kubelogin-oidc
# Infra
- terraform
+ tfswitch
];
custom.programs.project.directory = "${config.home.homeDirectory}/workspace";
diff --git a/hosts/work-macos/config.nix b/hosts/work-macos/config.nix
index 8604589e..0b9f6e5b 100644
--- a/hosts/work-macos/config.nix
+++ b/hosts/work-macos/config.nix
@@ -25,14 +25,15 @@ in
"python3" # Implicit dependency of Aiven client
"kubeseal" # K8s stuff
"go-task"
+ "snyk-cli"
];
casks = [
"bloop" # Scala
- "google-chrome" # Google Meet.
- "slack" # The usual rabbit-hole of channels.
- "1password-cli" # Team's 1password
- "postman" # Because it is more practical than curl
+ "google-chrome"
+ "slack"
+ "1password-cli"
+ "postman"
];
};
From 0619e04ceda7406f6dc66e07ce3e54a2c933ef96 Mon Sep 17 00:00:00 2001
From: Bruno Henriques <4727729+bphenriques@users.noreply.github.com>
Date: Tue, 17 Dec 2024 13:53:58 +0000
Subject: [PATCH 30/34] Major flattening of the directory structure
---
config/home-manager/coding/default.nix | 35 -----
.../coding/scala/ammonite-predef.sc | 19 ---
config/home-manager/default.nix | 63 ---------
config/home-manager/gaming/default.nix | 7 -
config/home-manager/internet/default.nix | 15 --
config/home-manager/media/default.nix | 12 --
config/home-manager/media/image.nix | 13 --
config/home-manager/media/music.nix | 85 -----------
config/home-manager/media/notes/default.nix | 4 -
config/home-manager/terminal/default.nix | 127 -----------------
config/nixos/desktop.nix | 16 ---
config/nixos/programs.nix | 22 ---
{config/darwin => darwin}/default.nix | 0
.../darwin => darwin/modules}/default.nix | 0
.../modules}/system/desktop.nix | 0
.../modules}/system/screencapture.nix | 0
flake.nix | 6 +-
home-manager/default.nix | 132 ++++++++++++++++++
.../desktop-environment}/README.md | 4 -
.../desktop-environment}/default.nix | 4 +-
.../desktop-environment}/dunst.nix | 0
.../desktop-environment}/fuzzel.nix | 0
.../desktop-environment}/niri.nix | 0
.../desktop-environment}/swayidle.nix | 0
.../desktop-environment}/waybar/default.nix | 0
.../desktop-environment}/waybar/style.css | 0
home-manager/desktop/beets.nix | 78 +++++++++++
home-manager/desktop/default.nix | 32 +++++
home-manager/desktop/discord.nix | 7 +
.../desktop}/firefox/basic.nix | 0
.../desktop}/firefox/default.nix | 0
.../desktop}/firefox/telemetry.nix | 0
.../desktop}/ghostty.nix | 0
home-manager/desktop/imv.nix | 5 +
.../desktop}/logseq/configs.edn | 0
.../desktop}/logseq/default.nix | 2 +-
.../desktop}/logseq/plugins.edn | 0
.../video.nix => home-manager/desktop/mpv.nix | 6 +-
.../desktop/zathura.nix | 0
home-manager/direnv.nix | 10 ++
.../terminal => home-manager}/fish.nix | 0
home-manager/fonts.nix | 8 ++
home-manager/fzf.nix | 21 +++
.../coding => home-manager}/git.nix | 4 +-
.../coding => home-manager}/helix.nix | 0
.../lang-scala.nix | 22 ++-
.../modules}/default.nix | 0
.../modules}/programs/dotfiles.nix | 0
.../modules}/programs/fzf-fd.nix | 0
.../modules}/programs/fzf-rg.nix | 0
.../modules}/programs/project.nix | 0
.../modules}/theme.nix | 0
.../modules}/wayland/swww.nix | 1 -
.../modules}/xdg-mime-apps.nix | 0
home-manager/ripgrep.nix | 12 ++
.../terminal => home-manager}/yazi.nix | 4 +-
hosts/laptop/bphenriques/home.nix | 6 +-
hosts/laptop/config.nix | 8 +-
.../wayland/notifications/default.nix | 84 -----------
.../wayland/notifications/dunst.nix | 88 ------------
.../wayland/notifications/scripts/volume.sh | 32 -----
{config/nixos => nixos}/default.nix | 39 +++---
.../desktop-environment/default.nix | 5 +-
.../desktop-environment/login-manager.nix | 0
nixos/desktop/default.nix | 27 ++++
{modules/nixos => nixos/modules}/default.nix | 0
.../modules}/profiles/emulation.nix | 0
.../modules}/profiles/gaming.nix | 0
.../modules}/programs/proton-run.nix | 0
.../modules}/services/input-remapper.nix | 0
.../modules}/services/solaar.nix | 0
.../modules}/system/boot-theme.nix | 0
72 files changed, 399 insertions(+), 666 deletions(-)
delete mode 100644 config/home-manager/coding/default.nix
delete mode 100644 config/home-manager/coding/scala/ammonite-predef.sc
delete mode 100644 config/home-manager/default.nix
delete mode 100644 config/home-manager/gaming/default.nix
delete mode 100644 config/home-manager/internet/default.nix
delete mode 100644 config/home-manager/media/default.nix
delete mode 100644 config/home-manager/media/image.nix
delete mode 100644 config/home-manager/media/music.nix
delete mode 100644 config/home-manager/media/notes/default.nix
delete mode 100644 config/home-manager/terminal/default.nix
delete mode 100644 config/nixos/desktop.nix
delete mode 100644 config/nixos/programs.nix
rename {config/darwin => darwin}/default.nix (100%)
rename {modules/darwin => darwin/modules}/default.nix (100%)
rename {modules/darwin => darwin/modules}/system/desktop.nix (100%)
rename {modules/darwin => darwin/modules}/system/screencapture.nix (100%)
create mode 100644 home-manager/default.nix
rename {config/home-manager/window-manager => home-manager/desktop-environment}/README.md (99%)
rename {config/home-manager/window-manager => home-manager/desktop-environment}/default.nix (86%)
rename {config/home-manager/window-manager => home-manager/desktop-environment}/dunst.nix (100%)
rename {config/home-manager/window-manager => home-manager/desktop-environment}/fuzzel.nix (100%)
rename {config/home-manager/window-manager => home-manager/desktop-environment}/niri.nix (100%)
rename {config/home-manager/window-manager => home-manager/desktop-environment}/swayidle.nix (100%)
rename {config/home-manager/window-manager => home-manager/desktop-environment}/waybar/default.nix (100%)
rename {config/home-manager/window-manager => home-manager/desktop-environment}/waybar/style.css (100%)
create mode 100644 home-manager/desktop/beets.nix
create mode 100644 home-manager/desktop/default.nix
create mode 100644 home-manager/desktop/discord.nix
rename {config/home-manager/internet => home-manager/desktop}/firefox/basic.nix (100%)
rename {config/home-manager/internet => home-manager/desktop}/firefox/default.nix (100%)
rename {config/home-manager/internet => home-manager/desktop}/firefox/telemetry.nix (100%)
rename {config/home-manager/terminal => home-manager/desktop}/ghostty.nix (100%)
create mode 100644 home-manager/desktop/imv.nix
rename {config/home-manager/media/notes => home-manager/desktop}/logseq/configs.edn (100%)
rename {config/home-manager/media/notes => home-manager/desktop}/logseq/default.nix (89%)
rename {config/home-manager/media/notes => home-manager/desktop}/logseq/plugins.edn (100%)
rename config/home-manager/media/video.nix => home-manager/desktop/mpv.nix (97%)
rename config/home-manager/media/documents.nix => home-manager/desktop/zathura.nix (100%)
create mode 100644 home-manager/direnv.nix
rename {config/home-manager/terminal => home-manager}/fish.nix (100%)
create mode 100644 home-manager/fonts.nix
create mode 100644 home-manager/fzf.nix
rename {config/home-manager/coding => home-manager}/git.nix (94%)
rename {config/home-manager/coding => home-manager}/helix.nix (100%)
rename config/home-manager/coding/scala/default.nix => home-manager/lang-scala.nix (54%)
rename {modules/home-manager => home-manager/modules}/default.nix (100%)
rename {modules/home-manager => home-manager/modules}/programs/dotfiles.nix (100%)
rename {modules/home-manager => home-manager/modules}/programs/fzf-fd.nix (100%)
rename {modules/home-manager => home-manager/modules}/programs/fzf-rg.nix (100%)
rename {modules/home-manager => home-manager/modules}/programs/project.nix (100%)
rename {modules/home-manager => home-manager/modules}/theme.nix (100%)
rename {modules/home-manager => home-manager/modules}/wayland/swww.nix (96%)
rename {modules/home-manager => home-manager/modules}/xdg-mime-apps.nix (100%)
create mode 100644 home-manager/ripgrep.nix
rename {config/home-manager/terminal => home-manager}/yazi.nix (94%)
delete mode 100644 modules/home-manager/wayland/notifications/default.nix
delete mode 100644 modules/home-manager/wayland/notifications/dunst.nix
delete mode 100755 modules/home-manager/wayland/notifications/scripts/volume.sh
rename {config/nixos => nixos}/default.nix (62%)
rename config/nixos/wayland.nix => nixos/desktop-environment/default.nix (93%)
rename config/nixos/greetd.nix => nixos/desktop-environment/login-manager.nix (100%)
create mode 100644 nixos/desktop/default.nix
rename {modules/nixos => nixos/modules}/default.nix (100%)
rename {modules/nixos => nixos/modules}/profiles/emulation.nix (100%)
rename {modules/nixos => nixos/modules}/profiles/gaming.nix (100%)
rename {modules/nixos => nixos/modules}/programs/proton-run.nix (100%)
rename {modules/nixos => nixos/modules}/services/input-remapper.nix (100%)
rename {modules/nixos => nixos/modules}/services/solaar.nix (100%)
rename {modules/nixos => nixos/modules}/system/boot-theme.nix (100%)
diff --git a/config/home-manager/coding/default.nix b/config/home-manager/coding/default.nix
deleted file mode 100644
index a39cc534..00000000
--- a/config/home-manager/coding/default.nix
+++ /dev/null
@@ -1,35 +0,0 @@
-{ lib, pkgs, config, network-devices, ... }:
-let
- mkSSHMatchBlock = deviceCfg: {
- inherit (deviceCfg) hostname;
- inherit (deviceCfg.ssh) user port;
- };
-in
-{
- imports = [
- ./git.nix
- ./scala
- ./helix.nix
- ];
-
- programs.ssh = {
- enable = true;
- serverAliveInterval = 60;
- matchBlocks = {
- home-nas = mkSSHMatchBlock network-devices.home-nas;
- pi-zero = mkSSHMatchBlock network-devices.pi-zero;
- rg353m = mkSSHMatchBlock network-devices.rg353m;
- deck = mkSSHMatchBlock network-devices.deck;
- };
-
- extraConfig = ''
- Include ''${HOME}/.ssh/config.local
- '';
- };
-
- home.packages = with pkgs; [
- jetbrains.idea-community
- ] ++ lib.optionals (pkgs.stdenv.isLinux) [
- filezilla # Access remote files
- ];
-}
diff --git a/config/home-manager/coding/scala/ammonite-predef.sc b/config/home-manager/coding/scala/ammonite-predef.sc
deleted file mode 100644
index 98b1b836..00000000
--- a/config/home-manager/coding/scala/ammonite-predef.sc
+++ /dev/null
@@ -1,19 +0,0 @@
-object load {
- def fs2Version(version: String): Unit = {
- repl.load.apply(s"""
- import $$ivy.`co.fs2::fs2-core:$version`
- import $$ivy.`co.fs2::fs2-reactive-streams:$version`
- import $$ivy.`co.fs2::fs2-io:$version`
-
- import cats.syntax.all._
- import cats.effect.{IO, Resource}
- import fs2.io.file.{Files, Path}
- import fs2.{Stream, text}
-
- // For unsafeRunSync
- implicit val runtime = cats.effect.unsafe.IORuntime.global
- """)
- }
-
- def fs2: Unit = fs2Version("3.11.0")
-}
diff --git a/config/home-manager/default.nix b/config/home-manager/default.nix
deleted file mode 100644
index bbe130f4..00000000
--- a/config/home-manager/default.nix
+++ /dev/null
@@ -1,63 +0,0 @@
-{ pkgs, lib, config, ... }:
-{
- imports = [
- ./coding
- ./internet
- ./media
- ./terminal
- ];
-
- # XDG Compliance to tidy up $HOME.
- xdg.enable = true;
- home.preferXdgDirectories = true;
-
- # Default apps and directories
- xdg.mimeApps.enable = pkgs.stdenv.isLinux;
-
- home.packages = with pkgs; [
- # Consistent UNIX command line tools regardless of the OS
- coreutils
- findutils
- gnugrep
- watch
- tree
- parallel
- gnused
- dateutils
- unzip
- xclip
-
- # Other core
- xdg-user-dirs
-
- # Archive
- p7zip # 7zip for linux
- unrar # Still need it
- ] ++ lib.optionals pkgs.stdenv.isLinux [
- pkgs.nerd-fonts.hack
- pkgs.nerd-fonts.jetbrains-mono
- baobab # Visual disk space analyzer
- ];
- fonts.fontconfig.enable = true;
-
- # Gpg
- programs.gpg.enable = pkgs.stdenv.isLinux;
- services.gpg-agent = {
- enable = pkgs.stdenv.isLinux;
- pinentryPackage = pkgs.pinentry-gnome3;
- };
-
- home.sessionVariables = {
- LANG = "en_US.UTF-8";
- LC_ALL = "en_US.UTF-8";
- };
-
- # Do not need the whole home-manager configuration reference.
- manual.manpages.enable = false;
-
- # Tighten permissions to private keys
- systemd.user.tmpfiles.rules = lib.optionals pkgs.stdenv.isLinux [
- "z ${config.home.homeDirectory}/.ssh 0700 ${config.home.username} users"
- "z ${config.home.homeDirectory}/.gnupg 0700 ${config.home.username} users"
- ];
-}
diff --git a/config/home-manager/gaming/default.nix b/config/home-manager/gaming/default.nix
deleted file mode 100644
index cf1cfb00..00000000
--- a/config/home-manager/gaming/default.nix
+++ /dev/null
@@ -1,7 +0,0 @@
-{ config, lib, pkgs, ... }:
-{
- xdg.mimeApps.defaultApplications."x-scheme-handler/heroic" = [ "heroic.desktop" ];
-}
-
-
-
diff --git a/config/home-manager/internet/default.nix b/config/home-manager/internet/default.nix
deleted file mode 100644
index a8df1d10..00000000
--- a/config/home-manager/internet/default.nix
+++ /dev/null
@@ -1,15 +0,0 @@
-{ config, pkgs, lib, ... }:
-{
- imports = [
- ./firefox
- ];
-
- home.packages = with pkgs; lib.optionals (pkgs.stdenv.isLinux) [
- qbittorrent # Torrent client
- filezilla # Access files remotely
- newsflash # RSS Reader
- vesktop # Lightweight discord
- ];
-
- xdg.mimeApps.defaultApplications."x-scheme-handler/discord" = [ "vesktop.desktop" ];
-}
\ No newline at end of file
diff --git a/config/home-manager/media/default.nix b/config/home-manager/media/default.nix
deleted file mode 100644
index 1df7d56f..00000000
--- a/config/home-manager/media/default.nix
+++ /dev/null
@@ -1,12 +0,0 @@
-{ lib, ... }: {
- imports = [
- ./notes
- ./music.nix
- ./image.nix
- ./video.nix
- ./documents.nix
- ];
-
- custom.xdgDefaultApps.archive = lib.mkBefore [ "org.kde.ark.desktop" ];
- custom.xdgDefaultApps.fileBrowser = lib.mkBefore [ "org.kde.dolphin.desktop" "org.gnome.baobab.desktop" "yazi.desktop" ];
-}
diff --git a/config/home-manager/media/image.nix b/config/home-manager/media/image.nix
deleted file mode 100644
index 440b0ee8..00000000
--- a/config/home-manager/media/image.nix
+++ /dev/null
@@ -1,13 +0,0 @@
-{ pkgs, lib, config, ... }:
-{
- home.packages = with pkgs; [
- exiftool
- ];
-
- programs.imv.enable = pkgs.stdenv.isLinux;
- home.shellAliases = lib.optionalAttrs (pkgs.stdenv.isLinux) {
- "webp_to_png" = ''nix-shell -p libwebp -p parallel --command "parallel dwebp {} -o {.}.png ::: *.webp"'';
- };
-
- custom.xdgDefaultApps.image = lib.mkBefore [ "imv.desktop" ];
-}
diff --git a/config/home-manager/media/music.nix b/config/home-manager/media/music.nix
deleted file mode 100644
index fe3bbb86..00000000
--- a/config/home-manager/media/music.nix
+++ /dev/null
@@ -1,85 +0,0 @@
-{ pkgs, lib, config, ... }:
-let
- inherit (lib) foldl';
-
- musicLibrary = "${config.xdg.userDirs.music}/library";
- playlistsDirectory = "${config.xdg.userDirs.music}/playlists";
-
- # Beets require absolute paths: https://github.com/beetbox/beets/issues/133
- # If needed:
- # 1. Find the base path in the db: beet list -f '$path' artist:beatles | head -n 1
- # 2. Manualyl update the databaseL
- # sqlite3 $XDG_DATA_HOME/beets/library.db "UPDATE items SET path = replace(path, '/home/bphenriques/Music/Library', '/home/bphenriques/music/library');"
- # sqlite3 $XDG_DATA_HOME/beets/library.db "UPDATE albums SET artpath = replace(artpath, '/home/bphenriques/Music/Library', '/home/bphenriques/music/library');"
- #
- # 3. Confirm if everything is alright. The following command should not hint that files should be deleted.
- # beets update -p
- beets = {
- database = "${config.xdg.dataHome}/beets/library.db";
- databaseBackup = "${config.xdg.userDirs.music}/beets.db.backup";
-
- # Healthcheck: beet bad && beet duplicates
- # Update files: beet fetchart && beet fingerprint && beet embedart && beet scrub
- # Docs: https://beets.readthedocs.io/en/stable/plugins/index.html
- plugins = let
- providers = [ "chroma" "spotify" "deezer" ];
- metadata = [ "fetchart" "embedart" "lyrics" "mbsync" ]; # lastgenre
- health = [ "duplicates" "badfiles" ];
- utility = [ "edit" "playlist" "scrub" "fish" ]; # https://beets.readthedocs.io/en/stable/plugins/smartplaylist.html
- in (providers ++ health ++ metadata ++ utility);
- basePackage = pkgs.beets-unstable.override {
- # Reference: https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/audio/beets/builtin-plugins.nix
- pluginOverrides = foldl' (acc: plugin: acc // { "${plugin}".enable = true; }) { } beets.plugins;
- };
-
- # Sanity check + backup database file to NAS. Can't store the DB file in the NAS as it leads to lock issues.
- finalPackage = (pkgs.writeScriptBin "beet" ''
- #!${pkgs.stdenv.shell}
- if [ ! -d "${musicLibrary}" ]; then
- echo "${musicLibrary} does not exist!"
- exit 1
- fi
-
- ${lib.getExe beets.basePackage} "$@"
- status=$?
- if [ $status -eq 0 ] && [ -f "${beets.database}" ] && ([ ! -f "${beets.databaseBackup}" ] || [[ "$(md5sum "${beets.databaseBackup}")" = "$(md5sum "${beets.database}")" ]]); then
- echo "Backing up beets library: ${beets.database}"
- cp -f "${beets.database}" "${beets.databaseBackup}"
- fi
- exit $status
- '');
- };
-in
-{
- home.packages = lib.optionals (pkgs.stdenv.isLinux) [
- pkgs.feishin # Jellyfin player
- pkgs.cmus # TUI based music player
- ];
-
- programs.beets = {
- enable = pkgs.stdenv.isLinux;
- package = beets.finalPackage;
- settings = {
- library = beets.database;
- directory = musicLibrary;
- paths = {
- default = "$albumartist/$album%aunique{}/$track $title";
- singleton = "$artist/Non-Album/$title";
- comp = "Compilations/$album%aunique{}/$track $title";
- };
- plugins = builtins.concatStringsSep " " beets.plugins;
- playlist = {
- auto = true; # Automatically remove/move items inside the playlists in case they move.
- relative_to = musicLibrary;
- playlist_dir = playlistsDirectory;
- };
- fetchart = {
- auto = true;
- cautious = true;
- };
- musicbrainz = {
- extra_tags = ["date" "year" "originalyear" "originalartist" "originalalbum" "artists"];
- };
- };
- };
-}
diff --git a/config/home-manager/media/notes/default.nix b/config/home-manager/media/notes/default.nix
deleted file mode 100644
index 7a9dbd03..00000000
--- a/config/home-manager/media/notes/default.nix
+++ /dev/null
@@ -1,4 +0,0 @@
-{ ... }:
-{
- imports = [ ./logseq ];
-}
\ No newline at end of file
diff --git a/config/home-manager/terminal/default.nix b/config/home-manager/terminal/default.nix
deleted file mode 100644
index 68142e28..00000000
--- a/config/home-manager/terminal/default.nix
+++ /dev/null
@@ -1,127 +0,0 @@
-{ pkgs, config, lib, self, ... }:
-{
- imports = [
- ./fish.nix
- ./ghostty.nix
- ./yazi.nix
- ];
-
- programs.bat.enable = true; # Better file previewer
- programs.fd.enable = true; # Better `find`.
- programs.jq.enable = true; # JSON query.
- programs.htop.enable = true; # Fancy `top`.
- programs.man.enable = true; # RTFM
- custom.programs.project.enable = true; # Easier way to navigate jump through different projects
- custom.programs.fzf-fd.enable = true; # Fuzzy fd
- custom.programs.fzf-rg.enable = true; # Fuzzy ripgrep
-
- programs.ripgrep = {
- enable = true;
- arguments = [
- "--max-columns=150"
- "--max-columns-preview"
- "--glob=!.git"
- "--smart-case"
- ];
- };
-
- programs.tealdeer = {
- enable = true;
- settings = {
- display = {
- compact = false;
- use_pager = true;
- };
-
- updates.auto_update = false;
- };
- };
-
- programs.zoxide = {
- enable = true;
- options = [ "--cmd j" ];
- };
-
- # Interesting for Android dev: https://git.belanyi.fr/ambroisie/nix-config/src/branch/main/modules/home/direnv/lib/android.sh
- programs.direnv = {
- enable = true; # Automatically load .envrc or .env.
- nix-direnv.enable = true; # Faster direnv for nix environments.
- silent = true; # Disable verbose messages when entering a directory.
- config.whitelist.prefix = [ config.custom.dotfiles.directory ]; # Surpress prompt in my private dotfiles
- };
-
- # Fuzzy matching
- programs.fzf = {
- enable = true;
- defaultCommand = "${lib.getExe pkgs.fd} --type file --hidden --exclude=.git";
- enableFishIntegration = true;
-
- defaultOptions = [
- "--height='80%'"
- "--marker='* '"
- "--pointer='▶'"
- "--preview-window='right:60%'"
- "--bind='ctrl-p:toggle-preview'"
- "--bind='alt-a:select-all'"
- "--bind='alt-n:deselect-all'"
- "--bind='ctrl-f:jump'"
- ];
- };
-
- home = {
- packages = with pkgs; [
- # Security
- openssl # Generate keys with openssl rand -hex 32
-
- # Text Processors
- yq-go # Query YAML.
- vim # Basic editor
-
- # Monitoring
- procs # Fancy `ps`.
- ];
-
- sessionVariables = {
- VISUAL = "$EDITOR"; # Set within the editor config.
- PAGER = "less -iMR";
-
- # Colors
- CLICOLOR = 1; # Enable ls colors in MacOS.
- LS_COLORS ="$(${pkgs.vivid}/bin/vivid generate snazzy)"; # LS_COLORS generator because I refuse to maintain one >.<
- } // (lib.optionalAttrs pkgs.config.allowUnfree {
- NIXPKGS_ALLOW_UNFREE = 1;
- });
-
- shellAliases = {
- # Default colorizatio
- diff = "diff --color=auto";
- grep = "grep --color=auto";
- egrep = "egrep --color=auto";
- fgrep = "fgrep --color=auto";
- ls = "ls --color=auto";
-
- # The usual aliases
- l = "ls -alh";
- ll = "ls -l";
-
- # Quality of life
- mkdir = "mkdir -pv";
- ".." = "cd ..";
- "..." = "cd ../..";
- ":q" = "exit";
- tmpdir = "cd (mktemp -d)";
-
- # Text Processor
- e = "$EDITOR";
-
- # Nix utility functions to set the SHELL automatically
- nix-shell = "nix-shell --run $SHELL";
- devshell = "nix develop --command $SHELL";
- whatsmyip = "${lib.getExe pkgs.curl} ifconfig.me";
- } // (lib.optionalAttrs pkgs.stdenv.isLinux {
- pbcopy = lib.getExe pkgs.xclip;
- pbpaste = "${lib.getExe pkgs.xclip} -o";
- }
- );
- };
-}
diff --git a/config/nixos/desktop.nix b/config/nixos/desktop.nix
deleted file mode 100644
index e344ed0c..00000000
--- a/config/nixos/desktop.nix
+++ /dev/null
@@ -1,16 +0,0 @@
-{ pkgs, ... }:
-{
- environment.systemPackages = [
- pkgs.nautilus # File Browser
- pkgs.cheese # Webcam
- ];
-
- services = {
- # TODO: https://github.com/ners/trilby/blob/7dd41d0704ebf75f8f705da066184f5ed6168441/modules/home/dconf.nix#L44
- gnome.sushi.enable = true; # Nautilus: previews
- gvfs.enable = true; # Nautilus: Mount, trash, and other functionalities
- flatpak.enable = true; # Easier to run some programs. Setup afterwards: flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
- };
-
- programs.partition-manager.enable = true;
-}
diff --git a/config/nixos/programs.nix b/config/nixos/programs.nix
deleted file mode 100644
index 6f4e3f35..00000000
--- a/config/nixos/programs.nix
+++ /dev/null
@@ -1,22 +0,0 @@
-{ pkgs, ... }:
-{
- environment.systemPackages = let
- filesystems = [ pkgs.exfat pkgs.ntfs3g ]; # Suport exFAT and NTFS formatted drives (pendisks + external disks)
- hardware = [
- pkgs.powertop # Check what is consuming too much energy
- pkgs.usbutils # USB utilities
- ];
- in filesystems ++ hardware;
-
- # Programs
- programs = {
- fish = {
- enable = true; # System level.
- vendor.functions.enable = true; # Ensure completions/functions are automatically set.
- };
-
- # Disabling some defaults
- command-not-found.enable = false;
- nano.enable = false;
- };
-}
diff --git a/config/darwin/default.nix b/darwin/default.nix
similarity index 100%
rename from config/darwin/default.nix
rename to darwin/default.nix
diff --git a/modules/darwin/default.nix b/darwin/modules/default.nix
similarity index 100%
rename from modules/darwin/default.nix
rename to darwin/modules/default.nix
diff --git a/modules/darwin/system/desktop.nix b/darwin/modules/system/desktop.nix
similarity index 100%
rename from modules/darwin/system/desktop.nix
rename to darwin/modules/system/desktop.nix
diff --git a/modules/darwin/system/screencapture.nix b/darwin/modules/system/screencapture.nix
similarity index 100%
rename from modules/darwin/system/screencapture.nix
rename to darwin/modules/system/screencapture.nix
diff --git a/flake.nix b/flake.nix
index e25375ef..a77901bb 100644
--- a/flake.nix
+++ b/flake.nix
@@ -49,14 +49,14 @@
default = import ./shell.nix { pkgs = nixpkgs.legacyPackages.${system}; };
});
overlays = import ./overlays { inherit inputs; };
- nixosModules = import ./modules/nixos;
+ nixosModules = import ./nixos/modules;
# Hosts - Each host defines what it needs from the inputs.
nixosConfigurations.laptop = import ./hosts/laptop { inherit mylib inputs; };
darwinConfigurations.work-macos = import ./hosts/work-macos { inherit mylib inputs; };
# Non standard flake outputs
- homeManagerModules = import ./modules/home-manager;
- darwinModules = import ./modules/darwin;
+ homeManagerModules = import ./home-manager/modules;
+ darwinModules = import ./darwin/modules;
};
}
diff --git a/home-manager/default.nix b/home-manager/default.nix
new file mode 100644
index 00000000..3935fda6
--- /dev/null
+++ b/home-manager/default.nix
@@ -0,0 +1,132 @@
+{ pkgs, lib, config, ... }:
+{
+ imports = [
+ ./fonts.nix
+ ./git.nix
+ ./fish.nix # Shell
+ ./helix.nix # Editor
+ ./direnv.nix # Automate dev environment when we enter directories
+ ./fzf.nix # Fuzzy search
+ ./ripgrep.nix # Search
+ ./yazi.nix # File browser
+ ./lang-scala.nix # Programming language
+ ];
+
+ # XDG Compliance to tidy up $HOME.
+ xdg.enable = true;
+ xdg.mimeApps.enable = pkgs.stdenv.isLinux; # Default apps and directories
+ home.preferXdgDirectories = true;
+
+ programs.bat.enable = true; # Better file previewer
+ programs.fd.enable = true; # Better `find`.
+ programs.jq.enable = true; # JSON query.
+ programs.htop.enable = true; # Fancy `top`.
+ custom.programs.project.enable = true; # Easier way to navigate jump through different projects
+
+ programs.tealdeer = {
+ enable = true;
+ settings = {
+ display = {
+ compact = false;
+ use_pager = true;
+ };
+
+ updates.auto_update = false;
+ };
+ };
+
+ programs.zoxide = {
+ enable = true;
+ options = [ "--cmd j" ];
+ };
+
+ home.packages = with pkgs; [
+ # Consistent UNIX command line tools regardless of the OS
+ coreutils
+ findutils
+ gnugrep
+ watch
+ tree
+ parallel
+ gnused
+ dateutils
+ unzip
+ openssl
+ xdg-user-dirs
+
+ # Text Processors
+ yq-go # Query YAML.
+ vim # Basic editor
+
+ # Archive
+ p7zip # 7zip for linux
+ unrar # Still need it
+
+ # Monitoring
+ procs # Fancy `ps`.
+ ];
+
+ # Gpg
+ programs.gpg.enable = pkgs.stdenv.isLinux;
+ services.gpg-agent = {
+ enable = pkgs.stdenv.isLinux;
+ pinentryPackage = pkgs.pinentry-gnome3;
+ };
+
+ home = {
+ sessionVariables = {
+ VISUAL = "$EDITOR"; # Set within the editor config.
+ PAGER = "less -iMR";
+
+ # Colors
+ LS_COLORS ="$(${pkgs.vivid}/bin/vivid generate snazzy)"; # LS_COLORS generator because I refuse to maintain one >.<
+ LANG = "en_US.UTF-8";
+ LC_ALL = "en_US.UTF-8";
+ } // (lib.optionalAttrs pkgs.config.allowUnfree {
+ NIXPKGS_ALLOW_UNFREE = 1;
+ }) // (lib.optionalAttrs pkgs.stdenv.isDarwin {
+ CLICOLOR = 1; # Enable ls colors in MacOS.
+ });
+
+ shellAliases = {
+ # Default colorizatio
+ diff = "diff --color=auto";
+ grep = "grep --color=auto";
+ egrep = "egrep --color=auto";
+ fgrep = "fgrep --color=auto";
+ ls = "ls --color=auto";
+
+ # The usual aliases
+ l = "ls -alh";
+ ll = "ls -l";
+
+ # Quality of life
+ mkdir = "mkdir -pv";
+ ".." = "cd ..";
+ "..." = "cd ../..";
+ ":q" = "exit";
+ tmpdir = "cd (mktemp -d)";
+
+ # Text Processor
+ e = "$EDITOR";
+
+ # Nix utility functions to set the SHELL automatically
+ nix-shell = "nix-shell --run $SHELL";
+ devshell = "nix develop --command $SHELL";
+ whatsmyip = "${lib.getExe pkgs.curl} ifconfig.me";
+ } // (lib.optionalAttrs pkgs.stdenv.isLinux {
+ pbcopy = lib.getExe pkgs.xclip;
+ pbpaste = "${lib.getExe pkgs.xclip} -o";
+ webp_to_png = ''nix-shell -p libwebp -p parallel --command "parallel dwebp {} -o {.}.png ::: *.webp"'';
+ });
+ };
+
+ programs.man.enable = true; # RTFM
+ manual.manpages.enable = false; # I do not need home-manager configuration reference in the man pages.
+
+ # Tighten permissions to private keys
+ systemd.user.tmpfiles.rules = lib.optionals pkgs.stdenv.isLinux [
+ "z ${config.home.homeDirectory}/.ssh 0700 ${config.home.username} users"
+ "z ${config.home.homeDirectory}/.gnupg 0700 ${config.home.username} users"
+ ];
+}
diff --git a/config/home-manager/window-manager/README.md b/home-manager/desktop-environment/README.md
similarity index 99%
rename from config/home-manager/window-manager/README.md
rename to home-manager/desktop-environment/README.md
index 5efc6cd1..7fdc044f 100644
--- a/config/home-manager/window-manager/README.md
+++ b/home-manager/desktop-environment/README.md
@@ -49,10 +49,6 @@ Waybar
https://github.com/NickCao/flakes/blob/d99c0a28b9357adce9749ca49364038184a1b95e/nixos/mainframe/waybar.nix
https://github.com/NickCao/flakes/blob/d99c0a28b9357adce9749ca49364038184a1b95e/nixos/mainframe/waybar.css
-
-
-
-
Sway
https://github.com/NickCao/flakes/blob/d99c0a28b9357adce9749ca49364038184a1b95e/nixos/mainframe/home.nix#L22
diff --git a/config/home-manager/window-manager/default.nix b/home-manager/desktop-environment/default.nix
similarity index 86%
rename from config/home-manager/window-manager/default.nix
rename to home-manager/desktop-environment/default.nix
index 23a346af..ccdc1564 100644
--- a/config/home-manager/window-manager/default.nix
+++ b/home-manager/desktop-environment/default.nix
@@ -5,14 +5,14 @@
# https://github.com/prasanthrangan/hyprdots?tab=readme-ov-file
imports = [
./niri.nix # Window Manager
- ./waybar # Top-bar. There are fancier solutions out-there.
+ ./waybar # Status bar
./dunst.nix # Notification Daemon
./fuzzel.nix # Application Launcher
];
custom.services.swww.enable = true;
- # Use the following theme: https://github.com/iynaix/dotfiles/blob/56d2d63b3b5f4c621429d79fb2aef8d44fdc25b9/home-manager/gui/gtk.nix#L85
+ # TODO: Use the following theme: https://github.com/iynaix/dotfiles/blob/56d2d63b3b5f4c621429d79fb2aef8d44fdc25b9/home-manager/gui/gtk.nix#L85
home.pointerCursor = {
gtk.enable = true;
package = pkgs.bibata-cursors;
diff --git a/config/home-manager/window-manager/dunst.nix b/home-manager/desktop-environment/dunst.nix
similarity index 100%
rename from config/home-manager/window-manager/dunst.nix
rename to home-manager/desktop-environment/dunst.nix
diff --git a/config/home-manager/window-manager/fuzzel.nix b/home-manager/desktop-environment/fuzzel.nix
similarity index 100%
rename from config/home-manager/window-manager/fuzzel.nix
rename to home-manager/desktop-environment/fuzzel.nix
diff --git a/config/home-manager/window-manager/niri.nix b/home-manager/desktop-environment/niri.nix
similarity index 100%
rename from config/home-manager/window-manager/niri.nix
rename to home-manager/desktop-environment/niri.nix
diff --git a/config/home-manager/window-manager/swayidle.nix b/home-manager/desktop-environment/swayidle.nix
similarity index 100%
rename from config/home-manager/window-manager/swayidle.nix
rename to home-manager/desktop-environment/swayidle.nix
diff --git a/config/home-manager/window-manager/waybar/default.nix b/home-manager/desktop-environment/waybar/default.nix
similarity index 100%
rename from config/home-manager/window-manager/waybar/default.nix
rename to home-manager/desktop-environment/waybar/default.nix
diff --git a/config/home-manager/window-manager/waybar/style.css b/home-manager/desktop-environment/waybar/style.css
similarity index 100%
rename from config/home-manager/window-manager/waybar/style.css
rename to home-manager/desktop-environment/waybar/style.css
diff --git a/home-manager/desktop/beets.nix b/home-manager/desktop/beets.nix
new file mode 100644
index 00000000..c0b13dc8
--- /dev/null
+++ b/home-manager/desktop/beets.nix
@@ -0,0 +1,78 @@
+{ pkgs, lib, config, ... }:
+let
+ inherit (lib) foldl';
+
+ musicLibrary = "${config.xdg.userDirs.music}/library";
+ playlistsDirectory = "${config.xdg.userDirs.music}/playlists";
+
+ # Beets require absolute paths: https://github.com/beetbox/beets/issues/133
+ # If needed:
+ # 1. Find the base path in the db: beet list -f '$path' artist:beatles | head -n 1
+ # 2. Manually update the database:
+ # sqlite3 $XDG_DATA_HOME/beets/library.db "UPDATE items SET path = replace(path, '/home/bphenriques/Music/Library', '/home/bphenriques/music/library');"
+ # sqlite3 $XDG_DATA_HOME/beets/library.db "UPDATE albums SET artpath = replace(artpath, '/home/bphenriques/Music/Library', '/home/bphenriques/music/library');"
+ #
+ # 3. Confirm if everything is alright. The following command should not hint that files should be deleted.
+ # beets update -p
+ database = "${config.xdg.dataHome}/beets/library.db";
+ databaseBackup = "${config.xdg.userDirs.music}/beets.db.backup";
+
+ # Healthcheck: beet bad && beet duplicates
+ # Update files: beet fetchart && beet fingerprint && beet embedart && beet scrub
+ # Docs: https://beets.readthedocs.io/en/stable/plugins/index.html
+ plugins = let
+ providers = [ "chroma" "spotify" "deezer" ];
+ metadata = [ "fetchart" "embedart" "lyrics" "mbsync" ]; # lastgenre
+ health = [ "duplicates" "badfiles" ];
+ utility = [ "edit" "playlist" "scrub" "fish" ]; # https://beets.readthedocs.io/en/stable/plugins/smartplaylist.html
+ in (providers ++ health ++ metadata ++ utility);
+ basePackage = pkgs.beets-unstable.override {
+ # Reference: https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/audio/beets/builtin-plugins.nix
+ pluginOverrides = foldl' (acc: plugin: acc // { "${plugin}".enable = true; }) { } plugins;
+ };
+
+ # Sanity check + backup database file to NAS. Can't store the DB file in the NAS as it leads to lock issues.
+ finalPackage = (pkgs.writeScriptBin "beet" ''
+ #!${pkgs.stdenv.shell}
+ if [ ! -d "${musicLibrary}" ]; then
+ echo "${musicLibrary} does not exist!"
+ exit 1
+ fi
+
+ ${lib.getExe basePackage} "$@"
+ status=$?
+ if [ $status -eq 0 ] && [ -f "${database}" ] && ([ ! -f "${databaseBackup}" ] || [[ "$(md5sum "${databaseBackup}")" = "$(md5sum "${database}")" ]]); then
+ echo "Backing up beets library: ${database}"
+ cp -f "${database}" "${databaseBackup}"
+ fi
+ exit $status
+ '');
+in
+{
+ programs.beets = {
+ enable = pkgs.stdenv.isLinux;
+ package = finalPackage;
+ settings = {
+ library = database;
+ directory = musicLibrary;
+ paths = {
+ default = "$albumartist/$album%aunique{}/$track $title";
+ singleton = "$artist/Non-Album/$title";
+ comp = "Compilations/$album%aunique{}/$track $title";
+ };
+ plugins = builtins.concatStringsSep " " plugins;
+ playlist = {
+ auto = true; # Automatically remove/move items inside the playlists in case they move.
+ relative_to = musicLibrary;
+ playlist_dir = playlistsDirectory;
+ };
+ fetchart = {
+ auto = true;
+ cautious = true;
+ };
+ musicbrainz = {
+ extra_tags = ["date" "year" "originalyear" "originalartist" "originalalbum" "artists"];
+ };
+ };
+ };
+}
diff --git a/home-manager/desktop/default.nix b/home-manager/desktop/default.nix
new file mode 100644
index 00000000..b5b149e3
--- /dev/null
+++ b/home-manager/desktop/default.nix
@@ -0,0 +1,32 @@
+{ pkgs, lib, config, ... }:
+{
+ imports = [
+ ./firefox # Browser
+ ./zathura.nix # Documents
+ ./mpv.nix # Videos
+ ./imv.nix # Images
+ ./logseq # Notes
+ ./beets.nix # Music library manager
+ ./discord.nix # Social
+ ./ghostty.nix # Terminal applicaton
+ ];
+
+ home.packages = lib.optionals pkgs.stdenv.isLinux [
+ pkgs.baobab # Disk space analyzer
+ pkgs.qbittorrent # Torrent client
+ pkgs.filezilla # Access files remotely
+ pkgs.newsflash # RSS Reader
+ pkgs.feishin # Jellyfin player
+ pkgs.cmus # TUI music player
+ pkgs.jetbrains.idea-community
+ ];
+
+ # Gaming
+ xdg.mimeApps.defaultApplications."x-scheme-handler/heroic" = [ "heroic.desktop" ];
+
+ # TODO
+ custom.xdgDefaultApps = {
+ archive = lib.mkBefore [ "org.kde.ark.desktop" ];
+ fileBrowser = lib.mkBefore [ "org.gnome.baobab.desktop" ];
+ };
+}
diff --git a/home-manager/desktop/discord.nix b/home-manager/desktop/discord.nix
new file mode 100644
index 00000000..4b676fd4
--- /dev/null
+++ b/home-manager/desktop/discord.nix
@@ -0,0 +1,7 @@
+{ lib, pkgs, ... }:
+lib.mkIf pkgs.stdenv.isLinux {
+ home.packages = [
+ pkgs.vesktop # Lightweight discord
+ ];
+ xdg.mimeApps.defaultApplications."x-scheme-handler/discord" = [ "vesktop.desktop" ];
+}
\ No newline at end of file
diff --git a/config/home-manager/internet/firefox/basic.nix b/home-manager/desktop/firefox/basic.nix
similarity index 100%
rename from config/home-manager/internet/firefox/basic.nix
rename to home-manager/desktop/firefox/basic.nix
diff --git a/config/home-manager/internet/firefox/default.nix b/home-manager/desktop/firefox/default.nix
similarity index 100%
rename from config/home-manager/internet/firefox/default.nix
rename to home-manager/desktop/firefox/default.nix
diff --git a/config/home-manager/internet/firefox/telemetry.nix b/home-manager/desktop/firefox/telemetry.nix
similarity index 100%
rename from config/home-manager/internet/firefox/telemetry.nix
rename to home-manager/desktop/firefox/telemetry.nix
diff --git a/config/home-manager/terminal/ghostty.nix b/home-manager/desktop/ghostty.nix
similarity index 100%
rename from config/home-manager/terminal/ghostty.nix
rename to home-manager/desktop/ghostty.nix
diff --git a/home-manager/desktop/imv.nix b/home-manager/desktop/imv.nix
new file mode 100644
index 00000000..e6fbe645
--- /dev/null
+++ b/home-manager/desktop/imv.nix
@@ -0,0 +1,5 @@
+{ pkgs, lib, config, ... }:
+{
+ programs.imv.enable = pkgs.stdenv.isLinux;
+ custom.xdgDefaultApps.image = lib.mkBefore [ "imv.desktop" ];
+}
diff --git a/config/home-manager/media/notes/logseq/configs.edn b/home-manager/desktop/logseq/configs.edn
similarity index 100%
rename from config/home-manager/media/notes/logseq/configs.edn
rename to home-manager/desktop/logseq/configs.edn
diff --git a/config/home-manager/media/notes/logseq/default.nix b/home-manager/desktop/logseq/default.nix
similarity index 89%
rename from config/home-manager/media/notes/logseq/default.nix
rename to home-manager/desktop/logseq/default.nix
index 0a928abb..ccb4e4e8 100644
--- a/config/home-manager/media/notes/logseq/default.nix
+++ b/home-manager/desktop/logseq/default.nix
@@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }:
let
- basePath = "${config.custom.dotfiles.directory}/home-manager/media/notes/logseq";
+ basePath = "${config.custom.dotfiles.directory}/home-manager/desktop/logseq";
in
{
home.packages = lib.optionals (pkgs.stdenv.isLinux) [ pkgs.logseq ];
diff --git a/config/home-manager/media/notes/logseq/plugins.edn b/home-manager/desktop/logseq/plugins.edn
similarity index 100%
rename from config/home-manager/media/notes/logseq/plugins.edn
rename to home-manager/desktop/logseq/plugins.edn
diff --git a/config/home-manager/media/video.nix b/home-manager/desktop/mpv.nix
similarity index 97%
rename from config/home-manager/media/video.nix
rename to home-manager/desktop/mpv.nix
index 9a9f52aa..6d83d3f6 100644
--- a/config/home-manager/media/video.nix
+++ b/home-manager/desktop/mpv.nix
@@ -100,6 +100,8 @@ in
"mpv360" = "${lib.getExe config.programs.mpv.package} --script-opts=360plugin-enabled=yes";
};
- custom.xdgDefaultApps.video = lib.mkBefore [ "mpv.desktop" ];
- custom.xdgDefaultApps.audio = lib.mkBefore [ "mpv.desktop" ];
+ custom.xdgDefaultApps = {
+ video = lib.mkBefore [ "mpv.desktop" ];
+ audio = lib.mkBefore [ "mpv.desktop" ];
+ };
}
diff --git a/config/home-manager/media/documents.nix b/home-manager/desktop/zathura.nix
similarity index 100%
rename from config/home-manager/media/documents.nix
rename to home-manager/desktop/zathura.nix
diff --git a/home-manager/direnv.nix b/home-manager/direnv.nix
new file mode 100644
index 00000000..a67600c5
--- /dev/null
+++ b/home-manager/direnv.nix
@@ -0,0 +1,10 @@
+{ pkgs, lib, config, ... }:
+{
+ # TODO: Interesting for Android dev: https://git.belanyi.fr/ambroisie/nix-config/src/branch/main/modules/home/direnv/lib/android.sh
+ programs.direnv = {
+ enable = true; # Automatically load .envrc or .env.
+ nix-direnv.enable = true; # Faster direnv for nix environments.
+ silent = true; # Disable verbose messages when entering a directory.
+ config.whitelist.prefix = [ config.custom.dotfiles.directory ]; # Surpress prompt in my private dotfiles
+ };
+}
diff --git a/config/home-manager/terminal/fish.nix b/home-manager/fish.nix
similarity index 100%
rename from config/home-manager/terminal/fish.nix
rename to home-manager/fish.nix
diff --git a/home-manager/fonts.nix b/home-manager/fonts.nix
new file mode 100644
index 00000000..7d341023
--- /dev/null
+++ b/home-manager/fonts.nix
@@ -0,0 +1,8 @@
+{ pkgs, lib, config, ... }:
+{
+ fonts.fontconfig.enable = true;
+ home.packages = [
+ pkgs.nerd-fonts.hack
+ pkgs.nerd-fonts.jetbrains-mono
+ ];
+}
diff --git a/home-manager/fzf.nix b/home-manager/fzf.nix
new file mode 100644
index 00000000..fb5fde35
--- /dev/null
+++ b/home-manager/fzf.nix
@@ -0,0 +1,21 @@
+{ pkgs, lib, config, ... }:
+{
+ custom.programs.fzf-fd.enable = true; # Fuzzy fd
+ custom.programs.fzf-rg.enable = true; # Fuzzy ripgrep
+ programs.fzf = {
+ enable = true;
+ defaultCommand = "${lib.getExe pkgs.fd} --type file --hidden --exclude=.git";
+ enableFishIntegration = true;
+
+ defaultOptions = [
+ "--height='80%'"
+ "--marker='* '"
+ "--pointer='▶'"
+ "--preview-window='right:60%'"
+ "--bind='ctrl-p:toggle-preview'"
+ "--bind='alt-a:select-all'"
+ "--bind='alt-n:deselect-all'"
+ "--bind='ctrl-f:jump'"
+ ];
+ };
+}
diff --git a/config/home-manager/coding/git.nix b/home-manager/git.nix
similarity index 94%
rename from config/home-manager/coding/git.nix
rename to home-manager/git.nix
index edf5c5d1..ffda5348 100644
--- a/config/home-manager/coding/git.nix
+++ b/home-manager/git.nix
@@ -15,8 +15,8 @@ let
in
{
home.packages = with pkgs; [
- lazygit # Cross-platform GUI to interact with Git
- git-absorb # Trying https://github.com/tummychow/git-absorb
+ lazygit # TODO: do I really need this? Cross-platform GUI to interact with Git
+ git-absorb # TODO: try out: https://github.com/tummychow/git-absorb
];
# TODO: Explore jujutsu: https://github.com/0xcharly/nix-config/blob/a8e1427a67494ad5de3d639d94ee619ca69f51c7/users/delay/home.nix#L99
diff --git a/config/home-manager/coding/helix.nix b/home-manager/helix.nix
similarity index 100%
rename from config/home-manager/coding/helix.nix
rename to home-manager/helix.nix
diff --git a/config/home-manager/coding/scala/default.nix b/home-manager/lang-scala.nix
similarity index 54%
rename from config/home-manager/coding/scala/default.nix
rename to home-manager/lang-scala.nix
index 74a37463..4a3fa020 100644
--- a/config/home-manager/coding/scala/default.nix
+++ b/home-manager/lang-scala.nix
@@ -20,7 +20,27 @@
};
# Ammonite is not XDG_CONFIG_HOME compliant: https://github.com/lihaoyi/Ammonite/issues/696
- home.file.".ammonite/predef.sc".source = ./ammonite-predef.sc;
+ home.file.".ammonite/predef.sc".text = ''
+ object load {
+ def fs2Version(version: String): Unit = {
+ repl.load.apply(s"""
+ import $$ivy.`co.fs2::fs2-core:$version`
+ import $$ivy.`co.fs2::fs2-reactive-streams:$version`
+ import $$ivy.`co.fs2::fs2-io:$version`
+
+ import cats.syntax.all._
+ import cats.effect.{IO, Resource}
+ import fs2.io.file.{Files, Path}
+ import fs2.{Stream, text}
+
+ // For unsafeRunSync
+ implicit val runtime = cats.effect.unsafe.IORuntime.global
+ """)
+ }
+
+ def fs2: Unit = fs2Version("3.11.0")
+ }
+ '';
programs.git.ignores = [
".metals"
diff --git a/modules/home-manager/default.nix b/home-manager/modules/default.nix
similarity index 100%
rename from modules/home-manager/default.nix
rename to home-manager/modules/default.nix
diff --git a/modules/home-manager/programs/dotfiles.nix b/home-manager/modules/programs/dotfiles.nix
similarity index 100%
rename from modules/home-manager/programs/dotfiles.nix
rename to home-manager/modules/programs/dotfiles.nix
diff --git a/modules/home-manager/programs/fzf-fd.nix b/home-manager/modules/programs/fzf-fd.nix
similarity index 100%
rename from modules/home-manager/programs/fzf-fd.nix
rename to home-manager/modules/programs/fzf-fd.nix
diff --git a/modules/home-manager/programs/fzf-rg.nix b/home-manager/modules/programs/fzf-rg.nix
similarity index 100%
rename from modules/home-manager/programs/fzf-rg.nix
rename to home-manager/modules/programs/fzf-rg.nix
diff --git a/modules/home-manager/programs/project.nix b/home-manager/modules/programs/project.nix
similarity index 100%
rename from modules/home-manager/programs/project.nix
rename to home-manager/modules/programs/project.nix
diff --git a/modules/home-manager/theme.nix b/home-manager/modules/theme.nix
similarity index 100%
rename from modules/home-manager/theme.nix
rename to home-manager/modules/theme.nix
diff --git a/modules/home-manager/wayland/swww.nix b/home-manager/modules/wayland/swww.nix
similarity index 96%
rename from modules/home-manager/wayland/swww.nix
rename to home-manager/modules/wayland/swww.nix
index d9cd5236..c399f362 100644
--- a/modules/home-manager/wayland/swww.nix
+++ b/home-manager/modules/wayland/swww.nix
@@ -10,7 +10,6 @@ in
};
config = mkIf cfg.enable {
- # TODO: move to a module
systemd.user.services = {
swww = {
Unit = {
diff --git a/modules/home-manager/xdg-mime-apps.nix b/home-manager/modules/xdg-mime-apps.nix
similarity index 100%
rename from modules/home-manager/xdg-mime-apps.nix
rename to home-manager/modules/xdg-mime-apps.nix
diff --git a/home-manager/ripgrep.nix b/home-manager/ripgrep.nix
new file mode 100644
index 00000000..b4728ddf
--- /dev/null
+++ b/home-manager/ripgrep.nix
@@ -0,0 +1,12 @@
+{ pkgs, lib, config, ... }:
+{
+ programs.ripgrep = {
+ enable = true;
+ arguments = [
+ "--max-columns=150"
+ "--max-columns-preview"
+ "--glob=!.git"
+ "--smart-case"
+ ];
+ };
+}
diff --git a/config/home-manager/terminal/yazi.nix b/home-manager/yazi.nix
similarity index 94%
rename from config/home-manager/terminal/yazi.nix
rename to home-manager/yazi.nix
index 4095867f..96220927 100644
--- a/config/home-manager/terminal/yazi.nix
+++ b/home-manager/yazi.nix
@@ -1,4 +1,4 @@
-{ config, ... }:
+{ config, lib, ... }:
let
downloadDirName = "downloads";
in
@@ -61,4 +61,6 @@ in
require("folder-rules"):setup()
'';
};
+
+ custom.xdgDefaultApps.fileBrowser = lib.mkBefore [ "yazi.desktop" ];
}
diff --git a/hosts/laptop/bphenriques/home.nix b/hosts/laptop/bphenriques/home.nix
index 4ca2256b..c4bef06a 100644
--- a/hosts/laptop/bphenriques/home.nix
+++ b/hosts/laptop/bphenriques/home.nix
@@ -1,9 +1,9 @@
{ pkgs, config, self, ... }:
{
imports = [
- ../../../config/home-manager
- ../../../config/home-manager/gaming
- ../../../config/home-manager/window-manager
+ ../../../home-manager
+ ../../../home-manager/desktop-environment
+ ../../../home-manager/desktop
./input-remapper
];
diff --git a/hosts/laptop/config.nix b/hosts/laptop/config.nix
index 8eeffcca..bd8bb14f 100644
--- a/hosts/laptop/config.nix
+++ b/hosts/laptop/config.nix
@@ -1,9 +1,11 @@
{ config, pkgs, lib, self, ... }:
{
imports = [
- ./hardware # CPU, graphics, peripherals, etc
- ./filesystem # Partitioning, etc
- ../../config/nixos # Default nixos settings
+ ./hardware # CPU, graphics, peripherals, etc
+ ./filesystem # Partitioning, etc
+ ../../nixos # Default nixos settings
+ ../../nixos/desktop-environment # My desktop environment
+ ../../nixos/desktop # The usual desktop applications
# Users
./bphenriques
diff --git a/modules/home-manager/wayland/notifications/default.nix b/modules/home-manager/wayland/notifications/default.nix
deleted file mode 100644
index 63f2b026..00000000
--- a/modules/home-manager/wayland/notifications/default.nix
+++ /dev/null
@@ -1,84 +0,0 @@
-{ config, lib, pkgs, ... }:
-let
- cfg = config.custom.services.swww;
-in
-{
- options.custom.services.notification-daemon = {
- enable = mkEnableOption ''notification-daemon service.'';
- };
-
- config = mkIf cfg.enable {
- services.dunst = {
- enable = true;
- iconTheme = {
- name = "Papirus-Dark";
- package = pkgs.papirus-icon-theme;
- };
- settings = {
- global = {
- rounded = "yes";
- origin = "top-right";
- monitor = "0";
- alignment = "left";
- vertical_alignment = "center";
- width = "400";
- height = "400";
- scale = 0;
- gap_size = 0;
- progress_bar = true;
- transparency = 0;
- text_icon_padding = 0;
- separator_color = "frame";
- sort = "yes";
- idle_threshold = 120;
- line_height = 0;
- markup = "full";
- show_age_threshold = 60;
- ellipsize = "middle";
- ignore_newline = "no";
- stack_duplicates = true;
- sticky_history = "yes";
- history_length = 20;
- always_run_script = true;
- corner_radius = 10;
- follow = "mouse";
- font = "Source Sans Pro 10";
- format = "%s\\n%b"; #format = "%s %p\n%b"
- frame_color = "#232323";
- frame_width = 1;
- offset = "15x15";
- horizontal_padding = 10;
- icon_position = "left";
- indicate_hidden = "yes";
- min_icon_size = 0;
- max_icon_size = 64;
- mouse_left_click = "do_action, close_current";
- mouse_middle_click = "close_current";
- mouse_right_click = "close_all";
- padding = 10;
- plain_text = "no";
- separator_height = 2;
- show_indicators = "yes";
- shrink = "no";
- word_wrap = "yes";
- browser = "/usr/bin/env librewolf -new-tab";
- };
-
- fullscreen_delay_everything = {fullscreen = "delay";};
-
- urgency_critical = {
- background = "#d64e4e";
- foreground = "#f0e0e0";
- };
- urgency_low = {
- background = "#232323";
- foreground = "#2596be";
- };
- urgency_normal = {
- background = "#1e1e2a";
- foreground = "#2596be";
- };
- };
- };
- };
-}
\ No newline at end of file
diff --git a/modules/home-manager/wayland/notifications/dunst.nix b/modules/home-manager/wayland/notifications/dunst.nix
deleted file mode 100644
index 0ca022fc..00000000
--- a/modules/home-manager/wayland/notifications/dunst.nix
+++ /dev/null
@@ -1,88 +0,0 @@
-{ config, lib, pkgs, ... }:
-let
- cfg = config.custom.services.swww;
-in
-{
- options.custom.services.swww = {
- enable = mkEnableOption ''swww service.'';
- };
-
- config = mkIf cfg.enable {
- services.avizo.enable = false; # Media notifications
- services.swayosd.enable = false; # notifications bindings at https://github.com/Frost-Phoenix/nixos-config/blob/92cb97590b06f6e5da9c893c64e8fb12cf723567/modules/home/swayosd.nix#L3
- services.swaync.enable = true; # General notifications TODO: fix the fact the service does not run
-
- services.dunst = {
- enable = false;
- iconTheme = {
- name = "Papirus-Dark";
- package = pkgs.papirus-icon-theme;
- };
- settings = {
- global = {
- rounded = "yes";
- origin = "top-right";
- monitor = "0";
- alignment = "left";
- vertical_alignment = "center";
- width = "400";
- height = "400";
- scale = 0;
- gap_size = 0;
- progress_bar = true;
- transparency = 0;
- text_icon_padding = 0;
- separator_color = "frame";
- sort = "yes";
- idle_threshold = 120;
- line_height = 0;
- markup = "full";
- show_age_threshold = 60;
- ellipsize = "middle";
- ignore_newline = "no";
- stack_duplicates = true;
- sticky_history = "yes";
- history_length = 20;
- always_run_script = true;
- corner_radius = 10;
- follow = "mouse";
- font = "Source Sans Pro 10";
- format = "%s\\n%b"; #format = "%s %p\n%b"
- frame_color = "#232323";
- frame_width = 1;
- offset = "15x15";
- horizontal_padding = 10;
- icon_position = "left";
- indicate_hidden = "yes";
- min_icon_size = 0;
- max_icon_size = 64;
- mouse_left_click = "do_action, close_current";
- mouse_middle_click = "close_current";
- mouse_right_click = "close_all";
- padding = 10;
- plain_text = "no";
- separator_height = 2;
- show_indicators = "yes";
- shrink = "no";
- word_wrap = "yes";
- browser = "/usr/bin/env librewolf -new-tab";
- };
-
- fullscreen_delay_everything = {fullscreen = "delay";};
-
- urgency_critical = {
- background = "#d64e4e";
- foreground = "#f0e0e0";
- };
- urgency_low = {
- background = "#232323";
- foreground = "#2596be";
- };
- urgency_normal = {
- background = "#1e1e2a";
- foreground = "#2596be";
- };
- };
- };
- };
-}
\ No newline at end of file
diff --git a/modules/home-manager/wayland/notifications/scripts/volume.sh b/modules/home-manager/wayland/notifications/scripts/volume.sh
deleted file mode 100755
index 4955c026..00000000
--- a/modules/home-manager/wayland/notifications/scripts/volume.sh
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/sh
-
-# TODO: See https://github.com/dunst-project/dunst/blob/master/contrib/progress-notify.sh
-# Similar thing for brigthness? cat /sys/class/backlight/amdgpu_bl1/
-
-get_volume() { amixer get Master | grep '%' | head -n 1 | cut -d '[' -f 2 | cut -d '%' -f 1; }
-is_muted() { amixer get Master | grep '%' | grep -oE '[^ ]+$' | grep off > /dev/null; }
-send_notification() {
- dunstify -h string:x-canonical-private-synchronous:audio \
- --icon H \
- "Volume: " -h int:value:"$(get_volume)";
-}
-
-case $1 in
- up)
- amixer -q sset Master 5%+ --quiet
- send_notification
- ;;
- down)
- amixer -q sset Master 5%- --quiet
- send_notification
- ;;
- mute)
- amixer -q sset Master toggle
- amixer -D pulse set Master 1+ toggle > /dev/null
- if is_muted ; then
- dunstify -h string:x-canonical-private-synchronous:audio "Volume: 0"
- else
- send_notification
- fi
- ;;
-esac
\ No newline at end of file
diff --git a/config/nixos/default.nix b/nixos/default.nix
similarity index 62%
rename from config/nixos/default.nix
rename to nixos/default.nix
index 1f627bcb..a9f515cc 100644
--- a/config/nixos/default.nix
+++ b/nixos/default.nix
@@ -1,14 +1,7 @@
{ pkgs, lib, network-devices, ... }:
{
- imports = [
- ./greetd.nix # X11/Wayland agnostic display manager
- ./wayland.nix # Wayland compositor
- ./programs.nix
- ./desktop.nix
- ];
-
nix = {
- settings.auto-optimise-store = true; # Optimise the store when building.
+ settings.auto-optimise-store = true; # Optimise the store when building.
gc = {
automatic = true;
dates = "weekly";
@@ -22,17 +15,6 @@
# Not enabling useTmpfs despite having enough RAM. Might consider it.
boot.tmp.cleanOnBoot = true;
- # Audio
- hardware.pulseaudio.enable = false; # Disable PulseAudio: https://nixos.wiki/wiki/PulseAudio
- security.rtkit.enable = true; # Recommended for pipewire
- services.pipewire = {
- enable = true; # Enable pipewire
- alsa.enable = true; # For better compatibility
- alsa.support32Bit = true; # For better compatibility
- pulse.enable = true; # For better compatibility
- wireplumber.enable = true; # Audio routing policy if I understood correctly.
- };
-
# Network
networking = {
networkmanager.enable = true;
@@ -60,9 +42,26 @@
};
};
+ environment.systemPackages = let
+ filesystems = [ pkgs.exfat pkgs.ntfs3g ]; # Suport exFAT and NTFS formatted drives (pendisks + external disks)
+ hardware = [
+ pkgs.powertop # Check what is consuming too much energy
+ pkgs.usbutils # USB utilities
+ ];
+ in filesystems ++ hardware;
+
+ programs.fish = {
+ enable = true; # System level.
+ vendor.functions.enable = true; # Ensure completions/functions are automatically set.
+ };
+
services.fwupd.enable = true; # Updates firmwares: `fwupdmgr`
- # Security related
+ # Disabling some defaults
+ programs.command-not-found.enable = false;
+ programs.nano.enable = false;
+
+ # Security
services.journald.extraConfig = ''
MaxRetentionSec=1month
SystemMaxUse=1G
diff --git a/config/nixos/wayland.nix b/nixos/desktop-environment/default.nix
similarity index 93%
rename from config/nixos/wayland.nix
rename to nixos/desktop-environment/default.nix
index cf4cd364..24e8fdb2 100644
--- a/config/nixos/wayland.nix
+++ b/nixos/desktop-environment/default.nix
@@ -1,5 +1,9 @@
{ pkgs, lib, network-devices, ... }:
{
+ imports = [
+ ./login-manager.nix
+ ];
+
programs.niri.enable = true;
security.pam.services.swaylock = {};
services.gnome.gnome-keyring.enable = true;
@@ -9,7 +13,6 @@
pkgs.xdg-desktop-portal-gnome # Required for screencasting
];
};
- programs.nm-applet.enable = true; # Network manager applet
# Other
# TODO: https://github.com/Aylur/dotfiles/blob/main/nixos/system.nix#L44
diff --git a/config/nixos/greetd.nix b/nixos/desktop-environment/login-manager.nix
similarity index 100%
rename from config/nixos/greetd.nix
rename to nixos/desktop-environment/login-manager.nix
diff --git a/nixos/desktop/default.nix b/nixos/desktop/default.nix
new file mode 100644
index 00000000..f75e8248
--- /dev/null
+++ b/nixos/desktop/default.nix
@@ -0,0 +1,27 @@
+{ pkgs, ... }:
+{
+ # Audio
+ hardware.pulseaudio.enable = false; # Disable PulseAudio: https://nixos.wiki/wiki/PulseAudio
+ security.rtkit.enable = true; # Recommended for pipewire
+ services.pipewire = {
+ enable = true; # Enable pipewire
+ alsa.enable = true; # For better compatibility
+ alsa.support32Bit = true; # For better compatibility
+ pulse.enable = true; # Pulse audio emulation for better compatibility
+ wireplumber.enable = true; # Audio routing policy if I understood correctly.
+ };
+
+ environment.systemPackages = [
+ pkgs.nautilus # File Browser
+ pkgs.cheese # Webcam TODO do not include it if there is no webcam
+ ];
+
+ services = {
+ # TODO: https://github.com/ners/trilby/blob/7dd41d0704ebf75f8f705da066184f5ed6168441/modules/home/dconf.nix#L44
+ gnome.sushi.enable = true; # Nautilus: previews
+ gvfs.enable = true; # Nautilus: Mount, trash, and other functionalities
+ flatpak.enable = true; # Easier to run some programs. Setup afterwards: flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
+ };
+
+ programs.partition-manager.enable = true;
+}
diff --git a/modules/nixos/default.nix b/nixos/modules/default.nix
similarity index 100%
rename from modules/nixos/default.nix
rename to nixos/modules/default.nix
diff --git a/modules/nixos/profiles/emulation.nix b/nixos/modules/profiles/emulation.nix
similarity index 100%
rename from modules/nixos/profiles/emulation.nix
rename to nixos/modules/profiles/emulation.nix
diff --git a/modules/nixos/profiles/gaming.nix b/nixos/modules/profiles/gaming.nix
similarity index 100%
rename from modules/nixos/profiles/gaming.nix
rename to nixos/modules/profiles/gaming.nix
diff --git a/modules/nixos/programs/proton-run.nix b/nixos/modules/programs/proton-run.nix
similarity index 100%
rename from modules/nixos/programs/proton-run.nix
rename to nixos/modules/programs/proton-run.nix
diff --git a/modules/nixos/services/input-remapper.nix b/nixos/modules/services/input-remapper.nix
similarity index 100%
rename from modules/nixos/services/input-remapper.nix
rename to nixos/modules/services/input-remapper.nix
diff --git a/modules/nixos/services/solaar.nix b/nixos/modules/services/solaar.nix
similarity index 100%
rename from modules/nixos/services/solaar.nix
rename to nixos/modules/services/solaar.nix
diff --git a/modules/nixos/system/boot-theme.nix b/nixos/modules/system/boot-theme.nix
similarity index 100%
rename from modules/nixos/system/boot-theme.nix
rename to nixos/modules/system/boot-theme.nix
From d6933bb6558e6d1a8aac0e5061bd73d54a659bdf Mon Sep 17 00:00:00 2001
From: Bruno Henriques <4727729+bphenriques@users.noreply.github.com>
Date: Sun, 29 Dec 2024 18:21:00 +0000
Subject: [PATCH 31/34] many many many changes
---
flake.lock | 73 +++---
home-manager/default.nix | 11 +-
home-manager/desktop-environment/README.md | 61 -----
home-manager/desktop-environment/default.nix | 21 +-
home-manager/desktop-environment/dunst.nix | 1 -
home-manager/desktop-environment/fuzzel.nix | 3 +
home-manager/desktop-environment/mako.nix | 26 ++
home-manager/desktop-environment/niri.nix | 17 +-
home-manager/desktop-environment/rofi.nix | 231 ++++++++++++++++++
home-manager/desktop-environment/swayidle.nix | 29 ++-
home-manager/desktop/default.nix | 31 ++-
home-manager/desktop/discord.nix | 4 +-
home-manager/desktop/heroic.nix | 5 +
home-manager/desktop/mangohud.nix | 22 ++
home-manager/desktop/retroarch.nix | 24 ++
home-manager/fish.nix | 4 +-
home-manager/fonts.nix | 2 +
hosts/laptop/config.nix | 1 -
hosts/laptop/filesystem/disko.nix | 1 +
hosts/laptop/hardware/default.nix | 14 +-
hosts/laptop/hardware/peripherals.nix | 4 +-
nixos/desktop-environment/default.nix | 4 +-
nixos/desktop-environment/login-manager.nix | 2 +-
nixos/desktop-environment/nautilus.nix | 7 +
nixos/desktop/default.nix | 16 +-
nixos/desktop/steam.nix | 62 +++++
nixos/desktop/sunshine.nix | 40 +++
nixos/modules/default.nix | 2 -
nixos/modules/profiles/emulation.nix | 39 ---
nixos/modules/profiles/gaming.nix | 120 ---------
nixos/modules/programs/proton-run.nix | 4 +-
packages/cliphist-dmenu/cliphist-dmenu.sh | 14 ++
packages/cliphist-dmenu/default.nix | 6 +
packages/default.nix | 7 +
packages/dotfiles/default.nix | 2 +-
packages/dotfiles/{src => }/dotfiles.sh | 0
packages/fzf-fd/default.nix | 2 +-
packages/fzf-fd/{src => }/fzf-fd.sh | 0
packages/fzf-rg/default.nix | 2 +-
packages/fzf-rg/{src => }/fzf-rg.sh | 0
packages/niri-window-dmenu/default.nix | 2 +-
.../{src => }/niri-window-dmenu.sh | 0
packages/proton-ge-custom/default.nix | 35 +++
packages/session-dmenu/default.nix | 6 +
packages/session-dmenu/session-dmenu.sh | 26 ++
packages/smart-paste/default.nix | 11 +
packages/smart-paste/smart-paste.sh | 7 +
47 files changed, 686 insertions(+), 315 deletions(-)
delete mode 100644 home-manager/desktop-environment/README.md
create mode 100644 home-manager/desktop-environment/mako.nix
create mode 100644 home-manager/desktop-environment/rofi.nix
create mode 100644 home-manager/desktop/heroic.nix
create mode 100644 home-manager/desktop/mangohud.nix
create mode 100644 home-manager/desktop/retroarch.nix
create mode 100644 nixos/desktop-environment/nautilus.nix
create mode 100644 nixos/desktop/steam.nix
create mode 100644 nixos/desktop/sunshine.nix
delete mode 100644 nixos/modules/profiles/emulation.nix
delete mode 100644 nixos/modules/profiles/gaming.nix
create mode 100644 packages/cliphist-dmenu/cliphist-dmenu.sh
create mode 100644 packages/cliphist-dmenu/default.nix
rename packages/dotfiles/{src => }/dotfiles.sh (100%)
rename packages/fzf-fd/{src => }/fzf-fd.sh (100%)
rename packages/fzf-rg/{src => }/fzf-rg.sh (100%)
rename packages/niri-window-dmenu/{src => }/niri-window-dmenu.sh (100%)
create mode 100644 packages/proton-ge-custom/default.nix
create mode 100644 packages/session-dmenu/default.nix
create mode 100644 packages/session-dmenu/session-dmenu.sh
create mode 100644 packages/smart-paste/default.nix
create mode 100644 packages/smart-paste/smart-paste.sh
diff --git a/flake.lock b/flake.lock
index 62bde81b..84265fe7 100644
--- a/flake.lock
+++ b/flake.lock
@@ -7,11 +7,11 @@
]
},
"locked": {
- "lastModified": 1733570843,
- "narHash": "sha256-sQJAxY1TYWD1UyibN/FnN97paTFuwBw3Vp3DNCyKsMk=",
+ "lastModified": 1735478292,
+ "narHash": "sha256-Ys9pSP9ch0SthhpbjnkCSJ9ZLfaNKnt/dcy7swjmS1A=",
"owner": "lnl7",
"repo": "nix-darwin",
- "rev": "a35b08d09efda83625bef267eb24347b446c80b8",
+ "rev": "71a3a075e3229a7518d76636bb762aef2bcb73ac",
"type": "github"
},
"original": {
@@ -28,11 +28,11 @@
]
},
"locked": {
- "lastModified": 1734088167,
- "narHash": "sha256-OIitVU+IstPbX/NWn2jLF+/sT9dVKcO2FKeRAzlyX6c=",
+ "lastModified": 1735468753,
+ "narHash": "sha256-2dt1nOe9zf9pDkf5Kn7FUFyPRo581s0n90jxYXJ94l0=",
"owner": "nix-community",
"repo": "disko",
- "rev": "d32f2d1750d61a476a236526b725ec5a32e16342",
+ "rev": "84a5b93637cc16cbfcc61b6e1684d626df61eb21",
"type": "github"
},
"original": {
@@ -61,6 +61,22 @@
"url": "ssh://git@github.com/bphenriques/dotfiles-private"
}
},
+ "flake-compat": {
+ "flake": false,
+ "locked": {
+ "lastModified": 1696426674,
+ "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
+ "owner": "edolstra",
+ "repo": "flake-compat",
+ "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
+ "type": "github"
+ },
+ "original": {
+ "owner": "edolstra",
+ "repo": "flake-compat",
+ "type": "github"
+ }
+ },
"flake-parts": {
"inputs": {
"nixpkgs-lib": [
@@ -102,6 +118,7 @@
},
"ghostty": {
"inputs": {
+ "flake-compat": "flake-compat",
"nixpkgs-stable": [
"nixpkgs"
],
@@ -111,11 +128,11 @@
"zig": "zig"
},
"locked": {
- "lastModified": 1734193420,
- "narHash": "sha256-FoD35icQTH0i/c7sGsYeJ4noP39wGv2tJO4FKpxtA/o=",
+ "lastModified": 1735490499,
+ "narHash": "sha256-kYIsb/MJ77fV/8Qa6VGYQU7Ss0u1nMXmYPpbccvFKz4=",
"ref": "refs/heads/main",
- "rev": "fba10a442cbe745cd837cc86b3da4f5c31af6ee7",
- "revCount": 8267,
+ "rev": "02538bed3cbbeda3749cdb5ab07c2bc6a26ed738",
+ "revCount": 8574,
"type": "git",
"url": "ssh://git@github.com/mitchellh/ghostty"
},
@@ -131,11 +148,11 @@
]
},
"locked": {
- "lastModified": 1734093295,
- "narHash": "sha256-hSwgGpcZtdDsk1dnzA0xj5cNaHgN9A99hRF/mxMtwS4=",
+ "lastModified": 1735381016,
+ "narHash": "sha256-CyCZFhMUkuYbSD6bxB/r43EdmDE7hYeZZPTCv0GudO4=",
"owner": "nix-community",
"repo": "home-manager",
- "rev": "66c5d8b62818ec4c1edb3e941f55ef78df8141a8",
+ "rev": "10e99c43cdf4a0713b4e81d90691d22c6a58bdf2",
"type": "github"
},
"original": {
@@ -146,11 +163,11 @@
},
"nixpkgs": {
"locked": {
- "lastModified": 1734126203,
- "narHash": "sha256-0XovF7BYP50rTD2v4r55tR5MuBLet7q4xIz6Rgh3BBU=",
+ "lastModified": 1735268880,
+ "narHash": "sha256-7QEFnKkzD13SPxs+UFR5bUFN2fRw+GlL0am72ZjNre4=",
"owner": "nixos",
"repo": "nixpkgs",
- "rev": "71a6392e367b08525ee710a93af2e80083b5b3e2",
+ "rev": "7cc0bff31a3a705d3ac4fdceb030a17239412210",
"type": "github"
},
"original": {
@@ -162,11 +179,11 @@
},
"nixpkgs-stable": {
"locked": {
- "lastModified": 1734083684,
- "narHash": "sha256-5fNndbndxSx5d+C/D0p/VF32xDiJCJzyOqorOYW4JEo=",
+ "lastModified": 1735264675,
+ "narHash": "sha256-MgdXpeX2GuJbtlBrH9EdsUeWl/yXEubyvxM1G+yO4Ak=",
"owner": "nixos",
"repo": "nixpkgs",
- "rev": "314e12ba369ccdb9b352a4db26ff419f7c49fa84",
+ "rev": "d49da4c08359e3c39c4e27c74ac7ac9b70085966",
"type": "github"
},
"original": {
@@ -178,11 +195,11 @@
},
"nixpkgs_2": {
"locked": {
- "lastModified": 1733940404,
- "narHash": "sha256-Pj39hSoUA86ZePPF/UXiYHHM7hMIkios8TYG29kQT4g=",
+ "lastModified": 1735291276,
+ "narHash": "sha256-NYVcA06+blsLG6wpAbSPTCyLvxD/92Hy4vlY9WxFI1M=",
"owner": "nixos",
"repo": "nixpkgs",
- "rev": "5d67ea6b4b63378b9c13be21e2ec9d1afc921713",
+ "rev": "634fd46801442d760e09493a794c4f15db2d0cbb",
"type": "github"
},
"original": {
@@ -199,11 +216,11 @@
"treefmt-nix": "treefmt-nix"
},
"locked": {
- "lastModified": 1734196117,
- "narHash": "sha256-sCNL2O3vVkstnJiaf4v7GyGi7ynxkuNe707IkL0rNwc=",
+ "lastModified": 1735490440,
+ "narHash": "sha256-v4s1vzJP2BMwYc1vtr6Y6P6i9uFMPKyrFv61YwAmQIM=",
"owner": "nix-community",
"repo": "nur",
- "rev": "f2d6c9fd0abce648bf52cfb0348bf6afbf7fe733",
+ "rev": "69f33b21fab40d98058247256fb8f964eb2c24e9",
"type": "github"
},
"original": {
@@ -232,11 +249,11 @@
]
},
"locked": {
- "lastModified": 1733965552,
- "narHash": "sha256-GZ4YtqkfyTjJFVCub5yAFWsHknG1nS/zfk7MuHht4Fs=",
+ "lastModified": 1735468296,
+ "narHash": "sha256-ZjUjbvS06jf4fElOF4ve8EHjbpbRVHHypStoY8HGzk8=",
"owner": "Mic92",
"repo": "sops-nix",
- "rev": "2d73fc6ac4eba4b9a83d3cb8275096fbb7ab4004",
+ "rev": "bcb8b65aa596866eb7e5c3e1a6cccbf5d1560b27",
"type": "github"
},
"original": {
diff --git a/home-manager/default.nix b/home-manager/default.nix
index 3935fda6..caa329ad 100644
--- a/home-manager/default.nix
+++ b/home-manager/default.nix
@@ -41,7 +41,7 @@
};
home.packages = with pkgs; [
- # Consistent UNIX command line tools regardless of the OS
+ # Consistency across different operating systems
coreutils
findutils
gnugrep
@@ -110,19 +110,16 @@
# Text Processor
e = "$EDITOR";
- # Nix utility functions to set the SHELL automatically
- nix-shell = "nix-shell --run $SHELL";
- devshell = "nix develop --command $SHELL";
+ # Utility
whatsmyip = "${lib.getExe pkgs.curl} ifconfig.me";
} // (lib.optionalAttrs pkgs.stdenv.isLinux {
- pbcopy = lib.getExe pkgs.xclip;
- pbpaste = "${lib.getExe pkgs.xclip} -o";
webp_to_png = ''nix-shell -p libwebp -p parallel --command "parallel dwebp {} -o {.}.png ::: *.webp"'';
});
};
programs.man.enable = true; # RTFM
- manual.manpages.enable = false; # I do not need home-manager configuration reference in the man pages.
+ manual.manpages.enable = false; # Discard home-manager configuration man pages.
+ manual.json.enable = false; # Discard home-manager configuration JSON docs.
# Tighten permissions to private keys
systemd.user.tmpfiles.rules = lib.optionals pkgs.stdenv.isLinux [
diff --git a/home-manager/desktop-environment/README.md b/home-manager/desktop-environment/README.md
deleted file mode 100644
index 7fdc044f..00000000
--- a/home-manager/desktop-environment/README.md
+++ /dev/null
@@ -1,61 +0,0 @@
-# THIS LOOKS REALLY GOOD
-https://github.com/shazow/nixfiles/blob/main/home/common/wayland.nix
-https://github.com/Misterio77/nix-config/blob/main/home/gabriel/features/desktop/common/wayland-wm/default.nix
-https://github.com/bashfulrobot/nixos/blob/main/modules/desktops/addons/wayland/default.nix
-
-
-
-https://github.com/bbigras/nix-config/tree/master/users/bbigras/graphical/sway
-https://github.com/bbigras/nix-config/blob/master/users/bbigras/graphical/common.nix
-https://codeberg.org/adamcstephens/dotfiles/src/branch/main/apps/waybar
-https://codeberg.org/adamcstephens/dotfiles/src/branch/main/apps/waylock/waylock.toml
-
-https://github.com/iynaix/dotfiles/tree/f0f8918caed8f4c245fa82fc505ae0de09a32f5c/home-manager/hyprland
-# https://github.com/edmundmiller/dotfiles/blob/main/modules/desktop/apps/rofi.nix
-https://github.com/Misterio77/nix-config/blob/cdc35ca281891268c6e9772cca1e66fb39de04ab/home/misterio/features/desktop/hyprland/default.nix
-https://github.com/prescientmoon/everything-nix/tree/develop/home/features/wayland
-https://gitlab.com/usmcamp0811/dotfiles/-/blob/nixos/modules/nixos/desktop/hyperland/default.nix?ref_type=heads
-https://codeberg.org/adamcstephens/dotfiles/src/branch/main/apps/waybar
-https://codeberg.org/adamcstephens/dotfiles/src/branch/main/apps/wofi
-https://codeberg.org/adamcstephens/dotfiles/src/branch/main/bin
-# File browser: https://github.com/iynaix/dotfiles/blob/e441ab4ff7a775b57b6c79a2fa6be99e3ab2d58b/home-manager/programs/nemo.nix#L79
-https://github.com/0xcharly/nix-config/blob/a8e1427a67494ad5de3d639d94ee619ca69f51c7/users/delay/wayland.nix
-
-
-
-https://github.com/namishh/crystal/blob/main/home/namish/conf/ui/hyprland/default.nix
-https://github.com/yusdacra/ark/blob/e49b560d6b1f2612ed27070b49d8a43d038532c4/users/modules/dunst/default.nix
-https://github.com/Mbhon1/Osama-Flake/blob/0b58a55a38d186b13cddfdda7f73ad23a48214d8/hyprland/default.nix
-https://github.com/shazow/nixfiles/blob/main/common/desktop-wayland.nix#L21
-
-
-
-https://github.com/Mic92/dotfiles/blob/main/home-manager/modules/waybar.nix
-
-
- Notification daemon? https://github.com/fufexan/dotfiles/blob/main/home/services/system/dunst.nix#L7
- More misc: https://github.com/fufexan/dotfiles/blob/main/home/services/wayland/swayidle.nix
- Too many things: https://github.com/bashfulrobot/nixos/tree/main/home/modules/wayland
- https://github.com/NickCao/flakes/blob/d99c0a28b9357adce9749ca49364038184a1b95e/nixos/mainframe/home.nix#L22
-
-
- https://github.com/fufexan/dotfiles/tree/main/home/programs/wayland
- Notification daemon? https://github.com/fufexan/dotfiles/blob/main/home/services/system/dunst.nix#L7
- More misc: https://github.com/fufexan/dotfiles/blob/main/home/services/wayland/swayidle.nix
- Too many things: https://github.com/bashfulrobot/nixos/tree/main/home/modules/wayland
- https://github.com/NickCao/flakes/blob/d99c0a28b9357adce9749ca49364038184a1b95e/nixos/mainframe/home.nix#L22
-
-Waybar
-https://github.com/NickCao/flakes/blob/d99c0a28b9357adce9749ca49364038184a1b95e/nixos/mainframe/waybar.nix
-https://github.com/NickCao/flakes/blob/d99c0a28b9357adce9749ca49364038184a1b95e/nixos/mainframe/waybar.css
-
-Sway
-https://github.com/NickCao/flakes/blob/d99c0a28b9357adce9749ca49364038184a1b95e/nixos/mainframe/home.nix#L22
-
-
-Wofi:
-# https://github.com/shazow/nixfiles/blob/main/home/bin/volumectl
-# https://github.com/mitchellh/nixos-config/blob/main/users/mitchellh/rofi
-
-
-https://github.com/wochap/nix-config/blob/main/hosts/glegion/hardware.nix#L65
\ No newline at end of file
diff --git a/home-manager/desktop-environment/default.nix b/home-manager/desktop-environment/default.nix
index ccdc1564..0d47de49 100644
--- a/home-manager/desktop-environment/default.nix
+++ b/home-manager/desktop-environment/default.nix
@@ -1,18 +1,21 @@
{ config, lib, pkgs, ... }:
-# TODO: pre-script for gaming: https://github.com/diniamo/niqs/blob/53288d72902365ee8d3bfdd6aff0ec79eb7c1c36/modules/workstation/gaming.nix#L16
-
{
- # https://github.com/prasanthrangan/hyprdots?tab=readme-ov-file
imports = [
- ./niri.nix # Window Manager
- ./waybar # Status bar
- ./dunst.nix # Notification Daemon
- ./fuzzel.nix # Application Launcher
+ ./niri.nix # Window Manager
+ ./waybar # Status bar
+ ./mako.nix # Notification Daemon
+ ./fuzzel.nix # Application Launcher
+ ./rofi.nix # Application Launcher
+ ./swayidle.nix # Locks/suspends the computer when idle
];
- custom.services.swww.enable = true;
+ custom.services.swww.enable = true; # Wallpaper daemon
+ home.packages = [
+ pkgs.cliphist # Wayland clipboard history
+ (pkgs.writeScriptBin "pbcopy" (lib.getExe' pkgs.wl-clipboard "wl-copy")) # I am too hardwired to pbcopy
+ (pkgs.writeScriptBin "pbpaste" (lib.getExe' pkgs.wl-clipboard "wl-paste")) # I am too hardwired to pbpaste
+ ];
- # TODO: Use the following theme: https://github.com/iynaix/dotfiles/blob/56d2d63b3b5f4c621429d79fb2aef8d44fdc25b9/home-manager/gui/gtk.nix#L85
home.pointerCursor = {
gtk.enable = true;
package = pkgs.bibata-cursors;
diff --git a/home-manager/desktop-environment/dunst.nix b/home-manager/desktop-environment/dunst.nix
index bc2961f5..174f0960 100644
--- a/home-manager/desktop-environment/dunst.nix
+++ b/home-manager/desktop-environment/dunst.nix
@@ -1,6 +1,5 @@
{ config, lib, pkgs, ... }:
{
- services.mako.enable = true;
services.dunst = {
enable = false;
iconTheme = {
diff --git a/home-manager/desktop-environment/fuzzel.nix b/home-manager/desktop-environment/fuzzel.nix
index ec5fe52a..08e9a9a3 100644
--- a/home-manager/desktop-environment/fuzzel.nix
+++ b/home-manager/desktop-environment/fuzzel.nix
@@ -1,5 +1,8 @@
{ config, pkgs, lib, ... }:
{
+ fonts.fontconfig.enable = true;
+ home.packages = [ pkgs.nerd-fonts.jetbrains-mono ];
+
programs.fuzzel = {
enable = true;
settings = {
diff --git a/home-manager/desktop-environment/mako.nix b/home-manager/desktop-environment/mako.nix
new file mode 100644
index 00000000..5cf4fb24
--- /dev/null
+++ b/home-manager/desktop-environment/mako.nix
@@ -0,0 +1,26 @@
+{ pkgs, lib, ... }:
+{
+ services.mako = {
+ enable = true;
+ layer = "overlay";
+ defaultTimeout = 5000;
+
+ # Theming
+ backgroundColor = "#151515";
+ textColor = "#e8e3e3";
+ progressColor = "over #2e2e2e";
+ width = 300;
+ height = 200;
+ margin = "8";
+ padding = "12";
+ borderSize = 1;
+ borderRadius = 4;
+ borderColor= "#424242";
+
+ extraConfig = ''
+ [urgency=critical]
+ border-color=#b66467
+ default-timeout=0
+ '';
+ };
+}
\ No newline at end of file
diff --git a/home-manager/desktop-environment/niri.nix b/home-manager/desktop-environment/niri.nix
index 42173aac..cb3d4122 100644
--- a/home-manager/desktop-environment/niri.nix
+++ b/home-manager/desktop-environment/niri.nix
@@ -2,6 +2,9 @@
# Logout: https://github.com/wuliuqii/nixos-config/blob/69606b2e0cccb6a135522fc5df188e4da0595e73/home/wm/wlogout.nix
# TODO: Alt F4 means keep closing active window until there is none. Then, show list of options.
# TODO: "Mod+Escape".action = spawn "wlogout";
+# # https://github.com/prasanthrangan/hyprdots?tab=readme-ov-file
+# https://github.com/linyinfeng/dotfiles/blob/340f913ea7520a3c0034034d4fe870c05145bbcb/home-manager/profiles/niri/default.nix#L796
+# ${lib.getExe pkgs.grim} -g \"$(${lib.getExe pkgs.slurp} -o -r -c '#ff0000ff')\" -t ppm - | ${lib.getExe pkgs.satty} --filename - --fullscreen --output-filename ~/Pictures/Screenshots/satty-$(date '+%Y%m%d-%H:%M:%S').png
# Battery? https://github.com/linuxmobile/kaku/blob/13eb9e8a19823cb2fa2aed29f7b1f49bea51c4a2/system/services/power.nix
# Seems to be more or less what I want? https://github.com/kiike/dotfiles/blob/ff788bae02ba6d15c73632d99654269d2b5fba49/hosts/balrog/default.nix
@@ -13,18 +16,23 @@
# Env variables: https://github.com/nyawox/nixboxes/blob/ecab4559da256b4f1198ca7d39d6e5b1d4442296/home/desktop/niri/general.nix#L185
# Funny login audio: https://github.com/nyawox/nixboxes/blob/ecab4559da256b4f1198ca7d39d6e5b1d4442296/home/desktop/niri/general.nix#L201
# https://gitlab.com/scientiac/einstein.nixos/-/tree/main/home/niriwm?ref_type=heads
+
+# TODO shortcut to lock the computer
+
let
# nix repl
# then :lf .
# then inputs.nixpkgs.lib.strings.concatMapStringsSep " " (x: ''"${x}"'') inputs.nixpkgs.lib.strings.splitString " " "please run this command"
# run-cmd = cmd: lib.strings.concatMapStringsSep " " (x: ''"${x}"'') lib.strings.splitString " " cmd;
+ xwaylandDisplayId = "21";
+
wallpapersPkg = self.private.wallpapers.override {
selected = [ "lake-fishing-sunset" "mountains" "whale-sunset" "watch-tower" ];
};
env = {
- DISPLAY = ":21";
+ DISPLAY = ":${xwaylandDisplayId}";
NIXOS_OZONE_WL = "1"; # Electron?
QT_QPA_PLATFORM = "wayland";
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; # Signal QT windows to remove their window decorations
@@ -32,9 +40,10 @@ let
on-startup = ''
spawn-at-startup "${lib.getExe self.pkgs.swww-util}" "random" "${wallpapersPkg}/share/wallpapers"
- spawn-at-startup "${lib.getExe pkgs.xwayland-satellite}" ":21"
+ spawn-at-startup "${lib.getExe pkgs.xwayland-satellite}" ":${xwaylandDisplayId}"
spawn-at-startup "${lib.getExe pkgs.waybar}"
spawn-at-startup "${lib.getExe self.pkgs.niri-output-configuration}" "startup"
+ spawn-at-startup "${pkgs.wl-clipboard}/bin/wl-paste" "--type" "text" "--watch" "${lib.getExe pkgs.cliphist}" "store" "-max-items" "20"
'';
input = ''
@@ -97,8 +106,8 @@ in
#services.gnome-keyring.enable = true; # Redundant as done in nixos?
xdg.configFile."niri/config.kdl".text = ''
- workspace "coding"
workspace "browsing"
+ workspace "coding"
workspace "gaming"
window-rule {
@@ -159,8 +168,10 @@ in
Mod+Shift+E { quit; }
Mod+Period { spawn "${lib.getExe pkgs.bemoji}"; }
+ Mod+Shitft+Q { spawn "${lib.getExe self.pkgs.session-dmenu}"; }
Mod+Shift+Tab { focus-workspace-previous; }
Mod+Tab { spawn "${lib.getExe self.pkgs.niri-window-dmenu}"; }
+ Mod+Shift+V { spawn "${lib.getExe self.pkgs.cliphist-dmenu}" "&&" "${lib.getExe self.pkgs.smart-paste}"; }
// Suggested binds for running programs: terminal, app launcher, screen locker.
Mod+Return { spawn "${lib.getExe community.pkgs.ghostty}"; }
diff --git a/home-manager/desktop-environment/rofi.nix b/home-manager/desktop-environment/rofi.nix
new file mode 100644
index 00000000..7c0fc675
--- /dev/null
+++ b/home-manager/desktop-environment/rofi.nix
@@ -0,0 +1,231 @@
+{ pkgs, lib, ... }:
+
+# desktop items: https://github.com/edmundmiller/dotfiles/blob/main/modules/desktop/apps/rofi.nix
+let
+ theme = ''
+ * {
+ font: "Cascadia Code NF 11";
+
+ bg0: #151515f2;
+ bg1: #1f1f1f80;
+ bg2: #393939bf;
+ fg0: #ffffff;
+ fg1: #cecece;
+ fg2: #DEDEDE80;
+
+ background-color: transparent;
+ text-color: @fg0;
+
+ margin: 0;
+ padding: 0;
+ spacing: 0;
+ }
+
+ window {
+ background-color: @bg0;
+ location: center;
+ width: 540px;
+ border-radius: 4px;
+ }
+
+ inputbar {
+ font: "Cascadia Code NF 13";
+ padding: 12px;
+ spacing: 12px;
+ children: [ icon-search, entry];
+ }
+
+ icon-search {
+ expand: false;
+ filename: "search";
+ size: 28px;
+ }
+
+ icon-search,
+ entry,
+ element-icon,
+ element-text {
+ vertical-align: 0.5;
+ }
+
+ entry {
+ font: inherit;
+
+ placeholder: "Search";
+ placeholder-color: @fg2;
+ }
+
+ message {
+ border: 2px 0 0;
+ border-color: @bg1;
+ background-color: @bg1;
+ }
+
+ textbox {
+ padding: 8px 24px;
+ }
+
+ listview {
+ lines: 7;
+ columns: 1;
+ fixed-height: false;
+ border: 1px 0 0;
+ border-color: @bg1;
+ }
+
+ element {
+ padding: 8px 16px;
+ spacing: 16px;
+ background-color: transparent;
+ children: [ element-icon, element-text];
+ }
+
+ element normal active {
+ text-color: @bg2;
+ }
+
+ element alternate active {
+ text-color: @bg2;
+ }
+
+ element selected normal,
+ element selected active {
+ background-color: @bg2;
+ text-color: @fg1;
+ }
+
+ element-icon {
+ size: 2em;
+ }
+
+ element-text {
+ text-color: inherit;
+ }
+ '';
+in
+{
+ # #https://codeberg.org/adamcstephens/dotfiles/src/branch/main/apps/rofi/default.nix
+ programs.rofi = {
+ enable = true;
+ package = pkgs.rofi-wayland;
+# theme = {
+# "*" = {
+# font = "FiraCode Nerd Font Medium 14";
+# bg0 = mkLiteral "#1e1e2e";
+# bg1 = mkLiteral "#181825";
+# bg2 = mkLiteral "#11111b";
+# bg3 = mkLiteral "#b4befe";
+# fg0 = mkLiteral "#cdd6f4";
+# fg1 = mkLiteral "#bac2de";
+# fg2 = mkLiteral "#a6adc8";
+# red = mkLiteral "#f38ba8";
+# green = mkLiteral "#a6e3a1";
+# yellow = mkLiteral "#f9e2af";
+# blue = mkLiteral "#89b4fa";
+# magenta = mkLiteral "#cba6f7";
+# cyan = mkLiteral "#94e2d5";
+#
+# accent = mkLiteral "@red";
+# urgent = mkLiteral "@yellow";
+#
+# background-color = mkLiteral "transparent";
+# text-color = mkLiteral "@fg0";
+#
+# margin = 0;
+# padding = 0;
+# spacing = 0;
+# };
+# "element-icon, element-text, scrollbar" = {
+# cursor = mkLiteral "pointer";
+# };
+#
+# "window" = {
+# location = mkLiteral "center";
+# width = mkLiteral "500px";
+#
+# background-color = mkLiteral "@bg1";
+# border = mkLiteral "3px";
+# border-color = mkLiteral "@bg3";
+# border-radius = mkLiteral "6px";
+# };
+#
+# "inputbar" = {
+# spacing = mkLiteral "8px";
+# padding = mkLiteral "4px 8px";
+# children = mkLiteral "[ prompt, entry ]";
+#
+# background-color = mkLiteral "@bg0";
+# };
+#
+# "icon-search, entry, element-icon, element-text" = {
+# vertical-align = mkLiteral "0.5";
+# };
+#
+# "icon-search" = {
+# expand = mkLiteral "false";
+# filename = "search-symbolic";
+# size = mkLiteral "14px";
+# };
+#
+# "textbox" = {
+# padding = mkLiteral "4px 8px";
+# background-color = mkLiteral "@bg2";
+# };
+#
+# "listview" = {
+# padding = mkLiteral "4px 0px";
+# lines = mkLiteral "12";
+# columns = mkLiteral "1";
+# scrollbar = mkLiteral "false";
+# fixed-height = mkLiteral "false";
+# dynamic = mkLiteral "true";
+# };
+#
+# "element" = {
+# padding = mkLiteral "4px 8px";
+# spacing = mkLiteral "8px";
+# };
+#
+# "element normal urgent" = {
+# text-color = mkLiteral "@urgent";
+# };
+#
+# "element normal active" = {
+# text-color = mkLiteral "@accent";
+# };
+#
+# "element selected" = {
+# text-color = mkLiteral "@bg1";
+# background-color = mkLiteral "@accent";
+# };
+#
+# "element selected urgent" = {
+# background-color = mkLiteral "@urgent";
+# };
+#
+# "element-icon" = {
+# size = mkLiteral "0.8em";
+# };
+#
+# "element-text" = {
+# text-color = mkLiteral "inherit";
+# };
+#
+# "scrollbar" = {
+# handle-width = mkLiteral "0px";
+# handle-color = mkLiteral "@fg2";
+# padding = mkLiteral "0 4px";
+# };
+# };
+# extraConfig = {
+# modes = mkLiteral "[ combi ]";
+# combi-modes = mkLiteral "[ window, drun, run ]";
+# };
+ };
+}
+
+# https://github.com/iynaix/dotfiles/blob/e441ab4ff7a775b57b6c79a2fa6be99e3ab2d58b/home-manager/programs/rofi.nix
+# https://github.com/iynaix/dotfiles/blob/e441ab4ff7a775b57b6c79a2fa6be99e3ab2d58b/home-manager/programs/rofi-wifi-menu.sh
+# https://github.com/iynaix/dotfiles/blob/e441ab4ff7a775b57b6c79a2fa6be99e3ab2d58b/home-manager/programs/rofi-power-menu.sh
+
+
diff --git a/home-manager/desktop-environment/swayidle.nix b/home-manager/desktop-environment/swayidle.nix
index 240eb446..d4ad2c61 100644
--- a/home-manager/desktop-environment/swayidle.nix
+++ b/home-manager/desktop-environment/swayidle.nix
@@ -1,16 +1,27 @@
{ pkgs, lib, ... }:
{
+ # https://gitlab.com/scientiac/einstein.nixos/-/blob/main/home/niriwm/locker.nix?ref_type=heads
+ # https://github.com/Misterio77/nix-config/blob/main/home/gabriel/features/desktop/common/wayland-wm/swayidle.nix
+ # https://gitlab.com/scientiac/einstein.nixos/-/blob/main/home/niriwm/scripts/locker.nix?ref_type=heads
+ # logout: https://github.com/prescientmoon/everything-nix/blob/develop/home/features/wayland/wlogout.nix
services.swayidle = {
enable = true;
timeouts = [
- {
- timeout = 60 * 10;
- command = "${lib.getExe pkgs.niri} msg action power-off-monitors";
- }
- {
- timeout = 600;
- command = "${lib.getExe pkgs.swaylock-effects} --screenshots --clock --indicator --indicator-radius 100 --indicator-thickness 7 --effect-blur 7x5 --effect-vignette 0.5:0.5 --ring-color f5c2e7 --text-color cdd6f4 --key-hl-color fab387 --line-color 00000000 --inside-color 1e1e2e88 --separator-color 00000000 --grace 2 --fade-in 0.2";
- }
+ { timeout = 60 * 5; command = "${lib.getExe pkgs.niri} msg action power-off-monitors"; }
+ { timeout = 60 * 10; command = "systemctl suspend"; }
];
};
-}
\ No newline at end of file
+}
+
+/*
+ cst = "${./chisato.jpg}";
+ cst-blurred = pkgs.runCommand "chisato.jpg" {
+ nativeBuildInputs = with pkgs;[ imagemagick ];
+ } ''convert -blur 14x5 ${cst} $out'';
+ programs.swaylock.settings = {
+ show-failed-attempts = true;
+ daemonize = true;
+ image = "${cst-blurred}";
+ scaling = "fill";
+ };
+*/
diff --git a/home-manager/desktop/default.nix b/home-manager/desktop/default.nix
index b5b149e3..51c4d4ab 100644
--- a/home-manager/desktop/default.nix
+++ b/home-manager/desktop/default.nix
@@ -1,28 +1,35 @@
{ pkgs, lib, config, ... }:
{
imports = [
- ./firefox # Browser
- ./zathura.nix # Documents
- ./mpv.nix # Videos
- ./imv.nix # Images
- ./logseq # Notes
- ./beets.nix # Music library manager
- ./discord.nix # Social
- ./ghostty.nix # Terminal applicaton
+ ./firefox # Browser
+ ./zathura.nix # Documents
+ ./mpv.nix # Videos
+ ./imv.nix # Images
+ ./logseq # Notes
+ ./beets.nix # Music library manager
+ ./discord.nix # Social
+ ./ghostty.nix # Terminal applicaton
+ ./mangohud.nix # Game HUD
+ ./retroarch.nix # Emulation
+ ./heroic.nix # Game launcher
];
home.packages = lib.optionals pkgs.stdenv.isLinux [
- pkgs.baobab # Disk space analyzer
+ # Internet
pkgs.qbittorrent # Torrent client
pkgs.filezilla # Access files remotely
+
+ # Media
pkgs.newsflash # RSS Reader
pkgs.feishin # Jellyfin player
pkgs.cmus # TUI music player
+
+ # Development
pkgs.jetbrains.idea-community
- ];
- # Gaming
- xdg.mimeApps.defaultApplications."x-scheme-handler/heroic" = [ "heroic.desktop" ];
+ # System
+ pkgs.baobab # Disk space analyzer
+ ];
# TODO
custom.xdgDefaultApps = {
diff --git a/home-manager/desktop/discord.nix b/home-manager/desktop/discord.nix
index 4b676fd4..5887d3e2 100644
--- a/home-manager/desktop/discord.nix
+++ b/home-manager/desktop/discord.nix
@@ -1,7 +1,5 @@
{ lib, pkgs, ... }:
lib.mkIf pkgs.stdenv.isLinux {
- home.packages = [
- pkgs.vesktop # Lightweight discord
- ];
+ home.packages = [ pkgs.vesktop ]; # Lightweight discord
xdg.mimeApps.defaultApplications."x-scheme-handler/discord" = [ "vesktop.desktop" ];
}
\ No newline at end of file
diff --git a/home-manager/desktop/heroic.nix b/home-manager/desktop/heroic.nix
new file mode 100644
index 00000000..a7116ff5
--- /dev/null
+++ b/home-manager/desktop/heroic.nix
@@ -0,0 +1,5 @@
+{ lib, pkgs, ... }:
+{
+ home.packages = [ pkgs.heroic ];
+ xdg.mimeApps.defaultApplications."x-scheme-handler/heroic" = [ "heroic.desktop" ];
+}
\ No newline at end of file
diff --git a/home-manager/desktop/mangohud.nix b/home-manager/desktop/mangohud.nix
new file mode 100644
index 00000000..e08bad84
--- /dev/null
+++ b/home-manager/desktop/mangohud.nix
@@ -0,0 +1,22 @@
+_: {
+ programs.mangohud = {
+ enable = true;
+ enableSessionWide = true;
+ settings = {
+ no_display = true; # Hide until toggled
+ toggle_hud = "Shift_L+F1";
+ toggle_hud_position = "Shift_L+F2";
+ toggle_logging = "Shift_L+F3";
+
+ cpu_stats = true;
+ cpu_temp = true;
+ gpu_stats = true;
+ gpu_temp = true;
+ ram = true;
+ vram = true;
+ fps = true;
+ frame_timing = false;
+ hud_compact = true;
+ };
+ };
+}
\ No newline at end of file
diff --git a/home-manager/desktop/retroarch.nix b/home-manager/desktop/retroarch.nix
new file mode 100644
index 00000000..c89bc56e
--- /dev/null
+++ b/home-manager/desktop/retroarch.nix
@@ -0,0 +1,24 @@
+{ lib, pkgs, ... }:
+{
+ # emulationstation # Does not as it needs additional configuration: perhaps FIXME: https://github.com/juliosueiras-nix/nix-emulationstation/blob/master/modules/emulationstation/default.nix?
+ home.packages = [
+ # More cores at: https://github.com/NixOS/nixpkgs/tree/master/pkgs/applications/emulators/libretro/cores
+ # Emulation
+ # Bios in XDG_CONFIG_DIR/retroarch/system
+ (pkgs.retroarch.withCores (cores: with cores; [
+ genesis-plus-gx # Megadrive
+ snes9x # Snes
+ swanstation # PSX
+ mgba # GBA
+ desmume # NDS
+ dosbox-pure # DOS
+ prboom # Doom
+ fbneo # Arcade
+ flycast # Dreamcast
+ gambatte
+ #N64 - Mupen64Plus-Next with Parallel-RDP - Mupen64Plus-Next GLES3 with GlideN64
+ ]))
+ pkgs.mame-tools # Convert to CHD: parallel chdman createcd -i {} -o {.}.chd ::: *.iso
+ pkgs.maxcso # To convert to CSO
+ ];
+}
\ No newline at end of file
diff --git a/home-manager/fish.nix b/home-manager/fish.nix
index 142f5562..fd27435d 100644
--- a/home-manager/fish.nix
+++ b/home-manager/fish.nix
@@ -42,9 +42,9 @@ in
test -f "$XDG_CONFIG_HOME"/fish/local.fish && source "$XDG_CONFIG_HOME"/fish/local.fish
'';
in concatStringsSep "\n" [
- (optionalString (pkgs.stdenv.system == "aarch64-darwin") nixDarwinIntegration)
+ (optionalString pkgs.stdenv.isDarwin nixDarwinIntegration)
purePrompt
- (optionalString (pkgs.stdenv.system == "aarch64-darwin") darwinHomebrew)
+ (optionalString pkgs.stdenv.isDarwin darwinHomebrew)
extra
];
};
diff --git a/home-manager/fonts.nix b/home-manager/fonts.nix
index 7d341023..f988bd62 100644
--- a/home-manager/fonts.nix
+++ b/home-manager/fonts.nix
@@ -4,5 +4,7 @@
home.packages = [
pkgs.nerd-fonts.hack
pkgs.nerd-fonts.jetbrains-mono
+ pkgs.nerd-fonts.fira-mono
+ pkgs.nerd-fonts.fira-code
];
}
diff --git a/hosts/laptop/config.nix b/hosts/laptop/config.nix
index bd8bb14f..6b538c2c 100644
--- a/hosts/laptop/config.nix
+++ b/hosts/laptop/config.nix
@@ -61,7 +61,6 @@
];
# Gaming
- custom.profiles.gaming.enable = true;
custom.proton-run.enable = true;
custom.proton-run.defaultProtonDir = "/mnt/games/GlobalProton";
diff --git a/hosts/laptop/filesystem/disko.nix b/hosts/laptop/filesystem/disko.nix
index 4bcb9cb6..b0c462b2 100644
--- a/hosts/laptop/filesystem/disko.nix
+++ b/hosts/laptop/filesystem/disko.nix
@@ -56,6 +56,7 @@
rootFsOptions = {
compression = "lz4";
xattr = "sa";
+ acltype = "posixacl";
atime = "off";
};
diff --git a/hosts/laptop/hardware/default.nix b/hosts/laptop/hardware/default.nix
index da0fe190..27a6e1f2 100644
--- a/hosts/laptop/hardware/default.nix
+++ b/hosts/laptop/hardware/default.nix
@@ -18,15 +18,21 @@
services.blueman.enable = true;
# Power
- # AMD has better battery life with PPD over TLP:
- # https://community.frame.work/t/responded-amd-7040-sleep-states/38101/13
+ # AMD has better battery life with PPD over TLP: https://community.frame.work/t/responded-amd-7040-sleep-states/38101/13
services.power-profiles-daemon.enable = true;
services.auto-epp = {
enable = true;
- # Making the default config explicit. See `cat /sys/devices/system/cpu/cpu0/cpufreq/energy_performance_available_preferences`
- settings.Settings = {
+ settings.Settings = { # See `cat /sys/devices/system/cpu/cpu0/cpufreq/energy_performance_available_preferences`
epp_state_for_AC = "balance_performance";
epp_state_for_BAT = "power";
};
};
+ # TODO: Notifications when it is too low
+ services.upower = {
+ enable = true;
+ percentageLow = 30;
+ percentageCritical = 20;
+ percentageAction = 10;
+ criticalPowerAction = "PowerOff";
+ };
}
diff --git a/hosts/laptop/hardware/peripherals.nix b/hosts/laptop/hardware/peripherals.nix
index 11ba38b4..93744f8a 100644
--- a/hosts/laptop/hardware/peripherals.nix
+++ b/hosts/laptop/hardware/peripherals.nix
@@ -26,6 +26,6 @@
custom.services.solaar.enable = true;
custom.services.input-remapper.enable = true;
- # Xbox(ish) gamepads
- hardware.xone.enable = true;
+ hardware.xone.enable = true; # Xbox(ish) gamepads
+ hardware.steam-hardware.enable = true; # Steam Hardware. TODO: I likely do not need this.
}
diff --git a/nixos/desktop-environment/default.nix b/nixos/desktop-environment/default.nix
index 24e8fdb2..afe2be5c 100644
--- a/nixos/desktop-environment/default.nix
+++ b/nixos/desktop-environment/default.nix
@@ -2,6 +2,7 @@
{
imports = [
./login-manager.nix
+ ./nautilus.nix # File Manager
];
programs.niri.enable = true;
@@ -22,6 +23,8 @@
qt6.qtwayland
libnotify
+ wl-clipboard # Wayland clipboard
+
xwayland-satellite # X11. See: https://github.com/YaLTeR/niri/wiki/Xwayland
konsole # Backup terminal in case something goes wrong
ark # KDE package: Manage compressed files
@@ -32,6 +35,5 @@
qogir-icon-theme
gnome-calendar
gnome-system-monitor
- gnome-calculator # Replace with launcher
];
}
diff --git a/nixos/desktop-environment/login-manager.nix b/nixos/desktop-environment/login-manager.nix
index 9e9b124d..c4996562 100644
--- a/nixos/desktop-environment/login-manager.nix
+++ b/nixos/desktop-environment/login-manager.nix
@@ -2,7 +2,7 @@
{
services.greetd = let
theme = "--theme border=magenta;text=cyan;prompt=green;time=red;action=blue;button=yellow;container=black;input=red";
- options = ''--user-menu --asterisks --time --asterisks --greeting "Hi!" --remember --remember-session'';
+ options = ''--user-menu --asterisks --time --greeting "Hi!" --remember --remember-session'';
session = {
command = ''${lib.getExe pkgs.greetd.tuigreet} ${theme} ${options} --cmd niri-session''; # FIXME: Hardcoded?
user = config.users.users.bphenriques.name; # FIXME: Hardcoded?
diff --git a/nixos/desktop-environment/nautilus.nix b/nixos/desktop-environment/nautilus.nix
new file mode 100644
index 00000000..0f9b841b
--- /dev/null
+++ b/nixos/desktop-environment/nautilus.nix
@@ -0,0 +1,7 @@
+{ pkgs, lib, network-devices, ... }:
+{
+ # TODO: https://github.com/ners/trilby/blob/7dd41d0704ebf75f8f705da066184f5ed6168441/modules/home/dconf.nix#L44
+ environment.systemPackages = with pkgs; [ pkgs.nautilus ];
+ services.gnome.sushi.enable = true; # Nautilus: previews
+ services.gvfs.enable = true; # Nautilus: Mount, trash, and other functionalities
+}
diff --git a/nixos/desktop/default.nix b/nixos/desktop/default.nix
index f75e8248..8a2d8b54 100644
--- a/nixos/desktop/default.nix
+++ b/nixos/desktop/default.nix
@@ -1,5 +1,16 @@
{ pkgs, ... }:
{
+ imports = [
+ ./steam.nix
+ # ./sunshine.nix # TODO: does not work
+ ];
+
+ # Graphics
+ hardware = {
+ graphics.enable = true;
+ graphics.enable32Bit = true;
+ };
+
# Audio
hardware.pulseaudio.enable = false; # Disable PulseAudio: https://nixos.wiki/wiki/PulseAudio
security.rtkit.enable = true; # Recommended for pipewire
@@ -12,16 +23,13 @@
};
environment.systemPackages = [
- pkgs.nautilus # File Browser
pkgs.cheese # Webcam TODO do not include it if there is no webcam
];
services = {
# TODO: https://github.com/ners/trilby/blob/7dd41d0704ebf75f8f705da066184f5ed6168441/modules/home/dconf.nix#L44
- gnome.sushi.enable = true; # Nautilus: previews
- gvfs.enable = true; # Nautilus: Mount, trash, and other functionalities
flatpak.enable = true; # Easier to run some programs. Setup afterwards: flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
};
- programs.partition-manager.enable = true;
+ # FIXME s.partition-manager.enable = true;
}
diff --git a/nixos/desktop/steam.nix b/nixos/desktop/steam.nix
new file mode 100644
index 00000000..8472952a
--- /dev/null
+++ b/nixos/desktop/steam.nix
@@ -0,0 +1,62 @@
+{ pkgs, config, lib, ... }:
+
+# TODO: https://github.com/Misterio77/nix-config/blob/main/home/gabriel/features/games/steam.nix
+with lib;
+let
+ steam-desktop-item = (pkgs.makeDesktopItem {
+ name = "steam";
+ desktopName = "Steam";
+ icon = "steam";
+ exec = "${pkgs.steam}/bin/steam";
+ terminal = false;
+ mimeTypes = [ "x-scheme-handler/steam" ];
+ categories = [ "Network" "FileTransfer" "Game" ];
+ });
+in
+{
+ # Tweaks
+ boot = {
+ kernel.sysctl."vm.max_map_count" = "2147483642"; # https://wiki.archlinux.org/title/gaming#Increase_vm.max_map_count
+ kernelParams = [ "tsc=reliable" "clocksource=tsc" ]; # https://wiki.archlinux.org/title/gaming#Improve_clock_gettime_throughput
+ };
+ security.pam.loginLimits = [
+ {
+ domain = "*";
+ type = "hard";
+ item = "nofile";
+ value = "1048576";
+ }
+ ];
+
+ programs = {
+ steam = {
+ enable = true;
+ remotePlay.openFirewall = true;
+ dedicatedServer.openFirewall = true;
+ localNetworkGameTransfers.openFirewall = true;
+
+ extraCompatPackages = with pkgs; [
+ proton-ge-bin
+ ];
+ };
+
+ # Steam's microcompositor that gives extra scaling features (https://github.com/ValveSoftware/gamescope).
+ # - Steam: Right-click game - Properties - Launch options: gamescope -- %command% (example)
+ # - Lutris: General Preferences - Enable gamescope
+ gamescope.enable = true;
+ gamescope.capSysNice = true; # Ensure niceness is lower to increased priority.
+
+ # Improve performance (https://github.com/FeralInteractive/gamemode):
+ # - Steam: Right-click game - Properties - Launch options: gamemoderun %command%
+ # - Lutris: General Preferences - Enable Feral GameMode
+ # - Global options - Add Environment Variables: LD_PRELOAD=/nix/store/*-gamemode-*-lib/lib/libgamemodeauto.so
+ gamemode.enable = true;
+ gamemode.enableRenice = true; # Ensure niceness is lower to increased priority.
+ };
+
+ environment.systemPackages = with pkgs; [
+ steam-desktop-item # Steam desktop item
+ ];
+}
+
+
diff --git a/nixos/desktop/sunshine.nix b/nixos/desktop/sunshine.nix
new file mode 100644
index 00000000..9d45eb67
--- /dev/null
+++ b/nixos/desktop/sunshine.nix
@@ -0,0 +1,40 @@
+{ pkgs, lib, config, ... }:
+{
+ services.sunshine = {
+ enable = true;
+ openFirewall = true;
+ capSysAdmin = true;
+ applications = {
+ env = {
+ PATH = "$(PATH):$(HOME)/.local/bin";
+ };
+ apps = [
+ {
+ name = "Desktop";
+ image-path = "desktop.png";
+ }
+ {
+ name = "Steam Big Picture";
+ output = "/tmp/sunlight-steam.txt";
+ detached = ["${pkgs.util-linux}/bin/setsid ${pkgs.steam}/bin/steam steam://open/bigpicture"];
+ image-path = "steam.png";
+ }
+ ];
+ };
+ };
+ # Required to simulate input in sunshine
+ services.udev.extraRules = lib.optionalString config.services.sunshine.enable ''
+ KERNEL=="uinput", SUBSYSTEM=="misc", OPTIONS+="static_node=uinput", TAG+="uaccess"
+ '';
+}
+
+# https://github.com/azuwis/nix-config/blob/d29d918097e5da916be5762255fb418c657860bc/nixos/sunshine/home.nix#L17
+# https://github.com/lucasew/nixcfg/blob/90505958b98379ac19d7c952a27bd7bce8714816/nix/nodes/gui-common/sunshine.nix#L9
+# https://github.com/aostanin/nixos-config/blob/c73238deae8538bc6cd0b885f108255e60c60e94/nixos/modules/headless-gaming.nix#L12
+
+# Enable using:
+# services.sunshine.enable = true;
+# Get Service Status
+# systemctl --user status sunshine
+# get logs
+# journalctl --user -u sunshine --since "2 minutes ago"
\ No newline at end of file
diff --git a/nixos/modules/default.nix b/nixos/modules/default.nix
index 7a8f7407..e3ffcdd4 100644
--- a/nixos/modules/default.nix
+++ b/nixos/modules/default.nix
@@ -1,7 +1,5 @@
{
proton-run = ./programs/proton-run.nix;
- profile-gaming = ./profiles/gaming.nix;
- profile-emulation = ./profiles/emulation.nix;
services-input-remapper-profiles = ./services/input-remapper.nix;
services-solaar = ./services/solaar.nix;
boot-theme = ./system/boot-theme.nix;
diff --git a/nixos/modules/profiles/emulation.nix b/nixos/modules/profiles/emulation.nix
deleted file mode 100644
index fc42618a..00000000
--- a/nixos/modules/profiles/emulation.nix
+++ /dev/null
@@ -1,39 +0,0 @@
-{ pkgs, config, lib, ... }:
-
-with lib;
-let
- cfg = config.custom.profiles.emulation;
-in
-{
- options.custom.profiles.emulation = with types; {
- enable = mkEnableOption "emulation profile";
- };
-
- config = lib.mkIf cfg.enable {
- environment.systemPackages = with pkgs; [
- # Emulation
- # Bios in XDG_CONFIG_DIR/retroarch/system
- # emulationstation # Does not as it needs additional configuration: perhaps https://github.com/juliosueiras-nix/nix-emulationstation/blob/master/modules/emulationstation/default.nix?
- (retroarch.override { # more: https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/emulators/retroarch/cores.nix
- cores = with libretro; [
- genesis-plus-gx # Megadrive
- snes9x # Snes
- swanstation # PSX
- mgba # GBA
- desmume # NDS
- dosbox-pure # DOS
- prboom # Doom
- fbneo # Most Arcade games
- flycast # Dremcast
- gambatte
- #N64 - Mupen64Plus-Next with Parallel-RDP - Mupen64Plus-Next GLES3 with GlideN64
- # bsnes
- # mesen
- # PPSSPP
- ];
- })
- mame-tools # Convert to CHD: parallel chdman createcd -i {} -o {.}.chd ::: *.iso
- maxcso # To convert to CSO
- ];
- };
-}
diff --git a/nixos/modules/profiles/gaming.nix b/nixos/modules/profiles/gaming.nix
deleted file mode 100644
index ae17c133..00000000
--- a/nixos/modules/profiles/gaming.nix
+++ /dev/null
@@ -1,120 +0,0 @@
-{ pkgs, config, lib, ... }:
-
-with lib;
-let
- cfg = config.custom.profiles.gaming;
- steam-desktop-item = (pkgs.makeDesktopItem {
- name = "steam";
- desktopName = "Steam";
- icon = "steam";
- exec = "${pkgs.steam}/bin/steam";
- terminal = false;
- mimeTypes = [ "x-scheme-handler/steam" ];
- categories = [ "Network" "FileTransfer" "Game" ];
- });
-in
-{
- options.custom.profiles.gaming = with types; {
- enable = mkEnableOption "gaming profile";
- };
-
- config = mkIf cfg.enable {
- # Tweaks
- boot = {
- kernel.sysctl."vm.max_map_count" = "2147483642"; # https://wiki.archlinux.org/title/gaming#Increase_vm.max_map_count
- kernelParams = [ "tsc=reliable" "clocksource=tsc" ]; # https://wiki.archlinux.org/title/gaming#Improve_clock_gettime_throughput
- };
- security.pam.loginLimits = [
- {
- domain = "*";
- type = "hard";
- item = "nofile";
- value = "1048576";
- }
- ];
-
- hardware = {
- graphics.enable = true;
- graphics.enable32Bit = true;
- steam-hardware.enable = true;
- };
-
- programs = {
- steam = {
- enable = true;
- remotePlay.openFirewall = true;
- dedicatedServer.openFirewall = true;
- localNetworkGameTransfers.openFirewall = true;
-
- extraCompatPackages = with pkgs; [
- proton-ge-bin
- ];
- };
-
- # Steam's microcompositor that gives extra scaling features (https://github.com/ValveSoftware/gamescope).
- # - Steam: Right-click game - Properties - Launch options: gamescope -- %command% (example)
- # - Lutris: General Preferences - Enable gamescope
- gamescope.enable = true;
- gamescope.capSysNice = true; # Ensure niceness is lower to increased priority.
-
- # Improve performance (https://github.com/FeralInteractive/gamemode):
- # - Steam: Right-click game - Properties - Launch options: gamemoderun %command%
- # - Lutris: General Preferences - Enable Feral GameMode
- # - Global options - Add Environment Variables: LD_PRELOAD=/nix/store/*-gamemode-*-lib/lib/libgamemodeauto.so
- gamemode.enable = true;
- gamemode.enableRenice = true; # Ensure niceness is lower to increased priority.
- };
-
- services.sunshine = {
- enable = true;
- openFirewall = true;
- capSysAdmin = true;
- applications = {
- env = {
- PATH = "$(PATH):$(HOME)/.local/bin";
- };
- apps = [
- {
- name = "Desktop";
- image-path = "desktop.png";
- }
- {
- name = "Steam Big Picture";
- output = "/tmp/sunlight-steam.txt";
- detached = ["${pkgs.util-linux}/bin/setsid ${pkgs.steam}/bin/steam steam://open/bigpicture"];
- image-path = "steam.png";
- }
- ];
- };
- };
- # Required to simulate input
- services.udev.extraRules = ''
- # Sunshine
- KERNEL=="uinput", SUBSYSTEM=="misc", OPTIONS+="static_node=uinput", TAG+="uaccess"
- '';
-
- environment.systemPackages = with pkgs; [
- steam-desktop-item # Steam desktop item
- heroic # Epic games / GoG
-
- (pkgs.lutris.override {
- extraPkgs = pkgs: [
- pkgs.protobuf # Required for battlenet.
- ] ++ lib.optionals config.services.desktopManager.plasma6.enable [
- pkgs.kdialog # Required for kde
- ];
- })
- ];
- };
-}
-
-# https://github.com/azuwis/nix-config/blob/d29d918097e5da916be5762255fb418c657860bc/nixos/sunshine/home.nix#L17
-# https://github.com/lucasew/nixcfg/blob/90505958b98379ac19d7c952a27bd7bce8714816/nix/nodes/gui-common/sunshine.nix#L9
-# https://github.com/aostanin/nixos-config/blob/c73238deae8538bc6cd0b885f108255e60c60e94/nixos/modules/headless-gaming.nix#L12
-
-# Enable using:
-# services.sunshine.enable = true;
-# Get Service Status
-# systemctl --user status sunshine
-# get logs
-# journalctl --user -u sunshine --since "2 minutes ago"
\ No newline at end of file
diff --git a/nixos/modules/programs/proton-run.nix b/nixos/modules/programs/proton-run.nix
index 9a4c6afd..f57205b3 100644
--- a/nixos/modules/programs/proton-run.nix
+++ b/nixos/modules/programs/proton-run.nix
@@ -1,4 +1,4 @@
-{ pkgs, config, lib, ... }:
+{ pkgs, config, lib, self, ... }:
with lib;
let
cfg = config.custom.proton-run;
@@ -9,7 +9,7 @@ let
if [ "$#" -gt 0 ]; then
STEAM_COMPAT_DATA_PATH="${cfg.defaultProtonDir}" \
STEAM_COMPAT_CLIENT_INSTALL_PATH="${cfg.defaultProtonDir}" \
- ${pkgs.steam-run}/bin/steam-run ${pkgs.nur.repos.ataraxiasjel.proton-ge}/bin/proton run "$@"
+ ${pkgs.steam-run}/bin/steam-run ${self.pkgs.proton-ge-custom}/bin/proton run "$@"
fi
'';
};
diff --git a/packages/cliphist-dmenu/cliphist-dmenu.sh b/packages/cliphist-dmenu/cliphist-dmenu.sh
new file mode 100644
index 00000000..fdef89db
--- /dev/null
+++ b/packages/cliphist-dmenu/cliphist-dmenu.sh
@@ -0,0 +1,14 @@
+#shellcheck shell=bash
+
+PREVIEW_WIDTH_CHARS=150
+exists_cmd() { command -v "$1" >/dev/null; }
+open_dmenu() {
+ if exists_cmd fuzzel; then
+ fuzzel --dmenu --prompt 'Paste ' --width "${PREVIEW_WIDTH_CHARS}"
+ else
+ echo "No compatible dmenu runner found" >&2;
+ exit 1
+ fi
+}
+
+cliphist -preview-width "${PREVIEW_WIDTH_CHARS}" list | open_dmenu | cliphist decode | wl-copy
diff --git a/packages/cliphist-dmenu/default.nix b/packages/cliphist-dmenu/default.nix
new file mode 100644
index 00000000..82c016f7
--- /dev/null
+++ b/packages/cliphist-dmenu/default.nix
@@ -0,0 +1,6 @@
+{ lib, pkgs, ... }:
+pkgs.writeShellApplication {
+ name = "niri-window-dmenu";
+ runtimeInputs = with pkgs; [ cliphist wl-clipboard ];
+ text = lib.fileContents ./cliphist-dmenu.sh;
+}
\ No newline at end of file
diff --git a/packages/default.nix b/packages/default.nix
index 88eeae03..e274d644 100644
--- a/packages/default.nix
+++ b/packages/default.nix
@@ -2,6 +2,7 @@
let
inherit (mylib.builders) forAllSystems forLinuxSystems;
+
crossPlatform = forAllSystems (system:
let pkgs = nixpkgs.legacyPackages.${system};
in rec {
@@ -21,6 +22,12 @@ let
niri-output-configuration = pkgs.callPackage ./niri-output-configuration { };
niri-window-dmenu = pkgs.callPackage ./niri-window-dmenu { };
swww-util = pkgs.callPackage ./swww-util { };
+ cliphist-dmenu = pkgs.callPackage ./cliphist-dmenu { };
+ smart-paste = pkgs.callPackage ./smart-paste { };
+ session-dmenu = pkgs.callPackage ./session-dmenu { };
+
+ # Move to community namespace
+ proton-ge-custom = pkgs.callPackage ./proton-ge-custom { };
}
);
in forAllSystems (system:
diff --git a/packages/dotfiles/default.nix b/packages/dotfiles/default.nix
index ed543f47..3fd1bcd9 100644
--- a/packages/dotfiles/default.nix
+++ b/packages/dotfiles/default.nix
@@ -5,4 +5,4 @@ let
buildCommand = "${old.buildCommand}\n patchShebangs $out";
});
in
-patchShebangs (pkgs.writeScriptBin "dotfiles" (lib.fileContents ./src/dotfiles.sh))
+patchShebangs (pkgs.writeScriptBin "dotfiles" (lib.fileContents ./dotfiles.sh))
diff --git a/packages/dotfiles/src/dotfiles.sh b/packages/dotfiles/dotfiles.sh
similarity index 100%
rename from packages/dotfiles/src/dotfiles.sh
rename to packages/dotfiles/dotfiles.sh
diff --git a/packages/fzf-fd/default.nix b/packages/fzf-fd/default.nix
index 147a031f..02e10d88 100644
--- a/packages/fzf-fd/default.nix
+++ b/packages/fzf-fd/default.nix
@@ -2,5 +2,5 @@
pkgs.writeShellApplication {
name = "fzf-fd";
runtimeInputs = with pkgs; [ fzf fd preview ];
- text = lib.fileContents ./src/fzf-fd.sh;
+ text = lib.fileContents ./fzf-fd.sh;
}
diff --git a/packages/fzf-fd/src/fzf-fd.sh b/packages/fzf-fd/fzf-fd.sh
similarity index 100%
rename from packages/fzf-fd/src/fzf-fd.sh
rename to packages/fzf-fd/fzf-fd.sh
diff --git a/packages/fzf-rg/default.nix b/packages/fzf-rg/default.nix
index 3a4d9f8f..46f5e8dc 100644
--- a/packages/fzf-rg/default.nix
+++ b/packages/fzf-rg/default.nix
@@ -2,5 +2,5 @@
pkgs.writeShellApplication {
name = "fzf-rg";
runtimeInputs = with pkgs; [ ripgrep fzf ];
- text = lib.fileContents ./src/fzf-rg.sh;
+ text = lib.fileContents ./fzf-rg.sh;
}
diff --git a/packages/fzf-rg/src/fzf-rg.sh b/packages/fzf-rg/fzf-rg.sh
similarity index 100%
rename from packages/fzf-rg/src/fzf-rg.sh
rename to packages/fzf-rg/fzf-rg.sh
diff --git a/packages/niri-window-dmenu/default.nix b/packages/niri-window-dmenu/default.nix
index b002ee32..3f290f66 100644
--- a/packages/niri-window-dmenu/default.nix
+++ b/packages/niri-window-dmenu/default.nix
@@ -2,5 +2,5 @@
pkgs.writeShellApplication {
name = "niri-window-dmenu";
runtimeInputs = with pkgs; [ niri fuzzel jq ];
- text = lib.fileContents ./src/niri-window-dmenu.sh;
+ text = lib.fileContents ./niri-window-dmenu.sh;
}
\ No newline at end of file
diff --git a/packages/niri-window-dmenu/src/niri-window-dmenu.sh b/packages/niri-window-dmenu/niri-window-dmenu.sh
similarity index 100%
rename from packages/niri-window-dmenu/src/niri-window-dmenu.sh
rename to packages/niri-window-dmenu/niri-window-dmenu.sh
diff --git a/packages/proton-ge-custom/default.nix b/packages/proton-ge-custom/default.nix
new file mode 100644
index 00000000..b16491e2
--- /dev/null
+++ b/packages/proton-ge-custom/default.nix
@@ -0,0 +1,35 @@
+{
+ stdenv,
+ lib,
+ fetchurl,
+ nix-update-script,
+}:
+stdenv.mkDerivation rec {
+ pname = "proton-ge-custom";
+ version = "GE-Proton9-22";
+
+ src = fetchurl {
+ url = "https://github.com/GloriousEggroll/proton-ge-custom/releases/download/${version}/${version}.tar.gz";
+ hash = "sha256-BAp+dIfA62T2SBIEQEWsVab2f2oXRKKRLgm5mTGtdo8=";
+ };
+
+ buildCommand = ''
+ runHook preBuild
+
+ mkdir -p $out/bin
+ tar -C $out/bin --strip=1 -x -f $src
+
+ runHook postBuild
+ '';
+
+ passthru.updateScript = nix-update-script { };
+
+ meta = with lib; {
+ description = "Compatibility tool for Steam Play based on Wine and additional components";
+ homepage = "https://github.com/GloriousEggroll/proton-ge-custom";
+ license = licenses.bsd3;
+ platforms = [ "x86_64-linux" ];
+ maintainers = with maintainers; [ bphenriques ];
+ preferLocalBuild = true;
+ };
+}
\ No newline at end of file
diff --git a/packages/session-dmenu/default.nix b/packages/session-dmenu/default.nix
new file mode 100644
index 00000000..ac3a49ef
--- /dev/null
+++ b/packages/session-dmenu/default.nix
@@ -0,0 +1,6 @@
+{ lib, pkgs, ... }:
+pkgs.writeShellApplication {
+ name = "session-dmenu";
+ runtimeInputs = with pkgs; [ fuzzel ];
+ text = lib.fileContents ./session-dmenu.sh;
+}
\ No newline at end of file
diff --git a/packages/session-dmenu/session-dmenu.sh b/packages/session-dmenu/session-dmenu.sh
new file mode 100644
index 00000000..c244fa7a
--- /dev/null
+++ b/packages/session-dmenu/session-dmenu.sh
@@ -0,0 +1,26 @@
+#shellcheck shell=bash
+exists_cmd() { command -v "$1" >/dev/null; }
+open_dmenu() {
+ if exists_cmd fuzzel; then
+ fuzzel --dmenu
+ else
+ echo "No compatible dmenu runner found" >&2;
+ exit 1
+ fi
+}
+
+options() {
+ echo "Lock"
+ echo "Logout"
+ echo "Reboot"
+ echo "Shutdown"
+ echo "Suspend"
+}
+
+case "$(options | open_dmenu)" in
+ "Lock") blurlock ;;
+ "Logout") loginctl terminate-user "$(whoami)" ;;
+ "Reboot") systemctl reboot ;;
+ "Shutdown") systemctl poweroff ;;
+ "Suspend") systemctl suspend ;;
+esac
\ No newline at end of file
diff --git a/packages/smart-paste/default.nix b/packages/smart-paste/default.nix
new file mode 100644
index 00000000..92d90639
--- /dev/null
+++ b/packages/smart-paste/default.nix
@@ -0,0 +1,11 @@
+{ lib, pkgs, ... }:
+
+with lib;
+pkgs.writeShellApplication {
+ name = "smart-paste";
+ runtimeInputs = with pkgs; [
+ wtype
+ niri
+ ];
+ text = fileContents ./smart-paste.sh;
+}
diff --git a/packages/smart-paste/smart-paste.sh b/packages/smart-paste/smart-paste.sh
new file mode 100644
index 00000000..d22d2e7c
--- /dev/null
+++ b/packages/smart-paste/smart-paste.sh
@@ -0,0 +1,7 @@
+#shellcheck shell=bash
+
+# TODO: too tied to niri. We can check if the binary exists.
+case "$(niri msg --json focused-window | jq -r '.app_id')" in
+ "com.mitchellh.ghostty") wtype -M shift -M ctrl v ;;
+ *) wtype -M ctrl v ;;
+esac
\ No newline at end of file
From 5680443694997b725c3cc8f16ef5316694d3c984 Mon Sep 17 00:00:00 2001
From: Bruno Henriques <4727729+bphenriques@users.noreply.github.com>
Date: Mon, 6 Jan 2025 09:57:03 +0000
Subject: [PATCH 32/34] lots of updates
---
darwin/default.nix | 2 +-
flake.lock | 142 +++---------------
flake.nix | 3 -
home-manager/desktop-environment/default.nix | 3 +-
home-manager/desktop-environment/niri.nix | 7 +-
home-manager/desktop-environment/rofi.nix | 5 +-
home-manager/desktop-environment/swayidle.nix | 2 +
home-manager/desktop/ghostty.nix | 3 +-
home-manager/desktop/mpv.nix | 1 +
hosts/laptop/default.nix | 1 -
hosts/laptop/hardware/peripherals.nix | 4 +
nixos/desktop/default.nix | 18 +--
12 files changed, 46 insertions(+), 145 deletions(-)
diff --git a/darwin/default.nix b/darwin/default.nix
index 61eadbc4..372ade79 100644
--- a/darwin/default.nix
+++ b/darwin/default.nix
@@ -110,9 +110,9 @@
brews = [ ];
casks = [
"rectangle" # Window Manager
+ "ghostty" # Terminal
"vlc" # Media player
"intellij-idea-ce" # JVM IDE
- "ngrok" # Useful
];
};
}
diff --git a/flake.lock b/flake.lock
index 84265fe7..ed18de88 100644
--- a/flake.lock
+++ b/flake.lock
@@ -7,11 +7,11 @@
]
},
"locked": {
- "lastModified": 1735478292,
- "narHash": "sha256-Ys9pSP9ch0SthhpbjnkCSJ9ZLfaNKnt/dcy7swjmS1A=",
+ "lastModified": 1736085891,
+ "narHash": "sha256-bTl9fcUo767VaSx4Q5kFhwiDpFQhBKna7lNbGsqCQiA=",
"owner": "lnl7",
"repo": "nix-darwin",
- "rev": "71a3a075e3229a7518d76636bb762aef2bcb73ac",
+ "rev": "ba9b3173b0f642ada42b78fb9dfc37ca82266f6c",
"type": "github"
},
"original": {
@@ -61,22 +61,6 @@
"url": "ssh://git@github.com/bphenriques/dotfiles-private"
}
},
- "flake-compat": {
- "flake": false,
- "locked": {
- "lastModified": 1696426674,
- "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
- "owner": "edolstra",
- "repo": "flake-compat",
- "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
- "type": "github"
- },
- "original": {
- "owner": "edolstra",
- "repo": "flake-compat",
- "type": "github"
- }
- },
"flake-parts": {
"inputs": {
"nixpkgs-lib": [
@@ -98,49 +82,6 @@
"type": "github"
}
},
- "flake-utils": {
- "inputs": {
- "systems": "systems"
- },
- "locked": {
- "lastModified": 1705309234,
- "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
- "owner": "numtide",
- "repo": "flake-utils",
- "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
- "type": "github"
- },
- "original": {
- "owner": "numtide",
- "repo": "flake-utils",
- "type": "github"
- }
- },
- "ghostty": {
- "inputs": {
- "flake-compat": "flake-compat",
- "nixpkgs-stable": [
- "nixpkgs"
- ],
- "nixpkgs-unstable": [
- "nixpkgs"
- ],
- "zig": "zig"
- },
- "locked": {
- "lastModified": 1735490499,
- "narHash": "sha256-kYIsb/MJ77fV/8Qa6VGYQU7Ss0u1nMXmYPpbccvFKz4=",
- "ref": "refs/heads/main",
- "rev": "02538bed3cbbeda3749cdb5ab07c2bc6a26ed738",
- "revCount": 8574,
- "type": "git",
- "url": "ssh://git@github.com/mitchellh/ghostty"
- },
- "original": {
- "type": "git",
- "url": "ssh://git@github.com/mitchellh/ghostty"
- }
- },
"home-manager": {
"inputs": {
"nixpkgs": [
@@ -148,11 +89,11 @@
]
},
"locked": {
- "lastModified": 1735381016,
- "narHash": "sha256-CyCZFhMUkuYbSD6bxB/r43EdmDE7hYeZZPTCv0GudO4=",
+ "lastModified": 1736089250,
+ "narHash": "sha256-/LPWMiiJGPHGd7ZYEgmbE2da4zvBW0acmshUjYC3WG4=",
"owner": "nix-community",
"repo": "home-manager",
- "rev": "10e99c43cdf4a0713b4e81d90691d22c6a58bdf2",
+ "rev": "172b91bfb2b7f5c4a8c6ceac29fd53a01ef07196",
"type": "github"
},
"original": {
@@ -163,11 +104,11 @@
},
"nixpkgs": {
"locked": {
- "lastModified": 1735268880,
- "narHash": "sha256-7QEFnKkzD13SPxs+UFR5bUFN2fRw+GlL0am72ZjNre4=",
+ "lastModified": 1736010017,
+ "narHash": "sha256-pMttboU4LraZezi3tc7NiHODd4eKziFRb2a4s4WO8Ms=",
"owner": "nixos",
"repo": "nixpkgs",
- "rev": "7cc0bff31a3a705d3ac4fdceb030a17239412210",
+ "rev": "a1945f760a8fe019a4d753808de424dcd4e5b3cf",
"type": "github"
},
"original": {
@@ -179,11 +120,11 @@
},
"nixpkgs-stable": {
"locked": {
- "lastModified": 1735264675,
- "narHash": "sha256-MgdXpeX2GuJbtlBrH9EdsUeWl/yXEubyvxM1G+yO4Ak=",
+ "lastModified": 1736061677,
+ "narHash": "sha256-DjkQPnkAfd7eB522PwnkGhOMuT9QVCZspDpJJYyOj60=",
"owner": "nixos",
"repo": "nixpkgs",
- "rev": "d49da4c08359e3c39c4e27c74ac7ac9b70085966",
+ "rev": "cbd8ec4de4469333c82ff40d057350c30e9f7d36",
"type": "github"
},
"original": {
@@ -195,11 +136,11 @@
},
"nixpkgs_2": {
"locked": {
- "lastModified": 1735291276,
- "narHash": "sha256-NYVcA06+blsLG6wpAbSPTCyLvxD/92Hy4vlY9WxFI1M=",
+ "lastModified": 1736012469,
+ "narHash": "sha256-/qlNWm/IEVVH7GfgAIyP6EsVZI6zjAx1cV5zNyrs+rI=",
"owner": "nixos",
"repo": "nixpkgs",
- "rev": "634fd46801442d760e09493a794c4f15db2d0cbb",
+ "rev": "8f3e1f807051e32d8c95cd12b9b421623850a34d",
"type": "github"
},
"original": {
@@ -216,11 +157,11 @@
"treefmt-nix": "treefmt-nix"
},
"locked": {
- "lastModified": 1735490440,
- "narHash": "sha256-v4s1vzJP2BMwYc1vtr6Y6P6i9uFMPKyrFv61YwAmQIM=",
+ "lastModified": 1736153313,
+ "narHash": "sha256-QbFglVYGZ/GRzCLetrTOPli11xHD6w8I2w/QGsyeR90=",
"owner": "nix-community",
"repo": "nur",
- "rev": "69f33b21fab40d98058247256fb8f964eb2c24e9",
+ "rev": "6dc38ea9c5d7d4c3d1785594198d726849a14a6a",
"type": "github"
},
"original": {
@@ -234,7 +175,6 @@
"darwin": "darwin",
"disko": "disko",
"dotfiles-private": "dotfiles-private",
- "ghostty": "ghostty",
"home-manager": "home-manager",
"nixpkgs": "nixpkgs",
"nixpkgs-stable": "nixpkgs-stable",
@@ -249,11 +189,11 @@
]
},
"locked": {
- "lastModified": 1735468296,
- "narHash": "sha256-ZjUjbvS06jf4fElOF4ve8EHjbpbRVHHypStoY8HGzk8=",
+ "lastModified": 1736064798,
+ "narHash": "sha256-xJRN0FmX9QJ6+w8eIIIxzBU1AyQcLKJ1M/Gp6lnSD20=",
"owner": "Mic92",
"repo": "sops-nix",
- "rev": "bcb8b65aa596866eb7e5c3e1a6cccbf5d1560b27",
+ "rev": "5dc08f9cc77f03b43aacffdfbc8316807773c930",
"type": "github"
},
"original": {
@@ -262,21 +202,6 @@
"type": "github"
}
},
- "systems": {
- "locked": {
- "lastModified": 1681028828,
- "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
- "owner": "nix-systems",
- "repo": "default",
- "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
- "type": "github"
- },
- "original": {
- "owner": "nix-systems",
- "repo": "default",
- "type": "github"
- }
- },
"treefmt-nix": {
"inputs": {
"nixpkgs": [
@@ -297,31 +222,6 @@
"repo": "treefmt-nix",
"type": "github"
}
- },
- "zig": {
- "inputs": {
- "flake-compat": [
- "ghostty"
- ],
- "flake-utils": "flake-utils",
- "nixpkgs": [
- "ghostty",
- "nixpkgs-stable"
- ]
- },
- "locked": {
- "lastModified": 1717848532,
- "narHash": "sha256-d+xIUvSTreHl8pAmU1fnmkfDTGQYCn2Rb/zOwByxS2M=",
- "owner": "mitchellh",
- "repo": "zig-overlay",
- "rev": "02fc5cc555fc14fda40c42d7c3250efa43812b43",
- "type": "github"
- },
- "original": {
- "owner": "mitchellh",
- "repo": "zig-overlay",
- "type": "github"
- }
}
},
"root": "root",
diff --git a/flake.nix b/flake.nix
index a77901bb..c6ce0bc2 100644
--- a/flake.nix
+++ b/flake.nix
@@ -32,9 +32,6 @@
disko.url = "github:nix-community/disko"; # Declaratively describe my disks layout
disko.inputs.nixpkgs.follows = "nixpkgs";
nur.url = "github:nix-community/nur"; # Collection of packages. Use it for Firefox extensions
- ghostty.url = "git+ssh://git@github.com/mitchellh/ghostty"; # Terminal
- ghostty.inputs.nixpkgs-stable.follows = "nixpkgs"; # Fix OpenGL
- ghostty.inputs.nixpkgs-unstable.follows = "nixpkgs"; # Fix OpenGL
};
outputs = inputs @ { nixpkgs, ... }:
diff --git a/home-manager/desktop-environment/default.nix b/home-manager/desktop-environment/default.nix
index 0d47de49..562543e3 100644
--- a/home-manager/desktop-environment/default.nix
+++ b/home-manager/desktop-environment/default.nix
@@ -11,7 +11,8 @@
custom.services.swww.enable = true; # Wallpaper daemon
home.packages = [
- pkgs.cliphist # Wayland clipboard history
+ # TODO: MOVE TO: https://github.com/savedra1/clipse
+ pkgs.cliphist # Wayland clipboard history
(pkgs.writeScriptBin "pbcopy" (lib.getExe' pkgs.wl-clipboard "wl-copy")) # I am too hardwired to pbcopy
(pkgs.writeScriptBin "pbpaste" (lib.getExe' pkgs.wl-clipboard "wl-paste")) # I am too hardwired to pbpaste
];
diff --git a/home-manager/desktop-environment/niri.nix b/home-manager/desktop-environment/niri.nix
index cb3d4122..b8f45cdf 100644
--- a/home-manager/desktop-environment/niri.nix
+++ b/home-manager/desktop-environment/niri.nix
@@ -16,6 +16,9 @@
# Env variables: https://github.com/nyawox/nixboxes/blob/ecab4559da256b4f1198ca7d39d6e5b1d4442296/home/desktop/niri/general.nix#L185
# Funny login audio: https://github.com/nyawox/nixboxes/blob/ecab4559da256b4f1198ca7d39d6e5b1d4442296/home/desktop/niri/general.nix#L201
# https://gitlab.com/scientiac/einstein.nixos/-/tree/main/home/niriwm?ref_type=heads
+# https://gitlab.com/scientiac/einstein.nixos/-/blob/main/home/niriwm/niri.nix?ref_type=heads
+# https://gitlab.com/usmcamp0811/dotfiles
+# https://github.com/gopi487krishna/niri-waydots/tree/main/rofi
# TODO shortcut to lock the computer
@@ -168,13 +171,13 @@ in
Mod+Shift+E { quit; }
Mod+Period { spawn "${lib.getExe pkgs.bemoji}"; }
- Mod+Shitft+Q { spawn "${lib.getExe self.pkgs.session-dmenu}"; }
+ Mod+Shift+Q { spawn "${lib.getExe self.pkgs.session-dmenu}"; }
Mod+Shift+Tab { focus-workspace-previous; }
Mod+Tab { spawn "${lib.getExe self.pkgs.niri-window-dmenu}"; }
Mod+Shift+V { spawn "${lib.getExe self.pkgs.cliphist-dmenu}" "&&" "${lib.getExe self.pkgs.smart-paste}"; }
// Suggested binds for running programs: terminal, app launcher, screen locker.
- Mod+Return { spawn "${lib.getExe community.pkgs.ghostty}"; }
+ Mod+Return { spawn "${lib.getExe pkgs.ghostty}"; }
Mod+Space { spawn "${lib.getExe pkgs.fuzzel}"; }
Super+Alt+L { spawn "swaylock"; }
diff --git a/home-manager/desktop-environment/rofi.nix b/home-manager/desktop-environment/rofi.nix
index 7c0fc675..1f9d2bb7 100644
--- a/home-manager/desktop-environment/rofi.nix
+++ b/home-manager/desktop-environment/rofi.nix
@@ -227,5 +227,6 @@ in
# https://github.com/iynaix/dotfiles/blob/e441ab4ff7a775b57b6c79a2fa6be99e3ab2d58b/home-manager/programs/rofi.nix
# https://github.com/iynaix/dotfiles/blob/e441ab4ff7a775b57b6c79a2fa6be99e3ab2d58b/home-manager/programs/rofi-wifi-menu.sh
# https://github.com/iynaix/dotfiles/blob/e441ab4ff7a775b57b6c79a2fa6be99e3ab2d58b/home-manager/programs/rofi-power-menu.sh
-
-
+# https://github.com/adi1090x/rofi/tree/master/files
+# https://github.com/edmundmiller/dotfiles/blob/main/modules/desktop/apps/rofi.nix
+# https://github.com/edmundmiller/dotfiles/blob/main/config/rofi/bin/rofi-browsermenu
diff --git a/home-manager/desktop-environment/swayidle.nix b/home-manager/desktop-environment/swayidle.nix
index d4ad2c61..46d47e1d 100644
--- a/home-manager/desktop-environment/swayidle.nix
+++ b/home-manager/desktop-environment/swayidle.nix
@@ -4,6 +4,8 @@
# https://github.com/Misterio77/nix-config/blob/main/home/gabriel/features/desktop/common/wayland-wm/swayidle.nix
# https://gitlab.com/scientiac/einstein.nixos/-/blob/main/home/niriwm/scripts/locker.nix?ref_type=heads
# logout: https://github.com/prescientmoon/everything-nix/blob/develop/home/features/wayland/wlogout.nix
+ # https://gitlab.com/scientiac/einstein.nixos/-/blob/main/home/niriwm/scripts/locker.nix?ref_type=heads
+ # https://gitlab.com/scientiac/einstein.nixos/-/blob/main/home/niriwm/locker.nix?ref_type=heads
services.swayidle = {
enable = true;
timeouts = [
diff --git a/home-manager/desktop/ghostty.nix b/home-manager/desktop/ghostty.nix
index 3439acc2..a7dcfc43 100644
--- a/home-manager/desktop/ghostty.nix
+++ b/home-manager/desktop/ghostty.nix
@@ -48,9 +48,8 @@ let
};
in
{
- # MacOS requires installation by hand for now: https://github.com/ghostty-org/ghostty/releases/tag/tip
home.packages = lib.optionals pkgs.stdenv.isLinux [
- community.pkgs.ghostty
+ pkgs.ghostty
];
xdg.mimeApps.defaultApplications = {
diff --git a/home-manager/desktop/mpv.nix b/home-manager/desktop/mpv.nix
index 6d83d3f6..3a3be38d 100644
--- a/home-manager/desktop/mpv.nix
+++ b/home-manager/desktop/mpv.nix
@@ -1,6 +1,7 @@
{ pkgs, lib, config, ... }:
# TODO: Check https://github.com/iynaix/dotfiles/blob/f0f8918caed8f4c245fa82fc505ae0de09a32f5c/home-manager/programs/mpv.nix
# TODO: https://github.com/diniamo/niqs/blob/53288d72902365ee8d3bfdd6aff0ec79eb7c1c36/home/mpv/anime.nix
+# TODO: https://github.com/iynaix/dotfiles/blob/56d2d63b3b5f4c621429d79fb2aef8d44fdc25b9/home-manager/gui/mpv.nix
# https://github.com/Samillion/ModernZ
let
# Interesting guides:
diff --git a/hosts/laptop/default.nix b/hosts/laptop/default.nix
index d501c1a5..009c9384 100644
--- a/hosts/laptop/default.nix
+++ b/hosts/laptop/default.nix
@@ -16,7 +16,6 @@ let
private = inputs.dotfiles-private.packages.${system};
};
community.pkgs = {
- ghostty = inputs.ghostty.packages.${system}.default;
firefox-addons = inputs.firefox-addons.packages.${system};
};
network-devices = import ../network-devices.nix;
diff --git a/hosts/laptop/hardware/peripherals.nix b/hosts/laptop/hardware/peripherals.nix
index 93744f8a..f6f9ee8b 100644
--- a/hosts/laptop/hardware/peripherals.nix
+++ b/hosts/laptop/hardware/peripherals.nix
@@ -28,4 +28,8 @@
hardware.xone.enable = true; # Xbox(ish) gamepads
hardware.steam-hardware.enable = true; # Steam Hardware. TODO: I likely do not need this.
+
+ environment.systemPackages = [
+ pkgs.cheese # Webcam
+ ];
}
diff --git a/nixos/desktop/default.nix b/nixos/desktop/default.nix
index 8a2d8b54..e619b57a 100644
--- a/nixos/desktop/default.nix
+++ b/nixos/desktop/default.nix
@@ -12,24 +12,18 @@
};
# Audio
- hardware.pulseaudio.enable = false; # Disable PulseAudio: https://nixos.wiki/wiki/PulseAudio
- security.rtkit.enable = true; # Recommended for pipewire
services.pipewire = {
enable = true; # Enable pipewire
- alsa.enable = true; # For better compatibility
- alsa.support32Bit = true; # For better compatibility
- pulse.enable = true; # Pulse audio emulation for better compatibility
- wireplumber.enable = true; # Audio routing policy if I understood correctly.
+ alsa.enable = true; # Improve compatibility
+ alsa.support32Bit = true; # Improve compatibility
+ pulse.enable = true; # Pulse audio emulation to improve compatibility
+ wireplumber.enable = true; # Audio routing policy
};
-
- environment.systemPackages = [
- pkgs.cheese # Webcam TODO do not include it if there is no webcam
- ];
+ security.rtkit.enable = true; # Recommended for pipewire
+ services.pulseaudio.enable = false; # Disable PulseAudio as pipewire is preferable
services = {
# TODO: https://github.com/ners/trilby/blob/7dd41d0704ebf75f8f705da066184f5ed6168441/modules/home/dconf.nix#L44
flatpak.enable = true; # Easier to run some programs. Setup afterwards: flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
};
-
- # FIXME s.partition-manager.enable = true;
}
From 6acc39158c68430b59ae3567ecac3919688bf274 Mon Sep 17 00:00:00 2001
From: Bruno Henriques <4727729+bphenriques@users.noreply.github.com>
Date: Fri, 10 Jan 2025 14:25:58 +0000
Subject: [PATCH 33/34] WIP but the external monitor automatic setup does not
work
---
home-manager/desktop-environment/niri.nix | 3 +-
home-manager/desktop-environment/swayidle.nix | 27 +++++--
home-manager/desktop/ghostty.nix | 2 +
hosts/laptop/bphenriques/default.nix | 2 +-
hosts/laptop/bphenriques/home.nix | 4 +
hosts/laptop/config.nix | 1 +
hosts/laptop/hardware/peripherals.nix | 5 ++
hosts/network-devices.nix | 2 +-
hosts/peripherals.nix | 1 +
nixos/modules/default.nix | 1 +
nixos/modules/hardware/ddcci.nix | 44 ++++++++++
packages/ddcci-util/ddcci-util.sh | 29 +++++++
packages/ddcci-util/default.nix | 6 ++
packages/default.nix | 2 +
packages/osd-brightness/default.nix | 4 +-
packages/osd-brightness/osd-brightness.sh | 81 +++++++++++++++++++
packages/osd-brightness/src/osd-brightness.sh | 41 ----------
packages/osd-volume/default.nix | 2 +-
packages/osd-volume/{src => }/osd-volume.sh | 0
packages/sway-audio-idle-inhibit/default.nix | 33 ++++++++
20 files changed, 237 insertions(+), 53 deletions(-)
create mode 100644 nixos/modules/hardware/ddcci.nix
create mode 100644 packages/ddcci-util/ddcci-util.sh
create mode 100644 packages/ddcci-util/default.nix
create mode 100755 packages/osd-brightness/osd-brightness.sh
delete mode 100755 packages/osd-brightness/src/osd-brightness.sh
rename packages/osd-volume/{src => }/osd-volume.sh (100%)
create mode 100644 packages/sway-audio-idle-inhibit/default.nix
diff --git a/home-manager/desktop-environment/niri.nix b/home-manager/desktop-environment/niri.nix
index b8f45cdf..eea3596c 100644
--- a/home-manager/desktop-environment/niri.nix
+++ b/home-manager/desktop-environment/niri.nix
@@ -46,7 +46,8 @@ let
spawn-at-startup "${lib.getExe pkgs.xwayland-satellite}" ":${xwaylandDisplayId}"
spawn-at-startup "${lib.getExe pkgs.waybar}"
spawn-at-startup "${lib.getExe self.pkgs.niri-output-configuration}" "startup"
- spawn-at-startup "${pkgs.wl-clipboard}/bin/wl-paste" "--type" "text" "--watch" "${lib.getExe pkgs.cliphist}" "store" "-max-items" "20"
+ spawn-at-startup "${pkgs.wl-clipboard}/bin/wl-paste" "--type" "text" "--watch" "${lib.getExe pkgs.cliphist}" "store" "-max-items" "20"
+ spawn-at-startup "${self.pkgs.sway-audio-idle-inhibit}/bin/sway-audio-idle-inhibit" "-w"
'';
input = ''
diff --git a/home-manager/desktop-environment/swayidle.nix b/home-manager/desktop-environment/swayidle.nix
index 46d47e1d..0fef99f6 100644
--- a/home-manager/desktop-environment/swayidle.nix
+++ b/home-manager/desktop-environment/swayidle.nix
@@ -1,20 +1,35 @@
-{ pkgs, lib, ... }:
+{ pkgs, lib, self, ... }:
{
# https://gitlab.com/scientiac/einstein.nixos/-/blob/main/home/niriwm/locker.nix?ref_type=heads
# https://github.com/Misterio77/nix-config/blob/main/home/gabriel/features/desktop/common/wayland-wm/swayidle.nix
- # https://gitlab.com/scientiac/einstein.nixos/-/blob/main/home/niriwm/scripts/locker.nix?ref_type=heads
# logout: https://github.com/prescientmoon/everything-nix/blob/develop/home/features/wayland/wlogout.nix
- # https://gitlab.com/scientiac/einstein.nixos/-/blob/main/home/niriwm/scripts/locker.nix?ref_type=heads
- # https://gitlab.com/scientiac/einstein.nixos/-/blob/main/home/niriwm/locker.nix?ref_type=heads
services.swayidle = {
enable = true;
timeouts = [
- { timeout = 60 * 5; command = "${lib.getExe pkgs.niri} msg action power-off-monitors"; }
- { timeout = 60 * 10; command = "systemctl suspend"; }
+ {
+ timeout = 60 * 1;
+ command = "${lib.getExe self.pkgs.osd-brightness} dim";
+ resumeCommand = "${lib.getExe self.pkgs.osd-brightness} restore";
+ }
+ {
+ timeout = 60 * 5;
+ command = "${lib.getExe pkgs.niri} niri msg action power-off-monitors"; # niri restores the active monitors oob
+ # TODO: Lock? loginctl lock-session
+ }
+ {
+ timeout = 60 * 10;
+ command = "systemctl suspend";
+ }
];
};
}
+# TODO: RGB keyboard if applicable
+
+# https://github.com/swaywm/swayidle/blob/master/swayidle.1.scd
+# https://github.com/nix-community/home-manager/blob/master/modules/services/swayidle.nix
+
+
/*
cst = "${./chisato.jpg}";
cst-blurred = pkgs.runCommand "chisato.jpg" {
diff --git a/home-manager/desktop/ghostty.nix b/home-manager/desktop/ghostty.nix
index a7dcfc43..0e56e110 100644
--- a/home-manager/desktop/ghostty.nix
+++ b/home-manager/desktop/ghostty.nix
@@ -1,4 +1,6 @@
{ config, pkgs, lib, community, ... }:
+
+# TODO: https://github.com/nix-community/home-manager/commit/5f6aa268e419d053c3d5025da740e390b12ac936
let
font = {
name = "Hack Nerd Font Mono";
diff --git a/hosts/laptop/bphenriques/default.nix b/hosts/laptop/bphenriques/default.nix
index 956173f9..f72e223f 100644
--- a/hosts/laptop/bphenriques/default.nix
+++ b/hosts/laptop/bphenriques/default.nix
@@ -12,4 +12,4 @@
nix.settings.trusted-users = [ "bphenriques" ];
home-manager.users.bphenriques = import ./home.nix;
-}
+}
\ No newline at end of file
diff --git a/hosts/laptop/bphenriques/home.nix b/hosts/laptop/bphenriques/home.nix
index c4bef06a..6e7cc5c8 100644
--- a/hosts/laptop/bphenriques/home.nix
+++ b/hosts/laptop/bphenriques/home.nix
@@ -23,6 +23,8 @@
# https://www.mankier.com/5/tmpfiles.d
systemd.user.tmpfiles.rules = [
# Tidy up most things under $HOME
+ "L ${config.home.homeDirectory}/nas-private - - - - /mnt/nas-bphenriques"
+ "L ${config.home.homeDirectory}/nas-media - - - - /mnt/nas-media"
"L ${config.home.homeDirectory}/games - - - - /mnt/games"
"L ${config.xdg.userDirs.documents} - - - - /mnt/bphenriques"
"L ${config.xdg.userDirs.pictures} - - - - /mnt/nas-bphenriques/photos"
@@ -41,6 +43,8 @@
"file://${config.xdg.userDirs.extraConfig.XDG_SCREENSHOTS_DIR}"
# Other
+ "file://${config.home.homeDirectory}/nas-private"
+ "file://${config.home.homeDirectory}/nas-media"
"file://${config.home.homeDirectory}/games"
"file://${config.home.homeDirectory}/.config Config"
];
diff --git a/hosts/laptop/config.nix b/hosts/laptop/config.nix
index 6b538c2c..4a0042ed 100644
--- a/hosts/laptop/config.nix
+++ b/hosts/laptop/config.nix
@@ -17,6 +17,7 @@
boot = {
supportedFilesystems.zfs = true;
kernelPackages = pkgs.linuxPackages_6_12;
+
loader.grub = {
enable = true;
efiSupport = true;
diff --git a/hosts/laptop/hardware/peripherals.nix b/hosts/laptop/hardware/peripherals.nix
index f6f9ee8b..bf860556 100644
--- a/hosts/laptop/hardware/peripherals.nix
+++ b/hosts/laptop/hardware/peripherals.nix
@@ -29,6 +29,11 @@
hardware.xone.enable = true; # Xbox(ish) gamepads
hardware.steam-hardware.enable = true; # Steam Hardware. TODO: I likely do not need this.
+ # Monitor
+ custom.hardware.ddcci.enable = true;
+ users.users.bphenriques.extraGroups = [ "i2c" ];
+
+ # Other
environment.systemPackages = [
pkgs.cheese # Webcam
];
diff --git a/hosts/network-devices.nix b/hosts/network-devices.nix
index c30fe90b..1901b4f9 100644
--- a/hosts/network-devices.nix
+++ b/hosts/network-devices.nix
@@ -2,7 +2,7 @@
{
# Server: Synology
home-nas = {
- hostname = "192.168.68.53";
+ hostname = "192.168.1.87";
ssh.user = "Bruno-Admin";
ssh.port = 6188;
};
diff --git a/hosts/peripherals.nix b/hosts/peripherals.nix
index 42ab2e86..37a02e33 100644
--- a/hosts/peripherals.nix
+++ b/hosts/peripherals.nix
@@ -9,6 +9,7 @@
};
"Dell Inc. DELL S2721DGF 4P11R83" = {
name = "Dell Inc. DELL S2721DGF 4P11R83";
+ model = "S2721DGF";
description = "Office Monitor";
resolution = "2560x1440";
refresh_rate = "143.912";
diff --git a/nixos/modules/default.nix b/nixos/modules/default.nix
index e3ffcdd4..c15e06d6 100644
--- a/nixos/modules/default.nix
+++ b/nixos/modules/default.nix
@@ -1,4 +1,5 @@
{
+ hardware-ddcci = ./hardware/ddcci.nix;
proton-run = ./programs/proton-run.nix;
services-input-remapper-profiles = ./services/input-remapper.nix;
services-solaar = ./services/solaar.nix;
diff --git a/nixos/modules/hardware/ddcci.nix b/nixos/modules/hardware/ddcci.nix
new file mode 100644
index 00000000..f2452fc6
--- /dev/null
+++ b/nixos/modules/hardware/ddcci.nix
@@ -0,0 +1,44 @@
+{ pkgs, config, lib, self, ... }:
+with lib;
+
+# https://github.com/ejmastnak/ejmastnak.com/blob/40e0d20bceedc75bc2111201976bb30bc421577f/content/tutorials/arch/monitor-hotplug.md
+
+let
+ cfg = config.custom.hardware.ddcci;
+in {
+ options.custom.hardware.ddcci = with types; {
+ enable = mkEnableOption "Manage external monitors through `/sys/class/backlight/`. User needs to belong to 'i2c' group";
+ };
+
+ # TODO: udev when battery is nearly done
+
+ config = lib.mkIf cfg.enable {
+ hardware.i2c.enable = true;
+ boot.extraModulePackages = [ config.boot.kernelPackages.ddcci-driver ];
+ boot.kernelModules = [ "ddcci" ];
+ #services.udev.extraRules = ''
+ # KERNEL=="card0", SUBSYSTEM=="drm", ACTION=="change", RUN+="${lib.getExe self.pkgs.ddcci-external-screen-hotplug}"
+ #'';
+
+ # TODO: Limitation, does not work when we plug/unplug devices. Works for me.
+ systemd.services."init-ddcci-connected-monitors" = {
+ wantedBy = [ "graphical.service" ];
+ after = [ "graphical.service" ];
+ serviceConfig = {
+ Type = "oneshot";
+ RemainAfterExit = false;
+ ExecStart = ''${lib.getExe self.pkgs.ddcci-util} init"'';
+ };
+ };
+ # Quick enough that does not justify modelling as a service
+ #systemd.services.graphical.postStart = ''
+ # ${pkgs.kmod}/bin/modprobe -r ddcci && ${pkgs.kmod}/bin/modprobe ddcci
+ #'';
+
+ # Temporary
+ environment.systemPackages = with pkgs; [
+ brightnessctl
+ ddcutil
+ ];
+ };
+}
diff --git a/packages/ddcci-util/ddcci-util.sh b/packages/ddcci-util/ddcci-util.sh
new file mode 100644
index 00000000..c1829315
--- /dev/null
+++ b/packages/ddcci-util/ddcci-util.sh
@@ -0,0 +1,29 @@
+#shellcheck shell=bash
+# udev rule that hotplugs display drivers.
+#
+# As documented by the ddcci-driver, we need to reload it everytime a device is (dis)connected.
+# Then, we manually add/remove the device so that it gets exposed under `/sys/class/backlight/`
+#
+# Installation: tied to udev using systemd (https://wiki.archlinux.org/title/Udev#Spawning_long-running_processes)
+
+fatal() { printf '%s\n' "$1" 1>&2; exit 1; }
+backlight_compatible() { ddcutil getvcp 10 --bus="$1"; }
+add_ddcci_device() { echo "Registering i2c device '$1'" && echo ddcci 0x37 | tee "/sys/bus/i2c/devices/$1/new_device"; }
+list_external_i2c_devices() { ddcutil detect | grep -A1 'Display [0-9]' | grep -oP '/dev/.*$' | sed 's|/dev/i2c-||g'; }
+register_backlight_devices() {
+ for i2c_bus in $(list_external_i2c_devices); do
+ if backlight_compatible "${i2c_bus}"; then
+ add_ddcci_device "/i2c-${i2c_bus}"
+ else
+ echo "$i2c_bus does not support backlight according to ddcutil"
+ fi
+ done
+}
+
+case "${1:-}" in
+ init) modprobe -r ddcci && modprobe ddcci && register_backlight_devices ;;
+ list) list_external_i2c_devices ;;
+ register-backlight-devices) register_backlight_devices ;;
+esac
+
+# TODO: maybe I _should_ make this smart and give another name to the backlight device so that it matches the desktop manager output (e.g., model).
\ No newline at end of file
diff --git a/packages/ddcci-util/default.nix b/packages/ddcci-util/default.nix
new file mode 100644
index 00000000..f4967fdc
--- /dev/null
+++ b/packages/ddcci-util/default.nix
@@ -0,0 +1,6 @@
+{ lib, pkgs, ... }:
+pkgs.writeShellApplication {
+ name = "ddcci-util";
+ runtimeInputs = with pkgs; [ kmod ddcutil gnugrep ];
+ text = lib.fileContents ./ddcci-util.sh;
+}
\ No newline at end of file
diff --git a/packages/default.nix b/packages/default.nix
index e274d644..ca430e0f 100644
--- a/packages/default.nix
+++ b/packages/default.nix
@@ -25,9 +25,11 @@ let
cliphist-dmenu = pkgs.callPackage ./cliphist-dmenu { };
smart-paste = pkgs.callPackage ./smart-paste { };
session-dmenu = pkgs.callPackage ./session-dmenu { };
+ ddcci-util = pkgs.callPackage ./ddcci-util { };
# Move to community namespace
proton-ge-custom = pkgs.callPackage ./proton-ge-custom { };
+ sway-audio-idle-inhibit = pkgs.callPackage ./sway-audio-idle-inhibit { };
}
);
in forAllSystems (system:
diff --git a/packages/osd-brightness/default.nix b/packages/osd-brightness/default.nix
index c11bdca8..e00ba330 100644
--- a/packages/osd-brightness/default.nix
+++ b/packages/osd-brightness/default.nix
@@ -1,7 +1,7 @@
{ lib, pkgs, ... }:
pkgs.writeShellApplication {
name = "osd-brightness";
- runtimeInputs = with pkgs; [ libnotify brightnessctl ];
+ runtimeInputs = with pkgs; [ libnotify brightnessctl gnugrep gawk findutils ];
text = let
iconBasePath = "${pkgs.pkgs.papirus-icon-theme}/share/icons/Papirus-Dark/symbolic/status";
in
@@ -12,6 +12,6 @@ pkgs.writeShellApplication {
OSD_BRIGHTNESS_MEDIUM_ICON="${iconBasePath}/display-brightness-medium-symbolic.svg"
OSD_BRIGHTNESS_HIGH_ICON="${iconBasePath}/display-brightness-high-symbolic.svg"
- ${lib.fileContents ./src/osd-brightness.sh}
+ ${lib.fileContents ./osd-brightness.sh}
'';
}
\ No newline at end of file
diff --git a/packages/osd-brightness/osd-brightness.sh b/packages/osd-brightness/osd-brightness.sh
new file mode 100755
index 00000000..1eaa5cf1
--- /dev/null
+++ b/packages/osd-brightness/osd-brightness.sh
@@ -0,0 +1,81 @@
+#shellcheck shell=bash
+
+# Issues:
+# - Applying to a class as whole does not work: brightnessctl --machine-readable --class=backlight set 10
+
+OSD_BRIGHTNESS_OFF_ICON="${OSD_BRIGHTNESS_OFF_ICON:-}"
+OSD_BRIGHTNESS_LOW_ICON="${OSD_BRIGHTNESS_LOW_ICON:-}"
+OSD_BRIGHTNESS_MEDIUM_ICON="${OSD_BRIGHTNESS_MEDIUM_ICON:-}"
+OSD_BRIGHTNESS_HIGH_ICON="${OSD_BRIGHTNESS_HIGH_ICON:-}"
+
+MIN_BRIGHTNESS=10 # 0 turns off OLED monitor (internals/external)
+
+# ignore 'kbd_backlight'
+default_device() { brightnessctl --machine-readable | awk -F, '{ print $1; }'; }
+list_backlight_devices() { brightnessctl --machine-readable -l | grep ',backlight,' | awk -F, '{ print $1; }'; }
+get_percentage() { brightnessctl --device="${2:-"$(default_device)"}" --machine-readable | awk -F, '{print $4}' | tr -d %; }
+set_brightness() { brightnessctl --device="${2:-"$(default_device)"}" set "$1" ; }
+
+dim() {
+ case ${1:-} in
+ "") list_backlight_devices | xargs -I{} brightnessctl --save --device={} set "$MIN_BRIGHTNESS" ;;
+ *) brightnessctl --save --device="$1" set "$MIN_BRIGHTNESS" ;;
+ esac
+}
+
+restore() {
+ case ${1:-} in
+ "") list_backlight_devices | xargs -I{} brightnessctl --restore --device={} ;;
+ *) brightnessctl --restore --device="$1" ;;
+ esac
+}
+
+notify() {
+ percentage="$1"
+ icon=
+ if [ "$percentage" -eq 0 ]; then
+ icon="$OSD_BRIGHTNESS_OFF_ICON"
+ progress=0
+ elif [ "$percentage" -lt 30 ]; then
+ icon="$OSD_BRIGHTNESS_LOW_ICON"
+ progress="$percentage"
+ elif [ "$percentage" -lt 70 ]; then
+ icon="$OSD_BRIGHTNESS_MEDIUM_ICON"
+ progress="$percentage"
+ else
+ icon="$OSD_BRIGHTNESS_HIGH_ICON"
+ progress="$percentage"
+ fi
+
+ notify-send \
+ --expire-time 1500 \
+ --icon "$icon" \
+ --category "brightness-osd" \
+ --hint string:x-canonical-private-synchronous:brightness \
+ --hint string:x-dunst-stack-tag:brightness \
+ --hint int:value:"$progress" \
+ "Brightness: $progress%"
+}
+
+case "${1:-}" in
+ increase)
+ shift 1
+ delta="+${1:-5}%"
+ device="${2:-"$(default_device)"}"
+ set_brightness "$delta" "$device"
+ notify "$(get_percentage "$device")"
+ ;;
+ decrease)
+ shift 1
+ delta="${1:-5}-%"
+ device="${2:-"$(default_device)"}"
+ set_brightness "$delta" "$device"q
+ notify "$(get_percentage "$device")"
+ ;;
+ dim) shift 1 && dim "${@:-}" ;;
+ restore) shift 1 && restore "${@:-}" ;;
+ list) shift 1 && list_backlight_devices ;;
+esac
+
+# 1. Find the correct device using: ddcutil detect | grep -A1 'Display [0-9]' | grep -oP '/dev/.*$'
+# 2. echo ddcci 0x37 | sudo tee /sys/bus/i2c/devices/i2c-18/new_device
\ No newline at end of file
diff --git a/packages/osd-brightness/src/osd-brightness.sh b/packages/osd-brightness/src/osd-brightness.sh
deleted file mode 100755
index 514a0486..00000000
--- a/packages/osd-brightness/src/osd-brightness.sh
+++ /dev/null
@@ -1,41 +0,0 @@
-#shellcheck shell=sh
-
-OSD_BRIGHTNESS_OFF_ICON="${OSD_BRIGHTNESS_OFF_ICON:-}"
-OSD_BRIGHTNESS_LOW_ICON="${OSD_BRIGHTNESS_LOW_ICON:-}"
-OSD_BRIGHTNESS_MEDIUM_ICON="${OSD_BRIGHTNESS_MEDIUM_ICON:-}"
-OSD_BRIGHTNESS_HIGH_ICON="${OSD_BRIGHTNESS_HIGH_ICON:-}"
-
-get_percentage() { brightnessctl -m | awk -F, '{print $4}' | tr -d %; }
-delta() { brightnessctl set "$1" > /dev/null; }
-
-notify() {
- percentage="$(get_percentage)"
- icon=
- if [ "$percentage" -eq 0 ]; then
- icon="$OSD_BRIGHTNESS_OFF_ICON"
- progress=0
- elif [ "$percentage" -lt 30 ]; then
- icon="$OSD_BRIGHTNESS_LOW_ICON"
- progress="$percentage"
- elif [ "$percentage" -lt 70 ]; then
- icon="$OSD_BRIGHTNESS_MEDIUM_ICON"
- progress="$percentage"
- else
- icon="$OSD_BRIGHTNESS_HIGH_ICON"
- progress="$percentage"
- fi
-
- notify-send \
- --expire-time 1500 \
- --icon "$icon" \
- --category "brightness-osd" \
- --hint string:x-canonical-private-synchronous:brightness \
- --hint string:x-dunst-stack-tag:brightness \
- --hint int:value:"$progress" \
- "Brightness: $progress%"
-}
-
-case "${1:-}" in
- increase) shift 1 && delta "+${1:-10}%" && notify ;;
- decrease) shift 1 && delta "${1:-10}-%" && notify ;;
-esac
diff --git a/packages/osd-volume/default.nix b/packages/osd-volume/default.nix
index 024ed8fa..9f052e39 100644
--- a/packages/osd-volume/default.nix
+++ b/packages/osd-volume/default.nix
@@ -11,6 +11,6 @@ pkgs.writeShellApplication {
OSD_VOLUME_MEDIUM_ICON="${iconBasePath}/audio-volume-medium-symbolic.svg"
OSD_VOLUME_HIGH_ICON="${iconBasePath}/audio-volume-high-symbolic.svg"
- ${lib.fileContents ./src/osd-volume.sh}
+ ${lib.fileContents ./osd-volume.sh}
'';
}
\ No newline at end of file
diff --git a/packages/osd-volume/src/osd-volume.sh b/packages/osd-volume/osd-volume.sh
similarity index 100%
rename from packages/osd-volume/src/osd-volume.sh
rename to packages/osd-volume/osd-volume.sh
diff --git a/packages/sway-audio-idle-inhibit/default.nix b/packages/sway-audio-idle-inhibit/default.nix
new file mode 100644
index 00000000..f0b83d8e
--- /dev/null
+++ b/packages/sway-audio-idle-inhibit/default.nix
@@ -0,0 +1,33 @@
+{
+ lib,
+ stdenv,
+ fetchFromGitHub,
+ meson,
+ pkg-config,
+ cmake,
+ ninja,
+ wayland,
+ wayland-scanner,
+ wayland-protocols,
+ pulseaudio,
+}:
+stdenv.mkDerivation rec {
+ pname = "swayaudioidleinhibit";
+ version = "0.1.2";
+
+ src = fetchFromGitHub {
+ owner = "ErikReider";
+ repo = pname;
+ rev = "v${version}";
+ hash = "sha256-6bdIkNosp/mzH5SiyK6Mox/z8kuFk5RLMmcFZ2VIi0g=";
+ };
+
+ nativeBuildInputs = [meson pkg-config cmake ninja wayland-scanner];
+ buildInputs = [wayland-protocols wayland pulseaudio];
+
+ meta = with lib; {
+ description = "Prevents swayidle from sleeping while any application is outputting or receiving audio";
+ homepage = "https://github.com/ErikReider/SwayAudioIdleInhibit";
+ license = licenses.gpl3Only;
+ };
+}
\ No newline at end of file
From e69474b9c5afb8659ddda97a9b88460a263df413 Mon Sep 17 00:00:00 2001
From: Bruno Henriques <4727729+bphenriques@users.noreply.github.com>
Date: Fri, 10 Jan 2025 20:05:18 +0000
Subject: [PATCH 34/34] improve lock mechanism
---
home-manager/desktop-environment/default.nix | 1 +
home-manager/desktop-environment/hyprlock.nix | 56 +++++++++++++++++++
home-manager/desktop-environment/niri.nix | 1 +
home-manager/desktop-environment/swayidle.nix | 50 +++++++----------
hosts/laptop/config.nix | 11 +---
hosts/laptop/hardware/peripherals.nix | 4 --
nixos/modules/hardware/ddcci.nix | 6 +-
packages/osd-brightness/osd-brightness.sh | 7 +--
8 files changed, 88 insertions(+), 48 deletions(-)
create mode 100644 home-manager/desktop-environment/hyprlock.nix
diff --git a/home-manager/desktop-environment/default.nix b/home-manager/desktop-environment/default.nix
index 562543e3..096c34e1 100644
--- a/home-manager/desktop-environment/default.nix
+++ b/home-manager/desktop-environment/default.nix
@@ -7,6 +7,7 @@
./fuzzel.nix # Application Launcher
./rofi.nix # Application Launcher
./swayidle.nix # Locks/suspends the computer when idle
+ ./hyprlock.nix # Lock screend
];
custom.services.swww.enable = true; # Wallpaper daemon
diff --git a/home-manager/desktop-environment/hyprlock.nix b/home-manager/desktop-environment/hyprlock.nix
new file mode 100644
index 00000000..9d5d82b0
--- /dev/null
+++ b/home-manager/desktop-environment/hyprlock.nix
@@ -0,0 +1,56 @@
+{ config, pkgs, lib, self, ... }:
+let
+ wallpapersPkg = self.private.wallpapers.override {
+ selected = [ "lake" ];
+ };
+in
+{
+ programs.hyprlock = {
+ enable = true;
+
+ settings = {
+ general.disable_loading_bar = true;
+ background = [{
+ path = "${wallpapersPkg}/share/wallpapers/lake.jpg";
+ blur_passes = 3;
+ blur_size = 12;
+ }];
+
+ input-field = [{
+ size = "300, 50";
+ valign = "bottom";
+ position = "0%, 10%";
+
+ outline_thickness = 1;
+
+ font_color = "rgb(b6c4ff)";
+ outer_color = "rgba(180, 180, 180, 0.5)";
+ inner_color = "rgba(200, 200, 200, 0.1)";
+ check_color = "rgba(247, 193, 19, 0.5)";
+ fail_color = "rgba(255, 106, 134, 0.5)";
+
+ fade_on_empty = false;
+ placeholder_text = "Enter Password";
+
+ shadow_color = "rgba(0, 0, 0, 0.1)";
+ shadow_size = 7;
+ shadow_passes = 2;
+ }];
+
+ label = [{
+ text = ''cmd[update:60000] echo "$(date +'%H:%M')"'';
+ font_size = 300;
+ font_family = "Ubuntu Nerd Font";
+
+ color = "rgb(b6c4ff)";
+ position = "0%, 2%";
+ valign = "center";
+ halign = "center";
+ shadow_color = "rgba(0, 0, 0, 0.1)";
+ shadow_size = 20;
+ shadow_passes = 2;
+ shadow_boost = 0.3;
+ }];
+ };
+ };
+}
\ No newline at end of file
diff --git a/home-manager/desktop-environment/niri.nix b/home-manager/desktop-environment/niri.nix
index eea3596c..738bc6f6 100644
--- a/home-manager/desktop-environment/niri.nix
+++ b/home-manager/desktop-environment/niri.nix
@@ -20,6 +20,7 @@
# https://gitlab.com/usmcamp0811/dotfiles
# https://github.com/gopi487krishna/niri-waydots/tree/main/rofi
+# https://github.com/LoneWolf4713/seraphic.dotfiles
# TODO shortcut to lock the computer
let
diff --git a/home-manager/desktop-environment/swayidle.nix b/home-manager/desktop-environment/swayidle.nix
index 0fef99f6..8aa6aa35 100644
--- a/home-manager/desktop-environment/swayidle.nix
+++ b/home-manager/desktop-environment/swayidle.nix
@@ -1,44 +1,34 @@
-{ pkgs, lib, self, ... }:
+{ pkgs, config, lib, self, ... }:
+
+let
+ pidof = lib.getExe' pkgs.procps "pidof";
+ hyprlock = lib.getExe config.programs.hyprlock.package;
+ niri = lib.getExe pkgs.niri;
+ osd-brightness = lib.getExe self.pkgs.osd-brightness;
+ systemctl = lib.getExe' pkgs.systemd "systemctl";
+in
{
- # https://gitlab.com/scientiac/einstein.nixos/-/blob/main/home/niriwm/locker.nix?ref_type=heads
- # https://github.com/Misterio77/nix-config/blob/main/home/gabriel/features/desktop/common/wayland-wm/swayidle.nix
- # logout: https://github.com/prescientmoon/everything-nix/blob/develop/home/features/wayland/wlogout.nix
services.swayidle = {
enable = true;
timeouts = [
{
- timeout = 60 * 1;
- command = "${lib.getExe self.pkgs.osd-brightness} dim";
- resumeCommand = "${lib.getExe self.pkgs.osd-brightness} restore";
+ timeout = 60 * 5;
+ command = "${osd-brightness} dim >/dev/null 2>&1";
+ resumeCommand = "${osd-brightness} restore >/dev/null 2>&1";
}
{
- timeout = 60 * 5;
- command = "${lib.getExe pkgs.niri} niri msg action power-off-monitors"; # niri restores the active monitors oob
- # TODO: Lock? loginctl lock-session
+ timeout = 60 * 6;
+ command = "${pidof} hyprlock || ${niri} msg action spawn -- ${hyprlock}";
}
{
timeout = 60 * 10;
- command = "systemctl suspend";
+ command = "${systemctl} suspend";
}
];
- };
-}
-# TODO: RGB keyboard if applicable
-
-# https://github.com/swaywm/swayidle/blob/master/swayidle.1.scd
-# https://github.com/nix-community/home-manager/blob/master/modules/services/swayidle.nix
-
-
-/*
- cst = "${./chisato.jpg}";
- cst-blurred = pkgs.runCommand "chisato.jpg" {
- nativeBuildInputs = with pkgs;[ imagemagick ];
- } ''convert -blur 14x5 ${cst} $out'';
- programs.swaylock.settings = {
- show-failed-attempts = true;
- daemonize = true;
- image = "${cst-blurred}";
- scaling = "fill";
+ events = [
+ { event = "before-sleep"; command = "${niri} msg action power-off-monitors"; }
+ { event = "after-resume"; command = "${niri} msg action power-on-monitors"; }
+ ];
};
-*/
+}
diff --git a/hosts/laptop/config.nix b/hosts/laptop/config.nix
index 4a0042ed..6b33c50b 100644
--- a/hosts/laptop/config.nix
+++ b/hosts/laptop/config.nix
@@ -49,16 +49,9 @@
theme = "angular";
};
- # Login Screen
+ # Login Screen.
environment.systemPackages = [
- (pkgs.writeScriptBin "reboot-to-windows" ''
- #!${pkgs.stdenv.shell}
- sudo grub-reboot "Windows 11" && reboot $@
- '')
- (pkgs.writeScriptBin "reboot-to-bios" ''
- #!${pkgs.stdenv.shell}
- sudo grub-reboot "BIOS Setup" && reboot $@
- '')
+ (pkgs.writeScriptBin "reboot-to-windows" ''sudo grub-reboot "Windows 11" && reboot $@'')
];
# Gaming
diff --git a/hosts/laptop/hardware/peripherals.nix b/hosts/laptop/hardware/peripherals.nix
index bf860556..0c5efeb7 100644
--- a/hosts/laptop/hardware/peripherals.nix
+++ b/hosts/laptop/hardware/peripherals.nix
@@ -29,10 +29,6 @@
hardware.xone.enable = true; # Xbox(ish) gamepads
hardware.steam-hardware.enable = true; # Steam Hardware. TODO: I likely do not need this.
- # Monitor
- custom.hardware.ddcci.enable = true;
- users.users.bphenriques.extraGroups = [ "i2c" ];
-
# Other
environment.systemPackages = [
pkgs.cheese # Webcam
diff --git a/nixos/modules/hardware/ddcci.nix b/nixos/modules/hardware/ddcci.nix
index f2452fc6..d75267ec 100644
--- a/nixos/modules/hardware/ddcci.nix
+++ b/nixos/modules/hardware/ddcci.nix
@@ -2,7 +2,11 @@
with lib;
# https://github.com/ejmastnak/ejmastnak.com/blob/40e0d20bceedc75bc2111201976bb30bc421577f/content/tutorials/arch/monitor-hotplug.md
-
+# https://github.com/sweenu/nixfiles/blob/77a35153c18ccfa9975c8c712fc6640806a4a102/profiles/laptop.nix#L27
+# https://github.com/sweenu/nixfiles/blob/77a35153c18ccfa9975c8c712fc6640806a4a102/profiles/laptop.nix#L27
+# https://github.com/floscr/dotfiles/blob/main/new/modules/services/hotplug.nix#L30
+# https://discourse.nixos.org/t/brightness-control-of-external-monitors-with-ddcci-backlight/8639/17
+# https://discourse.nixos.org/t/ddcci-kernel-driver/22186/7
let
cfg = config.custom.hardware.ddcci;
in {
diff --git a/packages/osd-brightness/osd-brightness.sh b/packages/osd-brightness/osd-brightness.sh
index 1eaa5cf1..3fe56642 100755
--- a/packages/osd-brightness/osd-brightness.sh
+++ b/packages/osd-brightness/osd-brightness.sh
@@ -10,6 +10,8 @@ OSD_BRIGHTNESS_HIGH_ICON="${OSD_BRIGHTNESS_HIGH_ICON:-}"
MIN_BRIGHTNESS=10 # 0 turns off OLED monitor (internals/external)
+# TODO: RGB keyboard if applicable
+
# ignore 'kbd_backlight'
default_device() { brightnessctl --machine-readable | awk -F, '{ print $1; }'; }
list_backlight_devices() { brightnessctl --machine-readable -l | grep ',backlight,' | awk -F, '{ print $1; }'; }
@@ -75,7 +77,4 @@ case "${1:-}" in
dim) shift 1 && dim "${@:-}" ;;
restore) shift 1 && restore "${@:-}" ;;
list) shift 1 && list_backlight_devices ;;
-esac
-
-# 1. Find the correct device using: ddcutil detect | grep -A1 'Display [0-9]' | grep -oP '/dev/.*$'
-# 2. echo ddcci 0x37 | sudo tee /sys/bus/i2c/devices/i2c-18/new_device
\ No newline at end of file
+esac
\ No newline at end of file