Dotfiles config update (2022-04-30)

This commit is contained in:
q3aql 2022-04-30 20:33:28 +02:00
parent f948b44f31
commit c16fa06c65
15 changed files with 191 additions and 129 deletions

View File

@ -1,7 +1,6 @@
#!/bin/sh #!/bin/sh
# Autostart script for Qtile # Autostart script for Qtile
cmd_exist() { unalias "$1" >/dev/null 2>&1 ; command -v "$1" >/dev/null 2>&1 ;} cmd_exist() { unalias "$1" >/dev/null 2>&1 ; command -v "$1" >/dev/null 2>&1 ;}
__kill() { kill -9 "$(pidof "$1")" >/dev/null 2>&1 ; } __kill() { kill -9 "$(pidof "$1")" >/dev/null 2>&1 ; }
__start() { sleep 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 systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
# Apps to autostart
if cmd_exist kanshi ; then
__kill kanshi
__start kanshi
fi
# Authentication dialog # Authentication dialog
if [ -f /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 ]; then if [ -f /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 ]; then
__kill polkit-gnome-authentication-agent-1 /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
__start /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
fi fi
# Notification daemon # Notification daemon
#dunst &
if cmd_exist dunst ; then # Network applet
__kill dunst #connman-gtk --tray &
__start dunst nm-applet
fi
# Applet for Audio
pnmixer -t &
# Configure screens and resolution
~/.config/qtile/startwlrrandr.sh &
# Configure screensaver
~/.config/qtile/startwlrscreensaver.sh &
# Clipboard (Diodon)
diodon &

View File

@ -5,7 +5,7 @@
# https://github.com/justinesmithies/qtile-wayland-dotfiles # https://github.com/justinesmithies/qtile-wayland-dotfiles
from typing import List # noqa: F401 from typing import List # noqa: F401
import hooks #import hooks
from settings.keys import mod, keys, home from settings.keys import mod, keys, home
from settings.workspaces import workspaces from settings.workspaces import workspaces
from settings.groups import groups from settings.groups import groups

View File

@ -5,9 +5,9 @@
from libqtile.config import Key, Group from libqtile.config import Key, Group
from libqtile.command import lazy from libqtile.command import lazy
from keys import mod, keys from .keys import mod, keys
from workspaces import workspaces from .workspaces import workspaces
from screens import connected_monitors from .screens import connected_monitors
groups = [] groups = []
for workspace in workspaces: for workspace in workspaces:

View File

@ -131,7 +131,7 @@ keys = [
Key([mod], "g", lazy.spawn("geany")), Key([mod], "g", lazy.spawn("geany")),
Key([mod], "m", lazy.spawn("telegram")), Key([mod], "m", lazy.spawn("telegram")),
Key([mod], "z", lazy.spawn("nitrogen")), 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], "t", lazy.spawn("rofi-theme-selector")),
Key([mod], "i", lazy.spawn("lxappearance")), Key([mod], "i", lazy.spawn("lxappearance")),
@ -143,10 +143,8 @@ keys = [
lazy.next_layout(), lazy.next_layout(),
desc="Toggle between layouts" desc="Toggle between layouts"
), ),
Key([mod], "w", Key([mod, "shift"], "q", lazy.window.kill()),
lazy.window.kill(), Key([mod, "control"], "q", lazy.shutdown()),
desc="Kill focused window"
),
# Toggle bars # Toggle bars
Key([mod], "b", Key([mod], "b",

View File

@ -54,4 +54,4 @@ floating_layout = layout.Floating(float_rules=[
Match(wm_class='ssh-askpass'), # ssh-askpass Match(wm_class='ssh-askpass'), # ssh-askpass
Match(title='branchdialog'), # gitk Match(title='branchdialog'), # gitk
Match(title='pinentry'), # GPG key password entry Match(title='pinentry'), # GPG key password entry
], **layout_theme) ])

View File

@ -5,7 +5,7 @@
from libqtile.config import Drag, Click from libqtile.config import Drag, Click
from libqtile.command import lazy from libqtile.command import lazy
from keys import mod from .keys import mod
mouse = [ mouse = [
Drag( Drag(

View File

@ -0,0 +1,3 @@
from os import path
qtile_path = path.join(path.expanduser('~'), ".config", "qtile")

View File

@ -6,15 +6,16 @@
from libqtile.config import Screen from libqtile.config import Screen
from libqtile import bar from libqtile import bar
from libqtile.log_utils import logger from libqtile.log_utils import logger
from widgets import primary_widgets, secondary_widgets from .widgets import primary_widgets, secondary_widgets
import subprocess import subprocess
def status_bar(widgets): 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" # xrandr = "xrandr | grep -w 'connected' | cut -d ' ' -f 2 | wc -l"
@ -36,4 +37,4 @@ connected_monitors = 2
if connected_monitors > 1: if connected_monitors > 1:
for _ in range(1, connected_monitors): 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)))

View File

@ -1,6 +1,3 @@
# Justine Smithies
# https://github.com/justinesmithies/qtile-wayland-dotfiles
# Widgets setup # Widgets setup
# Get the icons at https://www.nerdfonts.com/cheat-sheet # Get the icons at https://www.nerdfonts.com/cheat-sheet
@ -12,7 +9,7 @@ from libqtile import widget
#from colors import * #from colors import *
from .theme import colors from .theme import colors
#from ordinaldate import custom_date #from ordinaldate import custom_date
from keys import terminal from .keys import terminal
def base(fg='text', bg='dark'): def base(fg='text', bg='dark'):

View File

@ -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(),
]

View File

@ -11,7 +11,7 @@ workspaces = [
"name": "term", "name": "term",
"key": "1", "key": "1",
"matches": [ "matches": [
Match(wm_class='kitty'), Match(wm_class='xterm'),
], ],
"layout": "monadtall", "layout": "monadtall",
"spawn": [], "spawn": [],

View File

@ -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

View File

@ -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

View File

@ -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"
]
}
```

View File

@ -0,0 +1,5 @@
#!/bin/bash
# Load xterm config on Wayland
xrdb -load ~/.Xresources
xterm