replaced xdotool with i3 polling script for cpu reduction
This commit is contained in:
		
							parent
							
								
									0758755dfa
								
							
						
					
					
						commit
						ec0e530958
					
				
							
								
								
									
										14
									
								
								bin/i3-focus.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										14
									
								
								bin/i3-focus.sh
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,14 @@
 | 
				
			|||||||
 | 
					#!/usr/bin/env bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# loops over i3 ipc events to prevent unnesecary polling
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					while :; do
 | 
				
			||||||
 | 
					    # infinite loop
 | 
				
			||||||
 | 
					    i3_msg=$(i3-msg -t SUBSCRIBE '[ "window" , "output" ]')
 | 
				
			||||||
 | 
					    window=$(echo "$i3_msg" | gojq 'if .change == "focus" then .container.window_properties end | if .title == "tmux" then .title else .class end' | tr -d '"')
 | 
				
			||||||
 | 
					    case "$window" in
 | 
				
			||||||
 | 
					        'st-256color')      echo 'st'       ;;
 | 
				
			||||||
 | 
					        'Brave-browser')    echo 'Brave'    ;;
 | 
				
			||||||
 | 
					        *)                  echo "$window"  ;;
 | 
				
			||||||
 | 
					    esac
 | 
				
			||||||
 | 
					done
 | 
				
			||||||
@ -3,3 +3,8 @@ L3
 | 
				
			|||||||
Pset
 | 
					Pset
 | 
				
			||||||
Kalynn
 | 
					Kalynn
 | 
				
			||||||
Appt
 | 
					Appt
 | 
				
			||||||
 | 
					EPR
 | 
				
			||||||
 | 
					S983
 | 
				
			||||||
 | 
					Airpods
 | 
				
			||||||
 | 
					swiffer
 | 
				
			||||||
 | 
					postlab
 | 
				
			||||||
 | 
				
			|||||||
										
											Binary file not shown.
										
									
								
							@ -23,8 +23,9 @@ exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock-blur --nofork
 | 
				
			|||||||
# auto starting default applications
 | 
					# auto starting default applications
 | 
				
			||||||
# assign [class="st-256color"] 1
 | 
					# assign [class="st-256color"] 1
 | 
				
			||||||
# assign [title="startup-browser"] 2
 | 
					# assign [title="startup-browser"] 2
 | 
				
			||||||
 | 
					for_window [instance="startup-tmux"] move to workspace $ws1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
exec --no-startup-id i3-msg "workspace 1; exec st -e tmux"
 | 
					exec --no-startup-id exec st -n 'startup-tmux'-e tmux
 | 
				
			||||||
exec --no-startup-id i3-msg "workspace 2; exec brave"
 | 
					exec --no-startup-id i3-msg "workspace 2; exec brave"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Use pactl to adjust volume in PulseAudio.
 | 
					# Use pactl to adjust volume in PulseAudio.
 | 
				
			||||||
 | 
				
			|||||||
@ -46,7 +46,7 @@ inherit = section/base-bar
 | 
				
			|||||||
; height
 | 
					; height
 | 
				
			||||||
height = 24pt
 | 
					height = 24pt
 | 
				
			||||||
; modules
 | 
					; modules
 | 
				
			||||||
modules-left = xworkspaces focus spotify spotify-len todo
 | 
					modules-left = xworkspaces focus-fast spotify spotify-len todo
 | 
				
			||||||
;modules-left = xworkspaces spotify spotify-len
 | 
					;modules-left = xworkspaces spotify spotify-len
 | 
				
			||||||
modules-center = weather-desktop
 | 
					modules-center = weather-desktop
 | 
				
			||||||
modules-right = pulseaudio memory cpu temperature eth dev-bat seafile calendar-sync bg-selector quotes date powermenu
 | 
					modules-right = pulseaudio memory cpu temperature eth dev-bat seafile calendar-sync bg-selector quotes date powermenu
 | 
				
			||||||
@ -88,6 +88,12 @@ type = custom/script
 | 
				
			|||||||
interval = 0.2
 | 
					interval = 0.2
 | 
				
			||||||
exec = ~/.dotfiles/bin/focus_class
 | 
					exec = ~/.dotfiles/bin/focus_class
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[module/focus-fast]
 | 
				
			||||||
 | 
					; correct title size
 | 
				
			||||||
 | 
					type = custom/script
 | 
				
			||||||
 | 
					tail = true
 | 
				
			||||||
 | 
					exec = ~/.dotfiles/bin/i3-focus.sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[module/pulseaudio]
 | 
					[module/pulseaudio]
 | 
				
			||||||
type = internal/pulseaudio
 | 
					type = internal/pulseaudio
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user