From d5685185d7c04f333ef2b30176e86398203cfeb6 Mon Sep 17 00:00:00 2001 From: Smirnov Olexandr Date: Tue, 8 Dec 2020 16:56:17 +0200 Subject: [PATCH] :fire: Update --- config/i3/config | 1 - config/nvim/init.vim | 2 - config/qtile/config.py | 73 +++++++------ script/dmenu/dmenu-config-edit.sh | 14 ++- script/dmenu/dmenu-power.sh | 12 ++- script/spectrwm-bar.sh | 38 +++++++ spectrwm.conf | 170 ++++++++++++++++++++++++++++++ zshrc | 1 + 8 files changed, 270 insertions(+), 41 deletions(-) create mode 100755 script/spectrwm-bar.sh create mode 100644 spectrwm.conf diff --git a/config/i3/config b/config/i3/config index 632dba0..23d1eca 100644 --- a/config/i3/config +++ b/config/i3/config @@ -95,7 +95,6 @@ assign [title="KeePassXC"] $ws7 for_window [class="(?i)mousepad"] floating enable for_window [class="(?i)lxappearance|qt5ct"] floating enable for_window [class="(?i)nitrogen"] floating enable -for_window [class="(?i)virtualbox"] floating enable #focus_on_window_activation focus ############## Gaps ############### diff --git a/config/nvim/init.vim b/config/nvim/init.vim index a926bc2..439fba3 100644 --- a/config/nvim/init.vim +++ b/config/nvim/init.vim @@ -20,11 +20,9 @@ call plug#begin('~/.vim/plugged') Plug 'pearofducks/ansible-vim', { 'for': 'ansible' } Plug 'PotatoesMaster/i3-vim-syntax', { 'for': 'i3' } Plug 'kovetskiy/sxhkd-vim', { 'for': 'sxhkd' } - Plug 'vim-python/python-syntax', { 'for': 'python' } Plug 'mattn/emmet-vim', { 'on': 'Emmet' } Plug 'cakebaker/scss-syntax.vim', { 'for': 'scss' } Plug 'dag/vim-fish', { 'for': 'fish' } - Plug 'ocaml/vim-ocaml', { 'for': 'ocaml' } Plug 'plasticboy/vim-markdown', { 'for': 'markdown' } Plug 'ap/vim-css-color' call plug#end() diff --git a/config/qtile/config.py b/config/qtile/config.py index 1fb5b47..6b5cdb8 100644 --- a/config/qtile/config.py +++ b/config/qtile/config.py @@ -7,9 +7,12 @@ import os mod = "mod4" alt = "mod1" + terminal = "kitty" browser = "firefox" +filemanager="pcmanfm" user = "sasha" + color = [ "#FFFFFF", # 0. Text color "#CED4DA", # 1. Unfocus color @@ -37,6 +40,10 @@ keys = [ lazy.spawn(browser), desc="Launch browser" ), + Key([mod], "F4", + lazy.spawn(filemanager), + desc="Launch filemanager" + ), Key([mod, alt], "t", lazy.spawn(f"{terminal} -e \"nvim /home/{user}/.todo\""), desc="Open ~/.todo file in nvim" @@ -126,10 +133,14 @@ keys = [ desc="Mute volume" ), - # Menus(dmenu & rofi) + # Menus(dmenu or/and rofi) Key([mod, "shift"], "Return", - lazy.spawn("rofi -show drun -drun-display-format \"{name}\""), - desc="(Rofi) Program launcher" + lazy.spawn("j4-dmenu-desktop --dmenu=\"dmenu -h 24 -p Run\""), + desc="(j4-dmenu) Program launcher" + ), + Key([mod, "shift"], "apostrophe", + lazy.spawn("dmenu_run -h 24 -p Run"), + desc="(Dmenu) Program launcher" ), Key([mod],"Escape", lazy.spawn(f"/home/{user}/.script/dmenu/dmenu-power.sh"), @@ -170,15 +181,15 @@ keys = [ ] # Workspaces name, keys -group_names = [("term", {'layout': 'monadtall'}), - ("www", {'layout': 'max'}), - ("dev", {'layout': 'monadtall'}), - ("sys", {'layout': 'monadtall'}), - ("doc", {'layout': 'monadtall'}), - ("chat", {'layout': 'monadtall'}), - ("pass", {'layout': 'monadtall'}), - ("mus", {'layout': 'max'}), - ("flo", {'layout': 'monadtall'}) +group_names = [("term", {"layout": "monadtall"}), + ("www", {"layout": "max"}), + ("dev", {"layout": "monadtall"}), + ("sys", {"layout": "monadtall"}), + ("doc", {"layout": "monadtall"}), + ("chat", {"layout": "monadtall"}), + ("pass", {"layout": "monadtall"}), + ("mus", {"layout": "max"}), + ("flo", {"layout": "monadtall"}) ] groups = [Group(name, **kwargs) for name, kwargs in group_names] for i, (name, kwargs) in enumerate(group_names, 1): @@ -187,7 +198,7 @@ for i, (name, kwargs) in enumerate(group_names, 1): # Window layout(s) layout_theme = { - "border_width": 1, + "border_width": 2, "margin": 3, "border_focus": color[2], "border_normal": color[1], @@ -211,7 +222,7 @@ layouts = [ # Panel widget_defaults = dict( - font='Jatbrains Mono', + font="Jatbrains Mono", fontsize=12, padding=5, foreground=color[0], @@ -234,7 +245,7 @@ screens = [Screen(top=bar.Bar([ widget.WindowName(foreground=color[0]), widget.KeyboardKbdd( foreground=color[5], - configured_keyboards=['us', 'ru', 'ua'], + configured_keyboards=["us", "ru", "ua"], update_interval=0, fmt=" {}", ), @@ -247,12 +258,12 @@ screens = [Screen(top=bar.Bar([ ), widget.Net( interface="wlp3s0", - format='{down}↓↑{up}', + format="{down}↓↑{up}", foreground=color[7], ), widget.Systray(), widget.Clock( - format=' %H:%M', + format=" %H:%M", foreground=color[4] ), widget.Clock( @@ -275,20 +286,20 @@ follow_mouse_focus = True bring_front_click = False cursor_warp = False floating_layout = layout.Floating(float_rules=[ - {'wmclass': 'confirm'}, - {'wmclass': 'dialog'}, - {'wmclass': 'download'}, - {'wmclass': 'error'}, - {'wmclass': 'file_progress'}, - {'wmclass': 'notification'}, - {'wmclass': 'splash'}, - {'wmclass': 'toolbar'}, - {'wmclass': 'confirmreset'}, - {'wmclass': 'makebranch'}, - {'wmclass': 'maketag'}, - {'wname': 'branchdialog'}, - {'wname': 'pinentry'}, - {'wmclass': 'ssh-askpass'}, + {"wmclass": "confirm"}, + {"wmclass": "dialog"}, + {"wmclass": "download"}, + {"wmclass": "error"}, + {"wmclass": "file_progress"}, + {"wmclass": "notification"}, + {"wmclass": "splash"}, + {"wmclass": "toolbar"}, + {"wmclass": "confirmreset"}, + {"wmclass": "makebranch"}, + {"wmclass": "maketag"}, + {"wname": "branchdialog"}, + {"wname": "pinentry"}, + {"wmclass": "ssh-askpass"}, ]) auto_fullscreen = True focus_on_window_activation = "smart" diff --git a/script/dmenu/dmenu-config-edit.sh b/script/dmenu/dmenu-config-edit.sh index 916e87c..af5f6ae 100755 --- a/script/dmenu/dmenu-config-edit.sh +++ b/script/dmenu/dmenu-config-edit.sh @@ -3,6 +3,7 @@ declare options=("i3 berry qtile openbox +spectrwm polybar picom dunst @@ -40,18 +41,25 @@ case "$choice" in "menu") choice="$HOME/.config/openbox/menu.xml" ;; "reload") openbox --reconfigure && pkill kitty ;; esac + ;; + spectrwm) + why=$(echo -e "spectrwm.conf\nsectrwm-bar.sh"|dmenu -p Spectrwm $@) + case "$why" in + "spectrwm.conf") choice="$HOME/.spectrwm.conf" ;; + "spectrwm-bar.sh") choice="$HOME/.script/spectrwm-bar.sh" ;; + esac ;; picom) choice="$HOME/.config/picom.conf" ;; polybar) choice="$HOME/.config/polybar/config" ;; qutebrowser) - why=$(echo -e "config.py\nquickmarks" | dmenu -p 'Qutebrowser') + why=$(echo -e "config.py\nquickmarks"|dmenu -p 'Qutebrowser' $@) case "$why" in "config.py") choice="$HOME/.config/qutebrowser/config.py" ;; "quickmarks") choice="$HOME/.config/qutebrowser/quickmarks" ;; esac ;; ranger) - why=$(echo -e "rc.conf\nrifle.conf") + why=$(echo -e "rc.conf\nrifle.conf"|dmenu -p 'Ranger' $@) case "$why" in "rc.conf") choice="$HOME/.config/ranger/rc.conf" ;; "rifle.conf") choice="$HOME/.config/ranger/rifle.conf" ;; @@ -66,7 +74,7 @@ case "$choice" in ;; tmux) choice="$HOME/.tmux.conf" ;; term) - why=$(echo -e "kitty\nalacritty"|demnu -p "Term" $@) + why=$(echo -e "kitty\nalacritty"|dmenu -p Term $@) case "$why" in kitty) choice="$HOME/.config/kitty/kitty.conf" ;; alacritty) choice="$hoME/.config/alacritty/alacritty.yml" ;; diff --git a/script/dmenu/dmenu-power.sh b/script/dmenu/dmenu-power.sh index b10d9dc..2b4c777 100755 --- a/script/dmenu/dmenu-power.sh +++ b/script/dmenu/dmenu-power.sh @@ -1,5 +1,4 @@ #!/bin/sh - declare options=("Shut Down Reboot Logout @@ -7,7 +6,6 @@ Suspend Lock Screen") choice=$(echo -e "${options[@]}" | dmenu -p 'Power' $@) - case "$choice" in "Shut Down") declare opt=("Yes\nNo") @@ -27,9 +25,15 @@ case "$choice" in ;; "Logout") declare opt=("Yes\nNo") - yesno=$(echo -e "${opt[@]}" | dmenu -p 'Power' $@) + yesno=$(echo -e "${opt[@]}" | dmenu -p 'Logout' $@) case "$yesno" in - "Yes") exec loginctl terminate-session $XDG_SESSION_ID ;; + "Yes") + if [[ "$(pgrep spectrwm)" ]]; then + exec pkill spectrwm + else + exec loginctl terminate-session $XDG_SESSION_ID + fi + ;; "No") exec exit 0 ;; esac ;; diff --git a/script/spectrwm-bar.sh b/script/spectrwm-bar.sh new file mode 100755 index 0000000..4d1866f --- /dev/null +++ b/script/spectrwm-bar.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +## WIFI SIGNAL +wifi() { + wifis=$(cat /proc/net/wireless | grep "wlp3s0" | awk '{print $4}' | grep -o '[0-9]*') + echo -e " $wifis%" +} + +## RAM +mem() { + mem=`free | awk '/Mem/ {printf "%dM/%dM\n", $3 / 1024.0, $2 / 1024.0 }'` + echo -e "$mem" +} + +## VOLUME +vol() { + vol=`amixer get Master | awk -F'[][]' 'END{ print $4":"$2 }' | sed 's/on://g'` + echo -e " $vol" +} + + +## KEYBOARD +keyl() { + case "$(xkblayout)" in + Eng) date="us";; + Rus) date="ru";; + Ukr) date="ua";; + esac + echo -e " $date" +} + + +SLEEP_SEC=0 +while :; do + echo "+@fg=2;$(keyl) +@fg=0; +@fg=3;$(vol) +@fg=0; +@fg=4;$(wifi) +@fg=0;" + sleep $SLEEP_SEC +done + diff --git a/spectrwm.conf b/spectrwm.conf new file mode 100644 index 0000000..8182d72 --- /dev/null +++ b/spectrwm.conf @@ -0,0 +1,170 @@ +modkey = Mod4 + +# Autostart +autorun = ws[1]:setxkbmap "us,ru,ua" ",winkeys" "grp:alt_shift_toggle" -option "ctrl:nocaps" +autorun = ws[1]:nitrogen --restore +autorun = ws[1]:picom -b + +# Program +program[term] = kitty +program[browser] = firefox +program[dmenu] = dmenu_run -h 18 -p Run +program[menu] = j4-dmenu-desktop --dmenu="dmenu -h 18 -p Run" +program[edit-config] = ~/.script/dmenu/dmenu-config-edit.sh -h 18 +program[power-menu] = ~/.script/dmenu/dmenu-power.sh -h 18 +program[passmenu] = passmenu -h 18 -p Password +program[filemanager] = pcmanfm +program[codeeditor] = gnvim + +# User keybindings +bind[term] = MOD+Return +bind[menu] = MOD+Shift+Return +bind[dmenu] = MOD+Shift+apostrophe +bind[browser] = MOD+F2 +bind[codeeditor] = MOD+F3 +bind[filemanager] = MOD+F4 +bind[edit-config] = MOD+Control+U +bind[passmenu] = MOD+Control+i +bind[power-menu] = MOD+Escape + + +# Volume keys +program[volumeplus] = pulseaudio-ctl up +program[volumeminu] = pulseaudio-ctl down +program[volumemute] = pulseaudio-ctl mute +bind[volumeplus] = MOD+equal +bind[volumeminu] = MOD+minus +bind[volumemute] = MOD+Shift+minus + +# Workspace +workspace_limit = 9 +focus_mode = follow +focus_close = last +focus_close_wrap = 1 +focus_default = first +spawn_position = next +workspace_clamp = 0 +warp_focus = 1 +warp_pointer = 1 + +name = ws[1]:term +name = ws[2]:www +name = ws[3]:dev +name = ws[4]:sys +name = ws[5]:doc +name = ws[6]:chat +name = ws[7]:pass +name = ws[8]:mus +name = ws[9]:flo + +# Window Decoration +border_width = 2 +color_focus = rgb:00/8D/CD +color_focus_maximized = rgb:00/8D/CD +color_unfocus = rgb:CE/D4/DA +color_unfocus_maximized = rgb:CE/D4/DA +region_padding = 0 +tile_gap = 0 + +# Bar Settings +bar_action = ~/.script/spectrwm-bar.sh +bar_delay = 0 +bar_action_expand = 1 +bar_enabled = 1 +bar_border_width = 0 +bar_border[1] = rgb:28/2A/36 +bar_border_unfocus[1] = rgb:CE/D4/DA +bar_color[1] = rgb:26/2A/2B +bar_color_selected[1] = rgb:00/80/80 +bar_font_color[1] = rgb:FF/FF/FF, rgb:CE/D4/DA, rgb:C6/78/DD, rgb:FF/6C/6B, rgb:EC/BE/7B, rgb:51/AF/EF +bar_font_color_selected = black +bar_font = Jatbrains Mono:size=12, FontAwesome +bar_font_pua = FontAwesome +bar_format = +|L+1<+I +D +@fg=1;+W +|R+A+1<+@fg=5;  %d.%m.%y  %R +workspace_indicator = listactive,markcurrent +bar_justify = center +stack_enabled = 1 +iconic_enabled = 1 +window_class_enabled = 1 +window_instance_enabled = 1 +window_name_enabled = 1 +verbose_layout = 1 +urgent_enabled = 1 + +# Window keys +bind[width_grow] = MOD+Control+l +bind[width_shrink] = MOD+Control+h +bind[height_grow] = MOD+Control+j +bind[height_shrink] = MOD+Control+k +bind[master_grow] = MOD+Control+l +bind[master_shrink] = MOD+Control+h +#bind[swap_next] = MOD+Shift+j +#bind[swap_prev] = MOD+Shift+k + +# WM keys +bind[wind_kill] = MOD+q +bind[restart] = MOD+Control+r +bind[cycle_layout] = MOD+space +bind[float_toggle] = MOD+t +bind[focus_main] = MOD+m +bind[focus_next] = MOD+j +bind[focus_next] = MOD+Tab +bind[focus_prev] = MOD+k +bind[focus_urgent] = MOD+u +bind[iconify] = MOD+w +bind[initscr] = MOD+Shift+i +bind[master_add] = MOD+Shift+comma +bind[master_del] = MOD+Shift+period +bind[ws_1] = MOD+1 +bind[ws_2] = MOD+2 +bind[ws_3] = MOD+3 +bind[ws_4] = MOD+4 +bind[ws_5] = MOD+5 +bind[ws_6] = MOD+6 +bind[ws_7] = MOD+7 +bind[ws_8] = MOD+8 +bind[ws_9] = MOD+9 +bind[mvws_1] = MOD+Shift+1 +bind[mvws_2] = MOD+Shift+2 +bind[mvws_3] = MOD+Shift+3 +bind[mvws_4] = MOD+Shift+4 +bind[mvws_5] = MOD+Shift+5 +bind[mvws_6] = MOD+Shift+6 +bind[mvws_7] = MOD+Shift+7 +bind[mvws_8] = MOD+Shift+8 +bind[mvws_9] = MOD+Shift+9 + +# Unbind +bind[] = MOD+x +bind[] = MOD+p +bind[] = MOD+w +bind[] = MOD+Down +bind[] = MOD+Left +bind[] = MOD+Right +bind[] = MOD+Up +bind[] = MOD+Shift+Right +bind[] = MOD+Shift+Left +bind[] = MOD+Shift+Down +bind[] = MOD+Shift+Up +bind[] = MOD+v +bind[] = MOD+Shift+v +bind[] = MOD+Shift+w +bind[] = MOD+Shift+backslash +bind[] = MOD+s +bind[] = MOD+Shift+s +bind[] = MOD+f +bind[] = MOD+Shift+period +bind[] = MOD+Shift+End +bind[] = MOD+Shift+Down +bind[] = MOD+Shift+Next +bind[] = MOD+Shift+Left +bind[] = MOD+Shift+Begin +bind[] = MOD+Shift+Right +bind[] = MOD+Shift+Home +bind[] = MOD+Shift+Up +bind[] = MOD+Shift+Prior +bind[] = MOD+Shift+j +bind[] = MOD+Shift+l +bind[] = MOD+Shift+h +bind[] = MOD+Shift+k +bind[] = MOD+e diff --git a/zshrc b/zshrc index ee3d38a..f0d0cfc 100644 --- a/zshrc +++ b/zshrc @@ -29,6 +29,7 @@ export VISUAL="nvim" alias cls="clear" alias :q="exit" alias tmux="tmux -2" +alias icat="kitty +kitten icat" alias ..="cd .." alias ...="cd ../.."