From 7c6c1943b4011e6963c7388d1140de28a28d7557 Mon Sep 17 00:00:00 2001 From: Ryan Date: Wed, 15 Nov 2023 11:25:03 +0800 Subject: [PATCH] Add config for hyprland --- .config/hypr/hyprland.conf | 193 +-------------------- .config/hypr/hyprland.conf.d/autoexec.conf | 17 ++ .config/hypr/hyprland.conf.d/input.conf | 28 +++ .config/hypr/hyprland.conf.d/keybind.conf | 91 ++++++++++ .config/hypr/hyprland.conf.d/output.conf | 11 ++ .config/hypr/hyprland.conf.d/ui.conf | 55 ++++++ .config/hypr/hyprpaper.conf | 3 +- .config/hypr/scripts/clamshell.sh | 6 + .config/kanshi/config | 9 - .config/waybar/config | 9 +- .config/waybar/style.css | 5 + README.md | 4 +- 12 files changed, 229 insertions(+), 202 deletions(-) create mode 100644 .config/hypr/hyprland.conf.d/autoexec.conf create mode 100644 .config/hypr/hyprland.conf.d/input.conf create mode 100644 .config/hypr/hyprland.conf.d/keybind.conf create mode 100644 .config/hypr/hyprland.conf.d/output.conf create mode 100644 .config/hypr/hyprland.conf.d/ui.conf create mode 100755 .config/hypr/scripts/clamshell.sh delete mode 100644 .config/kanshi/config diff --git a/.config/hypr/hyprland.conf b/.config/hypr/hyprland.conf index 1b61207..f2df121 100644 --- a/.config/hypr/hyprland.conf +++ b/.config/hypr/hyprland.conf @@ -1,190 +1,7 @@ # See https://wiki.hyprland.org/Configuring/Keywords/ for more -# Execute your favorite apps at launch -exec=pkill kanshi; kanshi -exec=pidof hyprpaper || hyprpaper -exec=pidof wlsunset || wlsunset - -# Source a file (multi-file configs) -# source = ~/.config/hypr/myColors.conf - -# Some default env vars. -env = XCURSOR_SIZE,24 - -# env setting for nvidia -env = LIBVA_DRIVER_NAME,nvidia -env = XDG_SESSION_TYPE,wayland -# env = GBM_BACKEND,nvidia-drm -env = WLR_DRM_DEVICES,/dev/dri/card0:/dev/dri/card1 -env = __GLX_VENDOR_LIBRARY_NAME,nvidia -env = WLR_NO_HARDWARE_CURSORS,1 - -# For all categories, see https://wiki.hyprland.org/Configuring/Variables/ -input { - kb_layout = us - kb_variant = - kb_model = - kb_options = - kb_rules = - - follow_mouse = 1 - - touchpad { - natural_scroll = true - } - - sensitivity = 0 # -1.0 - 1.0, 0 means no modification. -} - -general { - gaps_in = 4 - gaps_out = 8 - border_size = 1 - col.active_border = rgb(fbf1c7) - col.inactive_border = rgb(928374) - cursor_inactive_timeout = 10 - resize_on_border = true - layout = dwindle -} - -decoration { - # See https://wiki.hyprland.org/Configuring/Variables/ for more - - rounding = 4 - - blur { - enabled = false - } - - drop_shadow = true -} - -animations { - enabled = yes - - # Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more - - bezier = myBezier, 0.05, 0.9, 0.1, 1.05 - - animation = windows, 1, 7, myBezier - animation = windowsOut, 1, 7, default, popin 80% - animation = border, 1, 10, default - animation = borderangle, 1, 8, default - animation = fade, 1, 7, default - animation = workspaces, 1, 6, default -} - -dwindle { - # See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more - pseudotile = yes # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below - preserve_split = yes # you probably want this - force_split = 2 - no_gaps_when_only = 1 - default_split_ratio = 1.2 -} - -master { - # See https://wiki.hyprland.org/Configuring/Master-Layout/ for more - new_is_master = true -} - -gestures { - # See https://wiki.hyprland.org/Configuring/Variables/ for more - workspace_swipe = on -} - -misc { - disable_splash_rendering = true - vrr = 1 - disable_autoreload = true - focus_on_activate = true -} - -xwayland { - force_zero_scaling = true -} - -# Example per-device config -# See https://wiki.hyprland.org/Configuring/Keywords/#executing for more -device:epic-mouse-v1 { - sensitivity = -0.5 -} - -# Example windowrule v1 -# windowrule = float, ^(kitty)$ -# Example windowrule v2 -# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$ -# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more - - -# See https://wiki.hyprland.org/Configuring/Keywords/ for more -$mainMod = SUPER - -# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more -bind = $mainMod, N, exec, kitty -bind = $mainMod, W, killactive, -bind = $mainMod + CTRL, Q, exit, -bind = $mainMod + SHIFT, SPACE, togglefloating, -bind = $mainMod + SHIFT, RETURN, exec, wofi --show drun -bind = $mainMod + SHIFT, P, pseudo, # dwindle - -# Move focus with mainMod + arrow keys -bind = $mainMod, left, movefocus, l -bind = $mainMod, right, movefocus, r -bind = $mainMod, up, movefocus, u -bind = $mainMod, down, movefocus, d - -# Move focus with hjkl also -bind = $mainMod, h, movefocus, l -bind = $mainMod, l, movefocus, r -bind = $mainMod, k, movefocus, u -bind = $mainMod, j, movefocus, d - -# Move windows with hjkl -bind = $mainMod + SHIFT, h, swapwindow, l -bind = $mainMod + SHIFT, l, swapwindow, r -bind = $mainMod + SHIFT, k, swapwindow, u -bind = $mainMod + SHIFT, j, swapwindow, d - -# Switch workspaces with mainMod + [0-9] -bind = $mainMod, 1, workspace, 1 -bind = $mainMod, 2, workspace, 2 -bind = $mainMod, 3, workspace, 3 -bind = $mainMod, 4, workspace, 4 -bind = $mainMod, 5, workspace, 5 -bind = $mainMod, 6, workspace, 6 -bind = $mainMod, 7, workspace, 7 -bind = $mainMod, 8, workspace, 8 -bind = $mainMod, 9, workspace, 9 -bind = $mainMod, 0, workspace, 10 - -# Move active window to a workspace with mainMod + SHIFT + [0-9] -bind = $mainMod SHIFT, 1, movetoworkspace, 1 -bind = $mainMod SHIFT, 2, movetoworkspace, 2 -bind = $mainMod SHIFT, 3, movetoworkspace, 3 -bind = $mainMod SHIFT, 4, movetoworkspace, 4 -bind = $mainMod SHIFT, 5, movetoworkspace, 5 -bind = $mainMod SHIFT, 6, movetoworkspace, 6 -bind = $mainMod SHIFT, 7, movetoworkspace, 7 -bind = $mainMod SHIFT, 8, movetoworkspace, 8 -bind = $mainMod SHIFT, 9, movetoworkspace, 9 -bind = $mainMod SHIFT, 0, movetoworkspace, 10 - -# Resize windows -bind = $mainMod SHIFT, 60, resizeactive, -10% 0 -bind = $mainMod SHIFT, 59, resizeactive, 10% 0 -bind = $mainMod SHIFT, 21, resizeactive, 0 -10% -bind = $mainMod, 20, resizeactive, 0 10% - -# Scroll through existing workspaces with mainMod + scroll -bind = $mainMod, mouse_down, workspace, e+1 -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 - -# AutoExecs: -# Systemd -exec-once=/usr/libexec/sway-systemd/session.sh -exec-once=/usr/libexec/sway-systemd/assign-cgroups.py +source=~/.config/hypr/hyprland.conf.d/ui.conf +source=~/.config/hypr/hyprland.conf.d/output.conf +source=~/.config/hypr/hyprland.conf.d/keybind.conf +source=~/.config/hypr/hyprland.conf.d/input.conf +source=~/.config/hypr/hyprland.conf.d/autoexec.conf diff --git a/.config/hypr/hyprland.conf.d/autoexec.conf b/.config/hypr/hyprland.conf.d/autoexec.conf new file mode 100644 index 0000000..35a173b --- /dev/null +++ b/.config/hypr/hyprland.conf.d/autoexec.conf @@ -0,0 +1,17 @@ +# env setting for nvidia +env = LIBVA_DRIVER_NAME,nvidia +env = XDG_SESSION_TYPE,wayland +# env = GBM_BACKEND,nvidia-drm +env = WLR_DRM_DEVICES,/dev/dri/card0:/dev/dri/card1 +env = __GLX_VENDOR_LIBRARY_NAME,nvidia +env = WLR_NO_HARDWARE_CURSORS,1 + +# Execute your favorite apps at launch +exec=pidof hyprpaper || hyprpaper +exec=pidof wlsunset || wlsunset -S 08:00 -s 19:00 +exec=pidof waybar || waybar +exec=~/.config/hypr/scripts/clamshell.sh +exec-once=fcitx5 -d + +# ssh agent +env = SSH_AUTH_SOCK,"${XDG_RUNTIME_DIR}/ssh-agent.socket" diff --git a/.config/hypr/hyprland.conf.d/input.conf b/.config/hypr/hyprland.conf.d/input.conf new file mode 100644 index 0000000..6cc99af --- /dev/null +++ b/.config/hypr/hyprland.conf.d/input.conf @@ -0,0 +1,28 @@ +# For all categories, see https://wiki.hyprland.org/Configuring/Variables/ +input { + kb_layout = us + kb_variant = + kb_model = + kb_options = + kb_rules = + + follow_mouse = 1 + + touchpad { + natural_scroll = true + } + + sensitivity = 0 # -1.0 - 1.0, 0 means no modification. +} + +gestures { + # See https://wiki.hyprland.org/Configuring/Variables/ for more + workspace_swipe = on +} + +# Example per-device config +# See https://wiki.hyprland.org/Configuring/Keywords/#executing for more +device:epic-mouse-v1 { + sensitivity = -0.5 +} + diff --git a/.config/hypr/hyprland.conf.d/keybind.conf b/.config/hypr/hyprland.conf.d/keybind.conf new file mode 100644 index 0000000..cc7c21a --- /dev/null +++ b/.config/hypr/hyprland.conf.d/keybind.conf @@ -0,0 +1,91 @@ +# See https://wiki.hyprland.org/Configuring/Keywords/ for more +$mainMod = SUPER + +# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more +bind = $mainMod, N, exec, kitty +bind = $mainMod, W, killactive, +bind = $mainMod + CTRL, Q, exit, +bind = $mainMod + SHIFT, SPACE, togglefloating, +bind = $mainMod + SHIFT, RETURN, exec, wofi --show drun +bind = $mainMod + SHIFT, P, pseudo, # dwindle + +# Move focus with mainMod + arrow keys +bind = $mainMod, left, movefocus, l +bind = $mainMod, right, movefocus, r +bind = $mainMod, up, movefocus, u +bind = $mainMod, down, movefocus, d + +# Move focus with hjkl also +bind = $mainMod, h, movefocus, l +bind = $mainMod, l, movefocus, r +bind = $mainMod, k, movefocus, u +bind = $mainMod, j, movefocus, d + +# Move windows with hjkl +bind = $mainMod + SHIFT, h, movewindow, l +bind = $mainMod + SHIFT, l, movewindow, r +bind = $mainMod + SHIFT, k, movewindow, u +bind = $mainMod + SHIFT, j, movewindow, d + +# Switch workspaces with mainMod + [0-9] +bind = $mainMod, 1, workspace, 1 +bind = $mainMod, 2, workspace, 2 +bind = $mainMod, 3, workspace, 3 +bind = $mainMod, 4, workspace, 4 +bind = $mainMod, 5, workspace, 5 +bind = $mainMod, 6, workspace, 6 +bind = $mainMod, 7, workspace, 7 +bind = $mainMod, 8, workspace, 8 +bind = $mainMod, 9, workspace, 9 +bind = $mainMod, 0, togglespecialworkspace + +# Move active window to a workspace with mainMod + SHIFT + [0-9] +bind = $mainMod SHIFT, 1, movetoworkspacesilent, 1 +bind = $mainMod SHIFT, 2, movetoworkspacesilent, 2 +bind = $mainMod SHIFT, 3, movetoworkspacesilent, 3 +bind = $mainMod SHIFT, 4, movetoworkspacesilent, 4 +bind = $mainMod SHIFT, 5, movetoworkspacesilent, 5 +bind = $mainMod SHIFT, 6, movetoworkspacesilent, 6 +bind = $mainMod SHIFT, 7, movetoworkspacesilent, 7 +bind = $mainMod SHIFT, 8, movetoworkspacesilent, 8 +bind = $mainMod SHIFT, 9, movetoworkspacesilent, 9 +bind = $mainMod SHIFT, 0, movetoworkspacesilent, special + +# Resize windows +binde = $mainMod SHIFT, 60, resizeactive, -10% 0 +binde = $mainMod SHIFT, 59, resizeactive, 10% 0 +binde = $mainMod SHIFT, 21, resizeactive, 0 -10% +binde = $mainMod, 20, resizeactive, 0 10% + +# Fullscreen +bind= $mainMod, F, fullscreen, 0 + +# Scroll through existing workspaces with mainMod + scroll +bind = $mainMod, mouse_down, workspace, e-1 +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 + +# reload hyprland +bind = $mainMod CTRL, r, exec, hyprctl reload + +# change IME +bind = $mainMod CTRL, 65, exec, fcitx5-remote -t + +# open swayNC +bind = $mainMod, M, exec, swaync-client -t + +# fn keys +bind=, XF86AudioRaiseVolume, exec, wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 2%+ +bindl=, XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%- +bind=, XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle +bind=, XF86AudioMicMute, exec , wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle +bind=, XF86MonBrightnessUp, exec, light -A 5 +bind=, XF86MonBrightnessDown, exec, light -U 5 +bind=, XF86AudioPause, exec, 'playerctl pause' +bind=, XF86AudioPlay, exec, 'playerctl play' +bind=, XF86AudioStop, exec, 'playerctl stop' +bind=, XF86AudioNext, exec, 'playerctl next' +bind=, XF86AudioPrev, exec, 'playerctl previous' diff --git a/.config/hypr/hyprland.conf.d/output.conf b/.config/hypr/hyprland.conf.d/output.conf new file mode 100644 index 0000000..dee4061 --- /dev/null +++ b/.config/hypr/hyprland.conf.d/output.conf @@ -0,0 +1,11 @@ +monitor=,highres,auto,auto +monitor=desc:Lectron Company Ltd LECOO M2412HL GG30A137,2560x1440@74.96800,0x500,auto,bitdepth,10 +monitor=desc:XMI Redmi 27 NU 3948622WH08F4,3840x2160@60.00000,2560x0,auto,transform,3,bitdepth,10 +monitor=eDP-1,2560x1600@60.00000,auto,auto,bitdepth,10 + +# Clamshell mode +## Lid is opened +bindl=,switch:off:Lid Switch,exec,~/.config/hypr/scripts/clamshell.sh + +## Lid is closed +bindl=,switch:on:Lid Switch,exec,~/.config/hypr/scripts/clamshell.sh diff --git a/.config/hypr/hyprland.conf.d/ui.conf b/.config/hypr/hyprland.conf.d/ui.conf new file mode 100644 index 0000000..545fdcb --- /dev/null +++ b/.config/hypr/hyprland.conf.d/ui.conf @@ -0,0 +1,55 @@ +general { + gaps_in = 4 + gaps_out = 8 + border_size = 1 + col.active_border = rgb(fbf1c7) + col.inactive_border = rgb(928374) + cursor_inactive_timeout = 10 + resize_on_border = true + layout = dwindle +} + +decoration { + # See https://wiki.hyprland.org/Configuring/Variables/ for more + + rounding = 4 + + blur { + enabled = false + } + + drop_shadow = false +} + +animations { + enabled = yes + animation=specialWorkspace,1,4,default,slidefadevert +} + +dwindle { + # See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more + pseudotile = yes # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below + preserve_split = yes # you probably want this + force_split = 2 + no_gaps_when_only = 1 + default_split_ratio = 1.2 +} + +master { + # See https://wiki.hyprland.org/Configuring/Master-Layout/ for more + new_is_master = false + no_gaps_when_only = true + # drop_at_cursor = true +} + +misc { + disable_splash_rendering = true + disable_hyprland_logo = true + vrr = 1 + disable_autoreload = true + focus_on_activate = true +} + +xwayland { + force_zero_scaling = true +} diff --git a/.config/hypr/hyprpaper.conf b/.config/hypr/hyprpaper.conf index 7ada119..70ab1f1 100644 --- a/.config/hypr/hyprpaper.conf +++ b/.config/hypr/hyprpaper.conf @@ -1,3 +1,4 @@ preload = ~/.config/sway/Wallpaper/bg.png -wallpaper = HDMI-A-1, ~/.config/sway/Wallpaper/bg.png +wallpaper = , ~/.config/sway/Wallpaper/bg.png +# wallpaper = HDMI-A-1, ~/.config/sway/Wallpaper/bg.png ipc = off diff --git a/.config/hypr/scripts/clamshell.sh b/.config/hypr/scripts/clamshell.sh new file mode 100755 index 0000000..cb05944 --- /dev/null +++ b/.config/hypr/scripts/clamshell.sh @@ -0,0 +1,6 @@ +if hyprctl monitors | grep "Lectron Company Ltd LECOO M2412HL GG30A137" &>/dev/null +then + hyprctl keyword monitor "eDP-1, disable" +else + hyprctl keyword monitor "eDP-1, 2560x1440@90, auto, auto" +fi diff --git a/.config/kanshi/config b/.config/kanshi/config deleted file mode 100644 index 9fa9764..0000000 --- a/.config/kanshi/config +++ /dev/null @@ -1,9 +0,0 @@ -profile docked { - output eDP-1 disable - output "XMI Redmi 27 NU 3948622WH08F4" mode 3840x2160@60Hz position 2560,0 transform 270 scale 1.5 - output "Lectron Company Ltd LECOO M2412HL GG30A137" mode 2560x1440@74.96800Hz position 0,0 -} - -profile mobile { - output eDP-1 enable -} diff --git a/.config/waybar/config b/.config/waybar/config index f74733b..ff9b591 100644 --- a/.config/waybar/config +++ b/.config/waybar/config @@ -18,8 +18,13 @@ "clock" ], "hyprland/workspaces": { - "on-scroll-up": "hyprctl dispatch workspace e+1", - "on-scroll-down": "hyprctl dispatch workspace e-1" + "on-scroll-up": "hyprctl dispatch workspace e-1", + "on-scroll-down": "hyprctl dispatch workspace e+1", + "show_special": true, + "on-click": "activate", + "persistent_workspaces": { + "9": ["HDMI-A-1"] + } }, "hyprland/window": { "max-length": 50, diff --git a/.config/waybar/style.css b/.config/waybar/style.css index 6bc15a8..df5fbc1 100644 --- a/.config/waybar/style.css +++ b/.config/waybar/style.css @@ -27,6 +27,11 @@ window#waybar { color: @background_b; } +#workspaces button.visible { + color: @foreground; + font-weight: bold; +} + #workspaces button.active { color: @foreground; font-weight: bold; diff --git a/README.md b/README.md index 6f72e13..74647f1 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ Linux desktop with gruvbox colorscheme, following the KISS philosophy. # Installing I use [yadm](https://github.com/TheLocehiliosan/yadm) to manage dotfiles, the directory layout is unchanged. + ```bash yadm clone https://github.com/JuanCldCmt/dotfiles ``` @@ -18,7 +19,7 @@ yadm clone https://github.com/JuanCldCmt/dotfiles | Name | Description | |------|-------------| -|swayWM|Tiling WM| +|hyprland|wayland WM with better nvidia support| |waybar|Custom bar for sway| |swayNC|Notification center| |wofi|App launcher| @@ -36,4 +37,3 @@ yadm clone https://github.com/JuanCldCmt/dotfiles |pipewire|Sound deamon| |wireplumber|media session management (remember to replace it in sway's config if using non-gentoo)| |playerctld|Control players| -|grim|Take screenshots|