From 6257330dccfd1422d2ff2db1944452490c0e2fa9 Mon Sep 17 00:00:00 2001 From: Bartek Stalewski Date: Thu, 9 Feb 2023 23:16:17 +0100 Subject: [PATCH] Switch to wayland. --- .../_scripts/{dmenu-emoji => dmenu-chars} | 0 _desktop/_scripts/dmenu-display | 56 ---------- _desktop/firefox | 2 - _desktop/fontconfig/fonts.conf | 12 --- _desktop/foot/foot.ini | 35 ++++++ _desktop/install-desktop.sh | 5 +- _desktop/kanshi/config | 8 ++ _desktop/neofetch/config.conf | 2 +- _desktop/qtile/config.py | 101 +++++++++--------- {_desktop => _unused}/clipit/clipitrc | 0 nvim/init.vim | 3 +- 11 files changed, 99 insertions(+), 125 deletions(-) rename _desktop/_scripts/{dmenu-emoji => dmenu-chars} (100%) delete mode 100644 _desktop/_scripts/dmenu-display delete mode 100755 _desktop/firefox delete mode 100644 _desktop/fontconfig/fonts.conf create mode 100644 _desktop/foot/foot.ini create mode 100644 _desktop/kanshi/config rename {_desktop => _unused}/clipit/clipitrc (100%) diff --git a/_desktop/_scripts/dmenu-emoji b/_desktop/_scripts/dmenu-chars similarity index 100% rename from _desktop/_scripts/dmenu-emoji rename to _desktop/_scripts/dmenu-chars diff --git a/_desktop/_scripts/dmenu-display b/_desktop/_scripts/dmenu-display deleted file mode 100644 index c73c6fa..0000000 --- a/_desktop/_scripts/dmenu-display +++ /dev/null @@ -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 diff --git a/_desktop/firefox b/_desktop/firefox deleted file mode 100755 index 1fd8513..0000000 --- a/_desktop/firefox +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -[ -n "$1" ] && firefox-bin "$*" || firefox-bin & diff --git a/_desktop/fontconfig/fonts.conf b/_desktop/fontconfig/fonts.conf deleted file mode 100644 index 92002f2..0000000 --- a/_desktop/fontconfig/fonts.conf +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - RobotoMono Nerd Font - - - 90 - - - diff --git a/_desktop/foot/foot.ini b/_desktop/foot/foot.ini new file mode 100644 index 0000000..3dae5e0 --- /dev/null +++ b/_desktop/foot/foot.ini @@ -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 diff --git a/_desktop/install-desktop.sh b/_desktop/install-desktop.sh index 9eb88d5..03be038 100644 --- a/_desktop/install-desktop.sh +++ b/_desktop/install-desktop.sh @@ -4,7 +4,7 @@ mkdir -p ~/.config ~/.local/bin # 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} ln -sf $(pwd)/${i} ~/.config done @@ -15,9 +15,6 @@ for i in dconf; do ln -sf /dev/null ~/.config/${i} done -# copy firefox wrapper -ln -sf $(pwd)/firefox ~/.local/bin - # install scripts for i in _scripts/*; do ln -sf $(pwd)/$i ~/.local/bin diff --git a/_desktop/kanshi/config b/_desktop/kanshi/config new file mode 100644 index 0000000..bd09b21 --- /dev/null +++ b/_desktop/kanshi/config @@ -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 +} diff --git a/_desktop/neofetch/config.conf b/_desktop/neofetch/config.conf index 5fb5851..d32837d 100644 --- a/_desktop/neofetch/config.conf +++ b/_desktop/neofetch/config.conf @@ -29,7 +29,7 @@ distro_shorthand="on" os_arch="off" uptime_shorthand="tiny" memory_percent="on" -package_managers="off" +package_managers="on" shell_version="off" cpu_brand="off" refresh_rate="on" diff --git a/_desktop/qtile/config.py b/_desktop/qtile/config.py index b33d4a1..917f483 100644 --- a/_desktop/qtile/config.py +++ b/_desktop/qtile/config.py @@ -1,20 +1,27 @@ import os -import psutil import subprocess -from libqtile import bar, extension, hook, layout, widget -from libqtile.config import Click, Drag, DropDown, Group, Key, Match, ScratchPad, Screen -from libqtile.dgroups import simple_key_binder +from libqtile import bar, extension, hook, layout 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 def autostart(): home = os.path.expanduser('~/.config/qtile/autostart.sh') subprocess.Popen([home]) +mod = "mod4" groups = [ Group("1", label="\uf292"), - Group("2", label="\uf738", matches=[Match(wm_class=["firefox"])]), - Group("3", label="\uf70d", matches=[Match(wm_class=["Ferdium", "discord", "Signal"])]), + Group("2", label="\uf738"), + Group("3", label="\uf70d", matches=[Match(wm_class=["ferdium", "discord", "Signal"])]), Group("4", label="\uf7aa", matches=[Match(wm_class=["mutt"])]), Group("5", label="\uf120"), Group("6", label="\uf120"), @@ -32,7 +39,7 @@ groups = [ y=0.25, ), 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, width=0.40, height=0.50, @@ -42,7 +49,6 @@ groups = [ ]), ] -mod = "mod4" keys = [ # switch between windows Key([mod], "h", lazy.layout.left()), @@ -61,25 +67,25 @@ keys = [ Key([mod, "shift"], "k", lazy.layout.grow_up()), Key([mod, "shift", "control"], "0", lazy.layout.normalize()), # 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], "a", lazy.spawn("authenticator")), 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], "m", lazy.spawn("sh -c 'pgrep -x neomutt > /dev/null || BROWSER=firefox st -n mutt -e neomutt'")), + Key([mod], "i", lazy.spawn("sh -c 'grim -g \"$(slurp)\"'")), + 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"], "i", lazy.spawn("scrot -f 'scrot_%Y-%m-%d_%H-%M-%S_%s.png'")), - Key([mod, "shift"], "Return", lazy.spawn("sh -c 'terminal_profile=work BROWSER=workfx st'")), + Key([mod, "shift"], "i", lazy.spawn("grim")), + 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"], "b", lazy.spawn("dmenu-bluetooth")), - Key([mod, "control"], "e", lazy.spawn("dmenu-emoji")), - Key([mod, "control"], "d", lazy.spawn("dmenu-display")), + Key([mod, "control"], "e", lazy.spawn("dmenu-chars")), # WM control Key([mod], "f", lazy.window.toggle_floating()), Key([mod], "q", lazy.window.kill()), Key([mod, "control", "shift"], "l", lazy.spawn("physlock")), Key([mod, "control", "shift"], "q", lazy.shutdown()), Key([mod, "control", "shift"], "r", lazy.reload_config()), + Key([mod], "r", lazy.reload_config()), # media keys Key([], "XF86AudioMute", lazy.spawn("pactl set-sink-mute @DEFAULT_SINK@ toggle")), Key([], "XF86AudioMicMute", lazy.spawn("key-micmute")), @@ -89,8 +95,22 @@ keys = [ Key([], "XF86MonBrightnessDown", lazy.spawn("xbacklight -dec 10")), ] -dgroups_key_binder = simple_key_binder(mod) -dgroups_app_rules = [] # type: list +for i in groups[:10]: + 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 = [ layout.Columns( @@ -104,10 +124,10 @@ layouts = [ ] widget_defaults = dict( - foreground='#c7c7c7', background='#272822', font="RobotoMono Nerd Font Medium", fontsize=14, + foreground='#c7c7c7', ) extension_defaults = widget_defaults.copy() @@ -128,6 +148,7 @@ screens = [ urgent_border='#770000', ), widget.Prompt( + bell_style=None, prompt='open: ', record_history=False, ), @@ -174,12 +195,14 @@ screens = [ widget.Clock( format='[%d] %H:%M:%S', ), - widget.Systray(), + widget.StatusNotifier( + icon_size=18, + ), ], 24, margin=[5, 5, 0, 5] ), - wallpaper='~/.local/share/wallpaper.jpg', + wallpaper=os.environ['XDG_CONFIG_HOME'] + '/qtile/wallpaper.img', wallpaper_mode='fill', ), ] @@ -193,39 +216,19 @@ mouse = [ floating_layout = layout.Floating( 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_width=2, + border_width=5, ) -@hook.subscribe.client_new -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_fullscreen = False auto_minimize = True -bring_front_click = False -cursor_warp = False -focus_on_window_activation = "smart" +focus_on_window_activation = 'smart' follow_mouse_focus = True reconfigure_screens = True diff --git a/_desktop/clipit/clipitrc b/_unused/clipit/clipitrc similarity index 100% rename from _desktop/clipit/clipitrc rename to _unused/clipit/clipitrc diff --git a/nvim/init.vim b/nvim/init.vim index 995b419..5994587 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -51,6 +51,7 @@ set termguicolors colorscheme skyknight hi Comment gui=italic +hi Normal guibg=NONE hi BadWhitespace guibg=#770000 hi ColorColumn guibg=#770000 hi DiffChange guibg=#465457 @@ -58,7 +59,7 @@ hi DiffText guifg=#ff8700 guibg=#465457 hi FoldColumn guifg=#465457 guibg=#272822 hi GitGutterChange guifg=#bbbb00 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 Visual guibg=#005577 hi SpellBad guibg=#770000