Merge pull request 'Switch to wayland.' (#1) from wayland into master

Reviewed-on: #1
This commit is contained in:
ftpd 2023-02-21 12:06:13 +01:00
commit 896fef83ec
11 changed files with 99 additions and 125 deletions

View file

@ -1,56 +0,0 @@
#!/bin/sh
twoscreen() {
mirror=$(printf "no\\nyes" | dmenu -c -l 2 -i -p "mirror?")
if [ "$mirror" = "yes" ]; then
external=$(echo "$screens" | dmenu -c -l 2 -i)
internal=$(echo "$screens" | grep -v "$external")
res_external=$(xrandr --query | sed -n "/^$external/,/\+/p" | \
tail -n 1 | awk '{print $1}')
res_internal=$(xrandr --query | sed -n "/^$internal/,/\+/p" | \
tail -n 1 | awk '{print $1}')
res_ext_x=$(echo "$res_external" | sed 's/x.*//')
res_ext_y=$(echo "$res_external" | sed 's/.*x//')
res_int_x=$(echo "$res_internal" | sed 's/x.*//')
res_int_y=$(echo "$res_internal" | sed 's/.*x//')
scale_x=$(echo "$res_ext_x / $res_int_x" | bc -l)
scale_y=$(echo "$res_ext_y / $res_int_y" | bc -l)
xrandr --output "$external" --auto --scale 1.0x1.0 \
--output "$internal" --auto --same-as "$external" \
--scale "$scale_x"x"$scale_y"
else
primary=$(echo "$screens" | dmenu -c -l 50 -i -p "select primary output")
secondary=$(echo "$screens" | grep -v "$primary")
direction=$(printf "left\\nright" | dmenu -c -l 2 -i -p "secondary display location")
xrandr --output "$primary" --auto --scale 1.0x1.0 --output "$secondary" --"$direction"-of "$primary" --auto --scale 1.0x1.0
fi
}
onescreen() {
if [ "$2" = "native" ]; then
xrandr --output "$1" --auto --scale 1.0x1.0 $(echo "$allposs" | grep -v "\b$1" | awk '{print "--output", $1, "--off"}' | paste -sd ' ' -)
else
scale=$(printf "native\\n0.75\\n0.5" | dmenu -c -l 3 -i -p "scale") &&
case "$scale" in
"native") xrandr --output "$1" --auto --scale 1.0x1.0 $(echo "$allposs" | grep -v "\b$1" | awk '{print "--output", $1, "--off"}' | paste -sd ' ' -);;
*) xrandr --output "$1" --auto --scale ${scale}x${scale} $(echo "$allposs" | grep -v "\b$1" | awk '{print "--output", $1, "--off"}' | paste -sd ' ' -);;
esac
fi
}
# Get all possible displays
allposs=$(xrandr -q | grep "connected")
# Get all connected screens.
screens=$(echo "$allposs" | awk '/ connected/ {print $1}')
# If there's only one screen
[ "$(echo "$screens" | wc -l)" -lt 2 ] &&
{ onescreen "$screens" "native"; notify-send -t 2000 -u critical ' no device to switch'; exit ;}
# Get user choice including both and manual selection:
chosen=$(printf -- "%s\\nmulti" "$screens" | dmenu -c -l 5 -i -p "select output") &&
case "$chosen" in
"multi") twoscreen ;;
*) onescreen "$chosen" ;;
esac

View file

@ -1,2 +0,0 @@
#!/bin/sh
[ -n "$1" ] && firefox-bin "$*" || firefox-bin &

View file

@ -1,12 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="scan">
<test name="family">
<string>RobotoMono Nerd Font</string>
</test>
<edit name="spacing">
<int>90</int>
</edit>
</match>
</fontconfig>

35
_desktop/foot/foot.ini Normal file
View file

@ -0,0 +1,35 @@
term=xterm-256color
font=RobotoMono Nerd Font:style=Medium:pixelsize=14, Noto Color Emoji:style=Regular:size=8
selection-target=clipboard
pad=5x5
[bell]
urgent=yes
[mouse]
hide-when-typing=yes
[colors]
alpha=0.95
background=272822
foreground=c7c7c7
0=272822
1=fd4285
2=a6e22d
3=e5da72
4=00bdff
5=9a37ff
6=50b6d8
7=c7c7c7
8=676767
9=fa7fac
10=bde271
11=fff27f
12=005577
13=bd9eff
14=5ed6fe
15=feffff
urls=005577
[key-bindings]
show-urls-launch=Control+o

View file

@ -4,7 +4,7 @@
mkdir -p ~/.config ~/.local/bin mkdir -p ~/.config ~/.local/bin
# link config # link config
for i in clipit gtk-3.0 neofetch qtile zathura; do for i in foot gtk-3.0 kanshi neofetch qtile zathura; do
rm -rf ~/.config/${i} rm -rf ~/.config/${i}
ln -sf $(pwd)/${i} ~/.config ln -sf $(pwd)/${i} ~/.config
done done
@ -15,9 +15,6 @@ for i in dconf; do
ln -sf /dev/null ~/.config/${i} ln -sf /dev/null ~/.config/${i}
done done
# copy firefox wrapper
ln -sf $(pwd)/firefox ~/.local/bin
# install scripts # install scripts
for i in _scripts/*; do for i in _scripts/*; do
ln -sf $(pwd)/$i ~/.local/bin ln -sf $(pwd)/$i ~/.local/bin

8
_desktop/kanshi/config Normal file
View file

@ -0,0 +1,8 @@
profile office {
output eDP-1 disable
output DP-1 mode 3840x2160 position 0,0 scale 1.3
}
profile nomad {
output eDP-1 enable
}

View file

@ -29,7 +29,7 @@ distro_shorthand="on"
os_arch="off" os_arch="off"
uptime_shorthand="tiny" uptime_shorthand="tiny"
memory_percent="on" memory_percent="on"
package_managers="off" package_managers="on"
shell_version="off" shell_version="off"
cpu_brand="off" cpu_brand="off"
refresh_rate="on" refresh_rate="on"

View file

@ -1,20 +1,27 @@
import os import os
import psutil
import subprocess import subprocess
from libqtile import bar, extension, hook, layout, widget from libqtile import bar, extension, hook, layout
from libqtile.config import Click, Drag, DropDown, Group, Key, Match, ScratchPad, Screen
from libqtile.dgroups import simple_key_binder
from libqtile.lazy import lazy from libqtile.lazy import lazy
from libqtile.config import Click, Drag, DropDown, Group, Key, Match, ScratchPad, Screen
from libqtile.backend.wayland import InputConfig
from qtile_extras import widget
wl_input_rules = {
"type:pointer": InputConfig(natural_scroll=True),
"type:touchpad": InputConfig(tap=True,natural_scroll=True),
"type:keyboard": InputConfig(kb_layout="pl",kb_repeat_delay=280,kb_repeat_rate=30),
}
@hook.subscribe.startup_once @hook.subscribe.startup_once
def autostart(): def autostart():
home = os.path.expanduser('~/.config/qtile/autostart.sh') home = os.path.expanduser('~/.config/qtile/autostart.sh')
subprocess.Popen([home]) subprocess.Popen([home])
mod = "mod4"
groups = [ groups = [
Group("1", label="\uf292"), Group("1", label="\uf292"),
Group("2", label="\uf738", matches=[Match(wm_class=["firefox"])]), Group("2", label="\uf738"),
Group("3", label="\uf70d", matches=[Match(wm_class=["Ferdium", "discord", "Signal"])]), Group("3", label="\uf70d", matches=[Match(wm_class=["ferdium", "discord", "Signal"])]),
Group("4", label="\uf7aa", matches=[Match(wm_class=["mutt"])]), Group("4", label="\uf7aa", matches=[Match(wm_class=["mutt"])]),
Group("5", label="\uf120"), Group("5", label="\uf120"),
Group("6", label="\uf120"), Group("6", label="\uf120"),
@ -32,7 +39,7 @@ groups = [
y=0.25, y=0.25,
), ),
DropDown( DropDown(
"spwork", "sh -c 'terminal_profile=work BROWSER=workfx st'", "spwork", "sh -c 'terminal_profile=work foot -o url.launch=workfx\ \${url}'",
on_focus_lost_hide=False, on_focus_lost_hide=False,
width=0.40, width=0.40,
height=0.50, height=0.50,
@ -42,7 +49,6 @@ groups = [
]), ]),
] ]
mod = "mod4"
keys = [ keys = [
# switch between windows # switch between windows
Key([mod], "h", lazy.layout.left()), Key([mod], "h", lazy.layout.left()),
@ -61,25 +67,25 @@ keys = [
Key([mod, "shift"], "k", lazy.layout.grow_up()), Key([mod, "shift"], "k", lazy.layout.grow_up()),
Key([mod, "shift", "control"], "0", lazy.layout.normalize()), Key([mod, "shift", "control"], "0", lazy.layout.normalize()),
# app binds # app binds
Key([mod], "Return", lazy.spawn("sh -c 'BROWSER=firefox st'")), Key([mod], "Return", lazy.spawn("foot")),
Key([mod], "space", lazy.spawncmd()), Key([mod], "space", lazy.spawncmd()),
Key([mod], "a", lazy.spawn("authenticator")), Key([mod], "a", lazy.spawn("authenticator")),
Key([mod], "e", lazy.group["scratchpad"].dropdown_toggle('spterm')), Key([mod], "e", lazy.group["scratchpad"].dropdown_toggle('spterm')),
Key([mod], "i", lazy.spawn("scrot -f -s 'scrot_%Y-%m-%d_%H-%M-%S_%s.png'")), Key([mod], "i", lazy.spawn("sh -c 'grim -g \"$(slurp)\"'")),
Key([mod], "m", lazy.spawn("sh -c 'pgrep -x neomutt > /dev/null || BROWSER=firefox st -n mutt -e neomutt'")), Key([mod], "m", lazy.spawn("sh -c 'pgrep -x neomutt > /dev/null || foot -a mutt -o bold-text-in-bright=yes neomutt'")),
Key([mod, "shift"], "e", lazy.group["scratchpad"].dropdown_toggle('spwork')), Key([mod, "shift"], "e", lazy.group["scratchpad"].dropdown_toggle('spwork')),
Key([mod, "shift"], "i", lazy.spawn("scrot -f 'scrot_%Y-%m-%d_%H-%M-%S_%s.png'")), Key([mod, "shift"], "i", lazy.spawn("grim")),
Key([mod, "shift"], "Return", lazy.spawn("sh -c 'terminal_profile=work BROWSER=workfx st'")), Key([mod, "shift"], "Return", lazy.spawn("sh -c 'terminal_profile=work foot -o url.launch=workfx\ \${url}'")),
Key([mod, "control"], "a", lazy.spawn("dmenu-audio")), Key([mod, "control"], "a", lazy.spawn("dmenu-audio")),
Key([mod, "control"], "b", lazy.spawn("dmenu-bluetooth")), Key([mod, "control"], "b", lazy.spawn("dmenu-bluetooth")),
Key([mod, "control"], "e", lazy.spawn("dmenu-emoji")), Key([mod, "control"], "e", lazy.spawn("dmenu-chars")),
Key([mod, "control"], "d", lazy.spawn("dmenu-display")),
# WM control # WM control
Key([mod], "f", lazy.window.toggle_floating()), Key([mod], "f", lazy.window.toggle_floating()),
Key([mod], "q", lazy.window.kill()), Key([mod], "q", lazy.window.kill()),
Key([mod, "control", "shift"], "l", lazy.spawn("physlock")), Key([mod, "control", "shift"], "l", lazy.spawn("physlock")),
Key([mod, "control", "shift"], "q", lazy.shutdown()), Key([mod, "control", "shift"], "q", lazy.shutdown()),
Key([mod, "control", "shift"], "r", lazy.reload_config()), Key([mod, "control", "shift"], "r", lazy.reload_config()),
Key([mod], "r", lazy.reload_config()),
# media keys # media keys
Key([], "XF86AudioMute", lazy.spawn("pactl set-sink-mute @DEFAULT_SINK@ toggle")), Key([], "XF86AudioMute", lazy.spawn("pactl set-sink-mute @DEFAULT_SINK@ toggle")),
Key([], "XF86AudioMicMute", lazy.spawn("key-micmute")), Key([], "XF86AudioMicMute", lazy.spawn("key-micmute")),
@ -89,8 +95,22 @@ keys = [
Key([], "XF86MonBrightnessDown", lazy.spawn("xbacklight -dec 10")), Key([], "XF86MonBrightnessDown", lazy.spawn("xbacklight -dec 10")),
] ]
dgroups_key_binder = simple_key_binder(mod) for i in groups[:10]:
dgroups_app_rules = [] # type: list keys.extend(
[
# mod1 + letter of group = switch to group
Key(
[mod], i.name, lazy.group[i.name].toscreen(),
desc="Switch to group {}".format(i.name),
),
# Key( [mod, "shift"], i.name, lazy.window.togroup(i.name, switch_group=True),
# desc="Switch to & move focused window to group {}".format(i.name),
# ),
Key([mod, "shift"], i.name, lazy.window.togroup(i.name),
desc="move focused window to group {}".format(i.name)
),
]
)
layouts = [ layouts = [
layout.Columns( layout.Columns(
@ -104,10 +124,10 @@ layouts = [
] ]
widget_defaults = dict( widget_defaults = dict(
foreground='#c7c7c7',
background='#272822', background='#272822',
font="RobotoMono Nerd Font Medium", font="RobotoMono Nerd Font Medium",
fontsize=14, fontsize=14,
foreground='#c7c7c7',
) )
extension_defaults = widget_defaults.copy() extension_defaults = widget_defaults.copy()
@ -128,6 +148,7 @@ screens = [
urgent_border='#770000', urgent_border='#770000',
), ),
widget.Prompt( widget.Prompt(
bell_style=None,
prompt='open: ', prompt='open: ',
record_history=False, record_history=False,
), ),
@ -174,12 +195,14 @@ screens = [
widget.Clock( widget.Clock(
format='[%d] %H:%M:%S', format='[%d] %H:%M:%S',
), ),
widget.Systray(), widget.StatusNotifier(
icon_size=18,
),
], ],
24, 24,
margin=[5, 5, 0, 5] margin=[5, 5, 0, 5]
), ),
wallpaper='~/.local/share/wallpaper.jpg', wallpaper=os.environ['XDG_CONFIG_HOME'] + '/qtile/wallpaper.img',
wallpaper_mode='fill', wallpaper_mode='fill',
), ),
] ]
@ -193,39 +216,19 @@ mouse = [
floating_layout = layout.Floating( floating_layout = layout.Floating(
float_rules=[ float_rules=[
*layout.Floating.default_float_rules, *layout.Floating.default_float_rules,
Match(wm_class='Authenticator'), Match(wm_class='authenticator'),
Match(title="Open File"),
Match(title="Open file"),
Match(title="Open Files"),
Match(title="Firefox — Sharing Indicator"),
], ],
border_focus='#feffff', border_focus='#005577',
border_normal="#272822", border_normal="#272822",
border_width=2, border_width=5,
) )
@hook.subscribe.client_new auto_fullscreen = False
def _swallow(window):
pid = window.window.get_net_wm_pid()
ppid = psutil.Process(pid).ppid()
cpids = {c.window.get_net_wm_pid(): wid for wid, c in window.qtile.windows_map.items()}
for i in range(5):
if not ppid:
return
if ppid in cpids:
parent = window.qtile.windows_map.get(cpids[ppid])
if parent.window.get_wm_class()[0] != "xterm-256color":
return
parent.minimized = True
window.parent = parent
return
ppid = psutil.Process(ppid).ppid()
@hook.subscribe.client_killed
def _unswallow(window):
if hasattr(window, 'parent'):
window.parent.minimized = False
auto_fullscreen = True
auto_minimize = True auto_minimize = True
bring_front_click = False focus_on_window_activation = 'smart'
cursor_warp = False
focus_on_window_activation = "smart"
follow_mouse_focus = True follow_mouse_focus = True
reconfigure_screens = True reconfigure_screens = True

View file

@ -51,6 +51,7 @@ set termguicolors
colorscheme skyknight colorscheme skyknight
hi Comment gui=italic hi Comment gui=italic
hi Normal guibg=NONE
hi BadWhitespace guibg=#770000 hi BadWhitespace guibg=#770000
hi ColorColumn guibg=#770000 hi ColorColumn guibg=#770000
hi DiffChange guibg=#465457 hi DiffChange guibg=#465457
@ -58,7 +59,7 @@ hi DiffText guifg=#ff8700 guibg=#465457
hi FoldColumn guifg=#465457 guibg=#272822 hi FoldColumn guifg=#465457 guibg=#272822
hi GitGutterChange guifg=#bbbb00 guibg=#272822 hi GitGutterChange guifg=#bbbb00 guibg=#272822
hi LineNr guifg=#465457 guibg=#272822 hi LineNr guifg=#465457 guibg=#272822
hi NonText guifg=#465457 guibg=#272822 hi NonText guifg=#465457 guibg=NONE
hi SignColumn guifg=#465457 guibg=#272822 hi SignColumn guifg=#465457 guibg=#272822
hi Visual guibg=#005577 hi Visual guibg=#005577
hi SpellBad guibg=#770000 hi SpellBad guibg=#770000