Added power confirmation script
This commit is contained in:
		
							parent
							
								
									80b82e8d86
								
							
						
					
					
						commit
						84fdfab431
					
				
							
								
								
									
										10
									
								
								config
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								config
									
									
									
									
									
								
							| @ -18,7 +18,7 @@ | |||||||
| 		"disable-scroll": true, | 		"disable-scroll": true, | ||||||
| 		"all-outputs": false, | 		"all-outputs": false, | ||||||
| 		"active-only": false, | 		"active-only": false, | ||||||
| 		"show-special": true, | 		"show-special": false, | ||||||
| 		"format": "{name}" | 		"format": "{name}" | ||||||
| 	}, | 	}, | ||||||
| 	"hyprland/window": { | 	"hyprland/window": { | ||||||
| @ -109,15 +109,15 @@ | |||||||
| 		}, | 		}, | ||||||
| 		"modules": [ | 		"modules": [ | ||||||
| 			"custom/power", // First element is the "group leader" and won't ever be hidden | 			"custom/power", // First element is the "group leader" and won't ever be hidden | ||||||
| 			"custom/exit", |  | ||||||
| 			"custom/lock", | 			"custom/lock", | ||||||
|  | 			"custom/exit", | ||||||
| 			"custom/reboot", | 			"custom/reboot", | ||||||
| 		] | 		] | ||||||
| 	}, | 	}, | ||||||
| 	"custom/exit": { | 	"custom/exit": { | ||||||
| 		"format": "  ", | 		"format": "  ", | ||||||
| 		"tooltip": false, | 		"tooltip": false, | ||||||
| 		"on-click": "hyprctl dispatch exit" | 		"on-click": "bash ~/.config/waybar/scripts/confirm.sh \"hyprctl dispatch exit\"" | ||||||
| 	}, | 	}, | ||||||
| 	"custom/lock": { | 	"custom/lock": { | ||||||
| 		"format": "  ", | 		"format": "  ", | ||||||
| @ -127,11 +127,11 @@ | |||||||
| 	"custom/reboot": { | 	"custom/reboot": { | ||||||
| 		"format": "  ", | 		"format": "  ", | ||||||
| 		"tooltip": false, | 		"tooltip": false, | ||||||
| 		"on-click": "reboot" | 		"on-click": "bash ~/.config/waybar/scripts/confirm.sh \"reboot\"" | ||||||
| 	}, | 	}, | ||||||
| 	"custom/power": { | 	"custom/power": { | ||||||
| 		"format": "  ", | 		"format": "  ", | ||||||
| 		"tooltip": false, | 		"tooltip": false, | ||||||
| 		"on-click": "shutdown now" | 		"on-click": "bash ~/.config/waybar/scripts/confirm.sh \"shutdown now\"" | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  | |||||||
							
								
								
									
										12
									
								
								scripts/confirm.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										12
									
								
								scripts/confirm.sh
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,12 @@ | |||||||
|  | #!/bin/bash | ||||||
|  | ACTION=$1 | ||||||
|  | LOCKFILE="/tmp/confirm_$(echo -n $ACTION | md5sum | awk '{print $1}')" | ||||||
|  | 
 | ||||||
|  | if [ -f "$LOCKFILE" ]; then | ||||||
|  |     rm "$LOCKFILE" | ||||||
|  |     $ACTION | ||||||
|  | else | ||||||
|  |     touch "$LOCKFILE" | ||||||
|  |     notify-send "Нажмите ещё раз для подтверждения" -t 5000 -w | ||||||
|  |     rm "$LOCKFILE" | ||||||
|  | fi | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user