From d650a39f24d53a87fa1fe148ea85333c1c7e2b1f Mon Sep 17 00:00:00 2001 From: q3aql Date: Mon, 1 May 2023 10:30:33 +0200 Subject: [PATCH] Dotfiles config update (2023-05-01) --- .config/nwg-wrapper/conky_sway.sh | 3 +- .config/sway/caffeine.py | 52 +++++++++++++++++++++++++++++ .config/sway/config | 27 +++++++-------- .config/sway/config.gruvbox | 25 ++++++-------- .config/sway/startwlrscreensaver.sh | 4 +-- README-sway.md | 5 +-- 6 files changed, 82 insertions(+), 34 deletions(-) create mode 100755 .config/sway/caffeine.py diff --git a/.config/nwg-wrapper/conky_sway.sh b/.config/nwg-wrapper/conky_sway.sh index 2697381..8da8b55 100755 --- a/.config/nwg-wrapper/conky_sway.sh +++ b/.config/nwg-wrapper/conky_sway.sh @@ -30,7 +30,7 @@ echo ' echo ' Super + f = Fullscreen' echo ' Super + p = Wofi (Run Mode)' echo ' Super + o = Wofi (Drun Mode)' -echo ' Super + q = Rofi (Window Mode)' +echo ' Super + q = Wofi (Window Mode)' echo ' Super + d = Wofi (Filebrowser)' echo ' Super + b = Mozilla Firefox' echo ' Super + n = PCManFM' @@ -42,6 +42,7 @@ echo ' echo ' Super + u = Xterm' echo ' Super + i = LXAppearance' echo ' Super + c = NetworkManager' +echo ' Super + וּ + c = Caffeine Mode' echo ' Super + h = Set Horizontal' echo ' Super + v = Set Vertical' echo '= Volume +5' diff --git a/.config/sway/caffeine.py b/.config/sway/caffeine.py new file mode 100755 index 0000000..2685486 --- /dev/null +++ b/.config/sway/caffeine.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python3 + +import tkinter as tk +import os + +class MainWindow: + def __init__(self, master): + self.master = master + master.title("Caffeine.py") + + # Set theme and window size + master.configure(bg='#262321') + master.geometry('250x150') + + 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="Exit", command=self.exec_command3, bg='#703207', fg="white") + self.boton3.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) + + def exec_command1(self): + print('# Enabled Caffeine Mode') + command = "killall startwlrscreensaver.sh 2> /dev/null" + os.system(command) + command = "killall swayidle 2> /dev/null" + os.system(command) + + def exec_command2(self): + command = "killall startwlrscreensaver.sh 2> /dev/null" + os.system(command) + command = "killall swayidle 2> /dev/null" + os.system(command) + command = "~/.config/sway/startwlrscreensaver.sh &" + os.system(command) + print('# Disabled Caffeine Mode') + + def exec_command3(self): + command = "exit" + os.system(command) + exit() + +root = tk.Tk() +window = MainWindow(root) +root.mainloop() diff --git a/.config/sway/config b/.config/sway/config index 7bcb668..48776fc 100644 --- a/.config/sway/config +++ b/.config/sway/config @@ -34,18 +34,14 @@ exec --no-startup-id pnmixer -t & # Configure screens and resolution exec --no-startup-id ~/.config/sway/startwlrrandr.sh & -# Load compton or picom -#exec --no-startup-id compton & -#exec --no-startup-id "sleep 15 && picom &" - # Configure wallpaper exec --no-startup-id "swaybg -i ~/wallpapers/gruvbox-arch.png -m fill" # Start Screensaver (Also Super+Ctrl+Shift+l to poweroff/start screen) exec --no-startup-id ~/.config/sway/startwlrscreensaver.sh -# Clipboard (Diodon) -exec --no-startup-id diodon & +# Clipboard (Clipman) +exec --no-startup-id WAYLAND_DISPLAY=wayland-1 wl-paste -t text --watch clipman store # Load Conky #exec --no-startup-id sleep 10 && conky -c ~/.config/conky/conkyrc_sway & @@ -65,10 +61,11 @@ floating_modifier $mod #new_window 1pixel #new_window pixel 3 -# start a terminal -#bindsym $mod+Return exec i3-sensible-terminal +# Start a terminal #bindsym $mod+Return exec xterm bindsym $mod+Return exec kitty +#bindsym $mod+Return exec env WAYLAND_DISPLAY=wayland-1 alacritty +#bindsym $mod+Return exec env WAYLAND_DISPLAY=wayland-1 foot # kill focused window bindsym $mod+Shift+q kill @@ -76,9 +73,10 @@ bindsym $mod+Shift+q kill # start filebrowser (a program launcher) bindsym $mod+d exec --no-startup-id ~/.config/sway/wofi/wofi_fbrun -# NetworkManager +# NetworkManager or Clipman #bindsym $mod+c exec --no-startup-id connman-gtk --no-icon bindsym $mod+c exec --no-startup-id nm-connection-editor +#bindsym $mod+c exec --no-startup-id WAYLAND_DISPLAY=wayland-1 clipman pick -t wofi # Run applications bindsym $mod+o exec --no-startup-id ~/.config/sway/wofi/wofi_drun @@ -94,6 +92,7 @@ bindsym $mod+z exec --no-startup-id kitty -e wf-recorder 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 # change focus bindsym $mod+j focus left @@ -251,12 +250,11 @@ for_window [class="Mozilla VPN" instance="mozillavpn"] floating enable 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 -# reload the configuration file -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) +bindsym $mod+Shift+r reload +# exit sway (logs you out of your X session) #bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'" bindsym $mod+Shift+e exec "swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit Sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit'" @@ -303,8 +301,7 @@ exec_always { gsettings set $gnome-schema font-name 'Sans 10' } -# Start i3bar to display a workspace bar (plus the system information i3status -# finds out, if available) +# Start sway bar to display a workspace bar bar { position top status_command ~/.config/sway/scripts/status_bar.sh diff --git a/.config/sway/config.gruvbox b/.config/sway/config.gruvbox index 2e68070..5e4062b 100644 --- a/.config/sway/config.gruvbox +++ b/.config/sway/config.gruvbox @@ -34,18 +34,14 @@ exec --no-startup-id pnmixer -t & # Configure screens and resolution exec --no-startup-id ~/.config/sway/startwlrrandr.sh & -# Load compton or picom -#exec --no-startup-id compton & -#exec --no-startup-id "sleep 15 && picom &" - # Configure wallpaper exec --no-startup-id "swaybg -i ~/wallpapers/39.png -m fill" # Start Screensaver (Also Super+Ctrl+Shift+l to poweroff/start screen) exec --no-startup-id ~/.config/sway/startwlrscreensaver.sh -# Clipboard (Diodon) -exec --no-startup-id diodon & +# Clipboard (Clipman) +exec --no-startup-id WAYLAND_DISPLAY=wayland-1 wl-paste -t text --watch clipman store # Load Conky #exec --no-startup-id sleep 10 && conky -c ~/.config/conky/conkyrc_sway & @@ -66,9 +62,10 @@ floating_modifier $mod #new_window pixel 3 # start a terminal -#bindsym $mod+Return exec i3-sensible-terminal #bindsym $mod+Return exec xterm bindsym $mod+Return exec kitty +#bindsym $mod+Return exec env WAYLAND_DISPLAY=wayland-1 alacritty +#bindsym $mod+Return exec env WAYLAND_DISPLAY=wayland-1 foot # kill focused window bindsym $mod+Shift+q kill @@ -76,9 +73,10 @@ bindsym $mod+Shift+q kill # start filebrowser (a program launcher) bindsym $mod+d exec --no-startup-id ~/.config/sway/wofi/wofi_fbrun -# NetworkManager +# NetworkManager or Clipman #bindsym $mod+c exec --no-startup-id connman-gtk --no-icon bindsym $mod+c exec --no-startup-id nm-connection-editor +#bindsym $mod+c exec --no-startup-id WAYLAND_DISPLAY=wayland-1 clipman pick -t wofi # Run applications bindsym $mod+o exec --no-startup-id ~/.config/sway/wofi/wofi_drun @@ -94,6 +92,7 @@ bindsym $mod+z exec --no-startup-id kitty -e wf-recorder 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 # change focus bindsym $mod+j focus left @@ -251,12 +250,11 @@ for_window [class="Mozilla VPN" instance="mozillavpn"] floating enable 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 -# reload the configuration file -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) +bindsym $mod+Shift+r reload +# exit sway (logs you out of your X session) #bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'" bindsym $mod+Shift+e exec "swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit Sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit'" @@ -303,8 +301,7 @@ exec_always { gsettings set $gnome-schema font-name 'Sans 10' } -# Start i3bar to display a workspace bar (plus the system information i3status -# finds out, if available) +# Start sway bar to display a workspace bar bar { position top status_command ~/.config/sway/scripts/status_bar.sh diff --git a/.config/sway/startwlrscreensaver.sh b/.config/sway/startwlrscreensaver.sh index f4aab20..2de2a4d 100755 --- a/.config/sway/startwlrscreensaver.sh +++ b/.config/sway/startwlrscreensaver.sh @@ -69,8 +69,8 @@ function resumeMonitors() { # Boot parameters if [ -z "${1}" ] ; then # Kill previous process - echo "Trying to kill previous process" - killall -9 swayidle + echo "# Trying to kill previous process" + killall -9 swayidle 2> /dev/null sleep 3 # Init swayidle command swayidle timeout ${ScreensaverTime} "bash ${0} sleep" resume "bash ${0} resume" diff --git a/README-sway.md b/README-sway.md index 8a3e58a..8ab0f08 100644 --- a/README-sway.md +++ b/README-sway.md @@ -90,9 +90,9 @@ dotfiles - My tiling Sway configuration (for Arch/Devuan/Debian) My list of extra combinations: - - Super + d = Open Dmenu + - Super + d = Open Wofi (fbrun mode) - Super + p = Open Wofi (run mode) - - Super + q = Open Rofi (window mode) + - Super + q = Open Wofi (window mode) - Super + o = Open Wofi (drun mode) - Super + b = Open Firefox - Super + n = Open PCManFM @@ -104,6 +104,7 @@ My list of extra combinations: - Super + u = Open Xterm - Super + i = Open LXAppearance - Super + c = Open NetWorkManager + - Super + Shift + c = Caffeine Mode - Volume-Up = Volume +5 - Volume-Down = Volume -5 - VolumeMute = Mute Volume