feat: hypr, neomutt, newsboat, pass

This commit is contained in:
ange 2024-02-02 22:58:07 +01:00
parent 82ebb9bc4b
commit 908d26dc96
Signed by: ange
GPG Key ID: 9E0C4157BB7BEB1D
55 changed files with 568 additions and 558 deletions

View File

@ -1,9 +1,9 @@
output HDMI-A-0
mode 1920x1080
pos 0x0
primary
rate 60.00
output eDP
mode 1920x1080
pos 1920x0
primary
rate 60.00
output HDMI-A-0
mode 1920x1080
pos 0x0
rate 60.00

View File

@ -1,2 +1,2 @@
HDMI-A-0 00ffffffffffff000472ff0275d130442b18010380351e78ca9265a655559f280d5054bfef80714f8140818081c081009500b300d1c0023a801871382d40582c4500132b2100001e000000fd00374c1e5011000a202020202020000000fc0047323436484c0a202020202020000000ff004c57414545303138383536380a014d020324f14f01020304050607901112131415161f230907078301000067030c001000382d023a801871382d40582c4500132b2100001f011d8018711c1620582c2500132b2100009f011d007251d01e206e285500132b2100001e8c0ad08a20e02d10103e9600132b21000018000000000000000000000000000000000000007e
HDMI-A-0 00ffffffffffff004c2d200d34415743191e010380341d782a9315a655519c27115054bfef80714f81c0810081809500a9c0b3000101023a801871382d40582c450009252100001e000000fd00324b1e5111000a202020202020000000fc00533234463335300a2020202020000000ff0048345a4e3630323031370a20200114020311b14690041f13120365030c001000011d00bc52d01e20b828554009252100001e8c0ad090204031200c4055000925210000188c0ad08a20e02d10103e9600092521000018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000051
eDP 00ffffffffffff0009e5d50800000000231d0104a5221378030b95935c59932a20505400000001010101010101010101010101010101043a803671381e403020360058c21000001a000000000000000000000000000000000000000000fe00424f452043510a202020202020000000fe004e5431353646484d2d4e34330a000e

View File

@ -1,9 +0,0 @@
output eDP
mode 1920x1080
pos 0x0
primary
rate 60.00
output HDMI-A-0
mode 1920x1080
pos 1920x0
rate 60.00

View File

@ -1,2 +0,0 @@
HDMI-A-0 00ffffffffffff004c2d200d34415743191e010380341d782a9315a655519c27115054bfef80714f81c0810081809500a9c0b3000101023a801871382d40582c450009252100001e000000fd00324b1e5111000a202020202020000000fc00533234463335300a2020202020000000ff0048345a4e3630323031370a20200114020311b14690041f13120365030c001000011d00bc52d01e20b828554009252100001e8c0ad090204031200c4055000925210000188c0ad08a20e02d10103e9600092521000018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000051
eDP 00ffffffffffff0009e5d50800000000231d0104a5221378030b95935c59932a20505400000001010101010101010101010101010101043a803671381e403020360058c21000001a000000000000000000000000000000000000000000fe00424f452043510a202020202020000000fe004e5431353646484d2d4e34330a000e

View File

@ -1,13 +1,11 @@
[commit]
gpgsign = true
[user]
email = ange@duhayon.com
email = ange@yw5n.com
name = ange
[credential]
helper = store
[diff]
tool = nvimdiff
[difftool "nvimdiff"]
cmd = nvim -d -c \"wincmd l\" \"$LOCAL\" \"$REMOTE\"
[init]
defaultBranch = main
[commit]
gpgsign = true

150
.config/hypr/hyprland.conf Normal file
View File

@ -0,0 +1,150 @@
# See https://wiki.hyprland.org/Configuring/
# See https://wiki.hyprland.org/Configuring/Monitors/
monitor=eDP, 1920x1080, 0x0, auto
monitor=HDMI-A-0, 1920x1080, 1920x0, auto
monitor=, preferred, auto, 1 # new monitors on the right
# See https://wiki.hyprland.org/Configuring/Keywords/
# Execute your favorite apps at launch
# exec-once = waybar & hyprpaper & firefox
# Source a file (multi-file configs)
# source = ~/.config/hypr/myColors.conf
# Set programs that you use
$terminal = alacritty
$fileManager = pcmanfm
$menu = dmenu_run
# Some default env vars.
env = MOZ_ENABLE_WAYLAND,1
# For all categories, see https://wiki.hyprland.org/Configuring/Variables/
input {
# See https://wiki.hyprland.org/Configuring/Variables/#input
kb_layout = us
kb_variant = altgr-intl
accel_profile = flat
follow_mouse = 1
touchpad {
accel_profile = adaptative
clickfinger_behavior = true
natural_scroll = true
}
}
general {
# See https://wiki.hyprland.org/Configuring/Variables/#general
gaps_in = 5
gaps_out = 20
border_size = 2
col.active_border = rgba(33ccffee) rgba(00ff99ee) 45deg
col.inactive_border = rgba(595959aa)
layout = master
# See https://wiki.hyprland.org/Configuring/Tearing/
allow_tearing = false
}
decoration {
# See https://wiki.hyprland.org/Configuring/Variables/#decoration
rounding = 10
blur {
enabled = true
size = 3
passes = 1
vibrancy = 0.1696
}
drop_shadow = true
shadow_range = 4
shadow_render_power = 3
col.shadow = rgba(1a1a1aee)
}
animations {
enabled = true
# See https://wiki.hyprland.org/Configuring/Animations/
bezier = myBezier, 0.05, 0.9, 0.1, 1.05
animation = windows, 1, 7, myBezier
animation = windowsOut, 1, 7, default, popin 80%
animation = border, 1, 10, default
animation = borderangle, 1, 8, default
animation = fade, 1, 7, default
animation = workspaces, 1, 6, default
}
master {
# See https://wiki.hyprland.org/Configuring/Master-Layout/
new_is_master = true
mfact = 0.5
}
gestures {
# See https://wiki.hyprland.org/Configuring/Variables/#gestures
workspace_swipe = false
}
misc {
# See https://wiki.hyprland.org/Configuring/Variables/#misc
force_default_wallpaper = 0
}
# See https://wiki.hyprland.org/Configuring/Window-Rules/
windowrulev2 = nomaximizerequest, class:.* # You'll probably like this.
# See https://wiki.hyprland.org/Configuring/Keywords/
$mainMod = SUPER
# See https://wiki.hyprland.org/Configuring/Binds/
bind = $mainMod, Q, exec, $terminal
bind = $mainMod, C, killactive,
bind = $mainMod, M, exit,
bind = $mainMod, E, exec, $fileManager
bind = $mainMod, V, togglefloating,
bind = $mainMod, R, exec, $menu
# Move focus with mainMod + hjkl
bind = $mainMod, l, movefocus, l
bind = $mainMod, h, movefocus, r
bind = $mainMod, k, movefocus, u
bind = $mainMod, j, movefocus, d
# Switch workspaces with mainMod + [0-9]
bind = $mainMod, 1, workspace, 1
bind = $mainMod, 2, workspace, 2
bind = $mainMod, 3, workspace, 3
bind = $mainMod, 4, workspace, 4
bind = $mainMod, 5, workspace, 5
bind = $mainMod, 6, workspace, 6
bind = $mainMod, 7, workspace, 7
bind = $mainMod, 8, workspace, 8
bind = $mainMod, 9, workspace, 9
bind = $mainMod, 0, workspace, 10
# Move active window to a workspace with mainMod + SHIFT + [1-9]
bind = $mainMod SHIFT, 1, movetoworkspace, 1
bind = $mainMod SHIFT, 2, movetoworkspace, 2
bind = $mainMod SHIFT, 3, movetoworkspace, 3
bind = $mainMod SHIFT, 4, movetoworkspace, 4
bind = $mainMod SHIFT, 5, movetoworkspace, 5
bind = $mainMod SHIFT, 6, movetoworkspace, 6
bind = $mainMod SHIFT, 7, movetoworkspace, 7
bind = $mainMod SHIFT, 8, movetoworkspace, 8
bind = $mainMod SHIFT, 9, movetoworkspace, 9
# Move/resize windows with mainMod + LMB/RMB and dragging
bindm = $mainMod, mouse:272, movewindow
bindm = $mainMod, mouse:273, resizewindow

View File

@ -0,0 +1,14 @@
source global
set imap_user = 'ange@duhayon.com'
set folder = "~/.mail/$imap_user"
set spoolfile = '+INBOX'
set postponed = '+Drafts'
set record = '+Sent'
set trash = '+Deleted Items'
set smtp_url = "smtps://$imap_user@ssl0.ovh.net"
set smtp_pass = "`pass show email/$imap_user`"
set from = "$imap_user"
# vim: ft=neomuttrc

View File

@ -0,0 +1,14 @@
source global
set imap_user = 'ange@yw5n.com'
set folder = "~/.mail/$imap_user"
set spoolfile = '+INBOX'
set postponed = '+Drafts'
set record = '+Sent'
set trash = '+Trash'
set smtp_url = "smtps://$imap_user@ssl0.ovh.net"
set smtp_pass = "`pass show email/$imap_user`"
set from = "$imap_user"
# vim: ft=neomuttrc

5
.config/neomutt/global Normal file
View File

@ -0,0 +1,5 @@
set mailcap_path = "$XDG_CONFIG_HOME/neomutt/mailcap"
auto_view text/html
set realname = 'Ange DUHAYON'
set signature = "$XDG_CONFIG_HOME/neomutt/signature.txt"

1
.config/neomutt/mailcap Normal file
View File

@ -0,0 +1 @@
text/html; lynx -assume_charset=%{charset} -display_charset=utf-8 -collapse_br_tags -dump %s; nametemplate=%s.html; copiousoutput

View File

@ -0,0 +1 @@
Ange DUHAYON

7
.config/newsboat/config Normal file
View File

@ -0,0 +1,7 @@
refresh-on-startup yes
reload-threads 8
feed-sort-order unreadarticlecount-asc
article-sort-order date-asc
run-on-startup goto-title "Unread" ; open

29
.config/newsboat/urls Normal file
View File

@ -0,0 +1,29 @@
https://github.com/LizardByte/Sunshine/releases.atom Updates
https://github.com/Prowlarr/Prowlarr/releases.atom Updates
https://github.com/Radarr/Radarr/releases.atom Updates
https://github.com/Readarr/Readarr/releases.atom Updates
https://github.com/Sonarr/Sonarr/tags.atom Updates
https://github.com/element-hq/synapse/releases.atom Updates
https://github.com/go-gitea/gitea/releases.atom Updates
https://github.com/jellyfin/jellyfin/releases.atom Updates
https://github.com/kubernetes/kubernetes/releases.atom Updates
https://github.com/modoboa/modoboa/releases.atom Updates
https://github.com/morpheus65535/bazarr/releases.atom Updates
https://github.com/nextcloud/server/releases.atom Updates
https://github.com/qbittorrent/qBittorrent/tags.atom Updates
https://github.com/searxng/searxng/commits/master.atom Updates
https://github.com/vector-im/element-web/releases.atom Updates
https://www.getmonero.org/feed.xml Updates
https://www.youtube.com/feeds/videos.xml?channel_id=UCI4W-ck8ZLA_YljxMhlpg2g Entertainment
https://www.youtube.com/feeds/videos.xml?channel_id=UCRlEFn0L2G_DktbyvN0AZ5A Entertainment
https://www.youtube.com/feeds/videos.xml?channel_id=UCkOSNfdRmKcg4sHHcfrpOcQ Entertainment
https://www.youtube.com/feeds/videos.xml?channel_id=UCto7D1L-MiRoOziCXK9uT5Q Entertainment
https://archlinux.org/feeds/news/ Linux
https://odysee.com/$/rss/@AlphaNerd:8 Linux
https://odysee.com/$/rss/@BrodieRobertson:5 Linux
https://www.debian.org/News/news Linux
https://www.youtube.com/feeds/videos.xml?channel_id=UC5UAwBUum7CPN5buc-_N1Fw Linux
"query:Unread:unread = \"yes\""

@ -1 +1 @@
Subproject commit c5476a091b0f1b4e853db91c91ff941f848a1cdd
Subproject commit 1230aaf2a427b2c5b73aba6e4a9a5881d3e69429

@ -1 +1 @@
Subproject commit 55d9fe89e33efd26f532ef20223e5f9430c8b0c0
Subproject commit 4f71c0c4a196ceb656c824a70792f3df3ce6bb6d

@ -1 +1 @@
Subproject commit 983460fb8cd864748311f4c7f0c8337091f24d59
Subproject commit 7b5c5f56a21e82fdcfe5b250278b8dfc4b1cbab4

@ -1 +1 @@
Subproject commit 0da349ed303bea955942f409d29059cdb89dbe2c
Subproject commit 1cda98132abfde758c1778096960f9b2c0bd78c1

View File

@ -107,7 +107,7 @@ fade-out-step = 0.03;
# Opacity of window titlebars and borders. (0.1 - 1.0, disabled by default)
# frame-opacity = 1.0
#frame-opacity = 0.7;
#frame-opacity = 0.9;
# Let inactive opacity set by -i override the '_NET_WM_WINDOW_OPACITY' values of windows.
# inactive-opacity-override = true
@ -298,7 +298,7 @@ detect-transient = true;
# practically happened) and may not work with blur-background.
# My tests show a 15% performance boost. Recommended.
#
# glx-no-stencil = false
glx-no-stencil = true;
# GLX backend: Avoid rebinding pixmap on window damage.
# Probably could improve performance on rapid window content changes,

View File

@ -68,6 +68,11 @@ static const char *nextcmd[] = { "playerctl", "next", NULL };
static const char *stopcmd[] = { "playerctl", "stop", NULL };
static const char *lbrtcmd[] = { "set-light", "-10", NULL };
static const char *rbrtcmd[] = { "set-light", "+10", NULL };
static const char *passselectcmd[] = { "passselect", NULL };
static const char *passopencmd[] = { "passopen", NULL };
static const char *passusercmd[] = { "passuser", NULL };
static const char *passpasscmd[] = { "passpass", NULL };
static const char *passotpcmd[] = { "passotp", NULL };
static const Key keys[] = {
/* modifier key function argument */
@ -90,7 +95,12 @@ static const Key keys[] = {
{ 0, XF86XK_AudioStop, spawn, {.v = stopcmd } },
{ 0, XF86XK_MonBrightnessDown, spawn, {.v = lbrtcmd } },
{ 0, XF86XK_MonBrightnessUp, spawn, {.v = rbrtcmd } },
{ 0, XF86XK_Calculator, spawn, {.v = calccmd} },
{ 0, XF86XK_Calculator, spawn, {.v = calccmd } },
{ MODKEY, XK_p, spawn, {.v = passselectcmd } },
{ MODKEY|ShiftMask, XK_p, spawn, {.v = passopencmd } },
{ MODKEY, XK_u, spawn, {.v = passusercmd } },
{ MODKEY, XK_i, spawn, {.v = passpasscmd } },
{ MODKEY, XK_o, spawn, {.v = passotpcmd } },
{ MODKEY, XK_j, focusstack, {.i = +1 } },
{ MODKEY, XK_k, focusstack, {.i = -1 } },
{ MODKEY|ShiftMask, XK_z, zoom, {0} },

View File

@ -88,6 +88,7 @@ struct Client {
char name[256];
float mina, maxa;
int x, y, w, h;
int sfx, sfy, sfw, sfh; /* stored float geometry, used on mode revert */
int oldx, oldy, oldw, oldh;
int basew, baseh, incw, inch, maxw, maxh, minw, minh, hintsvalid;
int bw, oldbw;
@ -825,6 +826,8 @@ focusmon(const Arg *arg)
unfocus(selmon->sel, 0);
selmon = m;
focus(NULL);
XWarpPointer(dpy, None, root, 0, 0, 0, 0, selmon->wx + selmon->ww / 2,
selmon->wy + selmon->wh / 2);
}
void
@ -1050,6 +1053,10 @@ manage(Window w, XWindowAttributes *wa)
updatewindowtype(c);
updatesizehints(c);
updatewmhints(c);
c->sfx = c->x;
c->sfy = c->y;
c->sfw = c->w;
c->sfh = c->h;
XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask);
grabbuttons(c, 0);
if (!c->isfloating)
@ -1316,8 +1323,13 @@ resizemouse(const Arg *arg)
&& c->mon->wy + nh >= selmon->wy && c->mon->wy + nh <= selmon->wy + selmon->wh)
{
if (!c->isfloating && selmon->lt[selmon->sellt]->arrange
&& (abs(nw - c->w) > snap || abs(nh - c->h) > snap))
&& (abs(nw - c->w) > snap || abs(nh - c->h) > snap)) {
c->sfx = c->x;
c->sfy = c->y;
c->sfw = c->w;
c->sfh = c->h;
togglefloating(NULL);
}
}
if (!selmon->lt[selmon->sellt]->arrange || c->isfloating)
resize(c, c->x, c->y, nw, nh, 1);
@ -1700,8 +1712,14 @@ togglefloating(const Arg *arg)
return;
selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed;
if (selmon->sel->isfloating)
resize(selmon->sel, selmon->sel->x, selmon->sel->y,
selmon->sel->w, selmon->sel->h, 0);
resize(selmon->sel, selmon->sel->sfx, selmon->sel->sfy,
selmon->sel->sfw, selmon->sel->sfh, 0);
else { /* save last known float dimensions */
selmon->sel->sfx = selmon->sel->x;
selmon->sel->sfy = selmon->sel->y;
selmon->sel->sfw = selmon->sel->w;
selmon->sel->sfh = selmon->sel->h;
}
arrange(selmon);
}

View File

@ -0,0 +1,55 @@
diff --git a/dwm.c b/dwm.c
index e5efb6a..3c9b734 100644
--- a/dwm.c
+++ b/dwm.c
@@ -88,6 +88,7 @@ struct Client {
char name[256];
float mina, maxa;
int x, y, w, h;
+ int sfx, sfy, sfw, sfh; /* stored float geometry, used on mode revert */
int oldx, oldy, oldw, oldh;
int basew, baseh, incw, inch, maxw, maxh, minw, minh, hintsvalid;
int bw, oldbw;
@@ -1059,6 +1060,10 @@ manage(Window w, XWindowAttributes *wa)
updatewindowtype(c);
updatesizehints(c);
updatewmhints(c);
+ c->sfx = c->x;
+ c->sfy = c->y;
+ c->sfw = c->w;
+ c->sfh = c->h;
XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask);
grabbuttons(c, 0);
if (!c->isfloating)
@@ -1327,8 +1332,13 @@ resizemouse(const Arg *arg)
&& c->mon->wy + nh >= selmon->wy && c->mon->wy + nh <= selmon->wy + selmon->wh)
{
if (!c->isfloating && selmon->lt[selmon->sellt]->arrange
- && (abs(nw - c->w) > snap || abs(nh - c->h) > snap))
+ && (abs(nw - c->w) > snap || abs(nh - c->h) > snap)) {
+ c->sfx = c->x;
+ c->sfy = c->y;
+ c->sfw = c->w;
+ c->sfh = c->h;
togglefloating(NULL);
+ }
}
if (!selmon->lt[selmon->sellt]->arrange || c->isfloating)
resize(c, c->x, c->y, nw, nh, 1);
@@ -1712,8 +1722,14 @@ togglefloating(const Arg *arg)
return;
selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed;
if (selmon->sel->isfloating)
- resize(selmon->sel, selmon->sel->x, selmon->sel->y,
- selmon->sel->w, selmon->sel->h, 0);
+ resize(selmon->sel, selmon->sel->sfx, selmon->sel->sfy,
+ selmon->sel->sfw, selmon->sel->sfh, 0);
+ else { /* save last known float dimensions */
+ selmon->sel->sfx = selmon->sel->x;
+ selmon->sel->sfy = selmon->sel->y;
+ selmon->sel->sfw = selmon->sel->w;
+ selmon->sel->sfh = selmon->sel->h;
+ }
arrange(selmon);
}

View File

@ -0,0 +1,13 @@
diff --git a/dwm.c b/dwm.c
index e5efb6a..a126648 100644
--- a/dwm.c
+++ b/dwm.c
@@ -834,6 +834,8 @@ focusmon(const Arg *arg)
unfocus(selmon->sel, 0);
selmon = m;
focus(NULL);
+ XWarpPointer(dpy, None, root, 0, 0, 0, 0, selmon->wx + selmon->ww / 2,
+ selmon->wy + selmon->wh / 2);
}
void

View File

@ -0,0 +1,9 @@
[Unit]
Description=Mailbox synchronization service
[Service]
Type=oneshot
ExecStart=/usr/bin/mbsync -Va
[Install]
WantedBy=default.target

View File

@ -0,0 +1,9 @@
[Unit]
Description=Mailbox synchronization timer
[Timer]
OnCalendar=*:00/15
Unit=mbsync.service
[Install]
WantedBy=timers.target

View File

@ -0,0 +1 @@
../mbsync.timer

View File

@ -1,5 +1,4 @@
# Generated by Powerlevel10k configuration wizard on 2023-11-07 at 23:48 CET.
# Based on romkatv/powerlevel10k/config/p10k-lean.zsh, checksum 61526.
# Based on romkatv/powerlevel10k/config/p10k-lean.zsh, checksum cc6ed.
# Wizard options: awesome-fontconfig + powerline + python, large icons, unicode, lean,
# 1 line, compact, few icons, concise, instant_prompt=quiet.
# Type `p10k configure` to generate another config.
@ -157,7 +156,7 @@
# POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR=' ' below.
typeset -g POWERLEVEL9K_SHOW_RULER=false
typeset -g POWERLEVEL9K_RULER_CHAR='─' # reasonable alternative: '·'
typeset -g POWERLEVEL9K_RULER_FOREGROUND=242
typeset -g POWERLEVEL9K_RULER_FOREGROUND=240
# Filler between left and right prompt on the first prompt line. You can set it to '·' or '─'
# to make it easier to see the alignment between left and right prompt and to separate prompt
@ -168,7 +167,7 @@
typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR=' '
if [[ $POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR != ' ' ]]; then
# The color of the filler.
typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_FOREGROUND=242
typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_FOREGROUND=240
# Add a space between the end of left prompt and the filler.
typeset -g POWERLEVEL9K_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL=' '
# Add a space between the filler and the start of right prompt.
@ -1344,7 +1343,7 @@
#[ aws: aws profile (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html) ]#
# Show aws only when the command you are typing invokes one of these tools.
# Tip: Remove the next line to always show aws.
typeset -g POWERLEVEL9K_AWS_SHOW_ON_COMMAND='aws|awless|terraform|pulumi|terragrunt'
typeset -g POWERLEVEL9K_AWS_SHOW_ON_COMMAND='aws|awless|cdk|terraform|pulumi|terragrunt'
# POWERLEVEL9K_AWS_CLASSES is an array with even number of elements. The first element
# in each pair defines a pattern against which the current AWS profile gets matched.

View File

@ -1,6 +1,4 @@
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
gpgconf --launch gpg-agent
gpg-connect-agent updatestartuptty /bye
[ "$XDG_VTNR" = 1 ] && {
GUILOG="$HOME/.local/share/gui.log"

View File

@ -42,6 +42,8 @@ export LESS_TERMCAP_us="${fg_bold[green]}"
export LESS_TERMCAP_ue="${reset_color}"
export GROFF_NO_SGR=1
export GPG_TTY="$(tty)"
. <(dircolors)
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"

View File

@ -1,12 +1,17 @@
alias update='sudo pacman -Syu && flatpak update && config submodule update --remote --recursive --init'
function update() {
$TERM --hold -e "$SHELL" -c "sudo pacman -Syu && echo -e '\e[32mDONE\e[0m'" &
$TERM --hold -e "$SHELL" -c "flatpak update && echo -e '\e[32mDONE\e[0m'" &
$TERM --hold -e "$SHELL" -c "git --git-dir='$HOME/.dotfiles/' --work-tree='$HOME' submodule update --remote --recursive --init && echo -e '\e[32mDONE\e[0m'" &
}
alias pac='sudo pacman' \
vi='$EDITOR' \
qcp='qcp -o tabsize=4' \
qmv='qmv -o tabsize=4'
qmv='qmv -o tabsize=4' \
mutt='neomutt'
alias config='git --git-dir="$HOME/.dotfiles/" --work-tree="$HOME"' \
viconf='(cd "$XDG_CONFIG_HOME/nvim" && $EDITOR .)' \
wconf='(cd "$XDG_CONFIG_HOME/sway" && $EDITOR .)' \
zconf='(cd "$ZDOTDIR/" && $EDITOR .) && . "$ZDOTDIR/.zshrc"'
alias valgrind='epitest valgrind' \
@ -22,7 +27,21 @@ alias _='sudo ' \
xargs='xargs '
function j() {
local dests=("${(@f)$(find . -mount -name "$1*" -type d 2> /dev/null)}")
local cmd=(
find . -mount -name "$1*" -type d \
\! -path '*/.bzr/*' \
\! -path '*/.cache/*' \
\! -path '*/.git/*' \
\! -path '*/.hg/*' \
\! -path '*/.idea/*' \
\! -path '*/.svn/*' \
\! -path '*/.tox/*' \
\! -path '*/.venv/*' \
\! -path '*/.vscode/*' \
\! -path '*/CVS/*' \
\! -path '*/node_modules/*'
)
local dests=("${(@f)$(${cmd[@]} 2> /dev/null)}")
local dest="${dests:-$1}"
[ -n "${dests[2]}" ] && dest="$(printf '%s\n' "${dests[@]}" | fzf)"
@ -51,7 +70,8 @@ alias ls='ls --color=tty' \
alias diff='diff --color'
alias grep="grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn,.idea,.tox}" \
egrep="grep -E"
alias grep="grep --color=auto --exclude-dir={.bzr,.cache,.git,.hg,.idea,.svn,.tox,.venv,.vscode,CVS,node_modules}" \
egrep="grep -E" \
fgrep="grep -F"
# vim: ft=zsh

@ -1 +1 @@
Subproject commit cc6ed4be416b70fe4e3f97d17061c751abaca04f
Subproject commit 62341054d8aa40ade03fc55bdbc95b9ff2d8d2b6

View File

@ -1,2 +1 @@
enable-ssh-support
pinentry-program /usr/bin/pinentry-tty

View File

@ -1 +1 @@
8B64484EC42A914650DD8960BF3D9BBD9FE71327
D17DD274A8FC460888C038B2F84ACB3A562A3BA4

View File

View File

47
.mbsyncrc Normal file
View File

@ -0,0 +1,47 @@
#######################
### Global settings ###
#######################
Create Both
Expunge Both
SyncState *
#####################
### ange@yw5n.com ###
#####################
IMAPStore ange@yw5n.com-remote
SSLType IMAPS
CertificateFile /etc/ssl/certs/ca-certificates.crt
Host ssl0.ovh.net
User ange@yw5n.com
PassCmd "pass show email/ange@yw5n.com"
MaildirStore ange@yw5n.com-local
Path ~/.mail/ange@yw5n.com/
Inbox ~/.mail/ange@yw5n.com/INBOX/
SubFolders Verbatim
Channel ange@yw5n.com
Far :ange@yw5n.com-remote:
Near :ange@yw5n.com-local:
Patterns *
########################
### ange@duhayon.com ###
########################
IMAPStore ange@duhayon.com-remote
SSLType IMAPS
CertificateFile /etc/ssl/certs/ca-certificates.crt
Host ssl0.ovh.net
User ange@duhayon.com
PassCmd "pass show email/ange@duhayon.com"
MaildirStore ange@duhayon.com-local
Path ~/.mail/ange@duhayon.com/
Inbox ~/.mail/ange@duhayon.com/INBOX/
SubFolders Verbatim
Channel ange@duhayon.com
Far :ange@duhayon.com-remote:
Near :ange@duhayon.com-local:
Patterns *

View File

@ -1,4 +1,4 @@
user_pref("app.shield.optoutstudies.enabled", true);
user_pref("app.shield.optoutstudies.enabled", false);
user_pref("browser.aboutConfig.showWarning", false);
user_pref("browser.contentblocking.category", "strict");
user_pref("browser.download.useDownloadDir", false);
@ -27,11 +27,13 @@ user_pref("startup.homepage_override_url", "");
user_pref("startup.homepage_welcome_url", "");
user_pref("toolkit.legacyUserProfileCustomizations.stylesheets", true);
user_pref("toolkit.telemetry.archive.enabled", false);
user_pref("toolkit.telemetry.pioneer-new-studies-available", false);
// user preferences
user_pref("browser.startup.page", 3);
user_pref("browser.tabs.inTitlebar", 0);
user_pref("browser.toolbars.bookmarks.visibility", "newtab");
user_pref("browser.translations.enable", false);
user_pref("browser.uiCustomization.state", "{\"placements\":{\"widget-overflow-fixed-list\":[],\"unified-extensions-area\":[],\"nav-bar\":[\"back-button\",\"forward-button\",\"stop-reload-button\",\"urlbar-container\",\"downloads-button\",\"fxa-toolbar-menu-button\",\"unified-extensions-button\",\"ublock0_raymondhill_net-browser-action\"],\"toolbar-menubar\":[\"menubar-items\"],\"TabsToolbar\":[\"tabbrowser-tabs\",\"alltabs-button\"],\"PersonalToolbar\":[\"personal-bookmarks\"]},\"currentVersion\":20,\"newElementCount\":3}");
user_pref("browser.zoom.siteSpecific", false);
user_pref("media.autoplay.default", 5);

View File

@ -8,7 +8,6 @@ xss-lock -n screensaver -- lock &
/usr/libexec/polkit-gnome-authentication-agent-1 & # fedora
picom &
gammastep 2> /dev/null &
sbar.py &
"$HOME/keepass/keepassxc" &
sbar &
exec dbus-launch dwm

View File

@ -11,7 +11,6 @@ export SAVEHIST=8192
export HISTFILE="$XDG_STATE_HOME/zsh_history"
export ZDOTDIR="$XDG_CONFIG_HOME/zsh"
export ZSH_CUSTOM="$ZDOTDIR/custom"
export ZLE_RPROMPT_INDENT=0
export LESSHISTFILE='-'
export PYTHONPYCACHEPREFIX="$XDG_CACHE_HOME/python"

5
bin/arch Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash -e
CRI=(sudo docker)
"${CRI[@]}" run --rm -it -v "$PWD:/mnt/" -w /mnt/ docker.io/archlinux:latest

View File

@ -25,5 +25,6 @@ fi
-v /usr/share/fonts/:/usr/share/fonts/:ro \
-v "$PWD:$PWD" \
-w "$PWD" \
--ulimit nofile=8192:8192 \
docker.io/epitechcontent/epitest-docker:latest \
"$@"

View File

@ -1,3 +1 @@
#!/bin/bash
exec i3lock -ftni "$XDG_CONFIG_HOME/wallpapers/lock.png"
#!/usr/bin/env -Si3lock -ftni "${XDG_CONFIG_HOME}/wallpapers/lock.png"

3
bin/muttduhayon Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash -e
neomutt -F "${XDG_CONFIG_HOME}/neomutt/ange@duhayon.com" "$@"

3
bin/muttyw5n Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash -e
neomutt -F "${XDG_CONFIG_HOME}/neomutt/ange@yw5n.com" "$@"

3
bin/passinfo Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash -e
pass show "$(cat /tmp/passselect)" | less

3
bin/passopen Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash -e
xdg-open "$(pass "$(cat /tmp/passselect)" | sed -n 's/URL: //p')"

3
bin/passotp Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash -e
xdotool type --clearmodifiers --delay 0 "$(pass otp "$(cat /tmp/passselect)")"

3
bin/passpass Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash -e
xdotool type --clearmodifiers --delay 0 "$(pass "$(cat /tmp/passselect)" | head -n1 -)"

14
bin/passselect Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash -e
shopt -s nullglob globstar
prefix="${PASSWORD_STORE_DIR-"$HOME"/.password-store}"
password_files=("$prefix"/**/*.gpg)
password_files=("${password_files[@]#"$prefix"/}")
password_files=("${password_files[@]%.gpg}")
password_file=$(printf '%s\n' "${password_files[@]}" | dmenu "$@")
[ -n "$password_file" ] || exit
echo "$password_file" > /tmp/passselect

3
bin/passuser Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash -e
xdotool type --clearmodifiers --delay 0 "$(pass "$(cat /tmp/passselect)" | sed -n 's/Username: //p')"

114
bin/sbar
View File

@ -1,101 +1,105 @@
#!/bin/bash
# INIT
echo "$$" > "$HOME/.cache/pidofbar"
# MODULES
update_crypto() {
local c="$(crypto)"
[ -n c ] && crypto="$c |"
function update_crypto() {
local c; c="$(crypto)" && crypto="$c"
}
update_cpu() {
cpu=" $(grep -o "^[^ ]*" /proc/loadavg) |"
function update_cpu() {
cpu=" $(awk '{print $1}' /proc/loadavg)"
}
update_memory() {
memory=" $(free -h | sed -n '2s/\([^ ]* *\)\{2\}\([^ ]*\).*/\2/p') |"
function update_memory() {
memory=" $(free -h | awk '$1 == "Mem:" {print $3}')"
}
update_bat() {
local dir; dir="$(echo /sys/class/power_supply/BAT*/ | sort -n | tail -n1)"
function update_bat() {
local dir; dir="$(find /sys/class/power_supply/ -mindepth 1 -name 'BAT*' -print -quit)"
local cap; cap="$(cat "$dir/capacity")"
bat="$(grep -q Charging "$dir/status" && printf '' || printf '')"
bat="$bat $(cat "$dir/capacity")% |"
{ grep -qv Discharging "$dir/status" && bat=" $cap%"; } ||
{ [ "$cap" -gt 80 ] && bat=" $cap%"; } ||
{ [ "$cap" -gt 60 ] && bat=" $cap%"; } ||
{ [ "$cap" -gt 40 ] && bat=" $cap%"; } ||
{ [ "$cap" -gt 20 ] && bat=" $cap%"; } ||
{ bat=" $cap%"; }
}
update_vol() {
local v; v="$(wpctl get-volume '@DEFAULT_AUDIO_SINK@')"
function update_sink_vol() {
local sink; sink="$(wpctl get-volume '@DEFAULT_AUDIO_SINK@')"
local vol;
if grep -q 'MUTED' <<< "$v"; then
vol='🔇'
if grep -q 'MUTED' <<< "$sink"; then
sink_vol='🔇'
else
vol=" $((10#$(tr -dc '0-9' <<< "$v")))"
vol="$(awk '{print int($2 * 100)}' <<< "$sink")"
{ [ "$vol" -gt 67 ] && sink_vol=" $vol"; } ||
{ [ "$vol" -gt 33 ] && sink_vol=" $vol"; } ||
{ sink_vol=" $vol"; }
fi
vol="$vol |"
}
update_wlp() {
local sig; sig="$(grep wlp /proc/net/wireless | awk '{print $3 * 100}')"
local ssid; ssid="$(nmcli device wifi show-password | grep SSID | sed 's/SSID: //')"
function update_source_vol() {
local source; source="$(wpctl get-volume '@DEFAULT_AUDIO_SOURCE@')"
local vol;
if grep -q 'MUTED' <<< "$source"; then
source_vol=""
else
vol="$(awk '{print int($2 * 100)}' <<< "$sink")"
source_vol=" $(awk '{print int($2 * 100)}' <<< "$source")"
fi
}
function update_wlp() {
local sig; sig="$(awk '$1 ~ "wlp" {print int($3)}' /proc/net/wireless)"
local ssid; ssid="$(nmcli device wifi show-password | sed -n 's/SSID: //p')"
[ -z "$ssid" ] && wlp='⚠' && return
[ -z "$sig" ] && sig=0
# https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/blob/d9b06a95/src/libnmc-base/nm-client-utils.c#L628
{ [ "$sig" -gt 5600 ] && wlp="▂▄▆█ $ssid"; } ||
{ [ "$sig" -gt 3850 ] && wlp="▂▄▆_ $ssid"; } ||
{ [ "$sig" -gt 1650 ] && wlp="▂▄__ $ssid"; } ||
{ [ "$sig" -gt 275 ] && wlp="▂___ $ssid"; } ||
{ [ "$sig" -gt 56 ] && wlp="▂▄▆█ $ssid"; } ||
{ [ "$sig" -gt 38 ] && wlp="▂▄▆_ $ssid"; } ||
{ [ "$sig" -gt 21 ] && wlp="▂▄__ $ssid"; } ||
{ [ "$sig" -gt 3 ] && wlp="▂___ $ssid"; } ||
{ wlp="____ $ssid"; }
wlp="$wlp |"
}
update_time() {
function update_time() {
time="$(date "+%a %m/%d %R")"
}
# modules that don't update on their own need to be run at the start for getting their initial value
while [ -z "$(wpctl get-volume '@DEFAULT_AUDIO_SINK@' 2> /dev/null)" ]; do
sleep 1
done
update_vol
reload_bar() {
sec=0
function display() {
"${DISPLAYCMD[@]}" "$crypto | $cpu | $memory | $sink_vol $source_vol | $wlp | $bat | $time"
}
display() {
"${DISPLAYCMD[@]}" "$crypto $cpu $memory $vol $wlp $bat $time"
}
# SIGNALING
# trap '<function>;display' 'RTMIN+n'
trap 'reload_bar;display' 'RTMIN'
trap 'update_vol;display' 'RTMIN+1'
trap 'update_crypto;display' 'RTMIN+2'
# to update it from external commands
## kill -m "$(cat ~/.cache/pidofbar)"
# where m = 34 + n
if [ "$XDG_SESSION_TYPE" = wayland ]; then
DISPLAYCMD=(echo)
else
DISPLAYCMD=(xsetroot -name)
fi
# crypto & > /tmp
# sleep 5 && cat /tmp
# SIGNALING
# trap '<function>;display' 'RTMIN+n'
trap 'update_sink_vol;display' 'RTMIN'
# to update it from external commands
## kill -m "$(cat ~/.cache/pidofbar)"
# where m = 34 + n
echo "$$" > "$HOME/.cache/pidofbar"
sec=0
while true; do
[ "$((sec % 300))" = 0 ] && update_crypto
[ "$((sec % 10))" = 0 ] && {
update_time
update_cpu
update_memory
update_bat
update_sink_vol
update_source_vol
update_wlp
update_bat
update_time
display
}

View File

@ -1,167 +0,0 @@
#!/usr/bin/env python3
import runpy
from datetime import datetime
from os import getenv, getpid
from signal import signal
from subprocess import CalledProcessError, check_output, run
from time import sleep, time
crypto = runpy.run_path(getenv("HOME", "") + "/bin/crypto")
def get_stdout(command: list[str]) -> str:
try:
return check_output(command).decode().rstrip()
except CalledProcessError:
return ""
def update_crypto():
try:
fees = crypto["get_btc_fees"]()
coins = crypto["get_coins_values"]()
except:
OUT["cryto"] = ""
return
OUT["crypto"] = f"{fees} {coins}"
def update_cpu():
loadavg: str
with open("/proc/loadavg") as f:
loadavg = f.read().split()[0]
OUT["cpu"] = f"{loadavg}"
def update_memory():
kbtot: int
kbavail: int
gbused: float
lines: list[str]
with open("/proc/meminfo") as f:
lines = f.read().split("\n")
kbtot = int(lines[0].split()[1])
kbavail = int(lines[2].split()[1])
gbused = (kbtot - kbavail) / 1024 / 1024
OUT["ram"] = f"{gbused:.1f}G"
def update_bat():
dir = "/sys/class/power_supply/BAT0"
status: str
capacity: str
with open(dir + "/status") as f:
status = "" if f.read() == "Charging\n" else ""
with open(dir + "/capacity") as f:
capacity = f.read().rstrip()
OUT["bat"] = f"{status} {capacity}%"
def update_vol():
vol = get_stdout(["wpctl", "get-volume", "@DEFAULT_AUDIO_SINK@"])
while not vol:
vol = get_stdout(["wpctl", "get-volume", "@DEFAULT_AUDIO_SINK@"])
sleep(1)
if "MUTED" in vol:
OUT["vol"] = "🔇"
else:
OUT["vol"] = f"{int(float(vol.split()[1]) * 100)}"
def update_wlp():
sig = 0
ssid = ""
lines: list[str]
with open("/proc/net/wireless") as f:
lines = f.read().split("\n")
for l in lines:
if l.startswith("wlp"):
sig = float(l.split()[2])
break
lines = get_stdout(["nmcli", "device", "wifi", "show-password"]).split("\n")
for l in lines:
if l.startswith("SSID: "):
ssid = l[6:]
break
# https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/blob/d9b06a95/src/libnmc-base/nm-client-utils.c#L628
if sig > 56: # 70 is max
OUT["wlp"] = f"▂▄▆█ {ssid}"
elif sig > 38:
OUT["wlp"] = f"▂▄▆_ {ssid}"
elif sig > 21:
OUT["wlp"] = f"▂▄__ {ssid}"
elif sig > 3:
OUT["wlp"] = f"▂___ {ssid}"
else:
OUT["wlp"] = f"____ {ssid}"
def update_time():
OUT["time"] = datetime.now().strftime("%a %m/%d %R")
def display():
s = f"{OUT.get('crypto')} | {OUT.get('cpu')} | {OUT.get('ram')} | {OUT.get('vol')} | {OUT.get('wlp')} | {OUT.get('bat')} | {OUT.get('time')}"
if getenv("XDG_SESSION_TYPE") == "wayland":
print(s)
else:
run(["xsetroot", "-name", s])
def handler(signum: int, _):
if signum == 34:
update_vol()
# elif signum == 35:
# pass
display()
def setup_sig():
cache_dir = getenv("XDG_CACHE_HOME") or f"{getenv('HOME')}/.cache"
with open(cache_dir + "/pidofbar", "w") as f:
f.write(str(getpid()))
# kill -m "$(cat ~/.cache/pidofbar)"
signal(34, handler)
OUT = dict()
def main():
sec = 0
setup_sig()
# modules that don't update on their own need to be run at the start for
# getting their initial value
update_vol()
# TODO async?
while True:
if not sec % 300:
update_crypto()
if not sec % 10:
update_time()
update_cpu()
update_memory()
update_bat()
update_wlp()
display()
sec += 10
sleep(10 - time() % 10)
if __name__ == "__main__":
main()

View File

@ -1,177 +0,0 @@
#!/usr/bin/env python3
import asyncio
import runpy
from datetime import datetime
from os import getenv, getpid
from signal import signal
from subprocess import CalledProcessError, check_output, run
from time import sleep, time
def get_stdout(command: list[str]) -> str:
try:
return check_output(command).decode().rstrip()
except CalledProcessError:
return ""
async def update_crypto():
crypto = runpy.run_path(getenv("HOME", "") + "/bin/crypto")
try:
fees = crypto["get_btc_fees"]()
coins = crypto["get_coins_values"]()
except:
return ""
return f"{fees} {coins}"
async def update_cpu():
loadavg: str
with open("/proc/loadavg") as f:
loadavg = f.read().split()[0]
return f"{loadavg}"
async def update_memory():
kbtot: int
kbavail: int
gbused: float
lines: list[str]
with open("/proc/meminfo") as f:
lines = f.read().split("\n")
kbtot = int(lines[0].split()[1])
kbavail = int(lines[2].split()[1])
gbused = (kbtot - kbavail) / 1024 / 1024
return f"{gbused:.1f}G"
async def update_bat():
dir = "/sys/class/power_supply/BAT0"
status: str
capacity: str
with open(dir + "/status") as f:
status = "" if f.read() == "Charging\n" else ""
with open(dir + "/capacity") as f:
capacity = f.read().rstrip()
return f"{status} {capacity}%"
async def update_vol():
vol = get_stdout(["wpctl", "get-volume", "@DEFAULT_AUDIO_SINK@"])
while not vol:
vol = get_stdout(["wpctl", "get-volume", "@DEFAULT_AUDIO_SINK@"])
sleep(1)
if "MUTED" in vol:
return "🔇"
return f"{int(float(vol.split()[1]) * 100)}"
async def update_wlp():
sig = 0
ssid = ""
lines: list[str]
with open("/proc/net/wireless") as f:
lines = f.read().split("\n")
for l in lines:
if l.startswith("wlp"):
sig = float(l.split()[2])
break
lines = get_stdout(
[
"nmcli",
"-t",
"-f",
"device,name",
"connection",
"show",
"--active",
]
).split("\n")
for l in lines:
if l.startswith("wlp"):
ssid = l.split(":")[1]
# https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/blob/d9b06a95/src/libnmc-base/nm-client-utils.c#L628
if sig > 56: # 70 is max
return f"▂▄▆█ {ssid}"
if sig > 38:
return f"▂▄▆_ {ssid}"
if sig > 21:
return f"▂▄__ {ssid}"
if sig > 3:
return f"▂___ {ssid}"
return f"____ {ssid}"
async def update_time():
return datetime.now().strftime("%a %m/%d %R")
async def display(*args):
res = []
for arg in args:
try:
res += arg.result()
except:
res += ""
print(res)
s = " | ".join(res)
if getenv("XDG_SESSION_TYPE") == "wayland":
print(s)
else:
run(["xsetroot", "-name", s])
def handler(signum: int, _):
if signum == 34:
asyncio.run(update_vol())
# elif signum == 35:
# pass
asyncio.run(display())
def setup_sig():
cache_dir = getenv("XDG_CACHE_HOME") or f"{getenv('HOME')}/.cache"
with open(cache_dir + "/pidofbar", "w") as f:
f.write(str(getpid()))
# kill -m "$(cat ~/.cache/pidofbar)"
signal(34, handler)
async def main():
sec = 0
crypto = asyncio.create_task(update_crypto())
date = asyncio.create_task(update_time())
cpu = asyncio.create_task(update_cpu())
mem = asyncio.create_task(update_memory())
vol = asyncio.create_task(update_vol())
bat = asyncio.create_task(update_bat())
wlp = asyncio.create_task(update_wlp())
setup_sig()
while True:
if not sec % 300:
crypto = asyncio.create_task(update_crypto())
if not sec % 10:
date = asyncio.create_task(update_time())
cpu = asyncio.create_task(update_cpu())
mem = asyncio.create_task(update_memory())
bat = asyncio.create_task(update_bat())
wlp = asyncio.create_task(update_wlp())
await display(crypto, cpu, mem, vol, wlp, bat, date)
sec += 10
sleep(10 - time() % 10)
if __name__ == "__main__":
asyncio.run(main())

View File

@ -1,3 +1 @@
#!/bin/bash
exec feh --fullscreen "$XDG_CONFIG_HOME/wallpapers/lock.png"
#!/usr/bin/env -Sfeh --fullscreen "${XDG_CONFIG_HOME}/wallpapers/lock.png"

View File

@ -7,9 +7,9 @@ function round() {
if [ "$mod" -lt "$((closest / 2))" ]; then
echo "$((nb - mod))"
return
fi
else
echo "$((nb + closest - mod))"
fi
}
function get_current() {

75
bin/wlp
View File

@ -1,75 +0,0 @@
#!/bin/bash -e
NMCLI=(nmcli -f 'SSID,RATE,BARS,SECURITY' dev wifi)
function ask_pass() {
local net="$1" p
while [ "${#p}" -lt 8 ]; do
p="$(zenity --entry --entry-text="$pass" --text "Enter password for $net")"
if [ "$?" -ne 0 ]; then
return 1
fi
pass="$p"
done
echo "$p"
}
function get_net() {
local cmd=("${NMCLI[@]}" list)
[ "$1" = '-r' ] && cmd+=(--rescan yes)
readarray -t NET <<< "$("${cmd[@]}" | awk '!w[$1]++' | tail +2)"
}
function connect() {
local cmd=("${NMCLI[@]}" connect "$1")
local pass
[[ "$2" -ge 2 ]] && return 1
"${cmd[@]}"
case "$?" in
0)
;;
4) # Connection activation failed.
while [ "$?" = 4 ]; do
pass="$(ask_pass "$1")"
if [ -z "$pass" ]; then
exit
fi
"${cmd[@]}" password "$pass"
done
;;
10) # Connection, device, or access point does not exist.
get_net -r && connect "$@" "$(($2 + 1))"
;;
*)
return 1
;;
esac
exit
}
function readopt() {
if ! printf '%s\n' "${NET[@]}" rescan | dmenu -i -l 10; then
exit
fi
}
if [ -n "$1" ]; then
connect "$1"
exit
fi
get_net
while true; do
opt="$(readopt)"
case "$opt" in
rescan)
get_net -r
;;
*)
connect "$(awk '{print $1}' <<< "$opt")"
;;
esac
done