add darwin stuff

This commit is contained in:
Mars 2024-07-28 21:52:06 -04:00
parent e4c20f0163
commit e0e24a42ad
Signed by: pupbrained
GPG key ID: 874E22DF2F9DFCB5
23 changed files with 455 additions and 303 deletions

View file

@ -177,6 +177,8 @@ with lib // pkgs // inputs; {
(mapAttrs (_: flake: {inherit flake;}))
(x: x // {nixpkgs.flake = nixpkgs;})
];
nixSuper = inputs.nix-super.packages.${pkgs.system}.default;
in {
package = mkForce nixSuper;
registry = mappedRegistry // optionalAttrs (config.nix.package == nixSuper) {default = mappedRegistry.nixpkgs;};

View file

@ -13,6 +13,9 @@
nix-colors.homeManagerModules.default
nix-index-database.hmModules.nix-index
schizofox.homeManagerModules.default
./hyprland
./screenshot
];
home = {
@ -131,33 +134,11 @@
};
programs = {
nix-index-database.comma.enable = true;
nix-index.enable = true;
ripgrep.enable = true;
wezterm.extraConfig = builtins.readFile ./wezterm.lua;
fzf = {
enable = true;
catppuccin.enable = true;
colors = with lib; {
bg = mkForce "-1";
"bg+" = mkForce "-1";
};
};
eza = {
enable = true;
git = true;
icons = true;
};
btop = {
enable = true;
catppuccin.enable = true;
};
direnv = {
enable = true;
nix-direnv.enable = true;
git = {
extraConfig.credential.helper = "libsecret";
signing.key = "0FF5B8826803F895";
};
};

View file

@ -0,0 +1,242 @@
{pkgs, ...}:
with pkgs; {
imports = [
./rofi.nix
./services.nix
./waybar.nix
];
home.packages = [
wl-clipboard
];
wayland.windowManager.hyprland = {
enable = true;
systemd.variables = ["--all"];
settings = let
rofi-clipboard = pkgs.writeScriptBin "rofi-clipboard" ''
tmp_dir="/tmp/cliphist"
rm -rf "$tmp_dir"
if [[ -n "$1" ]]; then
cliphist decode <<<"$1" | wl-copy
exit
fi
mkdir -p "$tmp_dir"
read -r -d "" prog <<EOF
/^[0-9]+\s<meta http-equiv=/ { next }
match(\$0, /^([0-9]+)\s(\[\[\s)?binary.*(jpg|jpeg|png|bmp)/, grp) {
system("echo " grp[1] "\\\\\t | cliphist decode >$tmp_dir/"grp[1]"."grp[3])
print \$0"\0icon\x1f$tmp_dir/"grp[1]"."grp[3]
next
}
1
EOF
cliphist list | gawk "$prog"
'';
scratchpad = pkgs.writeScriptBin "hyprscratchpad" ''
COMMAND=$1
CLASS=$2
WORKSPACE=$3
if [[ $(hyprctl clients | grep -v '"title":' | grep "class: $CLASS") ]];then
hyprctl dispatch togglespecialworkspace $WORKSPACE
else
hyprctl dispatch togglespecialworkspace $WORKSPACE && hyprctl dispatch exec "$COMMAND"
fi
'';
mod = "SUPER";
modC = "SUPER CTRL";
modS = "SUPER SHIFT";
browser = "firefox-nightly";
colorPicker = "notify-send -i gtk-color-picker $(${hyprpicker}/bin/hyprpicker -a) 'Copied to clipboard.'";
fileManager = "nautilus";
launcher = "rofi -show drun";
clipboard = "rofi -modi '':${rofi-clipboard}/bin/rofi-clipboard -show '' -show-icons";
terminal = "wezterm";
screenshot = mode: "${
hyprshot.overrideAttrs {
# Fixes cursors showing in region shots
src = pkgs.fetchFromGitHub {
owner = "BenCarmichael01";
repo = "Hyprshot";
rev = "84e2adcd5dd9060178d0d028ad032734797fba23";
hash = "sha256-XDKwBiUMWvxoWpkdJ0EK4kEqPSTZLcF6axHjom3c5Jk=";
};
}
}/bin/hyprshot --clipboard-only -m ${mode}";
in {
decoration.rounding = 10;
dwindle.preserve_split = true;
gestures.workspace_swipe = true;
input.touchpad = {
clickfinger_behavior = true;
natural_scroll = true;
};
device = [
{
name = "logitech-usb-receiver";
sensitivity = -0.5;
}
];
windowrule = [
"float, ^(vesktop)$"
"float, ^(org.telegram.desktop)$"
];
layerrule = [
"dimaround, rofi"
];
animations = {
enabled = true;
bezier = [
"overshot,0.7,0.6,0.1,1.1"
"bounce,1,1.6,0.1,0.85"
];
animation = [
"windows,1,5,bounce,popin"
"border,1,20,default"
"fade,1,5,default"
"workspaces,1,5,overshot,slide"
];
};
general = {
border_size = 2;
gaps_in = 10;
resize_on_border = true;
"col.active_border" = "rgba(33ccffee) rgba(00ff99ee) 45deg";
"col.inactive_border" = "rgba(595959aa)";
};
exec-once = [
"${mpvpaper.overrideAttrs {
version = "unstable-2024-07-05";
src = fetchFromGitHub {
owner = "GhostNaN";
repo = "mpvpaper";
rev = "a445391ff7491053fef78e3645eeed934f0c8fae";
sha256 = "sha256-3wHsUtIkh765EiMnx3BPzztvffIDf1NCqF0I/OATTZ4=";
};
}}/bin/mpvpaper -vp -o 'no-audio loop' DP-1 ${builtins.toString ./wall.mp4}"
"waybar"
];
misc = {
force_default_wallpaper = 0;
disable_hyprland_logo = true;
};
monitor = [
"eDP-1, disable"
"DP-1, 2560x1440@165, auto, auto"
];
env = [
# Nvidia stuff
"GBM_BACKEND, nvidia-drm"
"__GLX_VENDOR_LIBRARY_NAME, nvidia"
"LIBVA_DRIVER_NAME, nvidia"
"WLR_DRM_DEVICES, $HOME/.config/hypr/card"
# Cursors
"HYPRCURSOR_SIZE, 24"
"XCURSOR_SIZE, 24"
];
bindm = [
"${mod}, mouse:272, movewindow"
"${mod}, mouse:273, resizewindow"
];
bind =
[
# Apps
"${mod}, v, exec, ${clipboard}"
"${mod}, c, exec, ${colorPicker}"
"${mod}, w, exec, ${browser}"
"${mod}, e, exec, ${fileManager}"
"${mod}, r, exec, ${launcher}"
"${mod}, Return, exec, ${terminal}"
# Scratchpads
"${mod}, d, exec, ${scratchpad}/bin/hyprscratchpad vesktop vesktop vesktop"
"${mod}, t, exec, ${scratchpad}/bin/hyprscratchpad telegram-desktop org.telegram.desktop telegram"
# Screenshots
"${modS}, s, exec, ${screenshot "window"}"
"${modC}, 3, exec, ${screenshot "output -c"}"
"${modC}, 4, exec, ${screenshot "region -C 0,0"}"
# Mouse controls
"${mod}, mouse_down, workspace, e-1"
"${mod}, mouse_up, workspace, e+1"
# Quitting
"${mod}, q, killactive"
"${modS}, q, exit"
# Toggles
"${mod}, j, togglesplit"
"${mod}, Space, togglefloating"
# Focus movements
"${mod}, h, movefocus, l"
"${mod}, j, movefocus, d"
"${mod}, k, movefocus, u"
"${mod}, l, movefocus, r"
# Window movements
"${modS}, h, movewindow, l"
"${modS}, j, movewindow, d"
"${modS}, k, movewindow, u"
"${modS}, l, movewindow, r"
# Window resizing
"${modC}, h, resizeactive, -30 0"
"${modC}, j, resizeactive, 0 30"
"${modC}, k, resizeactive, 0 -30"
"${modC}, l, resizeactive, 30 0"
# Volume controls
", 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"
# Media controls
", XF86AudioPlay, exec, playerctl play-pause"
", XF86AudioNext, exec, playerctl next"
", XF86AudioPrev, exec, playerctl previous"
]
++ (
builtins.concatLists (builtins.genList (
x: let
ws = let
c = (x + 1) / 10;
in
builtins.toString (x + 1 - (c * 10));
in [
# Workspaces
"${mod}, ${ws}, workspace, ${builtins.toString (x + 1)}"
"${modS}, ${ws}, movetoworkspace, ${builtins.toString (x + 1)}"
]
)
10)
);
};
};
}

View file

@ -0,0 +1,28 @@
{pkgs, ...}: {
programs.rofi = {
enable = true;
catppuccin.enable = true;
package = pkgs.rofi-wayland;
extraConfig = {
modi = "run,drun,window";
icon-theme = "Oranchelo";
show-icons = true;
terminal = "wezterm";
drun-display-format = "{icon} {name}";
location = 0;
disable-history = false;
hide-scrollbar = true;
display-drun = " Apps ";
display-run = " Run ";
display-window = " 󰍲 Window";
display-Network = " 󰤨 Network";
sidebar-mode = true;
};
theme = {
"*".font = "Maple Mono NF 14";
window.border-radius = 10;
};
};
}

View file

@ -0,0 +1,14 @@
{...}: {
services = {
cliphist.enable = true;
udiskie.enable = true;
swaync = {
enable = true;
style = builtins.fetchurl {
url = "https://github.com/catppuccin/swaync/releases/download/v0.2.3/mocha.css";
sha256 = "1xr1wkg4zb467b35xhsfqiwhimfnn88i3ml5rf173rkm7fyby9qy";
};
};
};
}

Binary file not shown.

View file

@ -0,0 +1,282 @@
{
config,
lib,
pkgs,
...
}: let
palette = config.colorScheme.palette;
betterTransition = "all 0.3s cubic-bezier(.55,-0.68,.48,1.682)";
in {
programs.waybar = {
enable = true;
package = pkgs.waybar;
settings = [
{
layer = "top";
position = "top";
modules-center = ["hyprland/workspaces"];
modules-left = [
"custom/startmenu"
"hyprland/window"
"pulseaudio"
"cpu"
"memory"
];
modules-right = [
"mpris"
"network"
"custom/notification"
"tray"
"clock"
];
"mpris" = {
format = "{player_icon} {title} - {artist}";
format-paused = "{status_icon} {title} - {artist}";
player-icons.default = "󰝚";
status-icons.paused = "󰏤";
max-length = 40;
};
"hyprland/workspaces" = {
format = "{name}";
format-icons = {
default = " ";
active = " ";
urgent = " ";
};
on-scroll-up = "hyprctl dispatch workspace e-1";
on-scroll-down = "hyprctl dispatch workspace e+1";
};
"clock" = {
format = " {:L%I:%M %p}";
tooltip = true;
tooltip-format = "<big>{:%A, %d.%B %Y }</big>\n<tt><small>{calendar}</small></tt>";
};
"hyprland/window" = {
max-length = 40;
rewrite = {
"" = "󰍹 Desktop";
"(.*) Firefox Nightly" = "󰈹 $1";
"Slack" = "󰒱 Slack";
".*?Discord \\| @?(.*)" = "󰙯 $1";
"wezterm" = " WezTerm";
"Telegram(?: \\((\\d+)\\))?" = " Telegram";
"Steam" = "󰓓 Steam";
};
};
"memory" = {
interval = 5;
format = " {}%";
tooltip = true;
};
"cpu" = {
interval = 5;
format = " {usage:2}%";
tooltip = true;
};
"disk" = {
format = " {free}";
tooltip = true;
};
"network" = {
format-icons = [
"󰤯"
"󰤟"
"󰤢"
"󰤥"
"󰤨"
];
format-ethernet = " {bandwidthDownOctets}";
format-wifi = "{icon} {essid}";
format-disconnected = "󰤮";
tooltip = false;
};
"tray" = {
spacing = 12;
};
"pulseaudio" = {
format = "{icon} {volume}% {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 = "sleep 0.1 && pavucontrol";
};
"custom/startmenu" = {
tooltip = false;
format = "";
on-click = "rofi -show drun";
};
"custom/notification" = {
tooltip = false;
format = "{icon} {}";
format-icons = {
notification = "<span foreground='red'><sup></sup></span>";
none = "";
dnd-notification = "<span foreground='red'><sup></sup></span>";
dnd-none = "";
inhibited-notification = "<span foreground='red'><sup></sup></span>";
inhibited-none = "";
dnd-inhibited-notification = "<span foreground='red'><sup></sup></span>";
dnd-inhibited-none = "";
};
return-type = "json";
exec = "swaync-client -swb";
on-click = "swaync-client -t &";
escape = true;
};
}
];
style = lib.concatStrings [
''
* {
border: none;
border-radius: 0px;
font-family: Maple Mono NF;
font-size: 16px;
min-height: 0px;
}
window#waybar {
background-color: #${palette.base00};
}
#workspaces {
background: #${palette.base01};
border-radius: 16px;
color: #${palette.base00};
margin: 4px 4px;
padding: 8px 5px;
}
#workspaces button {
animation: gradient_horizontal 15s ease infinite;
background: linear-gradient(45deg, #${palette.base0E}, #${palette.base0F}, #${palette.base0D}, #${palette.base09});
background-size: 300% 300%;
border-radius: 16px;
color: #${palette.base00};
font-weight: bold;
margin: 0px 3px;
opacity: 0.5;
padding: 0px 5px;
transition: ${betterTransition};
}
#workspaces button.active {
animation: gradient_horizontal 15s ease infinite;
background: linear-gradient(45deg, #${palette.base0E}, #${palette.base0F}, #${palette.base0D}, #${palette.base09});
background-size: 300% 300%;
border-radius: 16px;
color: #${palette.base00};
font-weight: bold;
margin: 0px 3px;
min-width: 40px;
opacity: 1.0;
padding: 0px 5px;
transition: ${betterTransition};
}
#workspaces button:hover {
animation: gradient_horizontal 15s ease infinite;
background: linear-gradient(45deg, #${palette.base0E}, #${palette.base0F}, #${palette.base0D}, #${palette.base09});
background-size: 300% 300%;
border-radius: 16px;
color: #${palette.base00};
font-weight: bold;
opacity: 0.8;
transition: ${betterTransition};
}
@keyframes gradient_horizontal {
0% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
100% { background-position: 0% 50%; }
}
@keyframes swiping {
0% { background-position: 0% 200%; }
100% { background-position: 200% 200%; }
}
tooltip {
background: #${palette.base00};
border: 1px solid #${palette.base0E};
border-radius: 12px;
}
tooltip label {
color: #${palette.base07};
}
#window, #pulseaudio, #cpu, #memory, #idle_inhibitor {
background: #${palette.base01};
border-radius: 24px 10px 24px 10px;
color: #${palette.base05};
font-weight: bold;
margin: 4px 0px;
margin-left: 7px;
padding: 0px 18px;
}
#custom-startmenu {
background: #${palette.base01};
border-radius: 0px 0px 40px 0px;
color: #${palette.base0D};
font-size: 28px;
margin: 0px;
padding: 0px 30px 0px 15px;
}
#mpris, #network, #custom-notification, #tray {
background: #${palette.base01};
border-radius: 10px 24px 10px 24px;
color: #${palette.base05};
font-weight: bold;
margin: 4px 0px;
margin-right: 7px;
padding: 0px 18px;
}
#clock {
animation: gradient_horizontal 15s ease infinite;
background: linear-gradient(45deg, #${palette.base0C}, #${palette.base0F}, #${palette.base0B}, #${palette.base08});
background-size: 300% 300%;
border-radius: 0px 0px 0px 40px;
color: #${palette.base00};
font-weight: bold;
margin: 0px;
padding: 0px 15px 0px 30px;
}
''
];
};
}

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" fill="#cdd6f4" viewBox="0 0 256 256"><path d="M208,48V216a8,8,0,0,1-8,8H56a8,8,0,0,1-8-8V48a8,8,0,0,1,8-8H96a39.83,39.83,0,0,0-8,24v8h80V64a39.83,39.83,0,0,0-8-24h40A8,8,0,0,1,208,48Z" opacity="0.2"></path><path d="M200,32H163.74a47.92,47.92,0,0,0-71.48,0H56A16,16,0,0,0,40,48V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V48A16,16,0,0,0,200,32Zm-72,0a32,32,0,0,1,32,32H96A32,32,0,0,1,128,32Zm72,184H56V48H82.75A47.93,47.93,0,0,0,80,64v8a8,8,0,0,0,8,8h80a8,8,0,0,0,8-8V64a47.93,47.93,0,0,0-2.75-16H200Z"></path></svg>

After

Width:  |  Height:  |  Size: 578 B

View file

@ -0,0 +1,85 @@
{pkgs, ...}:
with pkgs; {
home.packages = [
(writeScriptBin "screenshot" ''
notify_user() {
${pulseaudio}/bin/paplay ${sound-theme-freedesktop}/share/sounds/freedesktop/stereo/screen-capture.oga 2>/dev/null &
${libnotify}/bin/notify-send \
-a Clipboard \
-i ${builtins.toString ./clipboard.svg} \
-u low \
-r 699 "Clipboard" "Screenshot saved on clipboard"
}
screen() {
${maim}/bin/maim -u -f png | ${pkgs.xclip}/bin/xclip -selection clipboard -t image/png
notify_user
}
window() {
window_geometry=$(${xdotool}/bin/xdotool getwindowgeometry $(${xdotool}/bin/xdotool getactivewindow) | tail -n +2 | awk '{print $2}' | tac)
last_line=$(echo "$window_geometry" | tail -n 1)
modified_last_line=$(echo "$last_line" | awk 'BEGIN {FS=OFS=","} {for(i=1; i<=NF; i++) $i+=2; print}' | sed -E "s/([+-]?[0-9]+),([+-]?[0-9]+)/+\1+\2/g; s/\+\-/\-/g")
final_string=$(echo "$window_geometry" | sed '$s/.*/'"$modified_last_line"'/' | paste -sd "")
${maim}/bin/maim -u -f png -g "$final_string" | ${pkgs.xclip}/bin/xclip -selection clipboard -t image/png
notify_user
}
area() {
${maim}/bin/maim -u -f png -s -b 2 -c 0.35,0.55,0.85,0.25 -l | ${pkgs.xclip}/bin/xclip -selection clipboard -t image/png
notify_user
}
menu() {
screen="󰍹"
area="󰒉"
window=""
chosen="$(printf "%s\n%s\n%s\n%s\n" "$screen" "$area" "$window" | rofi -theme ${builtins.toString ./screenshot.rasi} -p 'Take Screenshot' -dmenu -selected-row 0 -theme-str 'listview {lines: 3;}')"
case $chosen in
"$screen")
screen
;;
"$area")
area
;;
"$window")
window
;;
esac
}
docs() {
echo "
Usage: screenshot [Options]
--help - Prints this message
Options:
--screen - Take screenshot of the screen
--window - Take screenshot of the focused window
--area - Take screenshot of the selected area
--menu - Opens a gui selector
"
}
case $1 in
--screen)
screen
;;
--window)
window
;;
--area)
area
;;
--menu)
menu
;;
--help | *)
docs
;;
esac
'')
];
}

View file

@ -0,0 +1,67 @@
* {
font: "Maple Mono NF 12";
accent: #a6e3a1;
base: #1e1e2e;
mantle: #181825;
text: #cdd6f4;
}
configuration {
location: 4;
show-icons: false;
click-to-exit: true;
}
window {
transparency: "real";
background-color: @base;
text-color: @text;
border: 2px solid;
border-color: @mantle;
border-radius: 12px;
width: 100px;
x-offset: -10;
}
mainbox {
background-color: @base;
spacing: 10px;
padding: 20px;
children: [ listview ];
}
listview {
background-color: @mantle;
border-radius: 100%;
columns: 1;
cycle: true;
dynamic: true;
fixed-height: true;
fixed-columns: true;
layout: vertical;
}
element {
background-color: transparent;
text-color: @text;
orientation: horizontal;
border-radius: 100%;
padding: 14px;
cursor: pointer;
}
element-text {
background-color: inherit;
text-color: inherit;
font: "Phosphor 16";
horizontal-align: 0.25;
vertical-align: 0.5;
margin: 0px;
cursor: inherit;
}
element selected.normal {
background-color: @accent;
text-color: @mantle;
}

View file

@ -0,0 +1,134 @@
local c = wezterm.config_builder()
wezterm.on('user-var-changed', function(window, pane, name, value)
local overrides = window:get_config_overrides() or {}
if name == 'ZEN_MODE' then
local incremental = value:find('+')
local number_value = tonumber(value)
if incremental ~= nil then
while number_value > 0 do
window:perform_action(wezterm.action.IncreaseFontSize, pane)
number_value = number_value - 1
end
overrides.enable_tab_bar = false
elseif number_value < 0 then
window:perform_action(wezterm.action.ResetFontSize, pane)
overrides.font_size = nil
overrides.enable_tab_bar = true
else
overrides.font_size = number_value
overrides.enable_tab_bar = false
end
end
window:set_config_overrides(overrides)
end)
wezterm.on('format-window-title', function(tab, pane, tabs, panes, config)
local zoomed = ''
if tab.active_pane.is_zoomed then
zoomed = '[Z] '
end
local index = ''
if #tabs > 1 then
index = string.format('[%d/%d] ', tab.tab_index + 1, #tabs)
end
return 'WezTerm - ' .. zoomed .. index .. tab.active_pane.title
end)
wezterm.plugin.require('https://github.com/nekowinston/wezterm-bar').apply_to_config(c, {
position = 'bottom',
max_width = 32,
dividers = 'slant_right',
indicator = {
leader = {
enabled = true,
off = '',
on = '',
},
mode = {
enabled = true,
names = {
resize_mode = 'RESIZE',
copy_mode = 'VISUAL',
search_mode = 'SEARCH',
},
},
},
tabs = {
numerals = 'arabic',
pane_count = 'subscript',
brackets = {
active = { '', ':' },
inactive = { '', ':' },
},
},
clock = {
enabled = true,
format = '%l:%M %p',
},
})
local act = wezterm.action
local keybinds = {
{
key = 'Enter',
mods = 'CTRL|SHIFT',
action = act.SplitHorizontal({ domain = 'CurrentPaneDomain' }),
},
{
key = 'h',
mods = 'CTRL|SHIFT',
action = act.ActivatePaneDirection('Left'),
},
{
key = 'l',
mods = 'CTRL|SHIFT',
action = act.ActivatePaneDirection('Right'),
},
{
key = 'k',
mods = 'CTRL|SHIFT',
action = act.ActivatePaneDirection('Up'),
},
{
key = 'j',
mods = 'CTRL|SHIFT',
action = act.ActivatePaneDirection('Down'),
},
{
key = 't',
mods = 'CTRL|SHIFT',
action = act.SpawnCommandInNewTab({ cwd = wezterm.home_dir }),
},
}
local config = {
adjust_window_size_when_changing_font_size = false,
color_scheme = 'Catppuccin Mocha',
cursor_blink_ease_in = 'Constant',
cursor_blink_ease_out = 'Constant',
cursor_blink_rate = 500,
default_cursor_style = 'BlinkingBar',
enable_kitty_graphics = true,
enable_scroll_bar = false,
enable_wayland = false,
font_size = 12,
font = wezterm.font('Maple Mono NF'),
front_end = 'OpenGL',
initial_cols = 160,
keys = keybinds,
underline_position = -4,
use_fancy_tab_bar = false,
warn_about_missing_glyphs = false,
window_background_opacity = 0.8,
window_padding = { left = 0, right = 0, top = 0, bottom = 0 },
}
for k, v in pairs(config) do
c[k] = v
end
return c