From 152a7f967866ad984129aea16e3c8f13a905aee3 Mon Sep 17 00:00:00 2001 From: TrudeEH Date: Mon, 26 May 2025 22:14:19 +0100 Subject: [PATCH] Initial hyprland support and improved install script --- debian.sh | 51 ------- home/.config/hypr/hyprland.conf | 241 ++++++++++++++++++++++++++++++++ home/.config/rofi/config.rasi | 151 ++++++++++++++++++++ install.sh | 99 ++++++++++--- 4 files changed, 472 insertions(+), 70 deletions(-) delete mode 100755 debian.sh create mode 100644 home/.config/hypr/hyprland.conf create mode 100644 home/.config/rofi/config.rasi diff --git a/debian.sh b/debian.sh deleted file mode 100755 index 8bcdcd24..00000000 --- a/debian.sh +++ /dev/null @@ -1,51 +0,0 @@ -#! /bin/sh - -# Colors -RED='\033[0;31m' -YELLOW='\033[0;33m' -CYAN='\033[0;36m' -NC='\033[0m' # No Color - -trap 'printf "${RED}debian.sh interrupted.${NC}"; exit 1' INT TERM - -echo "Debian Sources:" -echo "1) Stable" -echo "2) Testing" -printf "Enter your choice: " - -while read -r REPLY; do - case $REPLY in - 1) - echo "${CYAN}Using Stable sources.${NC}" - sudo cp /etc/apt/sources.list /etc/apt/sources.list.bckp - sudo cp stable-sources.list /etc/apt/sources.list - break - ;; - 2) - echo "${CYAN}Using Testing sources.${NC}" - sudo cp /etc/apt/sources.list /etc/apt/sources.list.bckp - sudo cp testing-sources.list /etc/apt/sources.list - break - ;; - *) - echo "Invalid option." - printf "Enter your choice: " - ;; - esac -done - -./scripts/update - -echo "${YELLOW}Installing GNOME...${NC}" -sudo apt install gnome-core flatpak gnome-software-plugin-flatpak -sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo - -# Enable Network Manager -echo "${YELLOW}Enabling Network Manager...${NC}" -sudo mv /etc/network/interfaces /etc/network/interfaces.bckp -sudo systemctl restart networking -sudo service NetworkManager restart - -# Remove Firefox (Epiphany installed instead) -echo "${YELLOW}Removing Firefox...${NC}" -sudo apt purge firefox-esr diff --git a/home/.config/hypr/hyprland.conf b/home/.config/hypr/hyprland.conf new file mode 100644 index 00000000..9b0ae558 --- /dev/null +++ b/home/.config/hypr/hyprland.conf @@ -0,0 +1,241 @@ +############## +### COLORS ### +############## + +$color_accent = rgba(ffa348ee) +$color_inactive = rgba(242424aa) + + +################ +### MONITORS ### +################ + +# See https://wiki.hyprland.org/Configuring/Monitors/ +monitor = HDMI-A-1,1920x1080,0x0,auto +monitor = DP-2,preferred,1920x-400,auto +monitor=,preferred,auto,auto + + +################### +### MY PROGRAMS ### +################### + +# See https://wiki.hyprland.org/Configuring/Keywords/ + +# Set programs that you use +$terminal = foot +$fileManager = nautilus +$menu = rofi -show drun + + +################# +### AUTOSTART ### +################# + +exec-once = waybar +exec-once = swaybg -i ~/.wallpapers/bg-dark.png -m fill +exec-once = dunst +exec-once = udiskie + + +############################# +### ENVIRONMENT VARIABLES ### +############################# + +# See https://wiki.hyprland.org/Configuring/Environment-variables/ + +env = XCURSOR_SIZE,24 +env = HYPRCURSOR_SIZE,24 + + +##################### +### LOOK AND FEEL ### +##################### + +# Refer to https://wiki.hyprland.org/Configuring/Variables/ + +# https://wiki.hyprland.org/Configuring/Variables/#general +general { + gaps_in = 2.5 + gaps_out = 5 + border_size = 2 + + # https://wiki.hyprland.org/Configuring/Variables/#variable-types for info about colors + col.active_border = $color_accent + col.inactive_border = $color_inactive + + # Set to true enable resizing windows by clicking and dragging on borders and gaps + resize_on_border = true + + # Please see https://wiki.hyprland.org/Configuring/Tearing/ before you turn this on + allow_tearing = false + + layout = dwindle +} + +# https://wiki.hyprland.org/Configuring/Variables/#decoration +decoration { + rounding = 10 + + # Change transparency of focused and unfocused windows + active_opacity = 1.0 + inactive_opacity = 1.0 + + drop_shadow = false + shadow_range = 4 + shadow_render_power = 3 + col.shadow = rgba(1a1a1aee) + + # https://wiki.hyprland.org/Configuring/Variables/#blur + blur { + enabled = false + size = 3 + passes = 1 + + vibrancy = 0.1696 + } +} + +# https://wiki.hyprland.org/Configuring/Variables/#animations +animations { + enabled = true + + # Default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more + + bezier = myBezier, 0.05, 0.9, 0.1, 1.05 + + animation = windows, 1, 4, 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 +} + +# See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more +dwindle { + pseudotile = true # Master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below + preserve_split = true +} + +# See https://wiki.hyprland.org/Configuring/Master-Layout/ for more +master { + new_status = master +} + +# https://wiki.hyprland.org/Configuring/Variables/#misc +misc { + force_default_wallpaper = 0 # Set to 0 or 1 to disable the anime mascot wallpapers + disable_hyprland_logo = true # If true disables the random hyprland logo / anime girl background. :( + vfr = true +} + + +############# +### INPUT ### +############# + +# https://wiki.hyprland.org/Configuring/Variables/#input +input { + kb_layout = us + kb_variant = altgr-intl + kb_model = + kb_options = + kb_rules = + + follow_mouse = 1 + + sensitivity = 0 # -1.0 - 1.0, 0 means no modification. + + touchpad { + natural_scroll = true + } +} + +# https://wiki.hyprland.org/Configuring/Variables/#gestures +gestures { + workspace_swipe = false +} + +# Example per-device config +# See https://wiki.hyprland.org/Configuring/Keywords/#per-device-input-configs for more +device { + name = epic-mouse-v1 + sensitivity = -0.5 +} + + +#################### +### KEYBINDINGSS ### +#################### + +# See https://wiki.hyprland.org/Configuring/Keywords/ +$mainMod = SUPER + +# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more +bind = $mainMod, Return, exec, $terminal +bind = $mainMod, C, killactive, +bind = $mainMod, M, exit, +bind = $mainMod, E, exec, $fileManager +bind = $mainMod, V, togglefloating, +bind = $mainMod, R, exec, $menu +bind = $mainMod, P, pseudo, # dwindle +bind = $mainMod, J, togglesplit, # 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 + +# 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 + +# Example special workspace (scratchpad) +bind = $mainMod, S, togglespecialworkspace, magic +bind = $mainMod SHIFT, S, movetoworkspace, special:magic + +# 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 + + +############################## +### WINDOWS AND WORKSPACES ### +############################## + +# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more +# See https://wiki.hyprland.org/Configuring/Workspace-Rules/ for workspace rules + +# Example windowrule v1 +windowrule = float, ^(Rofi)$ + +# Example windowrule v2 +# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$ + +windowrulev2 = suppressevent maximize, class:.* diff --git a/home/.config/rofi/config.rasi b/home/.config/rofi/config.rasi new file mode 100644 index 00000000..55c13759 --- /dev/null +++ b/home/.config/rofi/config.rasi @@ -0,0 +1,151 @@ +configuration { +/* modes: "window,drun,run,ssh";*/ +/* font: "mono 12";*/ +/* location: 0;*/ +/* yoffset: 0;*/ +/* xoffset: 0;*/ +/* fixed-num-lines: true;*/ +/* show-icons: false;*/ +/* terminal: "rofi-sensible-terminal";*/ +/* ssh-client: "ssh";*/ +/* ssh-command: "{terminal} -e {ssh-client} {host} [-p {port}]";*/ +/* run-command: "{cmd}";*/ +/* run-list-command: "";*/ +/* run-shell-command: "{terminal} -e {cmd}";*/ +/* window-command: "wmctrl -i -R {window}";*/ +/* window-match-fields: "all";*/ +/* icon-theme: ;*/ +/* drun-match-fields: "name,generic,exec,categories,keywords";*/ +/* drun-categories: ;*/ +/* drun-show-actions: false;*/ +/* drun-display-format: "{name} [({generic})]";*/ +/* drun-url-launcher: "xdg-open";*/ +/* disable-history: false;*/ +/* ignored-prefixes: "";*/ +/* sort: false;*/ +/* sorting-method: "normal";*/ +/* case-sensitive: false;*/ +/* cycle: true;*/ +/* sidebar-mode: false;*/ +/* hover-select: false;*/ +/* eh: 1;*/ +/* auto-select: false;*/ +/* parse-hosts: false;*/ +/* parse-known-hosts: true;*/ +/* combi-modes: "window,run";*/ +/* matching: "normal";*/ +/* tokenize: true;*/ +/* m: "-5";*/ +/* filter: ;*/ +/* dpi: -1;*/ +/* threads: 0;*/ +/* scroll-method: 0;*/ +/* window-format: "{w} {c} {t}";*/ +/* click-to-exit: true;*/ +/* max-history-size: 25;*/ +/* combi-hide-mode-prefix: false;*/ +/* combi-display-format: "{mode} {text}";*/ +/* matching-negate-char: '-' /* unsupported */;*/ +/* cache-dir: ;*/ +/* window-thumbnail: false;*/ +/* drun-use-desktop-cache: false;*/ +/* drun-reload-desktop-cache: false;*/ +/* normalize-match: false;*/ +/* steal-focus: false;*/ +/* application-fallback-icon: ;*/ +/* refilter-timeout-limit: 8192;*/ +/* xserver-i300-workaround: false;*/ +/* pid: "/run/user/1000/rofi.pid";*/ +/* display-window: ;*/ +/* display-windowcd: ;*/ +/* display-run: ;*/ +/* display-ssh: ;*/ +/* display-drun: ;*/ +/* display-combi: ;*/ +/* display-keys: ;*/ +/* display-filebrowser: ;*/ +/* kb-primary-paste: "Control+V,Shift+Insert";*/ +/* kb-secondary-paste: "Control+v,Insert";*/ +/* kb-clear-line: "Control+w";*/ +/* kb-move-front: "Control+a";*/ +/* kb-move-end: "Control+e";*/ +/* kb-move-word-back: "Alt+b,Control+Left";*/ +/* kb-move-word-forward: "Alt+f,Control+Right";*/ +/* kb-move-char-back: "Left,Control+b";*/ +/* kb-move-char-forward: "Right,Control+f";*/ +/* kb-remove-word-back: "Control+Alt+h,Control+BackSpace";*/ +/* kb-remove-word-forward: "Control+Alt+d";*/ +/* kb-remove-char-forward: "Delete,Control+d";*/ +/* kb-remove-char-back: "BackSpace,Shift+BackSpace,Control+h";*/ +/* kb-remove-to-eol: "Control+k";*/ +/* kb-remove-to-sol: "Control+u";*/ +/* kb-accept-entry: "Control+j,Control+m,Return,KP_Enter";*/ +/* kb-accept-custom: "Control+Return";*/ +/* kb-accept-custom-alt: "Control+Shift+Return";*/ +/* kb-accept-alt: "Shift+Return";*/ +/* kb-delete-entry: "Shift+Delete";*/ +/* kb-mode-next: "Shift+Right,Control+Tab";*/ +/* kb-mode-previous: "Shift+Left,Control+ISO_Left_Tab";*/ +/* kb-mode-complete: "Control+l";*/ +/* kb-row-left: "Control+Page_Up";*/ +/* kb-row-right: "Control+Page_Down";*/ +/* kb-row-up: "Up,Control+p";*/ +/* kb-row-down: "Down,Control+n";*/ +/* kb-row-tab: "";*/ +/* kb-element-next: "Tab";*/ +/* kb-element-prev: "ISO_Left_Tab";*/ +/* kb-page-prev: "Page_Up";*/ +/* kb-page-next: "Page_Down";*/ +/* kb-row-first: "Home,KP_Home";*/ +/* kb-row-last: "End,KP_End";*/ +/* kb-row-select: "Control+space";*/ +/* kb-screenshot: "Alt+S";*/ +/* kb-ellipsize: "Alt+period";*/ +/* kb-toggle-case-sensitivity: "grave,dead_grave";*/ +/* kb-toggle-sort: "Alt+grave";*/ +/* kb-cancel: "Escape,Control+g,Control+bracketleft";*/ +/* kb-custom-1: "Alt+1";*/ +/* kb-custom-2: "Alt+2";*/ +/* kb-custom-3: "Alt+3";*/ +/* kb-custom-4: "Alt+4";*/ +/* kb-custom-5: "Alt+5";*/ +/* kb-custom-6: "Alt+6";*/ +/* kb-custom-7: "Alt+7";*/ +/* kb-custom-8: "Alt+8";*/ +/* kb-custom-9: "Alt+9";*/ +/* kb-custom-10: "Alt+0";*/ +/* kb-custom-11: "Alt+exclam";*/ +/* kb-custom-12: "Alt+at";*/ +/* kb-custom-13: "Alt+numbersign";*/ +/* kb-custom-14: "Alt+dollar";*/ +/* kb-custom-15: "Alt+percent";*/ +/* kb-custom-16: "Alt+dead_circumflex";*/ +/* kb-custom-17: "Alt+ampersand";*/ +/* kb-custom-18: "Alt+asterisk";*/ +/* kb-custom-19: "Alt+parenleft";*/ +/* kb-select-1: "Super+1";*/ +/* kb-select-2: "Super+2";*/ +/* kb-select-3: "Super+3";*/ +/* kb-select-4: "Super+4";*/ +/* kb-select-5: "Super+5";*/ +/* kb-select-6: "Super+6";*/ +/* kb-select-7: "Super+7";*/ +/* kb-select-8: "Super+8";*/ +/* kb-select-9: "Super+9";*/ +/* kb-select-10: "Super+0";*/ +/* ml-row-left: "ScrollLeft";*/ +/* ml-row-right: "ScrollRight";*/ +/* ml-row-up: "ScrollUp";*/ +/* ml-row-down: "ScrollDown";*/ +/* me-select-entry: "MousePrimary";*/ +/* me-accept-entry: "MouseDPrimary";*/ +/* me-accept-custom: "Control+MouseDPrimary";*/ + timeout { + action: "kb-cancel"; + delay: 0; + } + filebrowser { + directories-first: true; + sorting-method: "name"; + } +} diff --git a/install.sh b/install.sh index da925a81..7a9a1f8e 100755 --- a/install.sh +++ b/install.sh @@ -1,6 +1,6 @@ #! /bin/sh -# -r : Only reload configurations +# NOTE: Use `hyperfine` to benchmark # Colors RED='\033[0;31m' @@ -46,28 +46,42 @@ for arg in "$@"; do if [ "$arg" = "-r" ]; then reload=true fi + if [ "$arg" = "-t" ]; then + tiling=true + fi + if [ "$arg" = "-h" ]; then + echo "Usage: $0 [-r][-t][-h]" + echo " -r: Reload config" + echo " -t: Install window manager" + echo " -h: Show help message" + exit 0 + fi done # Clone Dotfiles if not already present -cd "$HOME/dotfiles" || exit -if [ "$(pwd)" != "$HOME/dotfiles" ]; then - echo "${YELLOW}Cloning dotfiles repository...${NC}" - sudo apt update - sudo apt install -y git - if ! git clone https://github.com/TrudeEH/dotfiles --depth 1; then - echo "${RED}Error cloning dotfiles repository. Exiting...${NC}" - exit 2 +if [ "$reload" = false ]; then + cd "$HOME/dotfiles" + if [ "$(pwd)" != "$HOME/dotfiles" ]; then + echo "${YELLOW}Cloning dotfiles repository...${NC}" + sudo apt update + sudo apt install -y git + if ! git clone https://github.com/TrudeEH/dotfiles --depth 1; then + echo "${RED}Error cloning dotfiles repository. Exiting...${NC}" + exit 2 + fi + cd dotfiles || exit + echo "${GREEN}dotfiles repository cloned successfully.${NC}" + else + echo "${YELLOW}Updating dotfiles repository...${NC}" + pull_output=$(git pull) + echo "$pull_output" + if ! echo "$pull_output" | grep -q "Already up to date."; then + echo "${YELLOW}Changes detected. Re-running script...${NC}" + exec "$0" "$@" + fi fi - cd dotfiles || exit - echo "${GREEN}dotfiles repository cloned successfully.${NC}" else - echo "${YELLOW}Updating dotfiles repository...${NC}" - pull_output=$(git pull) - echo "%s" "$pull_output" - if ! echo "$pull_output" | grep -q "Already up to date."; then - echo "${YELLOW}Changes detected. Re-running script...${NC}" - exec "$0" "$@" - fi + cd "$HOME/dotfiles" || exit fi mkdir -p "$HOME/dotfiles/logs" @@ -80,8 +94,55 @@ echo # Install Programs if [ "$reload" = false ]; then - sudo apt install git tmux fzf tealdeer pass-otp zbar-tools lynis bat ufw unp hyperfine \ + echo "Debian Sources:" + echo "1) Stable" + echo "2) Testing" + printf "Enter your choice: " + + while read -r REPLY; do + case $REPLY in + 1) + echo "${CYAN}Using Stable sources.${NC}" + sudo cp /etc/apt/sources.list /etc/apt/sources.list.bckp + sudo cp stable-sources.list /etc/apt/sources.list + break + ;; + 2) + echo "${CYAN}Using Testing sources.${NC}" + sudo cp /etc/apt/sources.list /etc/apt/sources.list.bckp + sudo cp testing-sources.list /etc/apt/sources.list + break + ;; + *) + echo "Invalid option." + printf "Enter your choice: " + ;; + esac + done + + ./scripts/update + + sudo apt install git tmux fzf tealdeer pass-otp zbar-tools lynis bat ufw unp network-manager flatpak \ gir1.2-gtop-2.0 lm-sensors # Vitals Extension deps + sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo + + if [ "$tiling" = true ]; then + echo "${YELLOW}Installing Hyprland...${NC}" + sudo apt install hyprland dunst pipewire wireplumber xdg-desktop-portal-gnome lxpolkit waybar swaybg rofi nautilus udiskie foot + else + echo "${YELLOW}Installing GNOME...${NC}" + sudo apt install gnome-core gnome-software-plugin-flatpak + + # Remove Firefox (Epiphany installed instead) + echo "${YELLOW}Removing Firefox...${NC}" + sudo apt purge firefox-esr + fi + + # Enable Network Manager + echo "${YELLOW}Enabling Network Manager...${NC}" + sudo mv /etc/network/interfaces /etc/network/interfaces.bckp + sudo systemctl restart networking + sudo service NetworkManager restart fi # Copy files