Add countdown module
This commit is contained in:
		
							parent
							
								
									c909f3c008
								
							
						
					
					
						commit
						8120e9088f
					
				@ -45,7 +45,7 @@ in
 | 
				
			|||||||
          module-margin-right = "2";
 | 
					          module-margin-right = "2";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          modules-left = "i3 title";
 | 
					          modules-left = "i3 title";
 | 
				
			||||||
          modules-right = "minecraft wlan eth filesystem uquota cpu memory battery date";
 | 
					          modules-right = "countdown minecraft wlan eth filesystem uquota cpu memory battery date";
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        "module/i3" = {
 | 
					        "module/i3" = {
 | 
				
			||||||
@ -179,6 +179,16 @@ in
 | 
				
			|||||||
          label = "%date% %time%";
 | 
					          label = "%date% %time%";
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        "module/countdown" = {
 | 
				
			||||||
 | 
					          type = "custom/script";
 | 
				
			||||||
 | 
					          exec-if = "test -f $HOME/countdown";
 | 
				
			||||||
 | 
					          exec = "" + pkgs.writers.writeBash "countdown" ''
 | 
				
			||||||
 | 
					            secs=$(( $(${pkgs.coreutils}/bin/date +%s -d $(${pkgs.coreutils}/bin/cat $HOME/countdown)) - $( ${pkgs.coreutils}/bin/date +%s ) ))
 | 
				
			||||||
 | 
					            printf '%d:%02d:%02d:%02d\n' $((secs/86400)) $((secs%86400/3600)) $((secs%3600/60)) $((secs%60))
 | 
				
			||||||
 | 
					          '';
 | 
				
			||||||
 | 
					          interval = 1;
 | 
				
			||||||
 | 
					        };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        "module/minecraft" = {
 | 
					        "module/minecraft" = {
 | 
				
			||||||
          type = "custom/script";
 | 
					          type = "custom/script";
 | 
				
			||||||
          exec = "" + pkgs.writers.writePython3 "minecraft_status" { libraries = [ pkgs.python3.pkgs.mcstatus ]; flakeIgnore = [ "E722" ]; } ''
 | 
					          exec = "" + pkgs.writers.writePython3 "minecraft_status" { libraries = [ pkgs.python3.pkgs.mcstatus ]; flakeIgnore = [ "E722" ]; } ''
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user