Added ability to have applications start in the scratchpad.
This commit is contained in:
		
							
								
								
									
										7
									
								
								i38.sh
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								i38.sh
									
									
									
									
									
								
							| @@ -516,9 +516,13 @@ bindsym Mod1+Tab focus right | |||||||
| bindsym \$mod+BackSpace fullscreen toggle | bindsym \$mod+BackSpace fullscreen toggle | ||||||
|  |  | ||||||
|  |  | ||||||
| # move the currently focused window to the scratchpad | # Move the currently focused window to the scratchpad | ||||||
| bindsym \$mod+Shift+minus move scratchpad | bindsym \$mod+Shift+minus move scratchpad | ||||||
|  |  | ||||||
|  | # Bind the currently focused window to the scratchpad | ||||||
|  | # This means it will always open in the scratchpad | ||||||
|  | bindsym \$mod+Shift+equal exec --no-startup-id ${i3Path}/scripts/bind_to_scratchpad.sh | ||||||
|  |  | ||||||
| # Show the next scratchpad window or hide the focused scratchpad window. | # Show the next scratchpad window or hide the focused scratchpad window. | ||||||
| # If there are multiple scratchpad windows, this command cycles through them. | # If there are multiple scratchpad windows, this command cycles through them. | ||||||
| bindsym \$mod+minus scratchpad show | bindsym \$mod+minus scratchpad show | ||||||
| @@ -770,6 +774,7 @@ exec --no-startup-id bash -c 'if [[ -f "${i3Path}/firstrun" ]]; then ${webBrowse | |||||||
|     include "${i3Path}/customizations" |     include "${i3Path}/customizations" | ||||||
| EOF | EOF | ||||||
| touch "${i3Path}/customizations" | touch "${i3Path}/customizations" | ||||||
|  | touch "${i3Path}/scratchpad" | ||||||
| # Check for markdown or pandoc for converting the welcome document | # Check for markdown or pandoc for converting the welcome document | ||||||
| if command -v pandoc &> /dev/null ; then | if command -v pandoc &> /dev/null ; then | ||||||
|     pandoc -f markdown -t html "I38.md" -so "${i3Path}/I38.html" --metadata title="Welcome to I38" |     pandoc -f markdown -t html "I38.md" -so "${i3Path}/I38.html" --metadata title="Welcome to I38" | ||||||
|   | |||||||
							
								
								
									
										32
									
								
								scripts/bind_to_scratchpad.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										32
									
								
								scripts/bind_to_scratchpad.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,32 @@ | |||||||
|  | #!/usr/bin/env bash | ||||||
|  |  | ||||||
|  | # Find out if we're using i3 | ||||||
|  | if ! [[ -n "${WAYLAND_DISPLAY}" ]]; then | ||||||
|  |     cmd="i3-msg" | ||||||
|  |     scratchConfig="${XDG_CONFIG_HOME:-$HOME/.config}/i3" | ||||||
|  | else | ||||||
|  |     cmd="swaymsg" | ||||||
|  |     scratchConfig="${XDG_CONFIG_HOME:-$HOME/.config}/sway" | ||||||
|  | fi | ||||||
|  | scratchConfig+="/scratchpad" | ||||||
|  | touch "${scratchConfig}" | ||||||
|  |  | ||||||
|  | # Get the focused window ID | ||||||
|  | windowId=$(xdotool getactivewindow) | ||||||
|  |  | ||||||
|  | # Get the class name of the window | ||||||
|  | class=$(xprop -id "$windowId" WM_CLASS | awk -F '"' '{print $4}') | ||||||
|  |  | ||||||
|  | if [[ -z "$class" ]]; then | ||||||
|  |     notify-send "Unable to move to scratchpad." | ||||||
|  |     exit 1 | ||||||
|  | fi | ||||||
|  |  | ||||||
|  | # Check if it's already in the config | ||||||
|  | if ! grep -q "class=\"$class\"" "$scratchConfig"; then | ||||||
|  |     echo "for_window [class=\"$class\"] move to scratchpad" >> "$scratchConfig" | ||||||
|  |     notify-send "Added window class $class to scratchpad" | ||||||
|  | fi | ||||||
|  |  | ||||||
|  | # Move the window to scratchpad now | ||||||
|  | $cmd "[class=\"$class\"] move to scratchpad" | ||||||
		Reference in New Issue
	
	Block a user