Make 'Break' more annoying
This commit is contained in:
		
							
								
								
									
										3
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								Makefile
									
									
									
									
									
								
							@@ -14,5 +14,8 @@ LDFLAGS=-ldflags "-w -s -X cmd.Version=${VERSION} -X cmd.Build=${BUILD}"
 | 
			
		||||
breaktime:
 | 
			
		||||
	go build ${LDFLAGS} -o build/${BINARY}
 | 
			
		||||
 | 
			
		||||
install:
 | 
			
		||||
	mv build/${BINARY} ${GOPATH}/bin
 | 
			
		||||
 | 
			
		||||
clean:
 | 
			
		||||
	rm build/*
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										13
									
								
								cmd/i3.go
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								cmd/i3.go
									
									
									
									
									
								
							@@ -1,6 +1,5 @@
 | 
			
		||||
/*
 | 
			
		||||
Copyright © 2023 Brian Buller <brian@bullercodeworks.com>
 | 
			
		||||
 | 
			
		||||
*/
 | 
			
		||||
package cmd
 | 
			
		||||
 | 
			
		||||
@@ -40,11 +39,15 @@ var i3Cmd = &cobra.Command{
 | 
			
		||||
			lastBreak := viper.GetTime("lastbreak")
 | 
			
		||||
			pomo := viper.GetDuration("pomodoro")
 | 
			
		||||
			warnPct := viper.GetFloat64("warnpct") //0.75
 | 
			
		||||
			warn := float64(pomo.Seconds() * warnPct)
 | 
			
		||||
			elapsed := time.Since(lastBreak).Seconds()
 | 
			
		||||
			warn := int(pomo.Seconds() * warnPct)
 | 
			
		||||
			elapsed := int(time.Since(lastBreak).Seconds())
 | 
			
		||||
			rem := time.Until(lastBreak.Add(pomo)).Round(time.Duration(time.Second))
 | 
			
		||||
			if elapsed > pomo.Seconds() {
 | 
			
		||||
				fmt.Print("{\"icon\":\"time\",\"state\":\"Critical\", \"text\": \"BREAK!\"}")
 | 
			
		||||
			if elapsed > int(pomo.Seconds()) {
 | 
			
		||||
				state := "Critical"
 | 
			
		||||
				if elapsed%2 == 1 {
 | 
			
		||||
					state = "Warning"
 | 
			
		||||
				}
 | 
			
		||||
				fmt.Printf("{\"icon\":\"time\",\"state\":\"%s\", \"text\": \"BREAK!\"}", state)
 | 
			
		||||
			} else if elapsed > warn {
 | 
			
		||||
				fmt.Printf("{\"icon\":\"time\",\"state\":\"Warning\", \"text\": \"%s\"}", rem)
 | 
			
		||||
			} else {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user