From 18dc7a1772d85e885eb5a0df5e4f2ac959f0073c Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Fri, 12 May 2023 01:08:14 -0500 Subject: [PATCH] Laptop powers --- common/empty-env/hyprland.d.conf | 0 host/desktop/hyprland.d.cond | 1 + host/desktop/hyprland.d.conf | 5 +++++ host/laptop/hyprland.d.conf | 11 +++++++++++ os/linux/bin/wm | 13 ++++++++++++- os/linux/eww/eww.yuck | 19 ++++++++----------- os/linux/hypr/hyprland.conf | 26 ++++++++++++++++++-------- 7 files changed, 55 insertions(+), 20 deletions(-) create mode 100644 common/empty-env/hyprland.d.conf create mode 100644 host/desktop/hyprland.d.cond create mode 100644 host/desktop/hyprland.d.conf create mode 100644 host/laptop/hyprland.d.conf diff --git a/common/empty-env/hyprland.d.conf b/common/empty-env/hyprland.d.conf new file mode 100644 index 0000000..e69de29 diff --git a/host/desktop/hyprland.d.cond b/host/desktop/hyprland.d.cond new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/host/desktop/hyprland.d.cond @@ -0,0 +1 @@ + diff --git a/host/desktop/hyprland.d.conf b/host/desktop/hyprland.d.conf new file mode 100644 index 0000000..ce26dfe --- /dev/null +++ b/host/desktop/hyprland.d.conf @@ -0,0 +1,5 @@ +source ~/.config/hypr/hyprland.conf + +monitor=DP-1,3840x2160@60,0x0,1.5,transform,3 +monitor=DP-2,3840x2160@60,5280x0,1.5,transform,3 +monitor=DP-3,3840x2160@120,1440x0,1 diff --git a/host/laptop/hyprland.d.conf b/host/laptop/hyprland.d.conf new file mode 100644 index 0000000..3716447 --- /dev/null +++ b/host/laptop/hyprland.d.conf @@ -0,0 +1,11 @@ +source = ~/.config/hypr/hyprland.conf + +bind = SUPER, return, exec, wezterm +bind = SUPER, M, exit, + +input { + kb_options = ctrl:nocaps + touchpad { + natural_scroll = yes + } +} diff --git a/os/linux/bin/wm b/os/linux/bin/wm index 3fcb28f..9972a7b 100755 --- a/os/linux/bin/wm +++ b/os/linux/bin/wm @@ -1,3 +1,14 @@ #!/usr/bin/env sh # exec "$(dirname "$0")/../sway/init" -exec Hyprland + +c="$HOME/.config" +ev="$c/hypr/hyprland.conf" +ee="$c/lytedev-env" +for e in "host-desktop" "host-laptop"; do + f="$ee/$e/hyprland.d.conf" + [ -f "$f" ] && c="$f" +done + +echo "Using config $c" + +exec Hyprland -c "$c" diff --git a/os/linux/eww/eww.yuck b/os/linux/eww/eww.yuck index 685cc13..0a8550b 100644 --- a/os/linux/eww/eww.yuck +++ b/os/linux/eww/eww.yuck @@ -5,7 +5,7 @@ (music))) (defwindow bar - :monitor 2 + :monitor 0 :stacking "fg" :exclusive true :geometry @@ -24,10 +24,10 @@ ; TODO: get these to align properly? (box :class "mic" (box :class {micMuted == "false" ? "live" : "muted"} {micMuted == "false" ? " " : " "})) {"󰕾 " + volume} - {" " + cpu} - {" " + ram} - ; TODO: brightness - ; TODO: battery + {" " + round(EWW_CPU["avg"], 0) + "%"} + {" " + round(EWW_RAM["used_mem_perc"], 0) + "%"} + {" " + brightness + "%"} + {"󱊣 " + EWW_BATTERY["BAT0"]["capacity"] + "%"} )) (defwidget music [] @@ -46,11 +46,8 @@ (deflisten micMuted :initial "false" "pamixer --default-source --get-mute; pactl subscribe | grep source --line-buffered | while read i; do pamixer --default-source --get-mute; done") -(defpoll cpu :interval "5s" - "mpstat -o JSON | jq -r '(100 - .sysstat.hosts[0].statistics[0][\"cpu-load\"][0].idle | round | tostring)+\"%\"'") - -(defpoll ram :interval "5s" - "free | grep Mem | awk '{printf \"%.0f%\", $3/$2 * 100.0}'") - (defpoll time :interval "1s" "date '+%a %b %d %H:%M:%S'") + +(defpoll brightness :interval "5s" + "echo $((100 * ($(brightnessctl get) / $(brightnessctl max))))") diff --git a/os/linux/hypr/hyprland.conf b/os/linux/hypr/hyprland.conf index e94b4a5..6c9345b 100644 --- a/os/linux/hypr/hyprland.conf +++ b/os/linux/hypr/hyprland.conf @@ -1,8 +1,5 @@ # See https://wiki.hyprland.org/Configuring/Monitors/ monitor=,preferred,auto,auto -monitor=DP-1,3840x2160@60,0x0,1.5,transform,3 -monitor=DP-2,3840x2160@60,5280x0,1.5,transform,3 -monitor=DP-3,3840x2160@120,1440x0,1 # See https://wiki.hyprland.org/Configuring/Keywords/ for more @@ -11,12 +8,8 @@ exec-once = firefox & wezterm & hyprpaper & mako & /usr/lib/polkit-kde-authentic exec-once = 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' before-sleep 'swaylock -f' exec-once = dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP -# source = ~/.config/hypr/myColors.conf - -# Some default env vars. env = XCURSOR_SIZE,24 -# For all categories, see https://wiki.hyprland.org/Configuring/Variables/ input { kb_layout = us # kb_variant = @@ -39,6 +32,15 @@ input { sensitivity = 1 # -1.0 - 1.0, 0 means no modification. } +misc { + disable_hyprland_logo = true + disable_splash_rendering = true +} + +binds { + allow_workspace_cycles = true +} + general { # See https://wiki.hyprland.org/Configuring/Variables/ for more @@ -161,6 +163,8 @@ bind = , XF86AudioPlay, exec, playerctl play-pause bind = , XF86AudioNext, exec, playerctl next bind = , XF86AudioPrev, exec, playerctl previous +bind = $mainMod, tab, workspace, previous + # Switch workspaces with mainMod + [0-9] bind = $mainMod, 1, workspace, 1 bind = $mainMod, 2, workspace, 2 @@ -185,6 +189,13 @@ bind = $mainMod SHIFT, 8, movetoworkspace, 8 bind = $mainMod SHIFT, 9, movetoworkspace, 9 bind = $mainMod SHIFT, 0, movetoworkspace, 10 +bind = , XF86MonBrightnessDown, exec, brightnessctl set 10%- +bind = , XF86MonBrightnessUp, exec, brightnessctl set +10% +bind = SHIFT, XF86MonBrightnessDown, exec, brightnessctl set 1% +bind = SHIFT, XF86MonBrightnessUp, exec, brightnessctl set 100% +bind = CTRL, XF86MonBrightnessDown, exec, brightnessctl set 1%- +bind = CTRL, XF86MonBrightnessUp, exec, brightnessctl set +1% + bind = $mainMod SHIFT, S, exec, clipshot # Scroll through existing workspaces with mainMod + scroll @@ -194,4 +205,3 @@ bind = $mainMod, mouse_up, workspace, e-1 # Move/resize windows with mainMod + LMB/RMB and dragging bindm = $mainMod, mouse:272, movewindow bindm = $mainMod, mouse:273, resizewindow -