From 908d26dc966a1664ad6f2c78c7da11e2593952d1 Mon Sep 17 00:00:00 2001 From: ange Date: Fri, 2 Feb 2024 22:58:07 +0100 Subject: [PATCH] feat: hypr, neomutt, newsboat, pass --- .config/autorandr/ip-agn/config | 10 +- .config/autorandr/ip-agn/setup | 2 +- .config/autorandr/ip-tls/config | 9 - .config/autorandr/ip-tls/setup | 2 - .config/git/config | 14 +- .config/hypr/hyprland.conf | 150 +++++++++++++++ .config/neomutt/ange@duhayon.com | 14 ++ .config/neomutt/ange@yw5n.com | 14 ++ .config/neomutt/global | 5 + .config/neomutt/mailcap | 1 + .config/neomutt/signature.txt | 1 + .config/newsboat/config | 7 + .config/newsboat/urls | 29 +++ .config/nvim/pack/plugins/opt/onedark | 2 +- .config/nvim/pack/plugins/opt/plenary | 2 +- .config/nvim/pack/plugins/opt/telescope | 2 +- .config/nvim/pack/plugins/opt/treesitter | 2 +- .config/picom.conf | 4 +- .config/suckless/dwm-6.4/config.h | 50 +++-- .config/suckless/dwm-6.4/dwm.c | 24 ++- .../dwm-6.4/patches/restorefloat.diff | 55 ++++++ .../suckless/dwm-6.4/patches/warpcursor.diff | 13 ++ .config/systemd/user/mbsync.service | 9 + .config/systemd/user/mbsync.timer | 9 + .../user/timers.target.wants/mbsync.timer | 1 + .config/zsh/.p10k.zsh | 9 +- .config/zsh/.zprofile | 2 - .config/zsh/.zshrc | 2 + .config/zsh/aliases/general.zsh | 32 +++- .config/zsh/powerlevel10k | 2 +- .gnupg/gpg-agent.conf | 1 - .gnupg/sshcontrol | 2 +- .mail/ange@duhayon.com/.gitkeep | 0 .mail/ange@yw5n.com/.gitkeep | 0 .mbsyncrc | 47 +++++ .mozilla/firefox/ange/user.js | 4 +- .xinitrc | 3 +- .zshenv | 1 - bin/arch | 5 + bin/epitest | 1 + bin/lock | 4 +- bin/muttduhayon | 3 + bin/muttyw5n | 3 + bin/passinfo | 3 + bin/passopen | 3 + bin/passotp | 3 + bin/passpass | 3 + bin/passselect | 14 ++ bin/passuser | 3 + bin/sbar | 118 ++++++------ bin/sbar.py | 167 ----------------- bin/sbar_async.py | 177 ------------------ bin/screensaver | 4 +- bin/set-light | 4 +- bin/wlp | 75 -------- 55 files changed, 568 insertions(+), 558 deletions(-) delete mode 100644 .config/autorandr/ip-tls/config delete mode 100644 .config/autorandr/ip-tls/setup create mode 100644 .config/hypr/hyprland.conf create mode 100644 .config/neomutt/ange@duhayon.com create mode 100644 .config/neomutt/ange@yw5n.com create mode 100644 .config/neomutt/global create mode 100644 .config/neomutt/mailcap create mode 100644 .config/neomutt/signature.txt create mode 100644 .config/newsboat/config create mode 100644 .config/newsboat/urls create mode 100644 .config/suckless/dwm-6.4/patches/restorefloat.diff create mode 100644 .config/suckless/dwm-6.4/patches/warpcursor.diff create mode 100644 .config/systemd/user/mbsync.service create mode 100644 .config/systemd/user/mbsync.timer create mode 120000 .config/systemd/user/timers.target.wants/mbsync.timer create mode 100644 .mail/ange@duhayon.com/.gitkeep create mode 100644 .mail/ange@yw5n.com/.gitkeep create mode 100644 .mbsyncrc create mode 100755 bin/arch create mode 100755 bin/muttduhayon create mode 100755 bin/muttyw5n create mode 100755 bin/passinfo create mode 100755 bin/passopen create mode 100755 bin/passotp create mode 100755 bin/passpass create mode 100755 bin/passselect create mode 100755 bin/passuser delete mode 100755 bin/sbar.py delete mode 100755 bin/sbar_async.py delete mode 100755 bin/wlp diff --git a/.config/autorandr/ip-agn/config b/.config/autorandr/ip-agn/config index c478261..a5c8e8d 100644 --- a/.config/autorandr/ip-agn/config +++ b/.config/autorandr/ip-agn/config @@ -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 diff --git a/.config/autorandr/ip-agn/setup b/.config/autorandr/ip-agn/setup index f9ff678..0415911 100644 --- a/.config/autorandr/ip-agn/setup +++ b/.config/autorandr/ip-agn/setup @@ -1,2 +1,2 @@ -HDMI-A-0 00ffffffffffff000472ff0275d130442b18010380351e78ca9265a655559f280d5054bfef80714f8140818081c081009500b300d1c0023a801871382d40582c4500132b2100001e000000fd00374c1e5011000a202020202020000000fc0047323436484c0a202020202020000000ff004c57414545303138383536380a014d020324f14f01020304050607901112131415161f230907078301000067030c001000382d023a801871382d40582c4500132b2100001f011d8018711c1620582c2500132b2100009f011d007251d01e206e285500132b2100001e8c0ad08a20e02d10103e9600132b21000018000000000000000000000000000000000000007e +HDMI-A-0 00ffffffffffff004c2d200d34415743191e010380341d782a9315a655519c27115054bfef80714f81c0810081809500a9c0b3000101023a801871382d40582c450009252100001e000000fd00324b1e5111000a202020202020000000fc00533234463335300a2020202020000000ff0048345a4e3630323031370a20200114020311b14690041f13120365030c001000011d00bc52d01e20b828554009252100001e8c0ad090204031200c4055000925210000188c0ad08a20e02d10103e9600092521000018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000051 eDP 00ffffffffffff0009e5d50800000000231d0104a5221378030b95935c59932a20505400000001010101010101010101010101010101043a803671381e403020360058c21000001a000000000000000000000000000000000000000000fe00424f452043510a202020202020000000fe004e5431353646484d2d4e34330a000e diff --git a/.config/autorandr/ip-tls/config b/.config/autorandr/ip-tls/config deleted file mode 100644 index 56794ab..0000000 --- a/.config/autorandr/ip-tls/config +++ /dev/null @@ -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 diff --git a/.config/autorandr/ip-tls/setup b/.config/autorandr/ip-tls/setup deleted file mode 100644 index 0415911..0000000 --- a/.config/autorandr/ip-tls/setup +++ /dev/null @@ -1,2 +0,0 @@ -HDMI-A-0 00ffffffffffff004c2d200d34415743191e010380341d782a9315a655519c27115054bfef80714f81c0810081809500a9c0b3000101023a801871382d40582c450009252100001e000000fd00324b1e5111000a202020202020000000fc00533234463335300a2020202020000000ff0048345a4e3630323031370a20200114020311b14690041f13120365030c001000011d00bc52d01e20b828554009252100001e8c0ad090204031200c4055000925210000188c0ad08a20e02d10103e9600092521000018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000051 -eDP 00ffffffffffff0009e5d50800000000231d0104a5221378030b95935c59932a20505400000001010101010101010101010101010101043a803671381e403020360058c21000001a000000000000000000000000000000000000000000fe00424f452043510a202020202020000000fe004e5431353646484d2d4e34330a000e diff --git a/.config/git/config b/.config/git/config index 9131fb4..b8de9e7 100644 --- a/.config/git/config +++ b/.config/git/config @@ -1,13 +1,11 @@ +[commit] + gpgsign = true [user] - email = ange@duhayon.com - name = ange -[credential] - helper = store + email = ange@yw5n.com + name = ange [diff] - tool = nvimdiff + tool = nvimdiff [difftool "nvimdiff"] cmd = nvim -d -c \"wincmd l\" \"$LOCAL\" \"$REMOTE\" [init] - defaultBranch = main -[commit] - gpgsign = true + defaultBranch = main diff --git a/.config/hypr/hyprland.conf b/.config/hypr/hyprland.conf new file mode 100644 index 0000000..02c13bd --- /dev/null +++ b/.config/hypr/hyprland.conf @@ -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 diff --git a/.config/neomutt/ange@duhayon.com b/.config/neomutt/ange@duhayon.com new file mode 100644 index 0000000..fe2ba93 --- /dev/null +++ b/.config/neomutt/ange@duhayon.com @@ -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 diff --git a/.config/neomutt/ange@yw5n.com b/.config/neomutt/ange@yw5n.com new file mode 100644 index 0000000..1ff5477 --- /dev/null +++ b/.config/neomutt/ange@yw5n.com @@ -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 diff --git a/.config/neomutt/global b/.config/neomutt/global new file mode 100644 index 0000000..d957ca4 --- /dev/null +++ b/.config/neomutt/global @@ -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" diff --git a/.config/neomutt/mailcap b/.config/neomutt/mailcap new file mode 100644 index 0000000..f93be9a --- /dev/null +++ b/.config/neomutt/mailcap @@ -0,0 +1 @@ +text/html; lynx -assume_charset=%{charset} -display_charset=utf-8 -collapse_br_tags -dump %s; nametemplate=%s.html; copiousoutput diff --git a/.config/neomutt/signature.txt b/.config/neomutt/signature.txt new file mode 100644 index 0000000..acdb285 --- /dev/null +++ b/.config/neomutt/signature.txt @@ -0,0 +1 @@ +Ange DUHAYON diff --git a/.config/newsboat/config b/.config/newsboat/config new file mode 100644 index 0000000..c8a60af --- /dev/null +++ b/.config/newsboat/config @@ -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 diff --git a/.config/newsboat/urls b/.config/newsboat/urls new file mode 100644 index 0000000..000d08f --- /dev/null +++ b/.config/newsboat/urls @@ -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\"" diff --git a/.config/nvim/pack/plugins/opt/onedark b/.config/nvim/pack/plugins/opt/onedark index c5476a0..1230aaf 160000 --- a/.config/nvim/pack/plugins/opt/onedark +++ b/.config/nvim/pack/plugins/opt/onedark @@ -1 +1 @@ -Subproject commit c5476a091b0f1b4e853db91c91ff941f848a1cdd +Subproject commit 1230aaf2a427b2c5b73aba6e4a9a5881d3e69429 diff --git a/.config/nvim/pack/plugins/opt/plenary b/.config/nvim/pack/plugins/opt/plenary index 55d9fe8..4f71c0c 160000 --- a/.config/nvim/pack/plugins/opt/plenary +++ b/.config/nvim/pack/plugins/opt/plenary @@ -1 +1 @@ -Subproject commit 55d9fe89e33efd26f532ef20223e5f9430c8b0c0 +Subproject commit 4f71c0c4a196ceb656c824a70792f3df3ce6bb6d diff --git a/.config/nvim/pack/plugins/opt/telescope b/.config/nvim/pack/plugins/opt/telescope index 983460f..7b5c5f5 160000 --- a/.config/nvim/pack/plugins/opt/telescope +++ b/.config/nvim/pack/plugins/opt/telescope @@ -1 +1 @@ -Subproject commit 983460fb8cd864748311f4c7f0c8337091f24d59 +Subproject commit 7b5c5f56a21e82fdcfe5b250278b8dfc4b1cbab4 diff --git a/.config/nvim/pack/plugins/opt/treesitter b/.config/nvim/pack/plugins/opt/treesitter index 0da349e..1cda981 160000 --- a/.config/nvim/pack/plugins/opt/treesitter +++ b/.config/nvim/pack/plugins/opt/treesitter @@ -1 +1 @@ -Subproject commit 0da349ed303bea955942f409d29059cdb89dbe2c +Subproject commit 1cda98132abfde758c1778096960f9b2c0bd78c1 diff --git a/.config/picom.conf b/.config/picom.conf index 1a245b1..637213c 100644 --- a/.config/picom.conf +++ b/.config/picom.conf @@ -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, diff --git a/.config/suckless/dwm-6.4/config.h b/.config/suckless/dwm-6.4/config.h index 6243bc3..0cf63a4 100644 --- a/.config/suckless/dwm-6.4/config.h +++ b/.config/suckless/dwm-6.4/config.h @@ -49,25 +49,30 @@ static const Layout layouts[] = { { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \ /* commands */ -static const char *dmenucmd[] = { "dmenu_run", "-i", "-fn", dmenufont, NULL }; -static const char *termcmd[] = { "alacritty", NULL }; -static const char *calccmd[] = { "alacritty", "-epython", NULL }; -static const char *wwwcmd[] = { "firefox", NULL }; -static const char *pwwwcmd[] = { "firefox", "--private-window", NULL }; -static const char *fmcmd[] = { "pcmanfm", NULL }; -static const char *lockcmd[] = { "lock", NULL }; -static const char *prtsccmd[] = { "flameshot", "full", "-c", NULL }; -static const char *prtscrectcmd[] = { "flameshot", "gui", NULL }; -static const char *lvolcmd[] = { "set-vol", "-5", NULL }; -static const char *rvolcmd[] = { "set-vol", "+5", NULL }; -static const char *mutecmd[] = { "set-vol", "m", NULL }; -static const char *micmutecmd[] = { "wpctl", "set-mute", "@DEFAULT_SOURCE@", "toggle", NULL }; -static const char *pausecmd[] = { "playerctl", "play-pause", NULL }; -static const char *prevcmd[] = { "playerctl", "previous", NULL }; -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 *dmenucmd[] = { "dmenu_run", "-i", "-fn", dmenufont, NULL }; +static const char *termcmd[] = { "alacritty", NULL }; +static const char *calccmd[] = { "alacritty", "-epython", NULL }; +static const char *wwwcmd[] = { "firefox", NULL }; +static const char *pwwwcmd[] = { "firefox", "--private-window", NULL }; +static const char *fmcmd[] = { "pcmanfm", NULL }; +static const char *lockcmd[] = { "lock", NULL }; +static const char *prtsccmd[] = { "flameshot", "full", "-c", NULL }; +static const char *prtscrectcmd[] = { "flameshot", "gui", NULL }; +static const char *lvolcmd[] = { "set-vol", "-5", NULL }; +static const char *rvolcmd[] = { "set-vol", "+5", NULL }; +static const char *mutecmd[] = { "set-vol", "m", NULL }; +static const char *micmutecmd[] = { "wpctl", "set-mute", "@DEFAULT_SOURCE@", "toggle", NULL }; +static const char *pausecmd[] = { "playerctl", "play-pause", NULL }; +static const char *prevcmd[] = { "playerctl", "previous", NULL }; +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} }, diff --git a/.config/suckless/dwm-6.4/dwm.c b/.config/suckless/dwm-6.4/dwm.c index c89dcbb..e1401d4 100644 --- a/.config/suckless/dwm-6.4/dwm.c +++ b/.config/suckless/dwm-6.4/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; @@ -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); } diff --git a/.config/suckless/dwm-6.4/patches/restorefloat.diff b/.config/suckless/dwm-6.4/patches/restorefloat.diff new file mode 100644 index 0000000..f96f1d9 --- /dev/null +++ b/.config/suckless/dwm-6.4/patches/restorefloat.diff @@ -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); + } + diff --git a/.config/suckless/dwm-6.4/patches/warpcursor.diff b/.config/suckless/dwm-6.4/patches/warpcursor.diff new file mode 100644 index 0000000..4bff9c0 --- /dev/null +++ b/.config/suckless/dwm-6.4/patches/warpcursor.diff @@ -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 diff --git a/.config/systemd/user/mbsync.service b/.config/systemd/user/mbsync.service new file mode 100644 index 0000000..03beacf --- /dev/null +++ b/.config/systemd/user/mbsync.service @@ -0,0 +1,9 @@ +[Unit] +Description=Mailbox synchronization service + +[Service] +Type=oneshot +ExecStart=/usr/bin/mbsync -Va + +[Install] +WantedBy=default.target diff --git a/.config/systemd/user/mbsync.timer b/.config/systemd/user/mbsync.timer new file mode 100644 index 0000000..1ed5471 --- /dev/null +++ b/.config/systemd/user/mbsync.timer @@ -0,0 +1,9 @@ +[Unit] +Description=Mailbox synchronization timer + +[Timer] +OnCalendar=*:00/15 +Unit=mbsync.service + +[Install] +WantedBy=timers.target diff --git a/.config/systemd/user/timers.target.wants/mbsync.timer b/.config/systemd/user/timers.target.wants/mbsync.timer new file mode 120000 index 0000000..fa56ef4 --- /dev/null +++ b/.config/systemd/user/timers.target.wants/mbsync.timer @@ -0,0 +1 @@ +../mbsync.timer \ No newline at end of file diff --git a/.config/zsh/.p10k.zsh b/.config/zsh/.p10k.zsh index 85901e9..934f7a5 100644 --- a/.config/zsh/.p10k.zsh +++ b/.config/zsh/.p10k.zsh @@ -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. diff --git a/.config/zsh/.zprofile b/.config/zsh/.zprofile index 65bdce1..bfdec45 100644 --- a/.config/zsh/.zprofile +++ b/.config/zsh/.zprofile @@ -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" diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index 467e134..58a6e4b 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -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}" diff --git a/.config/zsh/aliases/general.zsh b/.config/zsh/aliases/general.zsh index 3ab7e2d..be7ecc0 100644 --- a/.config/zsh/aliases/general.zsh +++ b/.config/zsh/aliases/general.zsh @@ -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 diff --git a/.config/zsh/powerlevel10k b/.config/zsh/powerlevel10k index cc6ed4b..6234105 160000 --- a/.config/zsh/powerlevel10k +++ b/.config/zsh/powerlevel10k @@ -1 +1 @@ -Subproject commit cc6ed4be416b70fe4e3f97d17061c751abaca04f +Subproject commit 62341054d8aa40ade03fc55bdbc95b9ff2d8d2b6 diff --git a/.gnupg/gpg-agent.conf b/.gnupg/gpg-agent.conf index 527a1ff..85405bc 100644 --- a/.gnupg/gpg-agent.conf +++ b/.gnupg/gpg-agent.conf @@ -1,2 +1 @@ enable-ssh-support -pinentry-program /usr/bin/pinentry-tty diff --git a/.gnupg/sshcontrol b/.gnupg/sshcontrol index f8f1b38..2aebab9 100644 --- a/.gnupg/sshcontrol +++ b/.gnupg/sshcontrol @@ -1 +1 @@ -8B64484EC42A914650DD8960BF3D9BBD9FE71327 +D17DD274A8FC460888C038B2F84ACB3A562A3BA4 diff --git a/.mail/ange@duhayon.com/.gitkeep b/.mail/ange@duhayon.com/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/.mail/ange@yw5n.com/.gitkeep b/.mail/ange@yw5n.com/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/.mbsyncrc b/.mbsyncrc new file mode 100644 index 0000000..a7dce2c --- /dev/null +++ b/.mbsyncrc @@ -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 * diff --git a/.mozilla/firefox/ange/user.js b/.mozilla/firefox/ange/user.js index 4339e0d..4f2ae3c 100644 --- a/.mozilla/firefox/ange/user.js +++ b/.mozilla/firefox/ange/user.js @@ -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); diff --git a/.xinitrc b/.xinitrc index 75a9c4f..738913a 100644 --- a/.xinitrc +++ b/.xinitrc @@ -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 diff --git a/.zshenv b/.zshenv index e9b0796..97a3be1 100644 --- a/.zshenv +++ b/.zshenv @@ -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" diff --git a/bin/arch b/bin/arch new file mode 100755 index 0000000..030a534 --- /dev/null +++ b/bin/arch @@ -0,0 +1,5 @@ +#!/bin/bash -e + +CRI=(sudo docker) + +"${CRI[@]}" run --rm -it -v "$PWD:/mnt/" -w /mnt/ docker.io/archlinux:latest diff --git a/bin/epitest b/bin/epitest index b88f686..4d6d34d 100755 --- a/bin/epitest +++ b/bin/epitest @@ -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 \ "$@" diff --git a/bin/lock b/bin/lock index 683771b..70c74b1 100755 --- a/bin/lock +++ b/bin/lock @@ -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" diff --git a/bin/muttduhayon b/bin/muttduhayon new file mode 100755 index 0000000..110aebe --- /dev/null +++ b/bin/muttduhayon @@ -0,0 +1,3 @@ +#!/bin/bash -e + +neomutt -F "${XDG_CONFIG_HOME}/neomutt/ange@duhayon.com" "$@" diff --git a/bin/muttyw5n b/bin/muttyw5n new file mode 100755 index 0000000..7835bb2 --- /dev/null +++ b/bin/muttyw5n @@ -0,0 +1,3 @@ +#!/bin/bash -e + +neomutt -F "${XDG_CONFIG_HOME}/neomutt/ange@yw5n.com" "$@" diff --git a/bin/passinfo b/bin/passinfo new file mode 100755 index 0000000..603fc5b --- /dev/null +++ b/bin/passinfo @@ -0,0 +1,3 @@ +#!/bin/bash -e + +pass show "$(cat /tmp/passselect)" | less diff --git a/bin/passopen b/bin/passopen new file mode 100755 index 0000000..ac8c631 --- /dev/null +++ b/bin/passopen @@ -0,0 +1,3 @@ +#!/bin/bash -e + +xdg-open "$(pass "$(cat /tmp/passselect)" | sed -n 's/URL: //p')" diff --git a/bin/passotp b/bin/passotp new file mode 100755 index 0000000..c4181b0 --- /dev/null +++ b/bin/passotp @@ -0,0 +1,3 @@ +#!/bin/bash -e + +xdotool type --clearmodifiers --delay 0 "$(pass otp "$(cat /tmp/passselect)")" diff --git a/bin/passpass b/bin/passpass new file mode 100755 index 0000000..24908cf --- /dev/null +++ b/bin/passpass @@ -0,0 +1,3 @@ +#!/bin/bash -e + +xdotool type --clearmodifiers --delay 0 "$(pass "$(cat /tmp/passselect)" | head -n1 -)" diff --git a/bin/passselect b/bin/passselect new file mode 100755 index 0000000..b02b0ce --- /dev/null +++ b/bin/passselect @@ -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 diff --git a/bin/passuser b/bin/passuser new file mode 100755 index 0000000..e062355 --- /dev/null +++ b/bin/passuser @@ -0,0 +1,3 @@ +#!/bin/bash -e + +xdotool type --clearmodifiers --delay 0 "$(pass "$(cat /tmp/passselect)" | sed -n 's/Username: //p')" diff --git a/bin/sbar b/bin/sbar index 99d9790..f9beb3d 100755 --- a/bin/sbar +++ b/bin/sbar @@ -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"; } || - { wlp="____ $ssid"; } - wlp="$wlp |" + { [ "$sig" -gt 56 ] && wlp="▂▄▆█ $ssid"; } || + { [ "$sig" -gt 38 ] && wlp="▂▄▆_ $ssid"; } || + { [ "$sig" -gt 21 ] && wlp="▂▄__ $ssid"; } || + { [ "$sig" -gt 3 ] && wlp="▂___ $ssid"; } || + { wlp="____ $ssid"; } } -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 ';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 ';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 + [ "$((sec % 10))" = 0 ] && { update_cpu update_memory - update_bat + update_sink_vol + update_source_vol update_wlp + update_bat + update_time display } diff --git a/bin/sbar.py b/bin/sbar.py deleted file mode 100755 index a2ee29c..0000000 --- a/bin/sbar.py +++ /dev/null @@ -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() diff --git a/bin/sbar_async.py b/bin/sbar_async.py deleted file mode 100755 index 688bd22..0000000 --- a/bin/sbar_async.py +++ /dev/null @@ -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()) diff --git a/bin/screensaver b/bin/screensaver index f2a5fb5..dbdc3b4 100755 --- a/bin/screensaver +++ b/bin/screensaver @@ -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" diff --git a/bin/set-light b/bin/set-light index e8624e1..ed824e1 100755 --- a/bin/set-light +++ b/bin/set-light @@ -7,9 +7,9 @@ function round() { if [ "$mod" -lt "$((closest / 2))" ]; then echo "$((nb - mod))" - return + else + echo "$((nb + closest - mod))" fi - echo "$((nb + closest - mod))" } function get_current() { diff --git a/bin/wlp b/bin/wlp deleted file mode 100755 index 43dffab..0000000 --- a/bin/wlp +++ /dev/null @@ -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