diff --git a/.config/sway/config b/.config/sway/config index 9a9208f..42c4adc 100644 --- a/.config/sway/config +++ b/.config/sway/config @@ -93,6 +93,7 @@ bindsym $mod+u exec --no-startup-id ~/.config/sway/xterm-wayland bindsym $mod+t exec --no-startup-id ~/.config/sway/wayland-screenshot bindsym $mod+i exec --no-startup-id lxappearance bindsym $mod+Shift+c exec --no-startup-id ~/.config/sway/caffeine.py +bindsym $mod+Shift+x exec --no-startup-id ~/.config/sway/display-tools.py # change focus bindsym $mod+j focus left @@ -251,6 +252,7 @@ for_window [class="Lxappearance" instance="lxappearance"] floating enable for_window [app_id="wdisplays" ] floating enable for_window [app_id="zenity"] floating enable for_window [title="Caffeine.py"] floating enable +for_window [title="Display-Tools.py"] floating enable for_window [title="Extract archive"] floating enable for_window [title="peazip"] floating enable for_window [title="read only"] floating enable diff --git a/.config/sway/config.gruvbox b/.config/sway/config.gruvbox index 705f152..032586b 100644 --- a/.config/sway/config.gruvbox +++ b/.config/sway/config.gruvbox @@ -93,6 +93,7 @@ bindsym $mod+u exec --no-startup-id ~/.config/sway/xterm-wayland bindsym $mod+t exec --no-startup-id ~/.config/sway/wayland-screenshot bindsym $mod+i exec --no-startup-id lxappearance bindsym $mod+Shift+c exec --no-startup-id ~/.config/sway/caffeine.py +bindsym $mod+Shift+x exec --no-startup-id ~/.config/sway/display-tools.py # change focus bindsym $mod+j focus left @@ -251,6 +252,7 @@ for_window [class="Lxappearance" instance="lxappearance"] floating enable for_window [app_id="wdisplays" ] floating enable for_window [app_id="zenity"] floating enable for_window [title="Caffeine.py"] floating enable +for_window [title="Display-Tools.py"] floating enable for_window [title="Extract archive"] floating enable for_window [title="peazip"] floating enable for_window [title="read only"] floating enable diff --git a/.config/sway/display-tools.py b/.config/sway/display-tools.py new file mode 100755 index 0000000..50b3e29 --- /dev/null +++ b/.config/sway/display-tools.py @@ -0,0 +1,73 @@ +#!/usr/bin/env python3 + +import tkinter as tk +import os +import psutil + +def check_process_running(process_name): + for proc in psutil.process_iter(['name']): + if proc.info['name'] == process_name: + return True + return False + +class MainWindow: + def __init__(self, master): + self.master = master + master.title("Display-Tools.py") + + # Set theme and window size + master.configure(bg='#23283f') + master.geometry('350x265') + + self.boton1 = tk.Button(master, text="Run wdisplays", command=self.exec_command1, bg='#205d2c', fg="white") + self.boton1.pack(side=tk.TOP, pady=10) + + self.boton2 = tk.Button(master, text="Run ~/.config/sway/startwlrrandr.sh", command=self.exec_command2, bg='#205d2c', fg="white") + self.boton2.pack(side=tk.TOP, pady=10) + + self.boton3 = tk.Button(master, text="Run ~/.config/sway/wayland-screenshot", command=self.exec_command3, bg='#205d2c', fg="white") + self.boton3.pack(side=tk.TOP, pady=10) + + self.boton4 = tk.Button(master, text="Start/Restart nwg-wrapper (conky sway)", command=self.exec_command4, bg='#205d2c', fg="white") + self.boton4.pack(side=tk.TOP, pady=10) + + self.boton5 = tk.Button(master, text="Exit", command=self.exec_command5, bg='#205d2c', fg="white") + self.boton5.pack(side=tk.TOP, pady=10) + + # Set center buttons + self.boton1.pack(side=tk.TOP, padx=10, pady=10, fill=tk.BOTH) + self.boton2.pack(side=tk.TOP, padx=10, pady=10, fill=tk.BOTH) + self.boton3.pack(side=tk.TOP, padx=10, pady=10, fill=tk.BOTH) + self.boton4.pack(side=tk.TOP, padx=10, pady=10, fill=tk.BOTH) + self.boton5.pack(side=tk.TOP, padx=10, pady=10, fill=tk.BOTH) + + def exec_command1(self): + print('# Run wdisplays') + command = "wdisplays" + os.system(command) + + def exec_command2(self): + print('# Run ~/.config/sway/startwlrrandr.sh') + command = "~/.config/sway/startwlrrandr.sh" + os.system(command) + + def exec_command3(self): + print('# Run ~/.config/sway/wayland-screenshot') + command = "~/.config/sway/wayland-screenshot" + os.system(command) + + def exec_command4(self): + print('# Start/Restart nwg-wrapper (conky sway)') + command = "killall nwg-wrapper && sleep 1" + os.system(command) + command = "nwg-wrapper -s conky_sway.sh -r 2000 -p right -mr 15 -mt 10 -mb 80 &" + os.system(command) + + def exec_command5(self): + command = "exit" + os.system(command) + exit() + +root = tk.Tk() +window = MainWindow(root) +root.mainloop() diff --git a/README-sway.md b/README-sway.md index 4677bf2..95dfffe 100644 --- a/README-sway.md +++ b/README-sway.md @@ -103,8 +103,9 @@ My list of extra combinations: - Super + x = Open Wdisplays - Super + u = Open Xterm - Super + i = Open LXAppearance - - Super + c = Open NetWorkManager + - Super + c = Open NetWorkManager or Clipboard - Super + Shift + c = Caffeine Mode + - Super + Shift + x = Display Tools - Volume-Up = Volume +5 - Volume-Down = Volume -5 - VolumeMute = Mute Volume