nowe podejście
This commit is contained in:
		
							
								
								
									
										11
									
								
								.config/sway/bin/alarms.py
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										11
									
								
								.config/sway/bin/alarms.py
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| #!/usr/bin/env python3 | ||||
| """ | ||||
| Alarmy moich SNS | ||||
| """ | ||||
|  | ||||
|  | ||||
| import boto3 | ||||
|  | ||||
| client = boto3.client('sns') | ||||
|  | ||||
| print(client.list_subscriptions()) | ||||
| @@ -10,4 +10,4 @@ swaylock --indicator-radius 100 \ | ||||
|   --text-color ECEFF4 \ | ||||
|   --text-caps-lock-color ECEFF4 \ | ||||
|   --show-failed-attempts \ | ||||
|   -i /home/paramah/Wallpapers/relax.png | ||||
|   -i /home/paramah/Downloads/lockscreen.png | ||||
							
								
								
									
										98
									
								
								.config/sway/bin/mysway.py
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										98
									
								
								.config/sway/bin/mysway.py
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,98 @@ | ||||
| #!/usr/bin/env python3 | ||||
|  | ||||
| """ | ||||
| Prosty demoninik do aktualizacji nazw workspace | ||||
| """ | ||||
|  | ||||
| from i3ipc import Connection, Event | ||||
|  | ||||
| i3 = Connection() | ||||
|  | ||||
|  | ||||
| def glyph(ws_number): | ||||
|     """ | ||||
|     Nazwy worspace | ||||
|     """ | ||||
|     # glyphs = ["", "", "", "", "", "", "", ""] | ||||
|     glyphs = [ | ||||
|         ".::term:::.", | ||||
|         ".:::web:::.", | ||||
|         ".:::work::.", | ||||
|         ".::((4))::.", | ||||
|         ".::debug::.", | ||||
|         ".::((6))::.", | ||||
|         ".::books::.", | ||||
|         ".::meets::.", | ||||
|         ".::music::.", | ||||
|         ".::mail:::." | ||||
|     ] | ||||
|     try: | ||||
|         return glyphs[ws_number - 1] | ||||
|     except IndexError: | ||||
|         return "?" | ||||
|  | ||||
|  | ||||
| def change_workspace_name(name): | ||||
|     """ | ||||
|     Zmiana nazwy | ||||
|     """ | ||||
|     try: | ||||
|         pass | ||||
|     except Exception: | ||||
|         raise | ||||
|     else: | ||||
|         pass | ||||
|     finally: | ||||
|         pass | ||||
|  | ||||
|  | ||||
| def assign_generic_name(i3, e): | ||||
|     """ | ||||
|     i3 events | ||||
|     """ | ||||
|     try: | ||||
|         if not e.change == 'rename':  # avoid looping | ||||
|             con = i3.get_tree().find_focused() | ||||
|             if not con.type == 'workspace': | ||||
|                 if not e.change == 'new': | ||||
|                     is_floating = con.type == 'floating_con' or con.floating and '_on' in con.floating | ||||
|  | ||||
|                     # Tiling mode or floating indication. Change symbols if necessary. | ||||
|                     ws_old_name = con.workspace().name | ||||
|                     ws_name = "%s: %s " % ( | ||||
|                         con.workspace().num, glyph(con.workspace().num)) | ||||
|  | ||||
|                     i3.command('rename workspace "%s" to %s' % | ||||
|                                (ws_old_name, ws_name)) | ||||
|                 else: | ||||
|                     # In sway we may open a new window w/o moving focus; let's give the workspace a name anyway. | ||||
|                     con = i3.get_tree().find_by_id(e.container.id) | ||||
|                     ws_num = con.workspace().num | ||||
|                     w_name = con.name if con.name else '' | ||||
|  | ||||
|                     if w_name and ws_num: | ||||
|                         name = "%s: %s\u00a0%s" % ( | ||||
|                             ws_num, glyph(ws_num), w_name) | ||||
|                         i3.command('rename workspace "%s" to %s' % | ||||
|                                    (ws_num, name)) | ||||
|  | ||||
|             else: | ||||
|                 # Give the (empty) workspace a generic name: "number: glyph" (like "1: ") | ||||
|                 ws_num = con.workspace().num | ||||
|                 ws_new_name = "%s: %s" % (ws_num, glyph(ws_num)) | ||||
|  | ||||
|                 i3.command('rename workspace to "{}"'.format(ws_new_name)) | ||||
|     except: | ||||
|         pass | ||||
|  | ||||
|  | ||||
| def main(): | ||||
|     # Subscribe to events | ||||
|     i3.on(Event.WORKSPACE_FOCUS, assign_generic_name) | ||||
|     i3.on(Event.BINDING, assign_generic_name) | ||||
|  | ||||
|     i3.main() | ||||
|  | ||||
|  | ||||
| if __name__ == "__main__": | ||||
|     main() | ||||
							
								
								
									
										8
									
								
								.config/sway/bin/test.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										8
									
								
								.config/sway/bin/test.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,8 @@ | ||||
| #!/bin/bash | ||||
| WS=$(i3-msg -t 'get_workspaces' | sed -e 's/{"num/\n{"num/g' | grep \"focused\":true | sed -e 's/,"/\n/g' | grep name | cut -d\" -f 3) | ||||
| WS_TEXT=$(echo $WS | cut -d \: -f 2) | ||||
| WS_NR=$(echo $WS | cut -d \: -f 1) | ||||
| NEW=$(zenity --text="Enter new name:" --entry --title="Rename workspace $WS" --entry-text="$WS_TEXT") | ||||
| i3-msg "rename workspace \"$WS\" to \"$WS_NR:$NEW\""  | ||||
|  | ||||
|  | ||||
							
								
								
									
										14
									
								
								.config/sway/bin/workspaces.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										14
									
								
								.config/sway/bin/workspaces.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,14 @@ | ||||
| #!/bin/sh | ||||
|  | ||||
| swaymsg rename workspace number 1 to '1: .>' | ||||
| swaymsg rename workspace number 2 to '2: .::web::.' | ||||
| swaymsg rename workspace number 3 to '3: .::IDE::.' | ||||
| swaymsg rename workspace number 4 to '4: .::VSCode::.' | ||||
| swaymsg rename workspace number 5 to '5: .::debug::.' | ||||
| swaymsg rename workspace number 6 to '6: .::tmux::.' | ||||
| swaymsg rename workspace number 7 to '7: .::sessions::.' | ||||
| swaymsg rename workspace number 8 to '8: .::terraform::.' | ||||
| swaymsg rename workspace number 9 to '9: .::music::.' | ||||
| swaymsg rename workspace number 10 to '10: .::mail::.' | ||||
|  | ||||
|  | ||||
		Reference in New Issue
	
	Block a user