From c16fa06c651b7b6766863e44ae468fb689cfa25d Mon Sep 17 00:00:00 2001 From: q3aql Date: Sat, 30 Apr 2022 20:33:28 +0200 Subject: [PATCH] Dotfiles config update (2022-04-30) --- .config/qtile-wayland/autostart.sh | 32 ++++--- .config/qtile-wayland/config.py | 2 +- .config/qtile-wayland/settings/groups.py | 6 +- .config/qtile-wayland/settings/keys.py | 8 +- .config/qtile-wayland/settings/layouts.py | 2 +- .config/qtile-wayland/settings/mouse.py | 2 +- .config/qtile-wayland/settings/path.py | 3 + .config/qtile-wayland/settings/screens.py | 9 +- .config/qtile-wayland/settings/widgets.py | 5 +- .config/qtile-wayland/settings/widgets.py.old | 94 ------------------- .config/qtile-wayland/settings/workspaces.py | 2 +- .config/qtile-wayland/startwlrrandr.sh | 12 +++ .config/qtile-wayland/startwlrscreensaver.sh | 82 ++++++++++++++++ .config/qtile-wayland/themes/README.md | 56 +++++++++++ .config/qtile-wayland/xterm-wayland | 5 + 15 files changed, 191 insertions(+), 129 deletions(-) create mode 100644 .config/qtile-wayland/settings/path.py delete mode 100644 .config/qtile-wayland/settings/widgets.py.old create mode 100755 .config/qtile-wayland/startwlrrandr.sh create mode 100755 .config/qtile-wayland/startwlrscreensaver.sh create mode 100644 .config/qtile-wayland/themes/README.md create mode 100755 .config/qtile-wayland/xterm-wayland diff --git a/.config/qtile-wayland/autostart.sh b/.config/qtile-wayland/autostart.sh index d49ff98..4647fb7 100755 --- a/.config/qtile-wayland/autostart.sh +++ b/.config/qtile-wayland/autostart.sh @@ -1,7 +1,6 @@ #!/bin/sh # Autostart script for Qtile - cmd_exist() { unalias "$1" >/dev/null 2>&1 ; command -v "$1" >/dev/null 2>&1 ;} __kill() { kill -9 "$(pidof "$1")" >/dev/null 2>&1 ; } __start() { sleep 1 && "$@" >/dev/null 2>&1 & } @@ -9,24 +8,27 @@ __running() { pidof "$1" >/dev/null 2>&1 ;} systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP -# Apps to autostart - -if cmd_exist kanshi ; then - __kill kanshi - __start kanshi -fi - # Authentication dialog - if [ -f /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 ]; then - __kill polkit-gnome-authentication-agent-1 - __start /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 + /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 fi # Notification daemon +#dunst & -if cmd_exist dunst ; then - __kill dunst - __start dunst -fi +# Network applet +#connman-gtk --tray & +nm-applet + +# Applet for Audio +pnmixer -t & + +# Configure screens and resolution +~/.config/qtile/startwlrrandr.sh & + +# Configure screensaver +~/.config/qtile/startwlrscreensaver.sh & + +# Clipboard (Diodon) +diodon & diff --git a/.config/qtile-wayland/config.py b/.config/qtile-wayland/config.py index e848249..abe7948 100644 --- a/.config/qtile-wayland/config.py +++ b/.config/qtile-wayland/config.py @@ -5,7 +5,7 @@ # https://github.com/justinesmithies/qtile-wayland-dotfiles from typing import List # noqa: F401 -import hooks +#import hooks from settings.keys import mod, keys, home from settings.workspaces import workspaces from settings.groups import groups diff --git a/.config/qtile-wayland/settings/groups.py b/.config/qtile-wayland/settings/groups.py index 066e696..8ad3a97 100644 --- a/.config/qtile-wayland/settings/groups.py +++ b/.config/qtile-wayland/settings/groups.py @@ -5,9 +5,9 @@ from libqtile.config import Key, Group from libqtile.command import lazy -from keys import mod, keys -from workspaces import workspaces -from screens import connected_monitors +from .keys import mod, keys +from .workspaces import workspaces +from .screens import connected_monitors groups = [] for workspace in workspaces: diff --git a/.config/qtile-wayland/settings/keys.py b/.config/qtile-wayland/settings/keys.py index a9df3ea..4ffcbde 100644 --- a/.config/qtile-wayland/settings/keys.py +++ b/.config/qtile-wayland/settings/keys.py @@ -131,7 +131,7 @@ keys = [ Key([mod], "g", lazy.spawn("geany")), Key([mod], "m", lazy.spawn("telegram")), Key([mod], "z", lazy.spawn("nitrogen")), - Key([mod], "u", lazy.spawn("xterm")), + Key([mod], "u", lazy.spawn("~/.config/qtile/xterm-wayland")), Key([mod], "t", lazy.spawn("rofi-theme-selector")), Key([mod], "i", lazy.spawn("lxappearance")), @@ -143,10 +143,8 @@ keys = [ lazy.next_layout(), desc="Toggle between layouts" ), - Key([mod], "w", - lazy.window.kill(), - desc="Kill focused window" - ), + Key([mod, "shift"], "q", lazy.window.kill()), + Key([mod, "control"], "q", lazy.shutdown()), # Toggle bars Key([mod], "b", diff --git a/.config/qtile-wayland/settings/layouts.py b/.config/qtile-wayland/settings/layouts.py index cd35328..0b95358 100644 --- a/.config/qtile-wayland/settings/layouts.py +++ b/.config/qtile-wayland/settings/layouts.py @@ -54,4 +54,4 @@ floating_layout = layout.Floating(float_rules=[ Match(wm_class='ssh-askpass'), # ssh-askpass Match(title='branchdialog'), # gitk Match(title='pinentry'), # GPG key password entry -], **layout_theme) +]) diff --git a/.config/qtile-wayland/settings/mouse.py b/.config/qtile-wayland/settings/mouse.py index 6cd0e88..43e72bf 100644 --- a/.config/qtile-wayland/settings/mouse.py +++ b/.config/qtile-wayland/settings/mouse.py @@ -5,7 +5,7 @@ from libqtile.config import Drag, Click from libqtile.command import lazy -from keys import mod +from .keys import mod mouse = [ Drag( diff --git a/.config/qtile-wayland/settings/path.py b/.config/qtile-wayland/settings/path.py new file mode 100644 index 0000000..730d101 --- /dev/null +++ b/.config/qtile-wayland/settings/path.py @@ -0,0 +1,3 @@ +from os import path + +qtile_path = path.join(path.expanduser('~'), ".config", "qtile") diff --git a/.config/qtile-wayland/settings/screens.py b/.config/qtile-wayland/settings/screens.py index b3a9efc..a97c7dc 100644 --- a/.config/qtile-wayland/settings/screens.py +++ b/.config/qtile-wayland/settings/screens.py @@ -6,15 +6,16 @@ from libqtile.config import Screen from libqtile import bar from libqtile.log_utils import logger -from widgets import primary_widgets, secondary_widgets +from .widgets import primary_widgets, secondary_widgets import subprocess def status_bar(widgets): - return bar.Bar(widgets, 24, background="#000000AA", margin=[10, 16, 0, 16]) # Margin = N E S W + #return bar.Bar(widgets, 24, background="#000000AA", margin=[10, 16, 0, 16]) # Margin = N E S W + return bar.Bar(widgets, 24, background="#000000AA", margin=[0, 0, 0, 0]) # Margin = N E S W -screens = [Screen(wallpaper='.cache/wallpaper', wallpaper_mode='fill', top=status_bar(primary_widgets))] +screens = [Screen(wallpaper='~/wallpapers/archlinux2.jpg', wallpaper_mode='fill', top=status_bar(primary_widgets))] # xrandr = "xrandr | grep -w 'connected' | cut -d ' ' -f 2 | wc -l" @@ -36,4 +37,4 @@ connected_monitors = 2 if connected_monitors > 1: for _ in range(1, connected_monitors): - screens.append(Screen(wallpaper='.cache/wallpaper', wallpaper_mode='fill', top=status_bar(secondary_widgets))) + screens.append(Screen(wallpaper='~/wallpapers/archlinux2.jpg', wallpaper_mode='fill', top=status_bar(secondary_widgets))) diff --git a/.config/qtile-wayland/settings/widgets.py b/.config/qtile-wayland/settings/widgets.py index d422192..1b976ca 100644 --- a/.config/qtile-wayland/settings/widgets.py +++ b/.config/qtile-wayland/settings/widgets.py @@ -1,6 +1,3 @@ -# Justine Smithies -# https://github.com/justinesmithies/qtile-wayland-dotfiles - # Widgets setup # Get the icons at https://www.nerdfonts.com/cheat-sheet @@ -12,7 +9,7 @@ from libqtile import widget #from colors import * from .theme import colors #from ordinaldate import custom_date -from keys import terminal +from .keys import terminal def base(fg='text', bg='dark'): diff --git a/.config/qtile-wayland/settings/widgets.py.old b/.config/qtile-wayland/settings/widgets.py.old deleted file mode 100644 index cb80341..0000000 --- a/.config/qtile-wayland/settings/widgets.py.old +++ /dev/null @@ -1,94 +0,0 @@ -# Justine Smithies -# https://github.com/justinesmithies/qtile-wayland-dotfiles - -# Widgets setup -# Get the icons at https://www.nerdfonts.com/cheat-sheet - -import psutil -import os -import subprocess -from libqtile import qtile -from libqtile import widget -from colors import * -from ordinaldate import custom_date -from keys import terminal - - -widget_defaults = dict( - font='UbuntuMono Nerd Font', - fontsize='14', - padding=1, -) -extension_defaults = widget_defaults.copy() - -primary_widgets = [ - widget.Spacer(length=10), - widget.GroupBox( - borderwidth=2, - inactive='969696', - this_current_screen_border='eee8d5', - this_screen_border='eee8d5', - font='FiraCode Nerd Font', - fontsize=14, - highlight_method='line', - highlight_color=['00000000', '00000000'] - ), - widget.CurrentLayoutIcon(scale=0.7), - widget.CurrentLayout(**widget_defaults), - widget.Spacer(length=320), - widget.GenPollText( - func=custom_date, - update_interval=1, - **widget_defaults, - mouse_callbacks={ - 'Button1': lambda: qtile.cmd_spawn(os.path.expanduser("~/.local/bin/statusbar/calendar.sh show"), shell=True), - 'Button3': lambda: qtile.cmd_spawn(os.path.expanduser("~/.local/bin/statusbar/calendar.sh edit"), shell=True) - } - ), - widget.Spacer(), - widget.CheckUpdates( - **widget_defaults, - update_interval=600, - distro='Arch_paru', - custom_command='~/.local/bin/statusbar/arch-updates.sh', - display_format=' {updates}', - colour_have_updates=colors[2], - execute='kitty -e paru' - ), - widget.Spacer(length=5), - widget.KeyboardLayout(configured_keyboards=['us', 'gb']), - widget.Spacer(length=5), - widget.GenPollText(update_interval=1, **widget_defaults, func=lambda: subprocess.check_output(os.path.expanduser("~/.local/bin/statusbar/brightnesscontrol")).decode(), mouse_callbacks={'Button1': lambda: qtile.cmd_spawn(os.path.expanduser("~/.local/bin/statusbar/brightnesscontrol down"), shell=True), 'Button3': lambda: qtile.cmd_spawn(os.path.expanduser("~/.local/bin/statusbar/brightnesscontrol up"), shell=True)}), - widget.Spacer(length=5), - widget.GenPollText(update_interval=1, **widget_defaults, func=lambda: subprocess.check_output(os.path.expanduser("~/.local/bin/statusbar/volumecontrol")).decode(), mouse_callbacks={'Button1': lambda: qtile.cmd_spawn(os.path.expanduser("~/.local/bin/statusbar/volumecontrol down"), shell=True), 'Button2': lambda: qtile.cmd_spawn(os.path.expanduser("~/.local/bin/statusbar/volumecontrol mute"), shell=True), 'Button3': lambda: qtile.cmd_spawn(os.path.expanduser("~/.local/bin/statusbar/volumecontrol up"), shell=True)}), - widget.Spacer(length=5), - widget.GenPollText(update_interval=1, **widget_defaults, func=lambda: subprocess.check_output(os.path.expanduser("~/.local/bin/statusbar/battery.py")).decode(), mouse_callbacks={'Button1': lambda: qtile.cmd_spawn(os.path.expanduser("~/.local/bin/statusbar/battery.py --c left-click"), shell=True)}), - widget.Spacer(length=5), - widget.GenPollText(update_interval=1, **widget_defaults, func=lambda: subprocess.check_output(os.path.expanduser("~/.local/bin/statusbar/network.sh")).decode(), mouse_callbacks={'Button1': lambda: qtile.cmd_spawn(os.path.expanduser("~/.local/bin/statusbar/network.sh ShowInfo"), shell=True), 'Button3': lambda: qtile.cmd_spawn(terminal + ' -e nmtui', shell=True)}), - widget.Spacer(length=10), -] - -secondary_widgets = [ - widget.GroupBox( - borderwidth=2, - inactive='969696', - this_current_screen_border='eee8d5', - this_screen_border='eee8d5', - font='FiraCode Nerd Font', - fontsize=14, highlight_method='line', - highlight_color=['00000000', '00000000'] - ), - widget.CurrentLayoutIcon(scale=0.7), - widget.CurrentLayout(**widget_defaults), - widget.Spacer(length=320), - widget.GenPollText( - func=custom_date, - update_interval=1, - **widget_defaults, - mouse_callbacks={ - 'Button1': lambda: qtile.cmd_spawn(os.path.expanduser("~/.local/bin/statusbar/calendar.sh show"), shell=True), - 'Button3': lambda: qtile.cmd_spawn(os.path.expanduser("~/.local/bin/statusbar/calendar.sh edit"), shell=True) - } - ), - widget.Spacer(), -] diff --git a/.config/qtile-wayland/settings/workspaces.py b/.config/qtile-wayland/settings/workspaces.py index 3ee2611..eaf8d12 100644 --- a/.config/qtile-wayland/settings/workspaces.py +++ b/.config/qtile-wayland/settings/workspaces.py @@ -11,7 +11,7 @@ workspaces = [ "name": "term", "key": "1", "matches": [ - Match(wm_class='kitty'), + Match(wm_class='xterm'), ], "layout": "monadtall", "spawn": [], diff --git a/.config/qtile-wayland/startwlrrandr.sh b/.config/qtile-wayland/startwlrrandr.sh new file mode 100755 index 0000000..bb39755 --- /dev/null +++ b/.config/qtile-wayland/startwlrrandr.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# Ignore sleep when run script from startwlrscreensaver.sh +if [ "${1}" == "screensaver" ] ; then + echo "Load monitor configuration quickly" +else + sleep 2 +fi + +# Configuration for your monitor(s). Use wlr-randr and/or wdisplays for help +wlr-randr --output DP-1 --custom-mode 1920x1200@60Hz --pos 288,0 +wlr-randr --output DP-2 --custom-mode 1280x1024@75Hz --transform 90 --pos 1568,0 diff --git a/.config/qtile-wayland/startwlrscreensaver.sh b/.config/qtile-wayland/startwlrscreensaver.sh new file mode 100755 index 0000000..ece728a --- /dev/null +++ b/.config/qtile-wayland/startwlrscreensaver.sh @@ -0,0 +1,82 @@ +#!/bin/bash + +# Basic configuration variables +ScreensaverTime="1200" # 20 minutes +monitorOne="DP-1" # First monitor +monitorTwo="DP-2" # Second monitor +monitorThree="" # Third monitor + +# Load script for load monitors config quickly from resume +LoadConfigResume="${HOME}/.config/qtile/startwlrrandr.sh" + +# StateFile variable +stateFile="${HOME}/.config/qtile/screen-state" + +# Function for sleep monitors +function sleepMonitors() { + # Check monitor 3 + if [ -z "${monitorThree}" ] ; then + echo "Monitor 3 is empty or disabled" + else + echo "Sleep monitor 3" + wlr-randr --output ${monitorThree} --off + fi + # Check monitor 2 + if [ -z "${monitorTwo}" ] ; then + echo "Monitor 2 is empty or disabled" + else + echo "Sleep monitor 2" + wlr-randr --output ${monitorTwo} --off + fi + # Check monitor 1 + if [ -z "${monitorOne}" ] ; then + echo "Monitor 1 is empty or disabled" + else + echo "Sleep monitor 1" + wlr-randr --output ${monitorOne} --off + fi + echo "sleep" > ${stateFile} +} + +# Function for resume monitors +function resumeMonitors() { + # Check monitor 3 + if [ -z "${monitorThree}" ] ; then + echo "Monitor 3 is empty or disabled" + else + echo "Resume monitor 3" + wlr-randr --output ${monitorThree} --on + fi + # Check monitor 2 + if [ -z "${monitorTwo}" ] ; then + echo "Monitor 2 is empty or disabled" + else + echo "Resume monitor 2" + wlr-randr --output ${monitorTwo} --on + fi + # Check monitor 1 + if [ -z "${monitorOne}" ] ; then + echo "Monitor 1 is empty or disabled" + else + echo "Resume monitor 1" + wlr-randr --output ${monitorOne} --on + fi + # Load monitors config quickly + bash ${LoadConfigResume} screensaver + echo "resume" > ${stateFile} +} + +# Boot parameters +if [ -z "${1}" ] ; then + # Kill previous process + echo "Trying to kill previous process" + killall -9 swayidle + # Init swayidle command + sleep 3 + swayidle timeout ${ScreensaverTime} "bash ${0} sleep" resume "bash ${0} resume" +elif [ "${1}" == "sleep" ] ; then + sleepMonitors +elif [ "${1}" == "resume" ] ; then + resumeMonitors +fi + diff --git a/.config/qtile-wayland/themes/README.md b/.config/qtile-wayland/themes/README.md new file mode 100644 index 0000000..545527c --- /dev/null +++ b/.config/qtile-wayland/themes/README.md @@ -0,0 +1,56 @@ +A theme consists of a simple json file. You can create your own by copying this +json object and changing values: + +```json +{ + "dark": [ + "#0f101a", + "#0f101a" + ], + "grey": [ + "#353c4a", + "#353c4a" + ], + "light": [ + "#f1ffff", + "#f1ffff" + ], + "text": [ + "#0f101a", + "#0f101a" + ], + "focus": [ + "#a151d3", + "#a151d3" + ], + "active": [ + "#f1ffff", + "#f1ffff" + ], + "inactive": [ + "#4c566a", + "#4c566a" + ], + "urgent": [ + "#F07178", + "#F07178" + ], + "color1": [ + "#a151d3", + "#a151d3" + ], + "color2": [ + "#F07178", + "#F07178" + ], + "color3": [ + "#fb9f7f", + "#fb9f7f" + ], + "color4": [ + "#ffd47e", + "#ffd47e" + ] +} + +``` diff --git a/.config/qtile-wayland/xterm-wayland b/.config/qtile-wayland/xterm-wayland new file mode 100755 index 0000000..3528ebc --- /dev/null +++ b/.config/qtile-wayland/xterm-wayland @@ -0,0 +1,5 @@ +#!/bin/bash + +# Load xterm config on Wayland +xrdb -load ~/.Xresources +xterm