From bbd072576bc560fb4920123e5613534665254038 Mon Sep 17 00:00:00 2001 From: q3aql Date: Sun, 14 May 2023 19:12:23 +0200 Subject: [PATCH] Dotfiles config update (2023-05-14) --- .config/foot/foot.ini | 2 +- .config/i3/caffeine.py | 91 +++++++++++++++++++++++++ .config/i3/config | 4 +- .config/i3/config.gruvbox | 4 +- .config/i3/display-tools.py | 75 ++++++++++++++++++++ .config/qtile/settings/caffeine.py | 91 +++++++++++++++++++++++++ .config/qtile/settings/display-tools.py | 75 ++++++++++++++++++++ .config/qtile/settings/keys.py | 2 + README-i3.md | 2 + README-qtile.md | 2 + 10 files changed, 345 insertions(+), 3 deletions(-) create mode 100755 .config/i3/caffeine.py create mode 100755 .config/i3/display-tools.py create mode 100755 .config/qtile/settings/caffeine.py create mode 100755 .config/qtile/settings/display-tools.py diff --git a/.config/foot/foot.ini b/.config/foot/foot.ini index 9c50d81..aa4b5b9 100644 --- a/.config/foot/foot.ini +++ b/.config/foot/foot.ini @@ -11,7 +11,7 @@ title=foot locked-title=no # Font configuration -font=mono:size=10 +font=mono:size=10.5 # font=monospace:size=8 # font-bold= # font-italic= diff --git a/.config/i3/caffeine.py b/.config/i3/caffeine.py new file mode 100755 index 0000000..54b60da --- /dev/null +++ b/.config/i3/caffeine.py @@ -0,0 +1,91 @@ +#!/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("Caffeine.py") + + # Set theme and window size + master.configure(bg='#262321') + master.geometry('250x215') + + self.boton1 = tk.Button(master, text="Enable Caffeine Mode", command=self.exec_command1, bg='#703207', fg="white") + self.boton1.pack(side=tk.TOP, pady=10) + + self.boton2 = tk.Button(master, text="Disable Caffeine Mode", command=self.exec_command2, bg='#703207', fg="white") + self.boton2.pack(side=tk.TOP, pady=10) + + self.boton3 = tk.Button(master, text="Check Status", command=self.exec_command3, bg='#703207', fg="white") + self.boton3.pack(side=tk.TOP, pady=10) + + self.boton4 = tk.Button(master, text="Exit", command=self.exec_command4, bg='#703207', fg="white") + self.boton4.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) + + def exec_command1(self): + print('# Enabled Caffeine Mode') + command = "killall startscreensaver.sh 2> /dev/null" + os.system(command) + command = "killall xscreensaver 2> /dev/null" + os.system(command) + command = "killall xautolock 2> /dev/null" + os.system(command) + + def exec_command2(self): + command = "killall startscreensaver.sh 2> /dev/null" + os.system(command) + command = "killall xscreensaver 2> /dev/null" + os.system(command) + command = "killall xautolock 2> /dev/null" + os.system(command) + command = "~/.config/i3/startscreensaver.sh &" + os.system(command) + print('# Disabled Caffeine Mode') + + def exec_command3(self): + message = tk.Tk() + message.title("Caffeine.py") + + # Set theme and window size + message.configure(bg='#262321') + message.geometry('190x105') + + # Verificar si el proceso swayidle está en ejecución + if check_process_running("xscreensaver"): + label = tk.Label(message, text="Caffeine Mode is Disabled.", bg='#703207', fg="white") + else: + if check_process_running("xautolock"): + label = tk.Label(message, text="Caffeine Mode is Disabled.", bg='#703207', fg="white") + else: + label = tk.Label(message, text="Caffeine Mode is Enabled.", bg='#703207', fg="white") + # Show window message + label.pack(side=tk.TOP, pady=10) + # Add close button + button = tk.Button(message, text="Close", command=message.destroy, bg='#703207', fg="white") + button.pack(side=tk.TOP, padx=10, pady=10, fill=tk.BOTH) + # Init events bucle + message.mainloop() + + def exec_command4(self): + command = "exit" + os.system(command) + exit() + +root = tk.Tk() +window = MainWindow(root) +root.mainloop() diff --git a/.config/i3/config b/.config/i3/config index 2dd959e..959766a 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -103,6 +103,8 @@ bindsym $mod+z exec --no-startup-id nitrogen bindsym $mod+u exec --no-startup-id xterm bindsym $mod+t exec --no-startup-id rofi-theme-selector bindsym $mod+i exec --no-startup-id lxappearance +bindsym $mod+Shift+c exec --no-startup-id ~/.config/i3/caffeine.py +bindsym $mod+Shift+x exec --no-startup-id ~/.config/i3/display-tools.py # change focus bindsym $mod+j focus left @@ -253,7 +255,7 @@ for_window [class="Mozilla VPN" instance="mozillavpn"] floating enable for_window [class="Lxappearance" instance="lxappearance"] floating enable # reload the configuration file -bindsym $mod+Shift+c reload +#bindsym $mod+Shift+c reload # restart i3 inplace (preserves your layout/session, can be used to upgrade i3) bindsym $mod+Shift+r restart # exit i3 (logs you out of your X session) diff --git a/.config/i3/config.gruvbox b/.config/i3/config.gruvbox index 0c6b5e3..2ad2bc8 100644 --- a/.config/i3/config.gruvbox +++ b/.config/i3/config.gruvbox @@ -103,6 +103,8 @@ bindsym $mod+z exec --no-startup-id nitrogen bindsym $mod+u exec --no-startup-id xterm bindsym $mod+t exec --no-startup-id rofi-theme-selector bindsym $mod+i exec --no-startup-id lxappearance +bindsym $mod+Shift+c exec --no-startup-id ~/.config/i3/caffeine.py +bindsym $mod+Shift+x exec --no-startup-id ~/.config/i3/display-tools.py # change focus bindsym $mod+j focus left @@ -253,7 +255,7 @@ for_window [class="Mozilla VPN" instance="mozillavpn"] floating enable for_window [class="Lxappearance" instance="lxappearance"] floating enable # reload the configuration file -bindsym $mod+Shift+c reload +#bindsym $mod+Shift+c reload # restart i3 inplace (preserves your layout/session, can be used to upgrade i3) bindsym $mod+Shift+r restart # exit i3 (logs you out of your X session) diff --git a/.config/i3/display-tools.py b/.config/i3/display-tools.py new file mode 100755 index 0000000..30216fc --- /dev/null +++ b/.config/i3/display-tools.py @@ -0,0 +1,75 @@ +#!/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 ARandR", command=self.exec_command1, bg='#205d2c', fg="white") + self.boton1.pack(side=tk.TOP, pady=10) + + self.boton2 = tk.Button(master, text="Run ~/.config/i3/startxrandr.sh", command=self.exec_command2, bg='#205d2c', fg="white") + self.boton2.pack(side=tk.TOP, pady=10) + + self.boton3 = tk.Button(master, text="Run xfce4-screenshooter", command=self.exec_command3, bg='#205d2c', fg="white") + self.boton3.pack(side=tk.TOP, pady=10) + + self.boton4 = tk.Button(master, text="Start/Restart Conky i3", 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 ARandR') + command = "arandr" + os.system(command) + + def exec_command2(self): + print('# Run ~/.config/i3/startxrandr.sh') + command = "killall startwlrrandr.sh" + os.system(command) + command = "~/.config/sway/startwlrrandr.sh &" + os.system(command) + + def exec_command3(self): + print('# Run xfce4-screenshooter"') + command = "xfce4-screenshooter" + os.system(command) + + def exec_command4(self): + print('# Start/Restart nwg-wrapper (conky sway)') + command = "killall conky && sleep 1" + os.system(command) + command = "conky -c ~/.config/conky/conkyrc_i3 &" + os.system(command) + + def exec_command5(self): + command = "exit" + os.system(command) + exit() + +root = tk.Tk() +window = MainWindow(root) +root.mainloop() diff --git a/.config/qtile/settings/caffeine.py b/.config/qtile/settings/caffeine.py new file mode 100755 index 0000000..6b36e04 --- /dev/null +++ b/.config/qtile/settings/caffeine.py @@ -0,0 +1,91 @@ +#!/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("Caffeine.py") + + # Set theme and window size + master.configure(bg='#262321') + master.geometry('250x215') + + self.boton1 = tk.Button(master, text="Enable Caffeine Mode", command=self.exec_command1, bg='#703207', fg="white") + self.boton1.pack(side=tk.TOP, pady=10) + + self.boton2 = tk.Button(master, text="Disable Caffeine Mode", command=self.exec_command2, bg='#703207', fg="white") + self.boton2.pack(side=tk.TOP, pady=10) + + self.boton3 = tk.Button(master, text="Check Status", command=self.exec_command3, bg='#703207', fg="white") + self.boton3.pack(side=tk.TOP, pady=10) + + self.boton4 = tk.Button(master, text="Exit", command=self.exec_command4, bg='#703207', fg="white") + self.boton4.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) + + def exec_command1(self): + print('# Enabled Caffeine Mode') + command = "killall startscreensaver.sh 2> /dev/null" + os.system(command) + command = "killall xscreensaver 2> /dev/null" + os.system(command) + command = "killall xautolock 2> /dev/null" + os.system(command) + + def exec_command2(self): + command = "killall startscreensaver.sh 2> /dev/null" + os.system(command) + command = "killall xscreensaver 2> /dev/null" + os.system(command) + command = "killall xautolock 2> /dev/null" + os.system(command) + command = "~/.config/qtile/startscreensaver.sh &" + os.system(command) + print('# Disabled Caffeine Mode') + + def exec_command3(self): + message = tk.Tk() + message.title("Caffeine.py") + + # Set theme and window size + message.configure(bg='#262321') + message.geometry('190x105') + + # Verificar si el proceso swayidle está en ejecución + if check_process_running("xscreensaver"): + label = tk.Label(message, text="Caffeine Mode is Disabled.", bg='#703207', fg="white") + else: + if check_process_running("xautolock"): + label = tk.Label(message, text="Caffeine Mode is Disabled.", bg='#703207', fg="white") + else: + label = tk.Label(message, text="Caffeine Mode is Enabled.", bg='#703207', fg="white") + # Show window message + label.pack(side=tk.TOP, pady=10) + # Add close button + button = tk.Button(message, text="Close", command=message.destroy, bg='#703207', fg="white") + button.pack(side=tk.TOP, padx=10, pady=10, fill=tk.BOTH) + # Init events bucle + message.mainloop() + + def exec_command4(self): + command = "exit" + os.system(command) + exit() + +root = tk.Tk() +window = MainWindow(root) +root.mainloop() diff --git a/.config/qtile/settings/display-tools.py b/.config/qtile/settings/display-tools.py new file mode 100755 index 0000000..bf81abb --- /dev/null +++ b/.config/qtile/settings/display-tools.py @@ -0,0 +1,75 @@ +#!/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 ARandR", command=self.exec_command1, bg='#205d2c', fg="white") + self.boton1.pack(side=tk.TOP, pady=10) + + self.boton2 = tk.Button(master, text="Run ~/.config/qtile/startxrandr.sh", command=self.exec_command2, bg='#205d2c', fg="white") + self.boton2.pack(side=tk.TOP, pady=10) + + self.boton3 = tk.Button(master, text="Run xfce4-screenshooter", command=self.exec_command3, bg='#205d2c', fg="white") + self.boton3.pack(side=tk.TOP, pady=10) + + self.boton4 = tk.Button(master, text="Start/Restart Conky Qtile", 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 ARandR') + command = "arandr" + os.system(command) + + def exec_command2(self): + print('# Run ~/.config/qtile/startxrandr.sh') + command = "killall startwlrrandr.sh" + os.system(command) + command = "~/.config/qtile/startxrandr.sh &" + os.system(command) + + def exec_command3(self): + print('# Run xfce4-screenshooter"') + command = "xfce4-screenshooter" + os.system(command) + + def exec_command4(self): + print('# Start/Restart Conky Qtile') + command = "killall conky && sleep 1" + os.system(command) + command = "conky -c ~/.config/conky/conkyrc_qtile &" + os.system(command) + + def exec_command5(self): + command = "exit" + os.system(command) + exit() + +root = tk.Tk() +window = MainWindow(root) +root.mainloop() diff --git a/.config/qtile/settings/keys.py b/.config/qtile/settings/keys.py index 866aaba..070752e 100644 --- a/.config/qtile/settings/keys.py +++ b/.config/qtile/settings/keys.py @@ -66,6 +66,8 @@ keys = [Key(key[0], key[1], *key[2:]) for key in [ ([mod], "x", lazy.spawn("lxrandr")), ([mod], "i", lazy.spawn("lxappearance")), ([mod], "v", lazy.spawn("pavucontrol")), + ([mod, "shift"], "c", lazy.spawn("~/.config/qtile/settings/caffeine.py")), + ([mod, "shift"], "x", lazy.spawn("~/.config/qtile/settings/display-tools.py")), # Terminal ([mod], "Return", lazy.spawn("kitty")), diff --git a/README-i3.md b/README-i3.md index 2a7df7d..a6c9ec0 100644 --- a/README-i3.md +++ b/README-i3.md @@ -99,6 +99,8 @@ My list of extra combinations: - Super + u = Open Xterm - Super + i = Open LXAppearance - Super + c = Open NetWorkManager + - Super + Shift + c = Caffeine Mode + - Super + Shift + x = Display Tools - Volume-Up = Volume +5 - Volume-Down = Volume -5 - VolumeMute = Mute Volume diff --git a/README-qtile.md b/README-qtile.md index 275cf86..81584b3 100644 --- a/README-qtile.md +++ b/README-qtile.md @@ -93,6 +93,8 @@ My list of extra combinations: - Super + i = Open LXAppearance - Super + v = Open Pavucontrol - Super + s = Open Screenshooter + - Super + Shift + c = Caffeine Mode + - Super + Shift + x = Display Tools - Volume-Up = Volume +5 - Volume-Down = Volume -5 - VolumeMute = Mute Volume