From eb3067ff2917f7982ae86b1948d03f75e4ad79e6 Mon Sep 17 00:00:00 2001 From: Tobias Reisinger Date: Thu, 6 Jul 2023 23:38:19 +0200 Subject: [PATCH] Improve configs --- .bin/autostart-manage | 4 ++- .bin/screenshot | 4 +-- .bin/vim-find | 2 +- .bin/vim-grep | 2 +- .config/environment.d/10-paths | 3 ++- .config/home-manager/common.nix | 1 + ...ortalo-tobias.nix => portalo-serguzim.nix} | 4 +-- .config/home-manager/wayland.nix | 1 + .config/hypr/base.conf | 10 ++++++-- .config/hypr/binds.conf | 20 +++++++++++---- .config/hypr/handler.sh | 25 +++++++++++++++++-- .config/hypr/rules.conf | 8 ++++-- .config/waybar/config | 3 ++- 13 files changed, 67 insertions(+), 20 deletions(-) rename .config/home-manager/{portalo-tobias.nix => portalo-serguzim.nix} (72%) diff --git a/.bin/autostart-manage b/.bin/autostart-manage index 3275b14..ec8145a 100755 --- a/.bin/autostart-manage +++ b/.bin/autostart-manage @@ -96,7 +96,9 @@ _autostart_run_graphical () { start-audio pipewire wait-for-service "network-online.target" - if ! pgrep keepassxc >/dev/null + # Execute only if not already running + # Don't match keepassxc-proxy + if ! (pgrep -l keepassxc | grep -v prox) >/dev/null then if pass x then diff --git a/.bin/screenshot b/.bin/screenshot index be8aa5f..37c5bbe 100755 --- a/.bin/screenshot +++ b/.bin/screenshot @@ -11,7 +11,7 @@ clip_image() { if [ -n "$WAYLAND_DISPLAY" ] then - wc-copy -t image/png < "$screenshot_path" + wl-copy -t image/png < "$screenshot_path" else xclip -t image/png "$screenshot_path" -selection clipboard fi @@ -56,7 +56,7 @@ main_no_upload() { if call_screenshot_tool then - clip_image $screenshot_path + clip_image fi } diff --git a/.bin/vim-find b/.bin/vim-find index d96a569..235fb5b 100755 --- a/.bin/vim-find +++ b/.bin/vim-find @@ -1,4 +1,4 @@ #!/usr/bin/env sh # shellcheck disable=SC2046 -vim $(find "$@") +$EDITOR $(find "$@") diff --git a/.bin/vim-grep b/.bin/vim-grep index ed618e8..4f9766d 100755 --- a/.bin/vim-grep +++ b/.bin/vim-grep @@ -1,4 +1,4 @@ #!/usr/bin/env sh # shellcheck disable=SC2046 -vim $(grep "$@") +$EDITOR $(grep "$@") diff --git a/.config/environment.d/10-paths b/.config/environment.d/10-paths index df85f4d..ae0caae 100644 --- a/.config/environment.d/10-paths +++ b/.config/environment.d/10-paths @@ -2,7 +2,8 @@ export GOPATH="$XDG_DATA_HOME/go" -export NIX_PATH="$HOME/.nix-defexpr/channels:/nix/var/nix/profiles/per-user/$(whoami)/channels${NIX_PATH:+:$NIX_PATH}" +export NIX_PATH="$HOME/.nix-defexpr/channels:$NIX_PATH" + # add my paths export PATH="$HOME/.local/bin:$HOME/.bin:$PATH" diff --git a/.config/home-manager/common.nix b/.config/home-manager/common.nix index 0222ef8..d56469b 100644 --- a/.config/home-manager/common.nix +++ b/.config/home-manager/common.nix @@ -32,6 +32,7 @@ #spotifyd # spotify-daemon (spotifyd.override { withMpris = true; }) # spotify-daemon tokei # project-language statistics + trash-cli # trash utils unzip # unzip vimHugeX # vim with clipboard support xdg-user-dirs # tool manage user directories diff --git a/.config/home-manager/portalo-tobias.nix b/.config/home-manager/portalo-serguzim.nix similarity index 72% rename from .config/home-manager/portalo-tobias.nix rename to .config/home-manager/portalo-serguzim.nix index d597b8b..e1a52e4 100644 --- a/.config/home-manager/portalo-tobias.nix +++ b/.config/home-manager/portalo-serguzim.nix @@ -1,8 +1,8 @@ { config, pkgs, ... }: { - home.username = "tobias"; - home.homeDirectory = "/home/tobias"; + home.username = "serguzim"; + home.homeDirectory = "/home/serguzim"; imports = [ ./common.nix diff --git a/.config/home-manager/wayland.nix b/.config/home-manager/wayland.nix index 4f66224..6e4897e 100644 --- a/.config/home-manager/wayland.nix +++ b/.config/home-manager/wayland.nix @@ -5,6 +5,7 @@ home.packages = with pkgs; [ cliphist # clipboard manager (history) grim # needed for screenshots/flameshot + slurp # needed for screenshots swww # wallpaper daemon wl-clipboard # clipboard manager (tools) ]; diff --git a/.config/hypr/base.conf b/.config/hypr/base.conf index 9f394ac..f5ed44c 100644 --- a/.config/hypr/base.conf +++ b/.config/hypr/base.conf @@ -22,6 +22,7 @@ input { numlock_by_default = true follow_mouse = 1 + mouse_refocus = false accel_profile = flat touchpad { @@ -38,9 +39,10 @@ general { gaps_out = 6 border_size = 1 + cursor_inactive_timeout = 3 no_cursor_warps = true - layout = dwindle + layout = master } decoration { @@ -70,12 +72,16 @@ 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 - no_gaps_when_only = yes # whether to apply gaps when there is only one window + + no_gaps_when_only = yes } master { # See https://wiki.hyprland.org/Configuring/Master-Layout/ for more new_is_master = true + mfact = 0.5 + + no_gaps_when_only = yes } source = ~/.config/hypr/binds.conf diff --git a/.config/hypr/binds.conf b/.config/hypr/binds.conf index 044e3bc..6620a8e 100644 --- a/.config/hypr/binds.conf +++ b/.config/hypr/binds.conf @@ -5,18 +5,28 @@ bind = $main_mod, return, exec, $TERMINAL bind = $main_mod, Q, killactive, bind = $main_mod, M, exit, bind = $main_mod, S, togglefloating, +bind = $main_mod, F, fullscreen, bind = $main_mod, D, exec, j4-dmenu-desktop --dmenu="$DMENU" bind = $main_mod, P, pseudo, # dwindle bind = $main_mod, J, togglesplit, # dwindle bind = $main_mod, Pause, exec, menu-shutdown +bind = $main_mod, Print, exec, screenshot bind = $main_mod SHIFT, R, exec, autostart-manage run-wayland -# Move focus with mainMod + arrow keys -bind = $main_mod, left, movefocus, l -bind = $main_mod, right, movefocus, r -bind = $main_mod, up, movefocus, u -bind = $main_mod, down, movefocus, d +# Move focus with mainMod + hjkl keys +bind = $main_mod, h, movefocus, l +bind = $main_mod, j, movefocus, d +bind = $main_mod, k, movefocus, u +bind = $main_mod, l, movefocus, r +# Move window with mainMod + hjkl keys +bind = $main_mod SHIFT, h, movewindow, l +bind = $main_mod SHIFT, j, movewindow, d +bind = $main_mod SHIFT, k, movewindow, u +bind = $main_mod SHIFT, l, movewindow, r + +# Move focus between windows +bind = $main_mod, c, layoutmsg, swapwithmaster master # Switch workspaces with mainMod + [0-9] bind = $main_mod, 1, workspace, $ws01 diff --git a/.config/hypr/handler.sh b/.config/hypr/handler.sh index f605201..2e7242e 100755 --- a/.config/hypr/handler.sh +++ b/.config/hypr/handler.sh @@ -4,10 +4,31 @@ ws_media="[08]" ws_voip="[09]" -_handler_check_ws_media_empty() { - has_zero_windows=$(hyprctl workspaces -j | jq ".[] | select(.name == \"$ws_media\") | .windows == 0") +ws_media_at="[ 0, 0 ]" +_handler_check_ws_media_empty() { + + # split at ">>" and get the second part and take first part of that + win_id=$(echo "$1" | cut -d'>' -f3 | cut -d',' -f1) + + media_got_emptied="false" + + is_on_media_ws=$(hyprctl clients -j | jq ".[] | select(.address == \"0x$win_id\") | .workspace.name == \"$ws_media\"") + if [ "$is_on_media_ws" == "true" ]; then + media_got_emptied="true" + fi + + was_on_media_ws=$(hyprctl clients -j | jq ".[] | select(.address == \"0x$win_id\") | .at == $ws_media_at") + if [ "$was_on_media_ws" == "true" ]; then + media_got_emptied="true" + fi + + has_zero_windows=$(hyprctl workspaces -j | jq ".[] | select(.name == \"$ws_media\") | .windows == 0") if [ "$has_zero_windows" == "true" ]; then + media_got_emptied="true" + fi + + if [ "$media_got_emptied" == "true" ]; then hyprctl dispatch workspace "$ws_voip" fi diff --git a/.config/hypr/rules.conf b/.config/hypr/rules.conf index 6b2a466..6e79fb9 100644 --- a/.config/hypr/rules.conf +++ b/.config/hypr/rules.conf @@ -7,6 +7,7 @@ windowrulev2 = workspace $ws_focus, class:^(jetbrains-) windowrulev2 = workspace $ws_media, class:(Chromium) windowrulev2 = workspace $ws_media, class:(FreeTube) +windowrulev2 = workspace $ws_media, class:(qutebrowser-kiosk) windowrulev2 = workspace $ws_voip silent, class:(discord) windowrulev2 = workspace $ws_voip silent, class:(Element) @@ -18,7 +19,10 @@ windowrulev2 = workspace $ws_msg silent, class:(Signal) ### Specific rules -#windowrulev2 = workspace $ws_steam silent,class:(steam) # Moves menues too :/ -#windowrulev2 = noinitialfocus,class:(steam) # No focus on menues :/ +#windowrulev2 = workspace $ws_steam silent, class:(steam) # Moves menues too :/ +#windowrulev2 = noinitialfocus, class:(steam) # No focus on menues :/ + +windowrulev2 = move 100%-300 100%-30, class:(steam), title:^(notificationtoasts) +windowrulev2 = nofocus, class:(steam), title:^(notificationtoasts) windowrulev2 = fullscreen, class:(FreeTube) diff --git a/.config/waybar/config b/.config/waybar/config index 588768a..5b939d4 100644 --- a/.config/waybar/config +++ b/.config/waybar/config @@ -3,6 +3,7 @@ "position": "bottom", "height": 24, "spacing": 6, + "mode": "dock", "modules-left": [ "wlr/workspaces" ], @@ -79,7 +80,7 @@ "format": " {}", "interval": 3600, "exec": "~/.config/waybar/custom/pacman", - "on-click": "alacritty -e 'archlinux-update; pkill -SIGRTMIN+8 waybar'", + "on-click": "alacritty -e 'archlinux-update'", "return-type": "json", "signal": 8 },