From f1b0d66756743e9d2874689bf0126904a79cc7fc Mon Sep 17 00:00:00 2001 From: Guanran Wang Date: Thu, 5 Oct 2023 15:14:52 +0800 Subject: [PATCH] home: modify wm config - rename script `wrapped-slurp` to `wrapped-grim` - add keybinds to sway in `home.nix` - remove needed environment variables on hyprland in `autostart.conf` - remove unneeded fcitx5 autostart in `autostart.conf` and `home.nix` - remove `hyprland.bak` - remove tabs in `main.conf` --- .../bin/{wrapped-slurp => wrapped-grim} | 0 .../dotfiles/config/hyprland/autostart.conf | 2 +- .../common/dotfiles/config/hyprland/env.conf | 10 - .../dotfiles/config/hyprland/hyprland.bak | 109 ---------- .../dotfiles/config/hyprland/keybinds.conf | 18 +- .../common/dotfiles/config/hyprland/main.conf | 190 ++++++++---------- users/guanranwang/home-manager/nixos/home.nix | 109 +++++++--- 7 files changed, 175 insertions(+), 263 deletions(-) rename users/guanranwang/home-manager/common/dotfiles/bin/{wrapped-slurp => wrapped-grim} (100%) delete mode 100755 users/guanranwang/home-manager/common/dotfiles/config/hyprland/hyprland.bak diff --git a/users/guanranwang/home-manager/common/dotfiles/bin/wrapped-slurp b/users/guanranwang/home-manager/common/dotfiles/bin/wrapped-grim similarity index 100% rename from users/guanranwang/home-manager/common/dotfiles/bin/wrapped-slurp rename to users/guanranwang/home-manager/common/dotfiles/bin/wrapped-grim diff --git a/users/guanranwang/home-manager/common/dotfiles/config/hyprland/autostart.conf b/users/guanranwang/home-manager/common/dotfiles/config/hyprland/autostart.conf index 5b7eaaf..eec1d7b 100644 --- a/users/guanranwang/home-manager/common/dotfiles/config/hyprland/autostart.conf +++ b/users/guanranwang/home-manager/common/dotfiles/config/hyprland/autostart.conf @@ -13,7 +13,7 @@ exec-once = swww init # wallpaper (not working on nixos somehow) #exec-once = hyprpaper # wallpaper but for factional scaling exec-once = waybar # status bar (bro why would nixos autostart waybar itself) #exec-once = eww open bar # status bar but better -exec-once = fcitx5 # input method +#exec-once = fcitx5 # input method #exec-once = swayosd #exec-once = dunst # notification #exec-once = udiskie -t # auto disk mount (with tray) diff --git a/users/guanranwang/home-manager/common/dotfiles/config/hyprland/env.conf b/users/guanranwang/home-manager/common/dotfiles/config/hyprland/env.conf index 45af6a8..741c060 100644 --- a/users/guanranwang/home-manager/common/dotfiles/config/hyprland/env.conf +++ b/users/guanranwang/home-manager/common/dotfiles/config/hyprland/env.conf @@ -3,11 +3,6 @@ # ~/.config/hypr/env.conf # -# Cursor -env = XCURSOR_THEME, Adwaita -#env = XCURSOR_THEME, Bibata-Modern-Classic -env = XCURSOR_SIZE, 24 - # Nvidia #env = LIBVA_DRIVER_NAME, nvidia #env = XDG_SESSION_TYPE, wayland @@ -15,8 +10,3 @@ env = XCURSOR_SIZE, 24 #env = __GLX_VENDOR_LIBRARY_NAME #env = WLR_NO_HARDWARE_CURSORS, 1 #env = __GL_THREADED_OPTIMIZATIONS, 0 # workround for minecraft glitch on nvidia 535.xx driver, https://github.com/NVIDIA/open-gpu-kernel-modules/issues/522 - -# Qt theming -#env = QT_QPA_PLATFORMTHEME, qt5ct -#env = QT_STYLE_OVERRIDE, Adwaita-dark -#env = QT_STYLE_OVERRIDE, kvantum diff --git a/users/guanranwang/home-manager/common/dotfiles/config/hyprland/hyprland.bak b/users/guanranwang/home-manager/common/dotfiles/config/hyprland/hyprland.bak deleted file mode 100755 index a092f5e..0000000 --- a/users/guanranwang/home-manager/common/dotfiles/config/hyprland/hyprland.bak +++ /dev/null @@ -1,109 +0,0 @@ -# -# Hyprland main config -# ~/.config/hypr/hyprland.conf -# wiki: https://wiki.hyprland.org/ -# - -# Display settings -monitor = ,preferred, auto, 1 -#monitor= ,addreserved, 28, 0, 0, 0 # eww bar -monitor = eDP-1, 1920x1080@60, 0x0, 1.25 # laptop screen eDP-1 - -# Multi GPU -#env = WLR_DRM_DEVICES, /dev/dri/card1:/dev/dri/card0 - -# Source (to split config in different files) -# source = ~/.config/hypr/themes/mocha.conf -#source = ~/.config/hypr/themes/colors.conf -source = ~/.config/hypr/keybinds.conf -source = ~/.config/hypr/autostart.conf -source = ~/.config/hypr/env.conf -#source = ~/.config/hypr/plugins.conf - - -# General settings -general { - gaps_in = 4 - gaps_out = 8 # dont forget to change waybar margin - border_size = 2 - layout = dwindle -} - -# Decorations -decoration { - blur { - size = 4 - passes = 4 - } - rounding = 4 - shadow_range = 50 - shadow_render_power = 5 - col.shadow = 0x88000000 - col.shadow_inactive = 0x44000000 -} - -# Animations -# animation=NAME,ONOFF,SPEED,CURVE,STYLE or -# animation=NAME,ONOFF,SPEED,CURVE -animations { - bezier = easeOutExpo, 0.16, 1, 0.3, 1 - bezier = easeOutQuint, 0.22, 1, 0.36, 1 - animation = windows, 1, 6, default, popin # slide or popin - animation = fade, 1, 8, default - animation = border, 1, 8, default - animation = borderangle, 1, 8, default - animation = workspaces, 1, 4, default -} - -# Input settings -input { - accel_profile = flat - force_no_accel = 1 - touchpad { - natural_scroll = yes - disable_while_typing = false - drag_lock = true - } -} - -# idk -dwindle { - pseudotile = yes - preserve_split = yes -} - -# Touchpad gestures -gestures { - workspace_swipe = true # touchpad swipe to switch workspaces - workspace_swipe_distance = 600 # doubles gesture distance -} - -# XWayland -XWayland { - use_nearest_neighbor = false - force_zero_scaling = true -} - -misc { - disable_hyprland_logo = true - disable_splash_rendering = true - animate_manual_resizes = true -} - -# Windows rules -windowrule = float, ^(pavucontrol)$ -windowrule = float, ^(blueberry)$ -windowrule = float, ^(gnome-system-monitor)$ -windowrule = float, ^(org.gnome.Calculator)$ -windowrule = float, ^(org.gnome.Weather)$ -windowrule = float, ^(zenity)$ # popups, input boxes, etc... -windowrule = float, title:^(Friends List)$ # steam friend list -windowrule = float, title:^(File Conflict)$ # nautilus -windowrule = float, title:^(Merge Folder)$ # another nautilus -windowrule = noblur, ^(xdg-desktop-portal-gtk)$ # i dont really know why did i add this -windowrule = noborder, ^(wechat-uos)$ - -# Layer rules -layerrule = blur, notifications -layerrule = blur, rofi -layerrule = ignorezero, notifications diff --git a/users/guanranwang/home-manager/common/dotfiles/config/hyprland/keybinds.conf b/users/guanranwang/home-manager/common/dotfiles/config/hyprland/keybinds.conf index 797c523..c7f6df3 100644 --- a/users/guanranwang/home-manager/common/dotfiles/config/hyprland/keybinds.conf +++ b/users/guanranwang/home-manager/common/dotfiles/config/hyprland/keybinds.conf @@ -3,18 +3,18 @@ # ~/.config/hypr/keybinds.conf # -# bind vars +# bind vars $lock = ~/.local/bin/wrapped-swaylock-effects $wp = ~/.local/bin/wrapped-swww $dwp = ~/.local/bin/wrapped-mpvpaper $changevolume = ~/.local/bin/wrapped-pamixer # use swayosd instead $changebrightness = ~/.local/bin/wrapped-brightnessctl $gamemode = ~/.local/bin/hyprland-gamemode -$screenshot = ~/.local/bin/wrapped-slurp +$screenshot = ~/.local/bin/wrapped-grim $inputfix = ~/.local/bin/minecraft-inputfix $video_path = ~/.var/app/com.valvesoftware.Steam/data/Steam/steamapps/workshop/content/431960 -# binds +# binds bind = SUPER, return, exec, alacritty #bind = SUPER, Q, exec, alacritty bind = SUPER, E, exec, xdg-open ~ @@ -40,12 +40,12 @@ bind = SUPER SHIFT, D, exec, cliphist list | rofi bind = SUPER, Period, exec, rofi -modi emoji -show emoji bind = SUPER SHIFT, L, exec, rofi -modi "power-menu:rofi-power-menu --confirm=reboot/shutdown" -show power-menu -# screenshot +# screenshot bind = ,Print, exec, $screenshot fullscreen bind = SUPER SHIFT, S, exec, $screenshot region bind = ALT SHIFT, S, exec, $screenshot region edit -# wallpaper switching +# wallpaper switching bind = SHIFT ALT, 1, exec, $wp /usr/share/backgrounds/odin.jpg # pkg: elementary-wallpapers bind = SHIFT ALT, 2, exec, $wp /usr/share/backgrounds/odin-dark.jpg bind = SHIFT ALT, 3, exec, $wp ~/.local/share/backgrounds/Mojave\ Night.jpg @@ -87,11 +87,11 @@ bind = SUPER, C, pseudo # dwindle bind = SUPER, S, togglesplit # dwindle bind = SUPER, V, togglefloating -# window size +# window size binde = SUPER, Minus, splitratio, -0.1 binde = SUPER, Equal, splitratio, 0.1 -# move window focus +# move window focus bind = SUPER, H, movefocus, l bind = SUPER, J, movefocus, d bind = SUPER, K, movefocus, u @@ -105,7 +105,7 @@ bind = SUPER, down, movefocus, d bind = SUPER, Tab, cyclenext # change focus to another window bind = SUPER, Tab, bringactivetotop # bring it to the top -# workspaces binds +# workspaces binds bind = SUPER, 1, workspace, 1 bind = SUPER, 2, workspace, 2 bind = SUPER, 3, workspace, 3 @@ -128,7 +128,7 @@ bind = SUPER SHIFT, 8, movetoworkspacesilent, 8 bind = SUPER SHIFT, 9, movetoworkspacesilent, 9 bind = SUPER SHIFT, 0, movetoworkspacesilent, 10 -# mouse binds +# mouse binds bind = SUPER, mouse_down, workspace, e-1 # scroll wheels bind = SUPER, mouse_up, workspace, e+1 bindm = SUPER, mouse:272, movewindow # left click diff --git a/users/guanranwang/home-manager/common/dotfiles/config/hyprland/main.conf b/users/guanranwang/home-manager/common/dotfiles/config/hyprland/main.conf index 273f229..2085df6 100644 --- a/users/guanranwang/home-manager/common/dotfiles/config/hyprland/main.conf +++ b/users/guanranwang/home-manager/common/dotfiles/config/hyprland/main.conf @@ -1,101 +1,89 @@ - # - # Hyprland main config - # ~/.config/hypr/hyprland.conf - # wiki: https://wiki.hyprland.org/ - # - - # Display settings - monitor = ,preferred, auto, 1 - #monitor= ,addreserved, 28, 0, 0, 0 # eww bar - monitor = eDP-1, 1920x1080@60, 0x0, 1.25 # laptop screen eDP-1 - - # Multi GPU - #env = WLR_DRM_DEVICES, /dev/dri/card1:/dev/dri/card0 - - # General settings - general { - gaps_in = 4 - gaps_out = 8 # dont forget to change waybar margin - border_size = 2 - layout = dwindle - } - - # Decorations - decoration { - blur { - size = 4 - passes = 4 - } - rounding = 4 - shadow_range = 50 - shadow_render_power = 5 - col.shadow = 0x88000000 - col.shadow_inactive = 0x44000000 - } - - # Animations - # animation=NAME,ONOFF,SPEED,CURVE,STYLE or - # animation=NAME,ONOFF,SPEED,CURVE - animations { - bezier = easeOutExpo, 0.16, 1, 0.3, 1 - bezier = easeOutQuint, 0.22, 1, 0.36, 1 - animation = windows, 1, 6, default, popin # slide or popin - animation = fade, 1, 8, default - animation = border, 1, 8, default - animation = borderangle, 1, 8, default - animation = workspaces, 1, 4, default - } - - # Input settings - input { - accel_profile = flat - #force_no_accel = false - natural_scroll = true - touchpad { - natural_scroll = true - disable_while_typing = false - drag_lock = true - } - } - - # idk - dwindle { - pseudotile = true - preserve_split = true - } - - # Touchpad gestures - gestures { - workspace_swipe = true # touchpad swipe to switch workspaces - workspace_swipe_distance = 600 # doubles gesture distance - } - - # XWayland - XWayland { - use_nearest_neighbor = false - force_zero_scaling = true - } - - misc { - disable_hyprland_logo = true - disable_splash_rendering = true - animate_manual_resizes = true - } - - # Windows rules - windowrule = float, ^(pavucontrol)$ - windowrule = float, ^(blueberry)$ - windowrule = float, ^(gnome-system-monitor)$ - windowrule = float, ^(org.gnome.Calculator)$ - windowrule = float, ^(org.gnome.Weather)$ - windowrule = float, ^(zenity)$ # popups, input boxes, etc... - windowrule = float, title:^(Friends List)$ # steam friend list - windowrule = float, title:^(File Conflict)$ # nautilus - windowrule = float, title:^(Merge Folder)$ # another nautilus - windowrule = noblur, ^(xdg-desktop-portal-gtk)$ # i dont really know why did i add this - windowrule = noborder, ^(wechat-uos)$ - - # Layer rules - layerrule = blur, notifications - layerrule = blur, rofi - layerrule = ignorezero, notifications \ No newline at end of file +# +# Hyprland main config +# ~/.config/hypr/hyprland.conf +# wiki: https://wiki.hyprland.org/ +# +# Display settings +monitor = ,preferred, auto, 1 +#monitor= ,addreserved, 28, 0, 0, 0 # eww bar +monitor = eDP-1, 1920x1080@60, 0x0, 1.25 # laptop screen eDP-1 +# Multi GPU +#env = WLR_DRM_DEVICES, /dev/dri/card1:/dev/dri/card0 +# General settings +general { + gaps_in = 4 + gaps_out = 8 # dont forget to change waybar margin + border_size = 2 + layout = dwindle +} +# Decorations +decoration { + blur { + size = 4 + passes = 4 + } + rounding = 4 + shadow_range = 50 + shadow_render_power = 5 + col.shadow = 0x88000000 + col.shadow_inactive = 0x44000000 +} +# Animations +# animation=NAME,ONOFF,SPEED,CURVE,STYLE or +# animation=NAME,ONOFF,SPEED,CURVE +animations { + bezier = easeOutExpo, 0.16, 1, 0.3, 1 + bezier = easeOutQuint, 0.22, 1, 0.36, 1 + animation = windows, 1, 6, default, popin # slide or popin + animation = fade, 1, 8, default + animation = border, 1, 8, default + animation = borderangle, 1, 8, default + animation = workspaces, 1, 4, default +} +# Input settings +input { + accel_profile = flat + #force_no_accel = false + natural_scroll = true + touchpad { + natural_scroll = true + disable_while_typing = false + drag_lock = true + } +} +# idk +dwindle { + pseudotile = true + preserve_split = true +} +# Touchpad gestures +gestures { + workspace_swipe = true # touchpad swipe to switch workspaces + workspace_swipe_distance = 600 # doubles gesture distance +} +# XWayland +XWayland { + use_nearest_neighbor = false + force_zero_scaling = true +} +misc { + disable_hyprland_logo = true + disable_splash_rendering = true + animate_manual_resizes = true +} +# Windows rules +windowrule = float, ^(pavucontrol)$ +windowrule = float, ^(blueberry)$ +windowrule = float, ^(gnome-system-monitor)$ +windowrule = float, ^(org.gnome.Calculator)$ +windowrule = float, ^(org.gnome.Weather)$ +windowrule = float, ^(zenity)$ # popups, input boxes, etc... +windowrule = float, title:^(Friends List)$ # steam friend list +windowrule = float, title:^(File Conflict)$ # nautilus +windowrule = float, title:^(Merge Folder)$ # another nautilus +windowrule = noblur, ^(xdg-desktop-portal-gtk)$ # i dont really know why did i add this +windowrule = noborder, ^(wechat-uos)$ +# Layer rules +layerrule = blur, notifications +layerrule = blur, rofi +layerrule = ignorezero, notifications \ No newline at end of file diff --git a/users/guanranwang/home-manager/nixos/home.nix b/users/guanranwang/home-manager/nixos/home.nix index 0f81614..f5e2a4c 100644 --- a/users/guanranwang/home-manager/nixos/home.nix +++ b/users/guanranwang/home-manager/nixos/home.nix @@ -283,9 +283,10 @@ startup = [ { command = "${pkgs.swww}/bin/swww init"; } { command = "${pkgs.waybar}/bin/waybar"; } + { command = "${pkgs.wl-clipboard}/bin/wl-paste --watch cliphist store"; } #{ command = "${pkgs.alacritty}/bin/alacritty"; } #{ command = "${pkgs.fcitx5}/bin/fcitx5 -d"; } - { command = "fcitx5 -d"; } + #{ command = "fcitx5 -d"; } ]; gaps = { inner = 4; @@ -295,39 +296,81 @@ modifier = "Mod4"; keybindings = let - modifier = config.wayland.windowManager.sway.config.modifier; - setBrightness = "/home/guanranwang/.local/bin/wrapped-brightnessctl"; - setVolume = "/home/guanranwang/.local/bin/wrapped-pamixer"; + modifier = config.wayland.windowManager.sway.config.modifier; + setBrightness = "/home/guanranwang/.local/bin/wrapped-brightnessctl"; + setVolume = "/home/guanranwang/.local/bin/wrapped-pamixer"; + screenshot = "/home/guanranwang/.local/bin/wrapped-grim"; + terminal = "exec ${pkgs.alacritty}/bin/alacritty"; + browser = "exec ${pkgs.xdg-utils}/bin/xdg-open http:"; + fileManager = "exec ${pkgs.xdg-utils}/bin/xdg-open ~"; in - lib.mkOptionDefault { - "${modifier}+Shift+q" = null; - "${modifier}+space" = null; - "${modifier}+b" = null; - "${modifier}+w" = "exec ${pkgs.xdg-utils}/bin/xdg-open https://"; - "${modifier}+e" = "exec ${pkgs.xdg-utils}/bin/xdg-open ~"; - #"${modifier}+h" = "focus left"; - #"${modifier}+j" = "focus down"; - #"${modifier}+k" = "focus up"; - #"${modifier}+l" = "focus right"; - "${modifier}+s" = "split toggle"; - "${modifier}+v" = "floating toggle"; - "${modifier}+d" = "exec ${pkgs.rofi}/bin/rofi -show drun -show-icons -icon-theme ${config.gtk.iconTheme.name}"; - #"${modifier}+backspace" = "exec loginctl lock-session"; - "${modifier}+q" = "kill"; - "${modifier}+Shift+s" = "exec /home/guanranwang/.local/bin/wrapped-slurp region"; - "XF86MonBrightnessUp" = "exec ${setBrightness} up"; - "XF86MonBrightnessDown" = "exec ${setBrightness} down"; - "XF86AudioRaiseVolume" = "exec ${setVolume} up"; - "XF86AudioLowerVolume" = "exec ${setVolume} down"; - "XF86AudioMute" = "exec ${setVolume} mute"; - "XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl play-pause"; - "XF86AudioPause" = "exec ${pkgs.playerctl}/bin/playerctl play-pause"; - "XF86AudioPrev" = "exec ${pkgs.playerctl}/bin/playerctl previous"; - "XF86AudioNext" = "exec ${pkgs.playerctl}/bin/playerctl next"; - "XF86AudioStop" = "exec ${pkgs.playerctl}/bin/playerctl stop"; - "XF86AudioMedia" = "exec ${pkgs.playerctl}/bin/playerctl play-pause"; - }; + { + ### Sway itself + # Window + "${modifier}+s" = "split toggle"; + "${modifier}+v" = "floating toggle"; + "${modifier}+f" = "fullscreen"; + "${modifier}+q" = "kill"; + "${modifier}+Shift+e" = "exec ${pkgs.sway}/bin/swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' '${pkgs.sway}/bin/swaymsg exit'"; + # Move around + "${modifier}+h" = "focus left"; + "${modifier}+j" = "focus down"; + "${modifier}+k" = "focus up"; + "${modifier}+l" = "focus right"; + + # Workspaces + # Switch to workspace + "${modifier}+1" = "workspace 1"; + "${modifier}+2" = "workspace 2"; + "${modifier}+3" = "workspace 3"; + "${modifier}+4" = "workspace 4"; + "${modifier}+5" = "workspace 5"; + "${modifier}+6" = "workspace 6"; + "${modifier}+7" = "workspace 7"; + "${modifier}+8" = "workspace 8"; + "${modifier}+9" = "workspace 9"; + "${modifier}+0" = "workspace 10"; + # Move focused Window to workspace + "${modifier}+Shift+1" = "move container to workspace 1"; + "${modifier}+Shift+2" = "move container to workspace 2"; + "${modifier}+Shift+3" = "move container to workspace 3"; + "${modifier}+Shift+4" = "move container to workspace 4"; + "${modifier}+Shift+5" = "move container to workspace 5"; + "${modifier}+Shift+6" = "move container to workspace 6"; + "${modifier}+Shift+7" = "move container to workspace 7"; + "${modifier}+Shift+8" = "move container to workspace 8"; + "${modifier}+Shift+9" = "move container to workspace 9"; + "${modifier}+Shift+0" = "move container to workspace 10"; + + ### Execute other stuff + # Launch applications + "${modifier}+Return" = terminal; + "${modifier}+w" = browser; + "${modifier}+e" = fileManager; + + # Rofi + "${modifier}+d" = "exec ${pkgs.rofi}/bin/rofi -show drun -show-icons -icon-theme ${config.gtk.iconTheme.name}"; + "${modifier}+Shift+d" = "exec ${pkgs.cliphist}/bin/cliphist list | ${pkgs.rofi}/bin/rofi -dmenu | ${pkgs.cliphist}/bin/cliphist decode | ${pkgs.wl-clipboard}/bin/wl-copy"; + "${modifier}+Shift+l" = "exec ${pkgs.rofi}/bin/rofi -modi \"power-menu:rofi-power-menu --confirm=reboot/shutdown\" -show power-menu"; + + # Screenshot + "${modifier}+Shift+s" = "exec ${screenshot} region"; + "Print" = "exec ${screenshot} fullscreen"; + + # Fn keys + "XF86MonBrightnessUp" = "exec ${setBrightness} up"; + "XF86MonBrightnessDown" = "exec ${setBrightness} down"; + "XF86AudioRaiseVolume" = "exec ${setVolume} up"; + "XF86AudioLowerVolume" = "exec ${setVolume} down"; + "XF86AudioMute" = "exec ${setVolume} mute"; + "XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl play-pause"; + "XF86AudioPause" = "exec ${pkgs.playerctl}/bin/playerctl play-pause"; + "XF86AudioPrev" = "exec ${pkgs.playerctl}/bin/playerctl previous"; + "XF86AudioNext" = "exec ${pkgs.playerctl}/bin/playerctl next"; + "XF86AudioStop" = "exec ${pkgs.playerctl}/bin/playerctl stop"; + "XF86AudioMedia" = "exec ${pkgs.playerctl}/bin/playerctl play-pause"; + }; }; extraConfig = '' default_border pixel 2 @@ -519,7 +562,7 @@ #boxxy = { # enable = true; # #rules = { - # # + # # # #}; #}; };