From b965bba57d1a65ea9f19cc8025c1e7974322b871 Mon Sep 17 00:00:00 2001 From: Forestcat Date: Sun, 21 Jan 2024 22:27:16 +0100 Subject: [PATCH] added hyprland xdg portals --- home.nix | 4 + local-configs/alacritty/alacritty.yml | 40 +++++ local-configs/config | 190 ---------------------- local-configs/hyprland/hyprland-start.sh | 15 ++ local-configs/hyprland/hyprland.conf | 194 +++++++++++++++++++++++ nixos/configuration.nix | 40 ++--- 6 files changed, 262 insertions(+), 221 deletions(-) create mode 100644 local-configs/alacritty/alacritty.yml delete mode 100644 local-configs/config create mode 100755 local-configs/hyprland/hyprland-start.sh create mode 100644 local-configs/hyprland/hyprland.conf diff --git a/home.nix b/home.nix index cd82111..89f5a08 100755 --- a/home.nix +++ b/home.nix @@ -49,6 +49,7 @@ # org.gradle.console=verbose # org.gradle.daemon.idletimeout=3600000 # ''; + #".config/hypr/hyprland.conf".source = ./local-configs/hyprland/hyprland.conf; }; # Home Manager can also manage your environment variables through @@ -62,6 +63,9 @@ # # /etc/profiles/per-user/forestcat/etc/profile.d/hm-session-vars.sh # + + # home.file.".config/hypr/hyprland.conf".source = ./hyprland.conf; + home.sessionVariables = { EDITOR = "hx"; }; diff --git a/local-configs/alacritty/alacritty.yml b/local-configs/alacritty/alacritty.yml new file mode 100644 index 0000000..c6a5bd6 --- /dev/null +++ b/local-configs/alacritty/alacritty.yml @@ -0,0 +1,40 @@ +window: + padding: + x: 5 + y: 5 + class: + instance: Alacritty + general: Alacritty + opacity: 0.8 + +scrolling: + history: 100000 + multiplier: 3 + +draw_bold_text_with_bright_colors: true + +colors: + primary: + background: "#11121D" + foreground: "#a9b1d6" + normal: + black: "#32344a" + red: "#f7768e" + green: "#9ece6a" + yellow: "#e0af68" + blue: "#7aa2f7" + magenta: "#ad8ee6" + cyan: "#449dab" + white: "#787c99" + bright: + black: "#444b6a" + red: "#ff7a93" + green: "#b9f27c" + yellow: "#ff9e64" + blue: "#7da6ff" + magenta: "#bb9af7" + cyan: "#0db9d7" + white: "#acb0d0" + +selection: + save_to_clipboard: false diff --git a/local-configs/config b/local-configs/config deleted file mode 100644 index ec120ab..0000000 --- a/local-configs/config +++ /dev/null @@ -1,190 +0,0 @@ -# This file has been auto-generated by i3-config-wizard(1). -# It will not be overwritten, so edit it as you like. -# -# Should you change your keyboard layout some time, delete -# this file and re-run i3-config-wizard(1). -# - -# i3 config file (v4) -# -# Please see https://i3wm.org/docs/userguide.html for a complete reference! - -set $mod Mod4 - -# Font for window titles. Will also be used by the bar unless a different font -# is used in the bar {} block below. -font pango:monospace 8 - -# This font is widely installed, provides lots of unicode glyphs, right-to-left -# text rendering and scalability on retina/hidpi displays (thanks to pango). -#font pango:DejaVu Sans Mono 8 - -# Start XDG autostart .desktop files using dex. See also -# https://wiki.archlinux.org/index.php/XDG_Autostart -exec --no-startup-id dex --autostart --environment i3 - -# The combination of xss-lock, nm-applet and pactl is a popular choice, so -# they are included here as an example. Modify as you see fit. - -# xss-lock grabs a logind suspend inhibit lock and will use i3lock to lock the -# screen before suspend. Use loginctl lock-session to lock your screen. -exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork - -# NetworkManager is the most popular way to manage wireless networks on Linux, -# and nm-applet is a desktop environment-independent system tray GUI for it. -exec --no-startup-id nm-applet - -# Use pactl to adjust volume in PulseAudio. -set $refresh_i3status killall -SIGUSR1 i3status -bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status -bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status -bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status -bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status - -# Use Mouse+$mod to drag floating windows to their wanted position -floating_modifier $mod - -# move tiling windows via drag & drop by left-clicking into the title bar, -# or left-clicking anywhere into the window while holding the floating modifier. -tiling_drag modifier titlebar - -# start a terminal -bindsym $mod+t exec xfce4-terminal - -# kill focused window -bindsym $mod+q kill - -# start dmenu (a program launcher) -# bindsym $mod+d exec --no-startup-id dmenu_run -# A more modern dmenu replacement is rofi: -bindcode $mod+40 exec "rofi -modi drun,run -show drun" -# There also is i3-dmenu-desktop which only displays applications shipping a -# .desktop file. It is a wrapper around dmenu, so you need that installed. -# bindcode $mod+40 exec --no-startup-id i3-dmenu-desktop - -# change focus -bindsym $mod+j focus left -bindsym $mod+k focus down -bindsym $mod+l focus up -bindsym $mod+odiaeresis focus right - -# alternatively, you can use the cursor keys: -bindsym $mod+Left focus left -bindsym $mod+Down focus down -bindsym $mod+Up focus up -bindsym $mod+Right focus right - -# move focused window -bindsym $mod+Shift+j move left -bindsym $mod+Shift+k move down -bindsym $mod+Shift+l move up -bindsym $mod+Shift+odiaeresis move right - -# alternatively, you can use the cursor keys: -bindsym $mod+Shift+Left move left -bindsym $mod+Shift+Down move down -bindsym $mod+Shift+Up move up -bindsym $mod+Shift+Right move right - -# split in horizontal orientation -bindsym $mod+h split h - -# split in vertical orientation -bindsym $mod+v split v - -# enter fullscreen mode for the focused container -bindsym $mod+f fullscreen toggle - -# change container layout (stacked, tabbed, toggle split) -bindsym $mod+s layout stacking -bindsym $mod+w layout tabbed -bindsym $mod+e layout toggle split - -# toggle tiling / floating -bindsym $mod+Shift+space floating toggle - -# change focus between tiling / floating windows -bindsym $mod+space focus mode_toggle - -# focus the parent container -bindsym $mod+a focus parent - -# focus the child container -#bindsym $mod+d focus child - -# Define names for default workspaces for which we configure key bindings later on. -# We use variables to avoid repeating the names in multiple places. -set $ws1 "1" -set $ws2 "2" -set $ws3 "3" -set $ws4 "4" -set $ws5 "5" -set $ws6 "6" -set $ws7 "7" -set $ws8 "8" -set $ws9 "9" -set $ws10 "10" - -# switch to workspace -bindsym $mod+1 workspace number $ws1 -bindsym $mod+2 workspace number $ws2 -bindsym $mod+3 workspace number $ws3 -bindsym $mod+4 workspace number $ws4 -bindsym $mod+5 workspace number $ws5 -bindsym $mod+6 workspace number $ws6 -bindsym $mod+7 workspace number $ws7 -bindsym $mod+8 workspace number $ws8 -bindsym $mod+9 workspace number $ws9 -bindsym $mod+0 workspace number $ws10 - -# move focused container to workspace -bindsym $mod+Shift+1 move container to workspace number $ws1 -bindsym $mod+Shift+2 move container to workspace number $ws2 -bindsym $mod+Shift+3 move container to workspace number $ws3 -bindsym $mod+Shift+4 move container to workspace number $ws4 -bindsym $mod+Shift+5 move container to workspace number $ws5 -bindsym $mod+Shift+6 move container to workspace number $ws6 -bindsym $mod+Shift+7 move container to workspace number $ws7 -bindsym $mod+Shift+8 move container to workspace number $ws8 -bindsym $mod+Shift+9 move container to workspace number $ws9 -bindsym $mod+Shift+0 move container to workspace number $ws10 - -# reload the configuration file -bindsym $mod+Shift+c reload -# restart i3 inplace (preserves your layout/session, can be used to upgrade i3) -bindsym $mod+Shift+r restart -# exit i3 (logs you out of your X session) -bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'" - -# resize window (you can also use the mouse for that) -mode "resize" { - # These bindings trigger as soon as you enter the resize mode - - # Pressing left will shrink the window’s width. - # Pressing right will grow the window’s width. - # Pressing up will shrink the window’s height. - # Pressing down will grow the window’s height. - bindsym j resize shrink width 10 px or 10 ppt - bindsym k resize grow height 10 px or 10 ppt - bindsym l resize shrink height 10 px or 10 ppt - bindsym odiaeresis resize grow width 10 px or 10 ppt - - # same bindings, but for the arrow keys - bindsym Left resize shrink width 10 px or 10 ppt - bindsym Down resize grow height 10 px or 10 ppt - bindsym Up resize shrink height 10 px or 10 ppt - bindsym Right resize grow width 10 px or 10 ppt - - # back to normal: Enter or Escape or $mod+r - bindsym Return mode "default" - bindsym Escape mode "default" - bindsym $mod+r mode "default" -} - -bindsym $mod+r mode "resize" - -# Start i3bar to display a workspace bar (plus the system information i3status -# finds out, if available) -bar { - status_command i3blocks -} diff --git a/local-configs/hyprland/hyprland-start.sh b/local-configs/hyprland/hyprland-start.sh new file mode 100755 index 0000000..175926a --- /dev/null +++ b/local-configs/hyprland/hyprland-start.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + + +# wallpaper deamon initialisation +swww init & +# setting wallpaper +# swww img ~/path/to/image.png & + +nm-applet --indicator & + +# infobar +waybar & + +# dunst notification deamon +dunst diff --git a/local-configs/hyprland/hyprland.conf b/local-configs/hyprland/hyprland.conf new file mode 100644 index 0000000..2a072ae --- /dev/null +++ b/local-configs/hyprland/hyprland.conf @@ -0,0 +1,194 @@ +# This is an example Hyprland config file. +# +# Refer to the wiki for more information. + +# +# Please note not all available settings / options are set here. +# For a full list, see the wiki +# + +# See https://wiki.hyprland.org/Configuring/Monitors/ +#monitor=,preferred,auto,auto +monitor=eDP-1,1920x1080@60,0x0,1.2 + + +# See https://wiki.hyprland.org/Configuring/Keywords/ for more + +# Execute your favorite apps at launch +# exec-once = waybar & hyprpaper & firefox + +# Source a file (multi-file configs) +# source = ~/.config/hypr/myColors.conf + +# Set programs that you use +$terminal = alacritty +$fileManager = dolphin +$menu = rofi -show drun -show-icons + +# Some default env vars. +env = XCURSOR_SIZE,24 +env = QT_QPA_PLATFORMTHEME,qt5ct # change to qt6ct if you have that + +# For all categories, see https://wiki.hyprland.org/Configuring/Variables/ +input { + kb_layout = de + kb_variant = + kb_model = + kb_options = + kb_rules = + + follow_mouse = 1 + + touchpad { + natural_scroll = false + } + + sensitivity = 0 # -1.0 - 1.0, 0 means no modification. +} + +general { + # See https://wiki.hyprland.org/Configuring/Variables/ for more + + gaps_in = 5 + gaps_out = 20 + border_size = 2 + col.active_border = rgba(33ccffee) rgba(00ff99ee) 45deg + col.inactive_border = rgba(595959aa) + + layout = dwindle + + # Please see https://wiki.hyprland.org/Configuring/Tearing/ before you turn this on + allow_tearing = false +} + +decoration { + # See https://wiki.hyprland.org/Configuring/Variables/ for more + + rounding = 5 + + blur { + enabled = true + size = 3 + passes = 1 + + vibrancy = 0.1696 + } + inactive_opacity = 0.9 + + drop_shadow = true + shadow_range = 4 + shadow_render_power = 3 + col.shadow = rgba(1a1a1aee) +} + +animations { + enabled = true + + # 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 = true # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below + preserve_split = true # you probably want this +} + +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 = false +} + +misc { + # See https://wiki.hyprland.org/Configuring/Variables/ for more + force_default_wallpaper = -1 # Set to 0 to disable the anime mascot wallpapers +} + +# Example per-device config +# See https://wiki.hyprland.org/Configuring/Keywords/#per-device-input-configs 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 +windowrulev2 = nomaximizerequest, class:.* # You'll probably like this. + + +# See https://wiki.hyprland.org/Configuring/Keywords/ for more +$mainMod = SUPER + +# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more +bind = $mainMod, T, exec, $terminal +bind = $mainMod, Q, killactive, +bind = $mainMod SHIFT, E, exit, +bind = $mainMod, E, exec, $fileManager +bind = $mainMod SHIFT, space, togglefloating, +bind = $mainMod, D, exec, $menu +bind = $mainMod, P, pseudo, # dwindle +bind = $mainMod, J, togglesplit, # dwindle +bind = $mainMod SHIFT, P, exec, grim -l 0 -g "$(slurp)" - | wl-copy +bind = $mainMod, L, exec, swaylock --color "1e1e1e" --ring-color "977ec9" +# 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 + +# lidswitch trigger +bindl=,switch:Lid Switch,exec,swaylock --color "1e1e1e" --ring-color "977ec9" + +# hyprland startup script +exec-once=bash ~/.config/hypr/start.sh diff --git a/nixos/configuration.nix b/nixos/configuration.nix index 4310e08..986c130 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -45,10 +45,7 @@ xkbVariant = ""; }; - # programs.xss-lock.enable = true; - # # programs.xss-lock.lockerCommand= "${pkgs.i3lock}/bin/i3lock"; - # programs.xss-lock.lockerCommand= "${pkgs.i3lock-color}/bin/i3lock-color --insidever-color='#00000000' --ringver-color='#00564dE6' --insidewrong-color='#ffffff22' --ringwrong-color='#880000bb' --inside-color='#00000000' --ring-color='#00897bE6' --line-color='#00000000' --separator-color='#00897bE6' --verif-color='#00897bE6' --wrong-color='#00897bE6' --layout-color='#00897bE6' --keyhl-color='#880000bb' --bshl-color='#880000bb' --screen 1 --blur 8 --indicator"; - + # Configure console keymap console.keyMap = "de"; @@ -100,9 +97,6 @@ environment.systemPackages = with pkgs; [ # System Packages go here brave - grim # screenshot utility; for selection screenshots do: grim -l 0 -g "$(slurp)" - | wl-clipboard - slurp # select utiliy - wl-clipboard # xclip alternative davfs2 htop picom-jonaburg @@ -123,7 +117,7 @@ prismlauncher alejandra keepassxc - kitty + # kitty swww rofi-wayland waybar @@ -149,10 +143,10 @@ lxappearance-gtk2 xorg.xev xfce.xfce4-pulseaudio-plugin - xbindkeys - xbindkeys-config + # xbindkeys + # xbindkeys-config traceroute - xorg.xinit + # xorg.xinit nil alacritty # gpu accelerated terminal dbus # make dbus-update-activation-environment available in the path @@ -165,7 +159,7 @@ swayidle grim # screenshot functionality slurp # screenshot functionality - wl-clipboard # wl-copy and wl-paste for copy/paste from stdin / stdout + wl-clipboard # wl-copy and wl-paste for copy/paste from stdin / stdout; for selection screenshots do: grim -l 0 -g "$(slurp)" - | wl-clipboard bemenu # wayland clone of dmenu mako # notification system developed by swaywm maintainer wdisplays # tool to configure displays @@ -185,22 +179,6 @@ # Enable the OpenSSH daemon. # services.openssh.enable = true; - # systemd.services."suspend@".unitConfig = { - # Before = [ "sleep.target" ]; - # Description = "suspend actions"; - # }; - - # systemd.services."suspend@".serviceConfig = { - # User = "%I"; - # Type = "forking"; - # environment = "DISPLAY=:0"; - # ExecStartPre = "-/usr/bin/pkill -u %u unison ; /usr/local/bin/music.sh stop"; - # ExecStart = "/home/forestcat/.config/i3/scripts/lock2.sh"; - # ExecStartPost = "/usr/bin/sleep 1"; - # }; - # systemd.services."suspend@".wantedBy = [ "sleep.target" ]; - - # systemd.services."suspend@forestcat".enable = true; # Open ports in the firewall. # networking.firewall.allowedTCPPorts = [ ... ]; # networking.firewall.allowedUDPPorts = [ ... ]; @@ -226,7 +204,7 @@ }; xdg.portal.enable = true; - xdg.portal.extraPortals = [pkgs.xdg-desktop-portal-gtk]; + xdg.portal.extraPortals = [pkgs.xdg-desktop-portal-gtk pkgs.xdg-desktop-portal-hyprland]; # services.xserver.wayland.enable = true; services.xserver.desktopManager.xfce.enable = true; @@ -240,8 +218,8 @@ # Hyperland programs.hyprland = { - enable = true; - xwayland.enable = true; + enable = true; + xwayland.enable = true; }; environment.sessionVariables = {