From f141a0ee049f7ddbeeab20dd5f7c7bb27bacedbe Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Tue, 7 Nov 2023 23:55:16 -0600 Subject: [PATCH] Hyprland stuff --- modules/home-manager/dragon.nix | 7 +++ modules/home-manager/eww/eww.scss | 4 ++ modules/home-manager/eww/eww.yuck | 18 +++++- modules/home-manager/hyprland.nix | 36 ++++++++++-- modules/home-manager/sway.nix | 2 +- modules/home-manager/wezterm.nix | 94 +++++++++++++++++++++---------- 6 files changed, 125 insertions(+), 36 deletions(-) diff --git a/modules/home-manager/dragon.nix b/modules/home-manager/dragon.nix index 7813509..661f71a 100644 --- a/modules/home-manager/dragon.nix +++ b/modules/home-manager/dragon.nix @@ -12,10 +12,17 @@ wayland.windowManager.hyprland = { settings = { + env = [ + "EWW_BAR_MON,1" + ]; # See https://wiki.hyprland.org/Configuring/Keywords/ for more monitor = [ "DP-3,3840x2160@120,0x0,1" ]; + input = { + force_no_accel = true; + sensitivity = 1; # -1.0 - 1.0, 0 means no modification. + }; }; }; diff --git a/modules/home-manager/eww/eww.scss b/modules/home-manager/eww/eww.scss index 1be5c50..bba8d1f 100644 --- a/modules/home-manager/eww/eww.scss +++ b/modules/home-manager/eww/eww.scss @@ -29,6 +29,8 @@ $rosewater: #f5e0dc; all: unset; } +.bar0, +.bar1, .bar { background-color: $base; color: $text; @@ -64,6 +66,8 @@ $rosewater: #f5e0dc; border-radius: 10px; } +.bar0>*, +.bar1>*, .bar>* { padding-left: 10px; padding-right: 10px; diff --git a/modules/home-manager/eww/eww.yuck b/modules/home-manager/eww/eww.yuck index 090429c..bbb60cd 100644 --- a/modules/home-manager/eww/eww.yuck +++ b/modules/home-manager/eww/eww.yuck @@ -4,7 +4,7 @@ (box) (music))) -(defwindow bar +(defwindow bar0 :monitor 0 :stacking "fg" :exclusive true @@ -17,6 +17,19 @@ :anchor "bottom center") (bar)) +(defwindow bar1 + :monitor 1 + :stacking "fg" + :exclusive true + :geometry + (geometry + :x "0%" + :y "0%" + :width "100%" + :height "31px" + :anchor "bottom center") + (bar)) + (defwidget sidestuff [] (box :class "sidestuff" :orientation "h" :space-evenly false :halign "start" :spacing 20 time @@ -66,3 +79,6 @@ (defpoll brightness :interval "10s" "echo $(((100 * $(brightnessctl get)) / $(brightnessctl max)))") + +(defpoll monitor :interval "60s" + "echo $EWW_BAR_MON") diff --git a/modules/home-manager/hyprland.nix b/modules/home-manager/hyprland.nix index 66269d3..b8d8a37 100644 --- a/modules/home-manager/hyprland.nix +++ b/modules/home-manager/hyprland.nix @@ -2,6 +2,7 @@ outputs, colors, config, + lib, # font, ... }: { @@ -30,14 +31,39 @@ "hyprpaper" "mako" "/usr/lib/polkit-kde-authentication-agent-1" - "eww daemon && eww open bar" - "firefox & kitty --single-instance &" + "eww daemon && eww open bar$EWW_BAR_MON" + "firefox & wezterm &" + (lib.concatStringsSep " " [ + "swayidle -w" + "timeout 300 'notify-send \"Idling in 300 seconds\"'" + "resume 'notify-send \"Idling cancelled.\"'" + "timeout 480 'notify-send -u critical \"Idling in 120 seconds\"'" + "timeout 510 'notify-send -u critical \"Idling in 90 seconds\"'" + "timeout 540 'notify-send -u critical \"Idling in 60 seconds!\"'" + "timeout 570 'notify-send -u critical \"Idling in 30 seconds!\"'" + "timeout 590 'notify-send -u critical \"Idling in 10 seconds!\"'" + "timeout 591 'notify-send -u critical \"Idling in 9 seconds!\"'" + "timeout 592 'notify-send -u critical \"Idling in 8 seconds!\"'" + "timeout 593 'notify-send -u critical \"Idling in 7 seconds!\"'" + "timeout 594 'notify-send -u critical \"Idling in 6 seconds!\"'" + "timeout 595 'notify-send -u critical \"Idling in 5 seconds!\"'" + "timeout 596 'notify-send -u critical \"Idling in 4 seconds!\"'" + "timeout 597 'notify-send -u critical \"Idling in 3 seconds!\"'" + "timeout 598 'notify-send -u critical \"Idling in 2 seconds!\"'" + "timeout 599 'notify-send -u critical \"Idling in 1 second!\"'" + "timeout 600 'swaylock -f'" + "timeout 600 'hyprctl dispatch dpms off'" + "resume 'hyprctl dispatch dpms on'" + # "resume 'maybe-good-morning'" + "before-sleep 'swaylock -f'" + ]) ''swayidle -w timeout 600 'notify-send "Locking in 30 seconds..."' timeout 630 'swaylock -f' timeout 660 'hyprctl dispatch dpms off' resume 'hyprctl dispatch dpms on && maybe-good-morning' before-sleep 'swaylock -f'"'' "dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP" ]; env = [ "XCURSOR_SIZE,24" + "EWW_BAR_MON,0" ]; input = { @@ -100,7 +126,7 @@ "$mainMod" = "SUPER"; bind = [ # See https://wiki.hyprland.org/Configuring/Keywords/ for more - "$mainMod, return, exec, kitty --single-instance" + "$mainMod, return, exec, wezterm" "$mainMod SHIFT, return, exec, kitty" "$mainMod, U, exec, firefox" "$mainMod, space, exec, wofi --show drun" @@ -223,9 +249,9 @@ # } # Example windowrule v1 - # windowrule = float, ^(kitty)$ + # windowrule = float, ^(kitty|firefox)$ # Example windowrule v2 - # windowrulev2 = float,class:^(kitty)$,title:^(kitty)$ + windowrulev2 = float,class:^.*(kitty|firefox|org.wezfurlong.wezterm).*$ # See https://wiki.hyprland.org/Configuring/Window-Rules/ for more ''; }; diff --git a/modules/home-manager/sway.nix b/modules/home-manager/sway.nix index f1fdef7..bb82924 100644 --- a/modules/home-manager/sway.nix +++ b/modules/home-manager/sway.nix @@ -202,7 +202,7 @@ # bindsym $mod+shift+space exec wofi --show drun "${mod}+control+space" = "exec makoctl dismiss"; "${mod}+shift+space" = "exec makoctl invoke"; - "${mod}+return" = "exec kitty --single-instance"; + "${mod}+return" = "exec wezterm"; "${mod}+shift+return" = "exec floating-term"; "${mod}+shift+alt+return" = "exec kitty"; "${mod}+c" = "kill"; diff --git a/modules/home-manager/wezterm.nix b/modules/home-manager/wezterm.nix index eedf61a..363e825 100644 --- a/modules/home-manager/wezterm.nix +++ b/modules/home-manager/wezterm.nix @@ -36,46 +36,82 @@ -- config.window_frame.font = config.font -- config.window_frame.font_size = font_size + function tab_title(tab_info) + local title = tab_info.tab_title + if title and #title > 0 then + return title + end + return tab_info.active_pane.title + end + + wezterm.on('format-tab-title', function (tab, tabs, panes, config, hover, max_width) + local title = tab_title(tab) + return ' ' .. string.sub(title, 0, max_width - 2) .. ' ' + end) + config.colors = { foreground = '${fg}', - background = '${primary}', + background = '${bg}', cursor_bg = '${text}', cursor_fg = '${bg}', - -- Specifies the border color of the cursor when the cursor style is set to Block, - -- or the color of the vertical or horizontal bar when the cursor style is set to - -- Bar or Underline. - cursor_border = '#52ad70', + cursor_border = '${text}', - -- the foreground color of selected text - selection_fg = 'black', - -- the background color of selected text - selection_bg = '#fffacd', + selection_fg = '${bg}', + selection_bg = '${yellow}', - -- The color of the scrollbar "thumb"; the portion that represents the current viewport - scrollbar_thumb = '#222222', + scrollbar_thumb = '${bg2}', - -- The color of the split lines between panes - split = '#444444', + split = '${bg5}', ansi = { - 'black', - 'maroon', - 'green', - 'olive', - 'navy', - 'purple', - 'teal', - 'silver', + '${colors.withHashPrefix."0"}', + '${colors.withHashPrefix."1"}', + '${colors.withHashPrefix."2"}', + '${colors.withHashPrefix."3"}', + '${colors.withHashPrefix."4"}', + '${colors.withHashPrefix."5"}', + '${colors.withHashPrefix."6"}', + '${colors.withHashPrefix."7"}', }, brights = { - 'grey', - 'red', - 'lime', - 'yellow', - 'blue', - 'fuchsia', - 'aqua', - 'white', + '${colors.withHashPrefix."8"}', + '${colors.withHashPrefix."9"}', + '${colors.withHashPrefix."10"}', + '${colors.withHashPrefix."11"}', + '${colors.withHashPrefix."12"}', + '${colors.withHashPrefix."13"}', + '${colors.withHashPrefix."14"}', + '${colors.withHashPrefix."15"}', + }, + + tab_bar = { + background = '${bg3}', + + active_tab = { + bg_color = '${primary}', + fg_color = '${bg}', + italic = false, + }, + inactive_tab = { + bg_color = '${bg2}', + fg_color = '${fgdim}', + italic = false, + }, + inactive_tab_hover = { + bg_color = '${bg3}', + fg_color = '${primary}', + italic = false, + }, + new_tab = { + bg_color = '${bg2}', + fg_color = '${fgdim}', + italic = false, + }, + new_tab_hover = { + bg_color = '${bg3}', + fg_color = '${primary}', + italic = false, + }, }, -- Arbitrary colors of the palette in the range from 16 to 255