From 4be176286806fb9c7ff6e9c0a8a26eebdac89018 Mon Sep 17 00:00:00 2001 From: ant Date: Mon, 3 Jun 2024 15:24:20 +0200 Subject: [PATCH] Big update --- additional-software.nix | 13 + bar.nix | 266 ++++++++++++++++ bin/quickrun.fish | 19 ++ dotfiles/rofi/theme.rasi | 4 +- dotfiles/waybar.css | 198 ------------ dotfiles/waybar.jsonc | 234 -------------- dunstconfig.nix | 22 -- fish.nix | 200 ++++++------ flake.nix | 14 +- gaming.nix | 14 + gui-software.nix | 35 +++ home.nix | 397 ++---------------------- hyprland.nix | 644 ++++++++++++++++++++------------------- lf.nix | 168 +++++----- terminal-software.nix | 60 ++++ ui.nix | 238 +++++++++++++++ waybar.css | 50 +++ 17 files changed, 1238 insertions(+), 1338 deletions(-) create mode 100644 additional-software.nix create mode 100644 bar.nix create mode 100755 bin/quickrun.fish delete mode 100644 dotfiles/waybar.css delete mode 100644 dotfiles/waybar.jsonc delete mode 100644 dunstconfig.nix create mode 100644 gaming.nix create mode 100644 gui-software.nix create mode 100644 terminal-software.nix create mode 100644 ui.nix create mode 100644 waybar.css diff --git a/additional-software.nix b/additional-software.nix new file mode 100644 index 0000000..cb27708 --- /dev/null +++ b/additional-software.nix @@ -0,0 +1,13 @@ +{ lib, config, pkgs, ... }: { + options = { + config.downloadSoftwares = lib.mkEnableOption "Enable qbittorrent, aria2 and yt-dlp"; + }; + + config = lib.mkIf config.downloadSoftwares.enable { + home.packages = with pkgs; [ + yt-dlp + qbittorrent + aria2 + ]; + }; +} diff --git a/bar.nix b/bar.nix new file mode 100644 index 0000000..d65bd03 --- /dev/null +++ b/bar.nix @@ -0,0 +1,266 @@ +{ lib, config, pkgs, ... }: { + + home.packages = with pkgs; [ + material-design-icons + jost + ncdu + ]; + + programs.waybar = { + enable = true; + # systemd.enable = true; + settings = { + bar = { + "reload_style_on_change" = true; + layer = "top"; + position = "bottom"; + exclusive = true; + # height = 0; + "on-scroll-up" = "hyprctl dispatch workspace e+1"; + "on-scroll-down" = "hyprctl dispatch workspace e-1"; + "modules-left" = [ + "group/controls" + "hyprland/submap" + ]; + "modules-center" = [ "hyprland/window" ]; + "modules-right" = [ + "network" + "group/disks" + "group/hardware" + "tray" + "clock" + ]; + + "group/controls" = { + orientation = "inherit"; + modules = [ + "hyprland/workspaces" + "pulseaudio#speaker" + "pulseaudio#microphone" + "idle_inhibitor" + "bluetooth" + "backlight" + "mpris" + ]; + }; + + "group/hardware" = { + orientation = "inherit"; + modules = [ "cpu" "temperature" "memory" "battery" ]; + }; + + "group/disks" = { + orientation = "inherit"; + modules = [ "disk" "disk#2" "disk#3" ]; + }; + + backlight = { + device = "intel_backlight"; + format = "{icon}"; + "on-click" = "${pkgs.light}/bin/light -S 100"; + "on-click-right" = "${pkgs.light}/bin/light -S 1"; + "tooltip-format" = "{percent}%"; + "format-icons" = [ "󰛩" "󱩎" "󱩏" "󱩐" "󱩑" "󱩒" "󱩓" "󱩔" "󱩕" "󱩖" "󰛨" ]; + }; + + idle_inhibitor = { + format = "{icon}"; + "format-icons" = { + activated = "󰈈"; + deactivated = "󰈉"; + }; + }; + + bluetooth = { + format = "󰂯"; + "format-disabled" = "󰂲"; + "on-click" = "${pkgs.util-linux}/bin/rfkill toggle bluetooth"; + "on-click-right" = "$TERMINAL --class floating -e bluetuith"; + "tooltip-format" = "{}"; + }; + + mpris = { + format = "{player_icon} {title}"; + "format-paused" = "{status_icon} {title}"; + "player-icons" = { + default = "󰐊"; + mpv = "󰐍"; + spotify = "󰓇"; + }; + "status-icons" = { + paused = "󰏤"; + }; + }; + + disk = { + interval = 1; + format = "󰋊 {free}"; + path = "/"; + "on-click" = "$TERMINAL --class floating -e ${pkgs.ncdu}/bin/ncdu -x /"; + }; + + "disk#2" = { + interval = 1; + format = "󰋊 {free}"; + path = "/home/ant/disk1"; + "on-click" = "$TERMINAL --class floating -e ${pkgs.ncdu}/bin/ncdu -x /home/ant/disk1"; + }; + + "disk#3" = { + interval = 1; + format = "󰋊 {free}"; + path = "/home/ant/disk2"; + "on-click" = "$TERMINAL --class floating -e ${pkgs.ncdu}/bin/ncdu -x /home/ant/disk2"; + }; + + memory = { + interval = 1; + format = "󰧑 {percentage:2}%"; + "tooltip-format" = "{used:0.1f}G/{total:0.1f}G"; + states = { low = 70; }; + "on-click" = "notify-send \"$(printf \"%-20s %10s\\n\" \"COMMAND\" \"MEMORY USAGE\"; ps axo comm,rss | awk '{mem[$1]+=$2} END {for (cmd in mem) printf \"%-20s %5.2f MiB\\n\", cmd, mem[cmd]/1024}' | sort -k2nr | head -n10)\""; + }; + + network = { + interval = 1; + format = "󰌙"; + "format-disconnected" = "󰌙"; + "format-linked" = "󰛵"; + "format-ethernet" = "󰓢 {bandwidthDownBytes:>} {bandwidthUpBytes:>}"; + "format-wifi" = "󰖩 {bandwidthDownBytes:>} {bandwidthUpBytes:>}"; + "on-click" = "wifi-toggle"; + "on-right-click" = "$TERMINAL --class floating -e nmtui"; + "tooltip-format-ethernet" = "{ipaddr}"; + "tooltip-format-wifi" = "{ipaddr}\n{essid}\n{signalStrength}"; + }; + + "hyprland/window" = { + format = "{}"; + "on-scroll-up" = "hyprctl dispatch workspace e+1"; + "on-scroll-down" = "hyprctl dispatch workspace e-1"; + }; + + "hyprland/workspaces" = { + "on-scroll-up" = "hyprctl dispatch workspace e+1"; + "on-scroll-down" = "hyprctl dispatch workspace e-1"; + "all-outputs" = true; + "on-click" = "activate"; + format = "{icon}"; + "format-icons" = { + "1" = "0"; + "2" = "1"; + "3" = "2"; + "4" = "3"; + "5" = "4"; + "6" = "5"; + "7" = "6"; + "8" = "7"; + "9" = "8"; + "10" = "9"; + }; + }; + + cpu = { + interval = 1; + format = "󰘚 {usage:2}%"; + "max-length" = 10; + "on-click" = "$TERMINAL --class floating -e htop"; + }; + + battery = { + interval = 30; + states = { + warning = 30; + critical = 15; + }; + "format-charging" = "󰂅 {capacity:2}%"; + format = "{icon} {capacity:2}%"; + "format-icons" = [ "󰂎" "󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹" ]; + tooltip = true; + }; + + "custom/weather" = { + tooltip = true; + format = "{}"; + "restart-interval" = 300; + exec = "~/.config/waybar/scripts/waybar-wttr.py"; + "return-type" = "json"; + }; + + tray = { + "icon-size" = 17; + # tooltip = false; + # spacing = 10; + }; + + clock = { + "min-length" = 10; + interval = 1; + format = "{:%d/%m %H:%M:%S}"; + timezones = [ "Europe/Paris" ]; + "tooltip-format" = "{:%Y %B}\n{calendar}"; + actions = { + "on-scroll-up" = "tz_up"; + "on-scroll-down" = "tz_down"; + }; + }; + + "pulseaudio#speaker" = { + format = "{icon} {volume}%"; + tooltip = false; + "format-muted" = "󰖁"; + "on-click" = "pamixer -t"; + # "on-click-right" = "pamixer -t"; + "on-scroll-up" = "pamixer -i 5"; + "on-scroll-down" = "pamixer -d 5"; + "scroll-step" = 5; + "format-icons" = { + headphone = "󰋋"; + "hands-free" = "󰋋"; + headset = "󰋋"; + phone = "󰏲"; + portable = "󰏲"; + car = "󰄋"; + default = [ "󰕿" "󰖀" "󰕾" ]; + }; + }; + + "pulseaudio#microphone" = { + format = "{format_source}"; + tooltip = false; + "format-source" = "󰍬 {volume}%"; + "format-source-muted" = "󰍭"; + "on-click" = "pamixer --default-source -t"; + "on-scroll-up" = "pamixer --default-source -i 5"; + "on-scroll-down" = + + "pamixer --default-source -d 5"; + "scroll-step" = 5; + }; + + "hyprland/submap" = { + format = "(l)ock, (e)xit, (s)uspend, (h)ibernate, (r)eboot, (S)hutdown"; + }; + + "custom/nvidia-load" = { + exec = ".config/waybar/scripts/nvidia-load.py"; + interval = 5; + "return-type" = "json"; + format = "{}"; + tooltip = "{tooltip}"; + "on-click" = "$TERMINAL --class floating -e nvtop"; + }; + + "custom/nvidia-mem" = { + exec = ".config/waybar/scripts/nvidia-mem.py"; + interval = 5; + "return-type" = "json"; + format = "{}"; + tooltip = "{tooltip}"; + "on-click" = "$TERMINAL --class floating -e nvtop"; + }; + }; + }; + style = ./waybar.css; + }; +} diff --git a/bin/quickrun.fish b/bin/quickrun.fish new file mode 100755 index 0000000..04354d3 --- /dev/null +++ b/bin/quickrun.fish @@ -0,0 +1,19 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i fish +#!nix-shell -p fish gcc + + +set file (realpath $argv[1]) + +set workdir (mktemp -d) +cd $workdir + +set extension (string match -r '\.([a-z]+)$' $file | head -n 1) + +switch $extension + case ".c" + gcc -o a.out $file + ./a.out + case ".py" + python $file +end diff --git a/dotfiles/rofi/theme.rasi b/dotfiles/rofi/theme.rasi index 366162a..7c88ef9 100644 --- a/dotfiles/rofi/theme.rasi +++ b/dotfiles/rofi/theme.rasi @@ -30,7 +30,7 @@ mainbox { } inputbar { spacing: 0; - border: 1px; + border: 0; padding: 0.4em 0.2em; background-color: @bg; index: 0; @@ -50,7 +50,7 @@ entry { } listview { - border: 1px; + border: 0; reverse: false; columns: 1; diff --git a/dotfiles/waybar.css b/dotfiles/waybar.css deleted file mode 100644 index 06ec4d8..0000000 --- a/dotfiles/waybar.css +++ /dev/null @@ -1,198 +0,0 @@ -* { - border: none; - background: rgba(0, 0, 0, 0); - /* font-family: "CartographCF italic"; */ - font-family: "Material Design Icons", Monospace; - /* font-family: "Roboto"; */ - font-weight: bold; - font-size: 14px; - min-height: 0; -} - -/* tooltip { */ -/* background: #000000; */ -/* border-width: 2px; */ -/* border-style: solid; */ -/* border-color: #222222; */ -/* } */ - -#custom-language, -#idle_inhibitor, -#custom-updates, -#bluetooth, -#custom-caffeine, -#custom-weather, -#custom-nvidia-load, -#custom-nvidia-mem, -#window, -#clock, -#battery, -#pulseaudio, -#network, -#workspaces, -#tray, -#disk, -#memory, -#temperature, -#cpu, -#mpris, -#submap, -#workspaces, -#backlight { - background: rgba(0, 0, 0, .6); - color: #ffffff; - padding: 0px 10px; - /* margin-top: 0px; */ - /* margin-bottom: 0px; */ - /* margin-right: 3px; */ - /* margin-left: 3px; */ - /* border: 1px solid #000000; */ - margin: 0px 4px 0px 4px; -} - - -#workspaces { - padding: 0; - /* margin-left: 0; */ - /* margin-right: 0; */ -} -#workspaces button { - padding: 4px; - color: #aaaaaa; -} -#workspaces button.active { - color: #ffffff; - border-radius: 20px; - background: #0f0f0f; -} -#workspaces button.focused { - /* color: #a6adc8; */ - border-radius: 0px; - background: #eba0ac; -} -#workspaces button.urgent { - /* color: #11111b; */ - background: #a6e3a1; -} -#workspaces button:hover { - background: #11111b; - border-radius: 0px; - /* color: #cdd6f4; */ -} - -#pulseaudio.speaker { - /* color: #89b4fa; */ - margin-left: 0; - margin-right: 0; -} - -#pulseaudio.microphone { - /* color: #cba6f7; */ - margin-left: 0; - margin-right: 0; -} - -#idle_inhibitor { - margin-left: 0; - margin-right: 0; -} - -#backlight { - margin-left: 0; -} - -#submap { - background: #000000; - border: 1px solid #ffffff; - color: #ffffff; -} - - -/* #mpris { */ -/* font-family: "CartographCF italic"; */ -/* } */ - -#network { - /* margin-right: 0; */ -} - -#disk { - margin-right: 0; - margin-left: 0; -} - -#cpu { - /* margin-left: 0; */ - margin-right: 0; -} - -#temperature { - /* color: #f9afdb; */ - margin-right: 0; - margin-left: 0; -} - -#memory { - margin-left: 0; - margin-right: 0; -} - -#memory.low { - /* color: #f85754; */ -} - -#battery { - margin-left: 0; - margin-right: 0; -} - -#tray { - /* margin-left: 0; */ - margin-right: 0; -} - -tooltip, -window#waybar #tray menu { - color: #aaaaaa; - background: #000000; - border: 1px solid #888888; - border-radius: 0; - } - -#clock { - /* margin-left: 0; */ - margin-right: 0; -} - -/* #custom-gpu { */ -/* color: #f5c2e7; */ -/* } */ - -#window { - color: #ffffff; - text-shadow: 1px 0 #000, -1px 0 #000, 0 1px #000, 0 -1px #000, - 1px 1px #000, -1px -1px #000, 1px -1px #000, -1px 1px #000; - background: rgba(0, 0, 0, 0); - border: 0 -} - - -#bluetooth { - margin-left: 0; - margin-right: 0; -} - -#custom-weather { - margin-right: 0; -} - -#custom-nvidia-load { - margin-right: 0; - /* color: #afb8f9; */ -} - -#custom-nvidia-mem { - margin-left: 0; - /* color: #aff9b2; */ -} - diff --git a/dotfiles/waybar.jsonc b/dotfiles/waybar.jsonc deleted file mode 100644 index 3098a5d..0000000 --- a/dotfiles/waybar.jsonc +++ /dev/null @@ -1,234 +0,0 @@ -{ - "layer": "top", - "position": "bottom", - "exclusive": true, - "passtrough": false, - "gtk-layer-shell": true, - "height": 0, - "on-scroll-up": "hyprctl dispatch workspace e+1", - "on-scroll-down": "hyprctl dispatch workspace e-1", - "modules-left": [ - "hyprland/workspaces", - "pulseaudio#speaker", - "pulseaudio#microphone", - "idle_inhibitor", - "bluetooth", - "backlight", - "mpris", - "hyprland/submap", - "hyprland/window" - ], - "modules-center": [], - "modules-right": [ - // "custom/updates", - // "custom/nvidia-load", - // "custom/nvidia-mem", - "disk#2", - "network", - "disk", - "cpu", - "temperature", - "memory", - "battery", - // "custom/weather", - "tray", - "clock", - ], - - "backlight": { - "device": "intel_backlight", - "format": "{icon}", - "on-click": "light -S 100", - "on-click-right": "light -S 1", - "tooltip-format": "{percent}%", - "format-icons": ["󰛩", "󱩎", "󱩏", "󱩐", "󱩑", "󱩒", "󱩓", "󱩔", "󱩕", "󱩖", "󰛨"] - }, - - "idle_inhibitor": { - "format": "{icon}", - "format-icons": { - "activated": "󰈈", - "deactivated": "󰈉" - } - }, - - "bluetooth": { - "format": "󰂯", - "format-disabled": "󰂲", - "on-click": "rfkill toggle bluetooth", - "on-click-right": "alacritty --class floating -e bluetuith", - "tooltip-format": "{}" - }, - - - "mpris": { - "format": "{player_icon} {title}", - "format-paused": "{status_icon} {title}", - "player-icons": { - "default": "󰐊", - "mpv": "󰐍", - "spotify": "󰓇" - }, - "status-icons": { - "paused": "󰏤" - }, - // "ignored-players": ["mpv"] - }, - - "disk": { - "interval": 1, - "format": "󰋊 {free}", - "path": "/", - "on-click": "alacritty --class floating -e ncdu -x /" - }, - - "disk#2": { - "interval": 30, - "format": "{path} {free}", - "path": "/home/ant/storage", - "on-click": "alacritty --class floating -e ncdu -x /home/ant/storage" - }, - - "memory": { - "interval": 1, - "format": "󰧑 {percentage:2}%", - "tooltip-format": "{used:0.1f}G/{total:0.1f}G", - "states": { "low": 70 }, - "on-click": "notify-send \"$(printf \"%-20s %10s\\n\" \"COMMAND\" \"MEMORY USAGE\"; ps axo comm,rss | awk '{mem[$1]+=$2} END {for (cmd in mem) printf \"%-20s %5.2f MiB\\n\", cmd, mem[cmd]/1024}' | sort -k2nr | head -n10)\"" - }, - - "network": { - "interval": 1, - "format": "󰌙", - "format-disconnected": "󰌙", - "format-linked": "󰛵", - "format-ethernet": "󰓢 {bandwidthDownBytes:>} {bandwidthUpBytes:>}", - "format-wifi": "󰖩 {bandwidthDownBytes:>} {bandwidthUpBytes:>}", - "on-click": "wifi-toggle", - "on-right-click": "$TERMINAL --class floating -e nmtui", - "tooltip-format-ethernet": "{ipaddr}", - "tooltip-format-wifi": "{ipaddr}\n{essid}\n{signalStrength}" - }, - - "hyprland/window": { - "format": "{}", - "on-scroll-up": "hyprctl dispatch workspace e+1", - "on-scroll-down": "hyprctl dispatch workspace e-1", - }, - "hyprland/workspaces": { - "on-scroll-up": "hyprctl dispatch workspace e+1", - "on-scroll-down": "hyprctl dispatch workspace e-1", - "all-outputs": true, - "on-click": "activate", - "format": "{icon}", - "format-icons": { - "1": "0", - "2": "1", - "3": "2", - "4": "3", - "5": "4", - "6": "5", - "7": "6", - "8": "7", - "9": "8", - "10": "9", - // "urgent": "", - // "active": "", - // "default": "" - } - }, - "cpu": { - "interval": 1, - "format": "󰘚 {usage:2}%", - "max-length": 10, - "on-click": "alacritty --class floating -e htop" - }, - "custom/updates": { - "exec": "pacman -Quq | wc -l | sed 's/^0$//'", - "interval": 60, - "format": "󰮯 {}" - }, - "battery": { - "interval": 30, - "states": { - "warning": 30, - "critical": 15 - }, - "format-charging": "󰂅 {capacity:2}%", - "format": "{icon} {capacity:2}%", - "format-icons": ["󰂎", "󰁺", "󰁻", "󰁼", "󰁽", "󰁾", "󰁿", "󰂀", "󰂁", "󰂂", "󰁹"], - "tooltip": true - }, - "custom/weather" : { - "tooltip" : true, - "format" : "{}", - "restart-interval" : 300, - "exec" : "~/.config/waybar/scripts/waybar-wttr.py", - "return-type" : "json" - }, - "tray": { - "icon-size": 13, - // "tooltip": false, - "spacing": 10 - }, - "clock": { - "min-length": 10, - "interval": 1, - "format": "{:%d/%m %H:%M:%S}", - "timezones": ["Europe/Paris"], - "tooltip-format": "{:%Y %B}\n{calendar}", - "actions": { - "on-scroll-up": "tz_up", - "on-scroll-down": "tz_down" - } - }, - "pulseaudio#speaker": { - "format": "{icon} {volume}%", - "tooltip": false, - "format-muted": "󰖁", - "on-click": "pamixer -t", - // "on-click-right": "pamixer -t", - "on-scroll-up": "pamixer -i 5", - "on-scroll-down": "pamixer -d 5", - "scroll-step": 5, - "format-icons": { - "headphone": "󰋋", - "hands-free": "󰋋", - "headset": "󰋋", - "phone": "󰏲", - "portable": "󰏲", - "car": "󰄋", - "default": ["󰕿", "󰖀", "󰕾"] - } - }, - "pulseaudio#microphone": { - "format": "{format_source}", - "tooltip": false, - "format-source": "󰍬 {volume}%", - "format-source-muted": "󰍭", - "on-click": "pamixer --default-source -t", - "on-scroll-up": "pamixer --default-source -i 5", - "on-scroll-down": "pamixer --default-source -d 5", - "scroll-step": 5 - }, - "hyprland/submap": { - "format": "(l)ock, (e)xit, (s)uspend, (h)ibernate, (r)eboot, (S)hutdown" - }, - "custom/nvidia-load": { - "exec": ".config/waybar/scripts/nvidia-load.py", - "interval": 5, - "return-type": "json", - "format": "{}", - "tooltip": "{tooltip}", - "on-click": "alacritty --class floating -e nvtop" - }, - "custom/nvidia-mem": { - "exec": ".config/waybar/scripts/nvidia-mem.py", - "interval": 5, - "return-type": "json", - "format": "{}", - "tooltip": "{tooltip}", - "on-click": "alacritty --class floating -e nvtop" - } -} - diff --git a/dunstconfig.nix b/dunstconfig.nix deleted file mode 100644 index 883decb..0000000 --- a/dunstconfig.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ - global = { - geometry = "750x5-20+20"; - horizontal_padding = 8; - indicate_hidden = true; - shrink = true; - transparency = 20; - separator_height = 2; - frame_width = 3; - frame_color = "#000000"; - font = "Monospace 11"; - alignment = "left"; - show_age_threshold = 60; - background = "#ffffff"; - foreground = "#000000"; - }; - - - urgency_critical = { - background = "#ff9999"; - }; -} diff --git a/fish.nix b/fish.nix index cc033e9..6967450 100644 --- a/fish.nix +++ b/fish.nix @@ -1,111 +1,113 @@ { pkgs, ... }: { - enable = true; - loginShellInit = '' - set -gx fish_greeting - if test $(tty) = /dev/tty1 - Hyprland - end - ''; - - interactiveShellInit = '' - # bind ctrl+s to fg - set -gx fish_greeting - bind \cz 'fg 2>/dev/null; commandline -f repaint' - set -x DIRENV_LOG_FORMAT "" - ''; - - functions = { - # use "e" to open the text editor. if e job is paused, return to it - e.body = '' - jobs -c | grep $EDITOR \ - || $EDITOR $argv \ - && fg 2>/dev/null; commandline -f repaint + programs.fish = { + enable = true; + loginShellInit = '' + set -gx fish_greeting + if test $(tty) = /dev/tty1 + Hyprland + end ''; - lfcd.body = '' - set tmp (mktemp) - # `command` is needed in case `lfcd` is aliased to `lf` - command lf -last-dir-path=$tmp $argv - if test -f "$tmp" - set dir (cat $tmp) - rm -f $tmp - if test -d "$dir" - if test "$dir" != (pwd) - cd $dir + + interactiveShellInit = '' + # bind ctrl+s to fg + set -gx fish_greeting + bind \cz 'fg 2>/dev/null; commandline -f repaint' + set -x DIRENV_LOG_FORMAT "" + ''; + + functions = { + # use "e" to open the text editor. if e job is paused, return to it + e.body = '' + jobs -c | grep $EDITOR \ + || $EDITOR $argv \ + && fg 2>/dev/null; commandline -f repaint + ''; + lfcd.body = '' + set tmp (mktemp) + # `command` is needed in case `lfcd` is aliased to `lf` + command lf -last-dir-path=$tmp $argv + if test -f "$tmp" + set dir (cat $tmp) + rm -f $tmp + if test -d "$dir" + if test "$dir" != (pwd) + cd $dir + end + end + end + ''; + upgrade-nix.body = '' + sudo nix-channel --update + sudo nixos-rebuild switch &| ${pkgs.nix-output-monitor}/bin/nom + nix-env -u '.*' + home-manager switch &| ${pkgs.nix-output-monitor}/bin/nom + ''; + fish_prompt.body = '' + set -l last_pipestatus $pipestatus + set -lx __fish_last_status $status # Export for __fish_print_pipestatus. + set -l normal (set_color normal) + set -q fish_color_status + or set -g fish_color_status red + + # Color the prompt differently when we're root + set -l color_cwd $fish_color_cwd + set -l suffix '>' + if functions -q fish_is_root_user; and fish_is_root_user + if set -q fish_color_cwd_root + set color_cwd $fish_color_cwd_root end + set suffix '#' end - end - ''; - upgrade-nix.body = '' - sudo nix-channel --update - sudo nixos-rebuild switch &| ${pkgs.nix-output-monitor}/bin/nom - nix-env -u '.*' - home-manager switch &| ${pkgs.nix-output-monitor}/bin/nom - ''; - fish_prompt.body = '' - set -l last_pipestatus $pipestatus - set -lx __fish_last_status $status # Export for __fish_print_pipestatus. - set -l normal (set_color normal) - set -q fish_color_status - or set -g fish_color_status red - # Color the prompt differently when we're root - set -l color_cwd $fish_color_cwd - set -l suffix '>' - if functions -q fish_is_root_user; and fish_is_root_user - if set -q fish_color_cwd_root - set color_cwd $fish_color_cwd_root + # Write pipestatus + # If the status was carried over (if no command is issued or if `set` leaves the status untouched), don't bold it. + set -l bold_flag --bold + set -q __fish_prompt_status_generation; or set -g __fish_prompt_status_generation $status_generation + if test $__fish_prompt_status_generation = $status_generation + set bold_flag end - set suffix '#' - end + set __fish_prompt_status_generation $status_generation + set -l status_color (set_color $fish_color_status) + set -l statusb_color (set_color $bold_flag $fish_color_status) + set -l prompt_status (__fish_print_pipestatus "[" "]" "|" "$status_color" "$statusb_color" $last_pipestatus) - # Write pipestatus - # If the status was carried over (if no command is issued or if `set` leaves the status untouched), don't bold it. - set -l bold_flag --bold - set -q __fish_prompt_status_generation; or set -g __fish_prompt_status_generation $status_generation - if test $__fish_prompt_status_generation = $status_generation - set bold_flag - end - set __fish_prompt_status_generation $status_generation - set -l status_color (set_color $fish_color_status) - set -l statusb_color (set_color $bold_flag $fish_color_status) - set -l prompt_status (__fish_print_pipestatus "[" "]" "|" "$status_color" "$statusb_color" $last_pipestatus) + # direnv status + set -l direnv_status (direnv status | grep -q "Found RC path" && echo " direnv") - # direnv status - set -l direnv_status (direnv status | grep -q "Found RC path" && echo " direnv") + # echo -n -s (prompt_login)' ' (set_color $color_cwd) (prompt_pwd) $normal (fish_vcs_prompt) \ + echo -n -s (set_color $color_cwd) (prompt_pwd) $normal (fish_vcs_prompt) \ + (set_color -i yellow) $direnv_status $normal " "$prompt_status " "$suffix " " + ''; + }; - # echo -n -s (prompt_login)' ' (set_color $color_cwd) (prompt_pwd) $normal (fish_vcs_prompt) \ - echo -n -s (set_color $color_cwd) (prompt_pwd) $normal (fish_vcs_prompt) \ - (set_color -i yellow) $direnv_status $normal " "$prompt_status " "$suffix " " - ''; + shellAliases = { + ls = "ls -hN --color=auto --group-directories-first"; + grep = "grep --color=auto"; + diff = "diff --color=auto"; + bt = "bluetuith"; + hm = "home-manager"; + hms = "home-manager switch"; + dev = "nix develop -c fish"; + gparted = "nix-shell -p pkgs.gparted --run 'sudo -E gparted'"; + ns = "nix-shell"; + nsp = "nix shell nixpkgs#"; + f = "lfcd"; + sxiv = "nsxiv"; + del = "trash -rf"; + rsyncp = "rsync --info=progress2 --no-inc-recursive"; + }; + + plugins = [ + { + name = "fish-lf-icons"; + src = pkgs.fetchFromGitHub { + owner = "joshmedeski"; + repo = "fish-lf-icons"; + rev = "d1c47b2088e0ffd95766b61d2455514274865b4f"; + sha256 = "sha256-6po/PYvq4t0K8Jq5/t5hXPLn80iyl3Ymx2Whme/20kc="; + }; + } + ]; }; - - shellAliases = { - ls = "ls -hN --color=auto --group-directories-first"; - grep = "grep --color=auto"; - diff = "diff --color=auto"; - bt = "bluetuith"; - hm = "home-manager"; - hms = "home-manager switch &| nom"; - dev = "nix develop -c fish"; - gparted = "nix-shell -p pkgs.gparted --run 'sudo -E gparted'"; - ns = "nix-shell"; - nsp = "nix shell nixpkgs#"; - f = "lfcd"; - sxiv = "nsxiv"; - del = "trash -rf"; - rsyncp = "rsync --info=progress2 --no-inc-recursive"; - }; - - plugins = [ - { - name = "fish-lf-icons"; - src = pkgs.fetchFromGitHub { - owner = "joshmedeski"; - repo = "fish-lf-icons"; - rev = "d1c47b2088e0ffd95766b61d2455514274865b4f"; - sha256 = "sha256-6po/PYvq4t0K8Jq5/t5hXPLn80iyl3Ymx2Whme/20kc="; - }; - } - ]; } diff --git a/flake.nix b/flake.nix index 1d8bc56..69ec848 100644 --- a/flake.nix +++ b/flake.nix @@ -1,5 +1,5 @@ { - description = "Home Manager configuration of ant"; + description = "Home Manager configuration"; inputs = { # Specify the source of Home Manager and Nixpkgs. @@ -8,16 +8,12 @@ url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; - hyprfocus.url = "github:VortexCoyote/hyprfocus"; }; - outputs = { nixpkgs, home-manager, hyprfocus, ... }: + outputs = { nixpkgs, home-manager, ... }: let system = "x86_64-linux"; pkgs = nixpkgs.legacyPackages.${system}; - flakes-pkgs = { - hyprfocus = hyprfocus.packages.${pkgs.system}.hyprfocus; - }; in { homeConfigurations."ant" = home-manager.lib.homeManagerConfiguration { inherit pkgs; @@ -27,12 +23,6 @@ modules = [ ./home.nix ]; - - # Optionally use extraSpecialArgs - # to pass through arguments to home.nix - extraSpecialArgs = { - inherit flakes-pkgs; - }; }; }; } diff --git a/gaming.nix b/gaming.nix new file mode 100644 index 0000000..12b1fb6 --- /dev/null +++ b/gaming.nix @@ -0,0 +1,14 @@ +{ lib, config, pkgs, ... }: { + + # nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ + # "lutris" + # ]; +nixpkgs.config = { allowUnfree = true; }; + + home.packages = with pkgs; [ + lutris + mangohud + prismlauncher + heroic + ]; +} diff --git a/gui-software.nix b/gui-software.nix new file mode 100644 index 0000000..db7c1a7 --- /dev/null +++ b/gui-software.nix @@ -0,0 +1,35 @@ +{ lib, cnfig, pkgs, ... }: { + home.packages = with pkgs; [ + betterbird + nsxiv + ]; + programs.mpv = { + enable = true; + config = { + keep-open = "yes"; + osd-bar = "no"; + }; + + scripts = with pkgs.mpvScripts; [ + uosc + thumbfast + mpris + ]; + }; + + # programs.chromium = { + # enable = true; + # package = pkgs.ungoogled-chromium; + # dictioaries = [ + # pkgs.hunspellDictsChromium.en_US + # pkgs.hunspellDictsChromium.fr_FR + # ]; + # extensions = [ + # { id = "cjpalhdlnbpafiamejdnhcphjbkeiagm"; } # ublock origin + # { id = "hfjbmagddngcpeloejdejnfgbamkjaeg"; } # vimium C + # ]; + # }; + + programs.firefox.enable = true; + programs.zathura.enable = true; +} diff --git a/home.nix b/home.nix index f4f32b5..d06f8cb 100644 --- a/home.nix +++ b/home.nix @@ -1,102 +1,48 @@ -let user = import ./name.nix; in -{ config, pkgs, flakes-pkgs, ... }: +{ inputs, config, lib, pkgs, flakes-pkgs, ... }: { + + imports = [ + ./lf.nix + ./fish.nix + ./ui.nix + ./terminal-software.nix + ./gui-software.nix + ./gaming.nix + ]; + # Home Manager needs a bit of information about you and the paths it should # manage. - home.username = user; - home.homeDirectory = "/home/${user}"; + home.username = "ant"; + home.homeDirectory = "/home/${config.home.username}"; - # This value determines the Home Manager release that your configuration is - # compatible with. This helps avoid breakage when a new Home Manager release - # introduces backwards incompatible changes. - # - # You should not change this value, even if you update Home Manager. If you do - # want to update the value, then make sure to first check the Home Manager - # release notes. home.stateVersion = "23.05"; # Please read the comment before changing. - # The home.packages option allows you to install Nix packages into your - # environment. home.packages = with pkgs; [ - betterbird + nh python3 python3Packages.virtualenv nodePackages.pyright - dunst - ncdu - nsxiv - wl-clipboard - pamixer - pulsemixer - bluez - bluetuith - wtype - dmenu - keepmenu - dtrx - trash-cli - rofimoji - nnn + # bluez go-mtpfs - nix-output-monitor - libnotify - qbittorrent - go - unzip - pandoc - gnumake xdg-utils - entr - # xdg-desktop-portal-wlr - xdg-desktop-portal-hyprland - (catppuccin-gtk.override { - accents = [ "pink" ]; - size = "compact"; - tweaks = [ "black" ]; - variant = "mocha"; - }) davfs2 - htop - yt-dlp - ffmpeg - wget - - lua-language-server - inter - material-design-icons - (nerdfonts.override { fonts = [ "CascadiaCode" "Noto" "Hack" ]; }) - devenv ]; - # Home Manager is pretty good at managing dotfiles. The primary way to manage - # plain files is through 'home.file'. - home.file = { - # ".config/fontconfig/fonts.conf".source = dotfiles/fonts.conf; - - ".config/waybar/config.jsonc".source = dotfiles/waybar.jsonc; - ".config/waybar/style.css".source = dotfiles/waybar.css; - - # ".config/kitty/kitty.conf".source = dotfiles/kitty/kitty.conf; ".config/kitty/light.conf".source = dotfiles/kitty/light.conf; ".config/kitty/dark.conf".source = dotfiles/kitty/dark.conf; ".config/rofi/colors-dark.rasi".source = dotfiles/rofi/colors-dark.rasi; ".config/rofi/colors-light.rasi".source = dotfiles/rofi/colors-light.rasi; - # ".config/rofi/config.rasi".source = dotfiles/rofi/config.rasi; ".config/rofi/theme.rasi".source = dotfiles/rofi/theme.rasi; - # ".config/dunst/dunstrc".source = dotfiles/dunstrc; - ".config/keepmenu/config.ini".source = dotfiles/keepmenu.ini; ".bin/runmenu".source = pkgs.writers.writeBash "runmenu" '' ${config.programs.rofi.package}/bin/rofi -matching normal -sort -show run ''; - # ".bin/wl".source = bin/wl; - ".bin/window_dir".source = pkgs.writers.writeBash "window_dir" '' PID=$(${pkgs.hyprland}/bin/hyprctl activewindow | grep pid | cut -d' ' -f 2) PID=$(echo $(ps --ppid $PID -o pid | tail -n1)) @@ -170,14 +116,13 @@ let user = import ./name.nix; in ]; home.sessionVariables = { - NIXOS_OZONE_WL = "1"; - EDITOR = "nvim"; - TERMINAL = "kitty"; - TERM = "kitty"; - NNN_TRASH = 1; + # EDITOR = "nvim"; + # TERMINAL = "kitty"; + # TERM = "kitty"; GOPATH = "${config.home.homeDirectory}/.local/share/go"; GOMODCACHE = "${config.home.homeDirectory}/.cache/go/pkg/mod"; + NIXOS_OZONE_WL = "1"; GDK_BACKEND = "wayland,x11"; QT_QPA_PLATFORM = "wayland;xcb"; CLUTTER_BACKEND = "wayland"; @@ -193,22 +138,9 @@ let user = import ./name.nix; in "caps:escape" ]; - # xsession.enable = true; - # xsession.windowManager.command = "${pkgs.fish}/bin/fish --login"; - - - - - wayland.windowManager.hyprland = (import ./hyprland.nix) { pkgs = pkgs; flakes-pkgs = flakes-pkgs; }; - xdg = { enable = true; systemDirs.data = [ "${config.home.homeDirectory}/.local/share" ]; - # portal = { - # enable = true; - # configPackage = pkgs.xdg-desktop-portal-hyprland; - # xdgOpenUsePortal = true; - # }; userDirs = { enable = true; createDirectories = false; @@ -226,297 +158,8 @@ let user = import ./name.nix; in }; }; + services.gnome-keyring.enable = true; services.syncthing.enable = true; - - systemd.user.services = { - battery-notify = { - Unit = { - Description = "Send notification when battery is low"; - Wants = "battery-timer.timer"; - }; - Service = { - Type = "oneshot"; - ExecStart = "${pkgs.writers.writeBash "battery-notify" '' - # ${pkgs.libnotify}/bin/notify-send $(${pkgs.coreutils}/bin/cat /sys/class/power_supply/BAT0/capacity) - if [[ $(${pkgs.coreutils}/bin/cat /sys/class/power_supply/BAT0/capacity) -lt 10 ]]; then - ${pkgs.libnotify}/bin/notify-send -u critical "Battery is low" - fi - '' }"; - }; - }; - }; - - - systemd.user.timers = { - battery-timer = { - Unit = { - Description = "Execute battery-notify every minute"; - }; - Install = { - # enable the service - # WantedBy = [ "default.target" ]; - }; - Timer = { - Unit = "battery-notify.service"; - OnCalendar = "*-*-* *:*:00"; - }; - }; - }; - - # services.darkman = { - # enable = true; - # - # lightModeScripts = { - # gtk-theme = '' - # ${pkgs.dconf}/bin/dconf write \ - # /org/gnome/desktop/interface/color-scheme "'prefer-light'" - # ''; - # # my-python-script = pkgs.writers.writePython3 "my-python-script" { } '' - # # print('Do something!') - # # ''; - # }; - # - # darkModeScripts = { - # gtk-theme = '' - # ${pkgs.dconf}/bin/dconf write \ - # /org/gnome/desktop/interface/color-scheme "'prefer-dark'" - # ''; - # # my-python-script = pkgs.writers.writePython3 "my-python-script" { } '' - # # print('Do something!') - # # ''; - # }; - # - # settings = { - # lat = 52.3; - # lng = 4.8; - # usegeoclue = true; - # }; - # }; - - fonts.fontconfig.enable = true; - gtk = { - enable = true; - font = { - package = pkgs.inter; - name = "Inter"; - }; - theme = { - name = "Catppuccin-Latte-Compact-Pink-Light"; - # name = "Catppuccin-Mocha-Compact-Pink-Dark"; - package = pkgs.catppuccin-gtk.override { - accents = [ "pink" ]; - size = "compact"; - tweaks = [ ]; - variant = "latte"; - }; - }; - iconTheme = { - name = "Adwaita"; - package = pkgs.gnome.adwaita-icon-theme; - }; - cursorTheme = { - name = "Hackneyed"; - package = pkgs.hackneyed; - }; - }; - - qt = { - enable = true; - platformTheme.name = "kde"; - }; - - programs.direnv = { - enable = true; - nix-direnv.enable = true; - }; - - programs.rofi = { - enable = true; - package = pkgs.rofi-wayland; - plugins = [ pkgs.rofi-calc pkgs.rofi-emoji ]; - # extraConfig = { - # "@theme" = "\"theme.rasi\""; - # }; - theme = "theme.rasi"; - }; - - programs.pistol.enable = true; - programs.lf = - (import ./lf.nix) { config = config; pkgs = pkgs; }; - programs.fish = (import ./fish.nix) pkgs; - - services.dunst.enable = true; - services.dunst.settings = import ./dunstconfig.nix; services.kdeconnect.enable = true; - - # programs.chromium = { - # enable = true; - # package = pkgs.ungoogled-chromium; - # dictioaries = [ - # pkgs.hunspellDictsChromium.en_US - # pkgs.hunspellDictsChromium.fr_FR - # ]; - # extensions = [ - # { id = "cjpalhdlnbpafiamejdnhcphjbkeiagm"; } # ublock origin - # { id = "hfjbmagddngcpeloejdejnfgbamkjaeg"; } # vimium C - # ]; - # }; - - programs.swaylock = { - enable = true; - package = pkgs.swaylock-effects; - # --screenshots \ - # --clock \ - # --indicator \ - # --indicator-radius 100 \ - # --indicator-thickness 7 \ - # --effect-blur 7x5 \ - # --effect-vignette 0.5:0.5 \ - # --ring-color bb00cc \ - # --key-hl-color 880033 \ - # --line-color 00000000 \ - # --inside-color 00000088 \ - # --separator-color 00000000 \ - # --grace 2 \ - # --fade-in 0.2 - settings = { - screenshots = true; - # clock = true; - font = "Sans:bold"; - disable-caps-lock-text = true; - effect-blur = "7x5"; - text-color = "ffffff"; - layout-text-color = "ffffff"; - - ring-color = "000000"; - key-hl-color = "dddddd"; - line-color = "00000000"; - inside-color = "00000088"; - separator-color = "00000000"; - - ring-clear-color = "00000000"; - line-clear-color = "00000000"; - inside-clear-color = "00000000"; - text-clear-color = "00000000"; - }; - }; - - services.swayidle = { - enable = true; - - events = [{ - event = "before-sleep"; - command = "${config.programs.swaylock.package}/bin/swaylock -defF"; - } - { - event = "after-resume"; - command = "${config.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms on"; - } - { - event = "lock"; - command = "${config.programs.swaylock.package}/bin/swaylock -defF"; - }]; - - timeouts = [{ - timeout = 900; - command = "${config.programs.swaylock.package}/bin/swaylock -defF"; - } - { - timeout = 900; - command = "${config.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms off"; - }]; - }; - - # services.swayidle = { - # enable = true; - # events = [ - # { event = "after-resume"; command = "${pkgs.hyprland}/bin/hyprctl dispatch dpms on"; } - # ]; - # timeouts = [{ - # timeout = 10; - # command = - # "${pkgs.hyprland}/bin/hyprctl dispatch dpms off & swaylock"; - # }]; - # - # }; - - programs.kitty = { - enable = true; - font.name = "monospace"; - font.size = 12; - settings = { - cursor_shape = "block"; - default_pointer_shape = "arrow"; - pointer_shape_when_dragging = "arrow"; - enable_audio_bell = false; - placement_strategy = "top-left"; - remember_window_size = false; - initial_window_width = 1300; - initial_window_height = 800; - confirm_os_window_close = 0; - resize_debounce_time = "0.1 0.1"; - }; - keybindings = { - "ctrl+shift+equal" = "change_font_size all +0.5"; - "ctrl+shift+plus" = "change_font_size all +0.5"; - "ctrl+shift+kp_add" = "change_font_size all +0.5"; - "ctrl+shift+minus" = "change_font_size all -0.5"; - "ctrl+shift+kp_subtract" = "change_font_size all -0.5"; - }; - shellIntegration.enableFishIntegration = true; - shellIntegration.mode = "no-cursor"; - extraConfig = '' - include colors.conf - ''; - }; - - programs.neovim = { - enable = true; - viAlias = true; - defaultEditor = true; - extraPackages = with pkgs; [ - nodejs_22 - gcc - ocamlPackages.lsp - ocamlPackages.ocamlformat - # rnix-lsp - cargo - ]; - }; - - programs.mpv = { - enable = true; - config = { - keep-open = "yes"; - osd-bar = "no"; - }; - - scripts = with pkgs.mpvScripts; [ - uosc - thumbfast - mpris - ]; - }; - - programs.waybar.enable = true; - programs.firefox.enable = true; - programs.zathura.enable = true; - programs.tmux = { - enable = true; - historyLimit = 600000; - escapeTime = 10; - keyMode = "vi"; - mouse = true; - extraConfig = '' - unbind-key 'Space' - bind-key 'Space' copy-mode - ''; - }; - programs.git = { - enable = true; - userName = user; - userEmail = "${user}@domain.xyz"; - }; - programs.home-manager.enable = true; } diff --git a/hyprland.nix b/hyprland.nix index 543981c..b63a442 100644 --- a/hyprland.nix +++ b/hyprland.nix @@ -1,326 +1,348 @@ -{ pkgs, flakes-pkgs }: -{ - enable = true; - xwayland.enable = true; - -# plugins = [ -# "${flakes-pkgs.hyprfocus}/lib/libhyprfocus.so" -# ]; - systemd.enable = true; - systemd.variables = [ - "GDK_BACKEND=wayland,x11" - "QT_QPA_PLATFORM=\"wayland;xcb\"" - "SDL_VIDEODRIVER=wayland" - "CLUTTER_BACKEND=wayland" - "XDG_CURRENT_DESKTOP=Hyprland" - "XDG_SESSION_TYPE=wayland" - "XDG_SESSION_DESKTOP=Hyprland" - "QT_AUTO_SCREEN_SCALE_FACTOR=1" - "WLR_NO_HARDWARE_CURSORS=1" - "XCURSOR_SIZE=24" - ]; - - - settings = { - input = { - kb_layout = "fr"; - kb_variant = ""; - kb_model = "pc105"; - kb_options = "caps:super"; - kb_rules = ""; - - touchpad = { - natural_scroll = "no"; - }; - - sensitivity = 0.0; - numlock_by_default = true; - - repeat_delay = 200; - repeat_rate = 50; - force_no_accel = true; - follow_mouse = 2; - }; - - general = { - gaps_in = 0; - gaps_out = 0; - border_size = 0; - "col.active_border" = "rgb(000000)"; - "col.inactive_border" = "rgba(00000000)"; - layout = "dwindle"; - }; - - decoration = { - blur = { - enabled = false; - }; - drop_shadow = true; - shadow_range = 8; - shadow_render_power = 4; - "col.shadow_inactive" = "rgba(1a1a1a33)"; - "col.shadow" = "rgba(1a1a1aee)"; - }; - - animations = { - enabled = true; - bezier = "myBezier, 0, 0, .58, 1"; - animation = "global, 1, 1, myBezier"; - }; - - dwindle = { - pseudotile = true; - preserve_split = true; - force_split = 2; - # no_gaps_when_only = true; - }; - - master = { - new_is_master = true; - }; - - gestures = { - workspace_swipe = "off"; - }; - - misc = { - disable_hyprland_logo = true; - enable_swallow = true; - mouse_move_enables_dpms = true; - key_press_enables_dpms = true; - # swallow_regex = "^(Alacritty)(.*)$"; - # swallow_regex = "^(kitty)(.*)$"; - }; - - - windowrule = "float, floating"; - - "$mod" = "SUPER"; - - bind = [ - "$mod, q, killactive" - "$mod SHIFT, q, exec, kill -9 $(hyprctl activewindow | grep pid | grep -E -o '[0-9]+$')" - "$mod, a, togglefloating" - "$mod SHIFT, a, workspaceopt, allfloat" - "$mod, Tab, togglesplit" - "$mod, P, pseudo" - "$mod, f, fullscreen" - "$mod SHIFT, f, fakefullscreen" - - "$mod, Return, exec, kitty" - "$mod SHIFT, e, exec, rofimoji" - "$mod, c, exec, rofi -show calc -modi calc -no-show-match -no-sort" - "$mod, e, exec, $TERMINAL -e lf" - "$mod SHIFT, Return, exec, kitty --working-directory \"$(window_dir)\"" - "$mod, w, exec, firefox" - "$mod SHIFT, w, exec, firefox --private-window" - "$mod SHIFT, s, exec, TMP=$(rofi -dmenu -p \"nix search\") && firefox \"https://search.nixos.org/packages?channel=unstable&query=$TMP\"" - "$mod SHIFT, e, exec, $(rofi -dmenu -p \"command\" -l 0)" - "$mod, m, exec, kitty --class floating -e pulsemixer" - "$mod, d, exec, ~/.bin/runmenu" - "$mod, x, exec, keepmenu" - "$mod, z, exec, tmux new -spopup_terminal -d; kitty --class floating -e tmux a -t popup_terminal" - "$mod, f11, exec, ocrzone" - "$mod, f12, exec, kitty --class floating -e nmtui" - "$mod, f2, exec, dark" - "$mod, f3, exec, hyprctl reload" - "$mod, f4, exec, rofi-udisk" - "$mod, f5, exec, mount-android" - - ",XF86AudioRaiseVolume, exec, pamixer -i 5" - ",XF86AudioLowerVolume, exec, pamixer -d 5" - ",XF86AudioMute, exec, pamixer -t" - ",XF86AudioMicMute, exec, pamixer -t --default-source" - - ",XF86MonBrightnessUp, exec, light -A 10" - ",XF86MonBrightnessDown, exec, light -U 10" - - "$mod,Print, exec, screenshot" - - "$mod, agrave, submap, power" - - "$mod, h, movefocus, l" - "$mod, l, movefocus, r" - "$mod, k, movefocus, u" - "$mod, j, movefocus, d" - - "$mod, Left, movefocus, l" - "$mod, Right, movefocus, r" - "$mod, Up, movefocus, u" - "$mod, Down, movefocus, d" - - "$mod SHIFT, h, movewindow, l" - "$mod SHIFT, l, movewindow, r" - "$mod SHIFT, k, movewindow, u" - "$mod SHIFT, j, movewindow, d" - - "$mod SHIFT, Left, movewindow, l" - "$mod SHIFT, Right, movewindow, r" - "$mod SHIFT, Up, movewindow, u" - "$mod SHIFT, Down, movewindow, d" - - "$mod, twosuperior, workspace, 1" - "$mod, ampersand, workspace, 2" - "$mod, eacute, workspace, 3" - "$mod, quotedbl, workspace, 4" - "$mod, apostrophe, workspace, 5" - "$mod, parenleft, workspace, 6" - "$mod, minus, workspace, 7" - "$mod, egrave, workspace, 8" - "$mod, underscore, workspace, 9" - "$mod, ccedilla, workspace, 10" - "$mod, rarenright, workspace, 11" - - "$mod SHIFT, twosuperior, movetoworkspacesilent, 1" - "$mod SHIFT, ampersand, movetoworkspacesilent, 2" - "$mod SHIFT, eacute, movetoworkspacesilent, 3" - "$mod SHIFT, quotedbl, movetoworkspacesilent, 4" - "$mod SHIFT, apostrophe, movetoworkspacesilent, 5" - "$mod SHIFT, parenleft, movetoworkspacesilent, 6" - "$mod SHIFT, minus, movetoworkspacesilent, 7" - "$mod SHIFT, egrave, movetoworkspacesilent, 8" - "$mod SHIFT, underscore, movetoworkspacesilent, 9" - "$mod SHIFT, ccedilla, movetoworkspacesilent, 10" - "$mod SHIFT, rarenright, movetoworkspacesilent, 11" - ]; - - bindm = [ - "$mod, mouse:272, movewindow" - "$mod, mouse:273, resizewindow" - ]; - - binde = [ - "$mod SHIFT, h, moveactive, -60 0" - "$mod SHIFT, l, moveactive, 60 0" - "$mod SHIFT, k, moveactive, 0 -60" - "$mod SHIFT, j, moveactive, 0 60" - "$mod CTRL, h, resizeactive, -60 0" - "$mod CTRL, l, resizeactive, 60 0" - "$mod CTRL, k, resizeactive, 0 -60" - "$mod CTRL, j, resizeactive, 0 60" - - "$mod SHIFT, Left, moveactive, -60 0" - "$mod SHIFT, Right, moveactive, 60 0" - "$mod SHIFT, Up, moveactive, 0 -60" - "$mod SHIFT, Down, moveactive, 0 60" - "$mod CTRL, Left, resizeactive, -60 0" - "$mod CTRL, Right, resizeactive, 60 0" - "$mod CTRL, Up, resizeactive, 0 -60" - "$mod CTRL, Down, resizeactive, 0 60" - ]; - -# plugin:hyprfocus { -# enabled = no; -# -# keyboard_focus_animation = shrink -# mouse_focus_animation = flash -# -# bezier = bezIn, 0.5,0.0,1.0,0.5 -# bezier = bezOut, 0.0,0.5,0.5,1.0 -# -# flash { -# flash_opacity = 0.7 -# -# in_bezier = bezIn -# in_speed = 0.5 -# -# out_bezier = bezOut -# out_speed = 3 -# } -# -# shrink { -# shrink_percentage = 0.8 -# -# in_bezier = bezIn -# in_speed = 0.5 -# -# out_bezier = bezOut -# out_speed = 3 -# } -# } - -# "plugin:hyprfocus" = { -# enabled = true; - -# keyboard_focus_animation = "flash"; -# mouse_focus_animation = "nothing"; - -# bezier = "bezIn, 0.5,0.0,1.0,0.5"; -# # bezier = "bezOut, 0.0,0.5,0.5,1.0"; - -# flash = { -# shrink_percentage = 0.8; - -# in_bezier = "bezIn"; -# in_speed = 0.5; - -# out_bezier = "bezIn"; -# out_speed = 3; -# }; - -# shrink = { -# shrink_percentage = 0.8; - -# in_bezier = "bezIn"; -# in_speed = 0.5; - -# out_bezier = "bezIn"; -# out_speed = 3; -# }; -# }; +{ config, lib, pkgs, ... }: { + home.packages = with pkgs; [ xdg-desktop-portal-hyprland ]; + home.sessionVariables = { + NIXOS_OZONE_WL = "1"; + GDK_BACKEND = "wayland,x11"; + QT_QPA_PLATFORM = "wayland;xcb"; + CLUTTER_BACKEND = "wayland"; + XDG_CURRENT_DESKTOP = "Hyprland"; + XDG_SESSION_TYPE = "wayland"; + XDG_SESSION_DESKTOP = "Hyprland"; + QT_AUTO_SCREEN_SCALE_FACTOR = "1"; + WLR_NO_HARDWARE_CURSORS = "1"; + XCURSOR_SIZE = "24"; }; - extraConfig = - let swaybgScript = (pkgs.writers.writeFish "display-background" '' - # find background image: only file in ~/.local/share/bg - set -l bg (find ~/.local/share/bg -type l) + wayland.windowManager.hyprland = { + enable = true; + xwayland.enable = true; - ${pkgs.swaybg}/bin/swaybg -m fill -i $bg + # plugins = [ + # "${flakes-pkgs.hyprfocus}/lib/libhyprfocus.so" + # ]; + systemd.enable = true; + systemd.variables = [ + "GDK_BACKEND=wayland,x11" + "QT_QPA_PLATFORM=\"wayland;xcb\"" + "SDL_VIDEODRIVER=wayland" + "CLUTTER_BACKEND=wayland" + "XDG_CURRENT_DESKTOP=Hyprland" + "XDG_SESSION_TYPE=wayland" + "XDG_SESSION_DESKTOP=Hyprland" + "QT_AUTO_SCREEN_SCALE_FACTOR=1" + "WLR_NO_HARDWARE_CURSORS=1" + "XCURSOR_SIZE=24" + ]; - # set background - # ${pkgs.nix}/bin/nix-shell \ - # -p pkgs.rubyPackages.gdk_pixbuf2 \ - # --run "${pkgs.swaybg}/bin/swaybg -m fill -i $bg" - ''); - in - '' - # env = GDK_BACKEND,wayland,x11 - # env = QT_QPA_PLATFORM,wayland;xcb - # env = SDL_VIDEODRIVER,wayland - # env = CLUTTER_BACKEND,wayland - # - # env = XDG_CURRENT_DESKTOP,Hyprland - # env = XDG_SESSION_TYPE,wayland - # env = XDG_SESSION_DESKTOP,Hyprland - # env = QT_AUTO_SCREEN_SCALE_FACTOR,1 - monitor=,highrr,auto,1 - monitor=HDMI-A-1,preferred,auto,1,mirror,eDP-1 + settings = { + debug = { + disable_logs = false; + }; + input = { + kb_layout = "fr"; + kb_variant = ""; + kb_model = "pc105"; + kb_options = "caps:super"; + kb_rules = ""; - exec = pkill swaybg; ${swaybgScript} - exec = pkill waybar; ${pkgs.waybar}/bin/waybar + touchpad = { + natural_scroll = "no"; + }; - submap = power - bind = ,s, exec, systemctl suspend - bind = ,s, submap, reset + sensitivity = 0.0; + numlock_by_default = true; - bind = SHIFT,S,exec, shutdown now - bind = ,S, submap, reset + repeat_delay = 200; + repeat_rate = 50; + force_no_accel = true; + follow_mouse = 2; + }; - bind = ,h, exec, systemctl hibernate - bind = ,h, submap, reset + general = { + gaps_in = 0; + gaps_out = 0; + border_size = 0; + "col.active_border" = "rgb(000000)"; + "col.inactive_border" = "rgba(00000000)"; + layout = "dwindle"; + }; - bind = ,e, exit - bind = ,e, submap, reset + decoration = { + blur = { + enabled = true; + }; + drop_shadow = true; + shadow_range = 8; + shadow_render_power = 4; + "col.shadow_inactive" = "rgba(1a1a1a33)"; + "col.shadow" = "rgba(1a1a1aee)"; + }; - bind = ,r, exec, reboot - bind = ,r, submap, reset + animations = { + enabled = true; + bezier = "myBezier, 0, 0, .58, 1"; + animation = "global, 1, 1, myBezier"; + }; - bind = ,l, exec, swaylock - bind = ,l, submap, reset + dwindle = { + pseudotile = true; + preserve_split = true; + force_split = 2; + # no_gaps_when_only = true; + }; - bind = ,escape, submap, reset - submap = reset - ''; + master = { + new_is_master = true; + }; + + gestures = { + workspace_swipe = "off"; + }; + + misc = { + disable_hyprland_logo = true; + enable_swallow = true; + mouse_move_enables_dpms = true; + key_press_enables_dpms = true; + # swallow_regex = "^(Alacritty)(.*)$"; + swallow_regex = "^(kitty)(.*)$"; + }; + + + windowrule = "float, floating"; + layerrule = "blur, waybar"; + + "$mod" = "SUPER"; + + bind = [ + "$mod, q, killactive" + "$mod SHIFT, q, exec, kill -9 $(hyprctl activewindow | grep pid | grep -E -o '[0-9]+$')" + "$mod, a, togglefloating" + "$mod SHIFT, a, workspaceopt, allfloat" + "$mod, Tab, togglesplit" + "$mod, P, pseudo" + "$mod, f, fullscreen" + "$mod SHIFT, f, fakefullscreen" + + "$mod, Return, exec, kitty" + "$mod SHIFT, e, exec, rofimoji" + "$mod, c, exec, rofi -show calc -modi calc -no-show-match -no-sort" + "$mod, e, exec, $TERMINAL -e lf" + "$mod SHIFT, Return, exec, kitty --working-directory \"$(window_dir)\"" + "$mod, w, exec, firefox" + "$mod SHIFT, w, exec, firefox --private-window" + "$mod SHIFT, s, exec, TMP=$(rofi -dmenu -p \"nix search\" -l 0) && firefox \"https://search.nixos.org/packages?channel=unstable&query=$TMP\"" + "$mod SHIFT, e, exec, $(rofi -dmenu -p \"command\" -l 0)" + "$mod, m, exec, kitty --class floating -e pulsemixer" + "$mod, d, exec, ~/.bin/runmenu" + "$mod, x, exec, keepmenu" + "$mod, z, exec, tmux new -spopup_terminal -d; kitty --class floating -e tmux a -t popup_terminal" + "$mod, f11, exec, ocrzone" + "$mod, f12, exec, kitty --class floating -e nmtui" + "$mod, f2, exec, dark" + "$mod, f3, exec, hyprctl reload" + "$mod, f4, exec, rofi-udisk" + "$mod, f5, exec, mount-android" + + ",XF86AudioRaiseVolume, exec, pamixer -i 5" + ",XF86AudioLowerVolume, exec, pamixer -d 5" + ",XF86AudioMute, exec, pamixer -t" + ",XF86AudioMicMute, exec, pamixer -t --default-source" + + ",XF86MonBrightnessUp, exec, light -A 10" + ",XF86MonBrightnessDown, exec, light -U 10" + + "$mod,Print, exec, screenshot" + + "$mod, agrave, submap, power" + + "$mod, h, movefocus, l" + "$mod, l, movefocus, r" + "$mod, k, movefocus, u" + "$mod, j, movefocus, d" + + "$mod, Left, movefocus, l" + "$mod, Right, movefocus, r" + "$mod, Up, movefocus, u" + "$mod, Down, movefocus, d" + + "$mod SHIFT, h, movewindow, l" + "$mod SHIFT, l, movewindow, r" + "$mod SHIFT, k, movewindow, u" + "$mod SHIFT, j, movewindow, d" + + "$mod SHIFT, Left, movewindow, l" + "$mod SHIFT, Right, movewindow, r" + "$mod SHIFT, Up, movewindow, u" + "$mod SHIFT, Down, movewindow, d" + + "$mod, twosuperior, workspace, 1" + "$mod, ampersand, workspace, 2" + "$mod, eacute, workspace, 3" + "$mod, quotedbl, workspace, 4" + "$mod, apostrophe, workspace, 5" + "$mod, parenleft, workspace, 6" + "$mod, minus, workspace, 7" + "$mod, egrave, workspace, 8" + "$mod, underscore, workspace, 9" + "$mod, ccedilla, workspace, 10" + "$mod, rarenright, workspace, 11" + + "$mod SHIFT, twosuperior, movetoworkspacesilent, 1" + "$mod SHIFT, ampersand, movetoworkspacesilent, 2" + "$mod SHIFT, eacute, movetoworkspacesilent, 3" + "$mod SHIFT, quotedbl, movetoworkspacesilent, 4" + "$mod SHIFT, apostrophe, movetoworkspacesilent, 5" + "$mod SHIFT, parenleft, movetoworkspacesilent, 6" + "$mod SHIFT, minus, movetoworkspacesilent, 7" + "$mod SHIFT, egrave, movetoworkspacesilent, 8" + "$mod SHIFT, underscore, movetoworkspacesilent, 9" + "$mod SHIFT, ccedilla, movetoworkspacesilent, 10" + "$mod SHIFT, rarenright, movetoworkspacesilent, 11" + ]; + + bindm = [ + "$mod, mouse:272, movewindow" + "$mod, mouse:273, resizewindow" + ]; + + binde = [ + "$mod SHIFT, h, moveactive, -60 0" + "$mod SHIFT, l, moveactive, 60 0" + "$mod SHIFT, k, moveactive, 0 -60" + "$mod SHIFT, j, moveactive, 0 60" + "$mod CTRL, h, resizeactive, -60 0" + "$mod CTRL, l, resizeactive, 60 0" + "$mod CTRL, k, resizeactive, 0 -60" + "$mod CTRL, j, resizeactive, 0 60" + + "$mod SHIFT, Left, moveactive, -60 0" + "$mod SHIFT, Right, moveactive, 60 0" + "$mod SHIFT, Up, moveactive, 0 -60" + "$mod SHIFT, Down, moveactive, 0 60" + "$mod CTRL, Left, resizeactive, -60 0" + "$mod CTRL, Right, resizeactive, 60 0" + "$mod CTRL, Up, resizeactive, 0 -60" + "$mod CTRL, Down, resizeactive, 0 60" + ]; + + # plugin:hyprfocus { + # enabled = no; + # + # keyboard_focus_animation = shrink + # mouse_focus_animation = flash + # + # bezier = bezIn, 0.5,0.0,1.0,0.5 + # bezier = bezOut, 0.0,0.5,0.5,1.0 + # + # flash { + # flash_opacity = 0.7 + # + # in_bezier = bezIn + # in_speed = 0.5 + # + # out_bezier = bezOut + # out_speed = 3 + # } + # + # shrink { + # shrink_percentage = 0.8 + # + # in_bezier = bezIn + # in_speed = 0.5 + # + # out_bezier = bezOut + # out_speed = 3 + # } + # } + + # "plugin:hyprfocus" = { + # enabled = true; + + # keyboard_focus_animation = "flash"; + # mouse_focus_animation = "nothing"; + + # bezier = "bezIn, 0.5,0.0,1.0,0.5"; + # # bezier = "bezOut, 0.0,0.5,0.5,1.0"; + + # flash = { + # shrink_percentage = 0.8; + + # in_bezier = "bezIn"; + # in_speed = 0.5; + + # out_bezier = "bezIn"; + # out_speed = 3; + # }; + + # shrink = { + # shrink_percentage = 0.8; + + # in_bezier = "bezIn"; + # in_speed = 0.5; + + # out_bezier = "bezIn"; + # out_speed = 3; + # }; + # }; + + }; + + extraConfig = + let + swaybgScript = (pkgs.writers.writeFish "display-background" '' + # find background image: only file in ~/.local/share/bg + set -l bg (find ~/.local/share/bg -type l) + + ${pkgs.swaybg}/bin/swaybg -m fill -i $bg + + # set background + # ${pkgs.nix}/bin/nix-shell \ + # -p pkgs.rubyPackages.gdk_pixbuf2 \ + # --run "${pkgs.swaybg}/bin/swaybg -m fill -i $bg" + ''); + in + '' + # env = GDK_BACKEND,wayland,x11 + # env = QT_QPA_PLATFORM,wayland;xcb + # env = SDL_VIDEODRIVER,wayland + # env = CLUTTER_BACKEND,wayland + # + # env = XDG_CURRENT_DESKTOP,Hyprland + # env = XDG_SESSION_TYPE,wayland + # env = XDG_SESSION_DESKTOP,Hyprland + # env = QT_AUTO_SCREEN_SCALE_FACTOR,1 + + monitor=,highrr,auto,1, + monitor=Unknown-1,disable + # monitor=HDMI-A-1,preferred,auto,1,mirror,eDP-1 + + exec = pkill swaybg; ${swaybgScript} + exec = pkill waybar; ${pkgs.waybar}/bin/waybar + + submap = power + bind = ,s, exec, systemctl suspend + bind = ,s, submap, reset + + bind = SHIFT,S,exec, shutdown now + bind = ,S, submap, reset + + bind = ,h, exec, systemctl hibernate + bind = ,h, submap, reset + + bind = ,e, exit + bind = ,e, submap, reset + + bind = ,r, exec, reboot + bind = ,r, submap, reset + + bind = ,l, exec, swaylock + bind = ,l, submap, reset + + bind = ,escape, submap, reset + submap = reset + ''; + }; } diff --git a/lf.nix b/lf.nix index 1d575f2..e93bef6 100644 --- a/lf.nix +++ b/lf.nix @@ -1,58 +1,59 @@ { config, pkgs, ... }: { - enable = true; - commands = { - trash = ''''${{ + programs.lf = { + enable = true; + commands = { + trash = ''''${{ set -f ${pkgs.trash-cli}/bin/trash $fx }}''; - extract = ''''${{ + extract = ''''${{ set -f ${pkgs.dtrx}/bin/dtrx -n $fx }}''; - compress_gzip = ''''${{ + compress_gzip = ''''${{ set -f ${pkgs.gnutar}/bin/tar Oc $(realpath --relative-to $PWD $f) | \ ${pkgs.pigz}/bin/pigz -cv - > $f.tar.gz }}''; - compress_zip = ''''${{ + compress_zip = ''''${{ set -f ${pkgs.zip}/bin/zip -r $f.zip $(realpath --relative-to $PWD $f) }}''; - compress_xz = ''''${{ + compress_xz = ''''${{ set -f ${pkgs.gnutar}/bin/tar Oc $(realpath --relative-to $PWD $f) | \ ${pkgs.pxz}/bin/pxz -cv - > $f.tar.xz }}''; - compress_bzip2 = ''''${{ + compress_bzip2 = ''''${{ set -f ${pkgs.gnutar}/bin/tar Oc $(realpath --relative-to $PWD $f) | \ ${pkgs.pbzip2}/bin/pbzip2 -cv - > $f.tar.bz2 }}''; - compress_zstd = ''''${{ + compress_zstd = ''''${{ set -f ${pkgs.gnutar}/bin/tar --zstd -cvf $f.tar.zst $(realpath --relative-to $PWD $f) }}''; - compress_just_tar = ''''${{ + compress_just_tar = ''''${{ set -f ${pkgs.gnutar}/bin/tar -cvf $f.tar $(realpath --relative-to $PWD $f) }}''; - show_size = ''%{{ + show_size = ''%{{ set -f ${pkgs.coreutils}/bin/du -sh $f }}''; - ncdu = ''''${{ + ncdu = ''''${{ set -f ${pkgs.ncdu}/bin/ncdu $f }}''; - # find = ''''${{ - # set -f - # read -p - send-warpinator = ''%{{ + # find = ''''${{ + # set -f + # read -p + send-warpinator = ''%{{ set -f ${pkgs.cinnamon.warpinator}/bin/warpinator-send $f }}''; - toggle_preview = ''%{{ + toggle_preview = ''%{{ if [ "$lf_preview" = "true" ]; then lf -remote "send $id :set preview false; set ratios 1:5" else @@ -60,7 +61,7 @@ fi }} ''; - paste = ''&{{ + paste = ''&{{ set -- $(cat ~/.local/share/lf/files) mode="$1" shift @@ -77,7 +78,7 @@ rm ~/.local/share/lf/files lf -remote "send clear" }}''; - bulk-rename = ''''${{ + bulk-rename = ''''${{ old="$(mktemp)" new="$(mktemp)" if [ -n "$fs" ]; then @@ -100,14 +101,14 @@ rm -- "$old" "$new" lf -remote "send $id unselect" }}''; - alt-paste = ''&{{ + alt-paste = ''&{{ if [ -n "$fs" ]; then lf -remote "send $id $1; save-select" fi lf -remote "send $id paste" }}''; - load-select = ''&{{ + load-select = ''&{{ # skip if triggered via save-select from itself if [ "$1" = "$id" ]; then exit 0 @@ -120,76 +121,77 @@ fi }}''; - save-select = ''&{{ + save-select = ''&{{ printf "%s" "$fs" > ~/.local/share/lf/select lf -remote "send load-select $id" }}''; - follow_link = ''%{{ + follow_link = ''%{{ lf -remote "send ''${id} select '$(readlink $f)'" }}''; - open_folder_in_sxiv = ''%{{ + open_folder_in_sxiv = ''%{{ nsxiv . }}''; + }; + keybindings = { + D = "trash"; + x = "extract"; + Xg = "compress_gzip"; + Xz = "compress_zip"; + Xx = "compress_xz"; + Xb = "compress_bzip2"; + Xs = "compress_zstd"; + Xt = "compress_just_tar"; + as = "show_size"; + an = "ncdu"; + ar = "bulk-rename"; + af = "follow_link"; + ai = "open_folder_in_sxiv"; + aw = "send-warpinator"; + E = "$nvim"; + p = "alt-paste copy"; + P = "alt-paste cut"; + "" = ":toggle; down; save-select"; + u = ":unselect; save-select"; + v = ":invert; save-select"; + "" = "toggle_preview"; + }; + + # previewer.source = "${pkgs.pistol}/bin/pistol"; + previewer.source = pkgs.writers.writeBash "pistol" '' + file=$1 + w=$2 + h=$3 + x=$4 + y=$5 + + if [[ "$( ${pkgs.file}/bin/file -Lb --mime-type "$file")" =~ ^image ]]; then + kitty +kitten icat --silent --stdin no --transfer-mode file --place \ + "''${w}x''${h}@''${x}x''${y}" "$file" < /dev/null > /dev/tty + exit 1 + fi + + ${pkgs.pistol}/bin/pistol "$file" + ''; + + settings = { + icons = true; + ifs = "\\n"; + cleaner = + let + cleaner = pkgs.writers.writeBash "cleaner" '' + kitty +kitten icat --clear --stdin no --silent --transfer-mode file < /dev/null > /dev/tty + ''; + in + "${cleaner}"; + }; + + extraConfig = '' + load-select + setlocal ${config.xdg.userDirs.download} sortby time + setlocal ${config.xdg.userDirs.download} reverse + setlocal ${config.xdg.userDirs.download} set info size:time + ''; }; - keybindings = { - D = "trash"; - x = "extract"; - Xg = "compress_gzip"; - Xz = "compress_zip"; - Xx = "compress_xz"; - Xb = "compress_bzip2"; - Xs = "compress_zstd"; - Xt = "compress_just_tar"; - as = "show_size"; - an = "ncdu"; - ar = "bulk-rename"; - af = "follow_link"; - ai = "open_folder_in_sxiv"; - aw = "send-warpinator"; - E = "$nvim"; - p = "alt-paste copy"; - P = "alt-paste cut"; - "" = ":toggle; down; save-select"; - u = ":unselect; save-select"; - v = ":invert; save-select"; - "" = "toggle_preview"; - }; - - # previewer.source = "${pkgs.pistol}/bin/pistol"; - previewer.source = pkgs.writers.writeBash "pistol" '' - file=$1 - w=$2 - h=$3 - x=$4 - y=$5 - - if [[ "$( ${pkgs.file}/bin/file -Lb --mime-type "$file")" =~ ^image ]]; then - kitty +kitten icat --silent --stdin no --transfer-mode file --place \ - "''${w}x''${h}@''${x}x''${y}" "$file" < /dev/null > /dev/tty - exit 1 - fi - - ${pkgs.pistol}/bin/pistol "$file" - ''; - - settings = { - icons = true; - ifs = "\\n"; - cleaner = - let - cleaner = pkgs.writers.writeBash "cleaner" '' - kitty +kitten icat --clear --stdin no --silent --transfer-mode file < /dev/null > /dev/tty - ''; - in - "${cleaner}"; - }; - - extraConfig = '' - load-select - setlocal ${config.xdg.userDirs.download} sortby time - setlocal ${config.xdg.userDirs.download} reverse - setlocal ${config.xdg.userDirs.download} set info size:time - ''; } diff --git a/terminal-software.nix b/terminal-software.nix new file mode 100644 index 0000000..0e2c396 --- /dev/null +++ b/terminal-software.nix @@ -0,0 +1,60 @@ +{ lib, config, pkgs, ... }: { + home.packages = with pkgs; [ + entr + trash-cli + nix-output-monitor + unzip + gnumake + pandoc + htop + ffmpeg + wget + dtrx + ]; + + + programs.neovim = { + enable = true; + viAlias = true; + defaultEditor = true; + extraPackages = with pkgs; [ + nodejs_22 + gcc + ocamlPackages.lsp + ocamlPackages.ocamlformat + cargo + nixd + nixpkgs-fmt + lua-language-server + ]; + }; + + programs.tmux = { + enable = true; + historyLimit = 600000; + escapeTime = 10; + keyMode = "vi"; + mouse = true; + extraConfig = '' + unbind-key 'Space' + bind-key 'Space' copy-mode + set -g status-right "#{net_speed} #{cpu_percentage}" + run-shell ${pkgs.tmuxPlugins.net-speed}/share/tmux-plugins/net-speed/net_speed.tmux + run-shell ${pkgs.tmuxPlugins.cpu}/share/tmux-plugins/cpu/cpu.tmux + ''; + plugins = with pkgs.tmuxPlugins; [ net-speed ]; + }; + + programs.git = { + enable = true; + userName = config.home.username; + userEmail = "${config.home.username}@domain.xyz"; + }; + + programs.direnv = { + enable = true; + nix-direnv.enable = true; + }; + + programs.pistol.enable = true; +} diff --git a/ui.nix b/ui.nix new file mode 100644 index 0000000..5996bf7 --- /dev/null +++ b/ui.nix @@ -0,0 +1,238 @@ +{ lib, config, pkgs, ... }: +{ + imports = [ + ./bar.nix + ./hyprland.nix + ./gui-software.nix + ]; + + home.packages = with pkgs; [ + gentium + (nerdfonts.override { fonts = [ "CascadiaCode" "Noto" "Hack" ]; }) + inter + emojione + + bluetuith + keepmenu + rofimoji + libnotify + wtype + wl-clipboard + + pamixer + pulsemixer + + (catppuccin-gtk.override { + accents = [ "pink" ]; + size = "compact"; + tweaks = [ "black" ]; + variant = "mocha"; + }) + ]; + + xsession.enable = true; + + + fonts.fontconfig.enable = true; + fonts.fontconfig.defaultFonts = { + serif = [ "Gentium Plus" ]; + sansSerif = [ "Inter" ]; + monospace = [ "CaskaydiaCove Nerd Font Mono" ]; + # monospace = [ "Hack Nerd Font Mono" ]; + emoji = [ "Noto Color Emoji" "OpenMoji Color" ]; + }; + + programs.kitty = { + enable = true; + font.name = "monospace"; + font.size = 12; + settings = { + cursor_shape = "block"; + default_pointer_shape = "arrow"; + pointer_shape_when_dragging = "arrow"; + enable_audio_bell = false; + placement_strategy = "top-left"; + remember_window_size = false; + initial_window_width = 1300; + initial_window_height = 800; + confirm_os_window_close = 0; + resize_debounce_time = "0.1 0.1"; + }; + keybindings = { + "ctrl+shift+equal" = "change_font_size all +0.5"; + "ctrl+shift+plus" = "change_font_size all +0.5"; + "ctrl+shift+kp_add" = "change_font_size all +0.5"; + "ctrl+shift+minus" = "change_font_size all -0.5"; + "ctrl+shift+kp_subtract" = "change_font_size all -0.5"; + }; + shellIntegration.enableFishIntegration = true; + shellIntegration.mode = "no-cursor"; + extraConfig = '' + include colors.conf + ''; + }; + + services.swayidle = { + enable = true; + events = [ + { + event = "before-sleep"; + command = "${config.programs.swaylock.package}/bin/swaylock -defF"; + } + { + event = "after-resume"; + command = "${config.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms on"; + } + { + event = "lock"; + command = "${config.programs.swaylock.package}/bin/swaylock -defF"; + } + ]; + + timeouts = [ + { + timeout = 900; + command = "${config.programs.swaylock.package}/bin/swaylock -defF"; + } + { + timeout = 900; + command = "${config.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms off"; + } + ]; + }; + + programs.swaylock = { + enable = true; + package = pkgs.swaylock-effects; + # --screenshots \ + # --clock \ + # --indicator \ + # --indicator-radius 100 \ + # --indicator-thickness 7 \ + # --effect-blur 7x5 \ + # --effect-vignette 0.5:0.5 \ + # --ring-color bb00cc \ + # --key-hl-color 880033 \ + # --line-color 00000000 \ + # --inside-color 00000088 \ + # --separator-color 00000000 \ + # --grace 2 \ + # --fade-in 0.2 + settings = { + screenshots = true; + # clock = true; + font = "Sans:bold"; + disable-caps-lock-text = true; + effect-blur = "7x5"; + text-color = "ffffff"; + layout-text-color = "ffffff"; + + ring-color = "000000"; + key-hl-color = "dddddd"; + line-color = "00000000"; + inside-color = "00000088"; + separator-color = "00000000"; + + ring-clear-color = "00000000"; + line-clear-color = "00000000"; + inside-clear-color = "00000000"; + text-clear-color = "00000000"; + }; + }; + + services.dunst.enable = true; + services.dunst.settings = { + global = { + geometry = "750x5-20+20"; + horizontal_padding = 8; + indicate_hidden = true; + shrink = true; + transparency = 20; + separator_height = 2; + frame_width = 3; + frame_color = "#000000"; + font = "Monospace 11"; + alignment = "left"; + show_age_threshold = 60; + background = "#ffffff"; + foreground = "#000000"; + }; + + + urgency_critical = { + background = "#ff9999"; + }; + }; + + programs.rofi = { + enable = true; + package = pkgs.rofi-wayland; + plugins = [ pkgs.rofi-calc pkgs.rofi-emoji ]; + theme = "theme.rasi"; + }; + + qt = { + enable = true; + platformTheme.name = "kde"; + }; + + gtk = { + enable = true; + font = { + package = pkgs.inter; + name = "Inter"; + }; + theme = { + name = "Catppuccin-Latte-Compact-Pink-Light"; + # name = "Catppuccin-Mocha-Compact-Pink-Dark"; + package = pkgs.catppuccin-gtk.override { + accents = [ "pink" ]; + size = "compact"; + tweaks = [ ]; + variant = "latte"; + }; + }; + iconTheme = { + name = "Adwaita"; + package = pkgs.gnome.adwaita-icon-theme; + }; + cursorTheme = { + name = "Hackneyed"; + package = pkgs.hackneyed; + }; + }; + + systemd.user.services = { + battery-notify = { + Unit = { + Description = "Send notification when battery is low"; + Wants = "battery-timer.timer"; + }; + Service = { + Type = "oneshot"; + ExecStart = "${pkgs.writers.writeBash "battery-notify" '' + if [[ $(${pkgs.coreutils}/bin/cat /sys/class/power_supply/BAT0/capacity) -lt 10 ]]; then + ${pkgs.libnotify}/bin/notify-send -u critical "Battery is low" + fi + '' }"; + }; + }; + }; + + systemd.user.timers = { + battery-timer = { + Unit = { + Description = "Execute battery-notify every minute"; + }; + Install = { + # enable the service + # WantedBy = [ "default.target" ]; + }; + Timer = { + Unit = "battery-notify.service"; + OnCalendar = "*-*-* *:*:00"; + }; + }; + }; + +} diff --git a/waybar.css b/waybar.css new file mode 100644 index 0000000..0fe80cf --- /dev/null +++ b/waybar.css @@ -0,0 +1,50 @@ +* { + font-family: "Jost", "Material Design Icons", Monospace; + font-size: 16px; + font-weight: bold; +} + +#tray, +label.module { + padding: 0px 8px; +} + +window#waybar { + background: rgba(255, 255, 255, .3); +} + +#controls, +#submap, +#network, +#disks, +#hardware, +#tray, +#clock { + background: rgba(0, 0, 0, .8); + color: white; + margin: 0px 5px; + border-radius: 0px; +} + +#workspaces button { + padding: 0; + color: #888888; +} + +#workspaces button.active { + color: #ffffff; +} + +#submap { + background: #000000; + border: 1px solid #ffffff; + color: #ffffff; +} + +#window { + color: #ffffff; + text-shadow: 1px 0 #000, -1px 0 #000, 0 1px #000, 0 -1px #000, + 1px 1px #000, -1px -1px #000, 1px -1px #000, -1px 1px #000; + background: rgba(0, 0, 0, 0); + border: 0 +}