Improve hyprland config (env + handler)
This commit is contained in:
		
							parent
							
								
									c6267c7163
								
							
						
					
					
						commit
						b3f1045292
					
				
					 7 changed files with 135 additions and 99 deletions
				
			
		|  | @ -1,89 +1,7 @@ | |||
| source = ~/.config/hypr/dracula.conf | ||||
| 
 | ||||
| 
 | ||||
| # See https://wiki.hyprland.org/Configuring/Monitors/ | ||||
| #monitor=,preferred,auto,auto | ||||
| 
 | ||||
| # See https://wiki.hyprland.org/Configuring/Keywords/ for more | ||||
| 
 | ||||
| # Execute your favorite apps at launch | ||||
| # exec-once = waybar & hyprpaper & firefox | ||||
| 
 | ||||
| # Some default env vars. | ||||
| env = XCURSOR_SIZE,24 | ||||
| 
 | ||||
| # For all categories, see https://wiki.hyprland.org/Configuring/Variables/ | ||||
| input { | ||||
|     kb_layout = de | ||||
|     kb_variant = | ||||
|     kb_model = | ||||
|     kb_options = | ||||
|     kb_rules = | ||||
| 	numlock_by_default = true | ||||
| 
 | ||||
|     follow_mouse = 1 | ||||
| 	mouse_refocus = false | ||||
| 	accel_profile = flat | ||||
| 
 | ||||
|     touchpad { | ||||
|         natural_scroll = no | ||||
|     } | ||||
| 
 | ||||
|     sensitivity = 0 # -1.0 - 1.0, 0 means no modification. | ||||
| } | ||||
| 
 | ||||
| general { | ||||
|     # See https://wiki.hyprland.org/Configuring/Variables/ for more | ||||
| 
 | ||||
|     gaps_in = 3 | ||||
|     gaps_out = 6 | ||||
|     border_size = 1 | ||||
| 
 | ||||
| 	cursor_inactive_timeout = 3 | ||||
| 	no_cursor_warps = true | ||||
| 
 | ||||
|     layout = master | ||||
| } | ||||
| 
 | ||||
| decoration { | ||||
|     # See https://wiki.hyprland.org/Configuring/Variables/ for more | ||||
| 
 | ||||
|     rounding = 3 | ||||
|     blur = yes | ||||
|     blur_size = 3 | ||||
|     blur_passes = 1 | ||||
|     blur_new_optimizations = true | ||||
| } | ||||
| 
 | ||||
| animations { | ||||
|     enabled = true | ||||
| 
 | ||||
|     # Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more | ||||
| 
 | ||||
|     bezier = overshot, 0.05, 0.9, 0.1, 1.1 | ||||
| 
 | ||||
|     animation = windows, 1, 3, overshot, slide | ||||
|     animation = fade, 0, 6, default | ||||
|     animation = border, 1, 6, default | ||||
|     animation = workspaces, 1, 6, overshot, slide | ||||
| } | ||||
| 
 | ||||
| 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 | ||||
| } | ||||
| 
 | ||||
| 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/env.conf | ||||
| source = ~/.config/hypr/vars.conf | ||||
| source = ~/.config/hypr/binds.conf | ||||
| source = ~/.config/hypr/rules.conf | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,19 +1,19 @@ | |||
| $main_mod = SUPER | ||||
| 
 | ||||
| # Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more | ||||
| bind = $main_mod, return, exec, $TERMINAL | ||||
| bind = $main_mod SHIFT, return, exec, [float] $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 + hjkl keys | ||||
| bind = $main_mod, h, movefocus, l | ||||
| bind = $main_mod, j, movefocus, d | ||||
|  | @ -28,6 +28,7 @@ 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 | ||||
| bind = $main_mod, 2, workspace, $ws02 | ||||
|  |  | |||
							
								
								
									
										8
									
								
								.config/hypr/env.conf
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								.config/hypr/env.conf
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,8 @@ | |||
| # Some default env vars. | ||||
| env = XCURSOR_SIZE,24 | ||||
| env = XCURSOR_THEME,Dracula-cursors | ||||
| 
 | ||||
| env = GDK_BACKEND,wayland,x11 | ||||
| env = QT_QPA_PLATFORM,wayland;xcb | ||||
| env = SDL_VIDEODRIVER,wayland | ||||
| env = CLUTTER_BACKEND,wayland | ||||
|  | @ -1,35 +1,65 @@ | |||
| #!/usr/bin/env nix-shell | ||||
| #!nix-shell -i sh -p socat jq | ||||
| 
 | ||||
| # Config | ||||
| ws_media="[08]" | ||||
| ws_voip="[09]" | ||||
| 
 | ||||
| ws_media_at="[ 0, 0 ]" | ||||
| 
 | ||||
| 
 | ||||
| # Debug code | ||||
| debug_enabled="false" | ||||
| if [ "$1" == "--debug" ]; then | ||||
| 	debug_enabled="true" | ||||
| fi | ||||
| 
 | ||||
| debug() { | ||||
| 	if [ "$debug_enabled" == "true" ]; then | ||||
| 		echo "$1" >&2 | ||||
| 	fi | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| # Main code | ||||
| all_clients="[]" | ||||
| 
 | ||||
| _handler_update_all_clients() { | ||||
| 	all_clients=$(hyprctl clients -j) | ||||
| } | ||||
| 
 | ||||
| _handler_check_ws_media_empty() { | ||||
| 
 | ||||
| 	# split at ">>" and get the second part and take first part of that | ||||
| 	event=$(echo "$1" | cut -d'>' -f1) | ||||
| 	win_id=$(echo "$1" | cut -d'>' -f3 | cut -d',' -f1) | ||||
| 
 | ||||
| 	event_on_media="false" | ||||
| 	win_client=$(echo "$all_clients" | jq ".[] | select(.address == \"0x$win_id\")") | ||||
| 
 | ||||
| 	moved_from_media=$(hyprctl clients -j | jq ".[] | select(.address == \"0x$win_id\") | .workspace.name == \"$ws_media\"") | ||||
| 	closed_on_media=$(hyprctl clients -j | jq ".[] | select(.address == \"0x$win_id\") | .at == $ws_media_at") | ||||
| 
 | ||||
| 	if [ "$moved_from_media" == "true" ] || [ "$closed_on_media" == "true" ]; then | ||||
| 		event_on_media="true" | ||||
| 	if [ "$event" == "closewindow" ]; then | ||||
| 		event_on_media="$(echo "$win_client" | jq ".workspace.name == \"$ws_media\"")" | ||||
| 	fi | ||||
| 	if [ "$event" == "movewindow" ]; then | ||||
| 		event_on_media="$(echo "$win_client" | jq ".at == $ws_media_at")" | ||||
| 	fi | ||||
| 
 | ||||
| 	has_zero_windows=$(hyprctl workspaces -j | jq ".[] | select(.name == \"$ws_media\") | .windows == 0") | ||||
| 
 | ||||
| 	debug "event: $event" | ||||
| 	debug "win_id: $win_id" | ||||
| 	debug "client: $win_client" | ||||
| 	debug "event_on_media: $event_on_media" | ||||
| 	debug "has_zero_windows: $has_zero_windows" | ||||
| 
 | ||||
| 	if [ "$has_zero_windows" == "true" ] && [ "$event_on_media" == "true" ]; then | ||||
| 		hyprctl dispatch workspace "$ws_voip" | ||||
| 	fi | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| handle() { | ||||
| 	debug "----- $1 -----" | ||||
| 	case $1 in | ||||
| 		openwindow*) _handler_update_all_clients "$1" ;; | ||||
| 		movewindow*) _handler_check_ws_media_empty "$1" ;; | ||||
| 		closewindow*) _handler_check_ws_media_empty "$1" ;; | ||||
| 	esac | ||||
|  |  | |||
|  | @ -24,5 +24,17 @@ windowrulev2 = workspace $ws_msg silent, class:(Signal) | |||
| 
 | ||||
| windowrulev2 = move 100%-300 100%-30, class:(steam), title:^(notificationtoasts) | ||||
| windowrulev2 = nofocus, class:(steam), title:^(notificationtoasts) | ||||
| windowrulev2 = float, class:(steam), title:^(Friends List) | ||||
| windowrulev2 = noinitialfocus, class:(steam), title:^(Friends List) | ||||
| 
 | ||||
| windowrulev2 = float, class:(xdg-desktop-portal-gtk) | ||||
| 
 | ||||
| windowrulev2 = workspace unset, class:(thunderbird), title:^$ | ||||
| windowrulev2 = noinitialfocus, class:(thunderbird), title:^$ | ||||
| windowrulev2 = float, class:(thunderbird), title:^$ | ||||
| windowrulev2 = move 100%-1300,100%-1400, class:(thunderbird), title:^$ | ||||
| windowrulev2 = float, class:(thunderbird), title:(Reminder)$ | ||||
| 
 | ||||
| windowrulev2 = float, class:(org.keepassxc.KeePassXC), title:(KeePassXC - Browser Access Request) | ||||
| 
 | ||||
| windowrulev2 = fullscreen, class:(FreeTube) | ||||
|  |  | |||
							
								
								
									
										71
									
								
								.config/hypr/vars.conf
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										71
									
								
								.config/hypr/vars.conf
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,71 @@ | |||
| # For all categories, see https://wiki.hyprland.org/Configuring/Variables/ | ||||
| input { | ||||
|     kb_layout = de | ||||
|     kb_variant = | ||||
|     kb_model = | ||||
|     kb_options = | ||||
|     kb_rules = | ||||
| 	numlock_by_default = true | ||||
| 
 | ||||
|     follow_mouse = 1 | ||||
| 	mouse_refocus = false | ||||
| 	accel_profile = flat | ||||
| 
 | ||||
|     touchpad { | ||||
|         natural_scroll = no | ||||
|     } | ||||
| 
 | ||||
|     sensitivity = 0 # -1.0 - 1.0, 0 means no modification. | ||||
| } | ||||
| 
 | ||||
| general { | ||||
|     # See https://wiki.hyprland.org/Configuring/Variables/ for more | ||||
| 
 | ||||
|     gaps_in = 3 | ||||
|     gaps_out = 6 | ||||
|     border_size = 1 | ||||
| 
 | ||||
| 	cursor_inactive_timeout = 3 | ||||
| 	no_cursor_warps = true | ||||
| 
 | ||||
|     layout = master | ||||
| } | ||||
| 
 | ||||
| decoration { | ||||
|     # See https://wiki.hyprland.org/Configuring/Variables/ for more | ||||
| 
 | ||||
|     rounding = 3 | ||||
|     blur = yes | ||||
|     blur_size = 3 | ||||
|     blur_passes = 1 | ||||
|     blur_new_optimizations = true | ||||
| } | ||||
| 
 | ||||
| animations { | ||||
|     enabled = true | ||||
| 
 | ||||
|     # Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more | ||||
| 
 | ||||
|     bezier = overshot, 0.05, 0.9, 0.1, 1.1 | ||||
| 
 | ||||
|     animation = windows, 1, 3, overshot, slide | ||||
|     animation = fade, 0, 6, default | ||||
|     animation = border, 1, 6, default | ||||
|     animation = workspaces, 1, 6, overshot, slide | ||||
| } | ||||
| 
 | ||||
| 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 | ||||
| } | ||||
| 
 | ||||
| master { | ||||
|     # See https://wiki.hyprland.org/Configuring/Master-Layout/ for more | ||||
|     new_is_master = true | ||||
| 	mfact = 0.5 | ||||
| 
 | ||||
| 	no_gaps_when_only = yes | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue