Edited tmux configuration

This commit is contained in:
Thai Noodles 2023-12-25 07:45:28 -08:00
parent 3d85329ca7
commit 4e64fff750
14 changed files with 30 additions and 477 deletions

View File

@ -22,11 +22,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1701718080,
"narHash": "sha256-6ovz0pG76dE0P170pmmZex1wWcQoeiomUZGggfH9XPs=",
"lastModified": 1703013332,
"narHash": "sha256-+tFNwMvlXLbJZXiMHqYq77z/RfmpfpiI3yjL6o/Zo9M=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "2c7f3c0fb7c08a0814627611d9d7d45ab6d75335",
"rev": "54aac082a4d9bb5bbc5c4e899603abfb76a3f6d6",
"type": "github"
},
"original": {

View File

@ -81,9 +81,12 @@
enable = true;
baseIndex = 1;
clock24 = true;
escapeTime = 250;
historyLimit = 8000;
keyMode = "vi";
mouse = false;
newSession = true;
newSession = false;
prefix = "C-b";
extraConfig = ''
# Do not rename windows automatically
set-option -g allow-rename off
@ -109,11 +112,10 @@
unbind a
bind a new-window
unbind l
unbind Tab
bind Tab last-window
unbind l
# Rebind moving panes
bind -n C-h select-pane -L
bind -n C-j select-pane -D
@ -139,7 +141,6 @@
tmuxPlugins.urlview
tmuxPlugins.yank
];
prefix = "C-b";
};
home.stateVersion = "23.05";
}

View File

@ -0,0 +1,4 @@
nick = iiogama
real = iiogama
host = irc.snoonet.org
join = #chicoca

View File

@ -43,23 +43,6 @@
xsession.windowManager.bspwm = {
enable = true;
rules = {
"Wrapper-2.0" = {
state = "floating";
border = false;
focus = true;
};
"mpv" = {
state = "floating";
sticky = true;
follow = false;
focus = true;
};
"*:Toolkit:Picture-in-Picture" = {
state = "floating";
sticky = true;
follow = false;
focus = true;
};
"trayer:panel:" = {
border = false;
manage = false;

View File

@ -57,6 +57,7 @@ in
exclude = [
"/home/*/go/bin"
"/home/*/go/pkg"
"/var/lib/libvirt/images/*.qcow2"
];
repo = "/mnt/archive/buckwheat";
encryption = {

View File

@ -18,14 +18,6 @@
"0"
];
};
rules = {
"mpv" = {
rectangle = "640x360+1920+1080";
};
"*:Toolkit:Picture-in-Picture" = {
rectangle = "640x360+1920+1080";
};
};
};
services = {
udiskie = {

View File

@ -4,8 +4,8 @@
users.users.${user.name}.packages = with pkgs; [
catgirl
discord
halloy
profanity
signal-desktop
tut
];
}

View File

@ -33,7 +33,7 @@
# and it makes connecting from a local Mac possible.
avahi = {
enable = true;
nssmdns = true;
nssmdns4 = true;
publish = {
enable = true;
addresses = true;
@ -98,7 +98,6 @@
mdp
mediainfo
nb
nom
oed
pdfgrep
phetch
@ -106,7 +105,6 @@
shellcheck
ssss
surfraw
tut
unrar
unzip
up

View File

@ -23,9 +23,11 @@
enable = true;
xdgOpenUsePortal = true;
extraPortals = [
pkgs.xdg-desktop-portal
pkgs.xdg-desktop-portal-gtk
];
configPackages = [
pkgs.gnome.gnome-session
];
};
};
services = {
@ -71,7 +73,7 @@
#onionshare-gui
scrot
tor-browser-bundle-bin
urlview
#urlview
];
environment.systemPackages = with pkgs; [
(dmenu.overrideAttrs (oldAttrs: rec {

View File

@ -1,13 +0,0 @@
diff --git a/x.c b/x.c
index 13fa9f4..88fd341 100644
--- a/x.c
+++ b/x.c
@@ -624,6 +624,8 @@ setsel(char *str, Time t)
XSetSelectionOwner(xw.dpy, XA_PRIMARY, xw.win, t);
if (XGetSelectionOwner(xw.dpy, XA_PRIMARY) != xw.win)
selclear();
+
+ xclipcopy();
}
void

View File

@ -1,109 +0,0 @@
From be408247f1c1ff8ccf7ab128b126f54d19bd4392 Mon Sep 17 00:00:00 2001
From: Michael Buch <michaelbuch12@gmail.com>
Date: Sat, 2 Feb 2019 14:20:52 +0000
Subject: [PATCH] Port the copyurl patch to the 0.8.1 st release. Mainly fix
usage of depracted selcopy
---
config.def.h | 1 +
st.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++
st.h | 1 +
3 files changed, 64 insertions(+)
diff --git a/config.def.h b/config.def.h
index 82b1b09..cbe923e 100644
--- a/config.def.h
+++ b/config.def.h
@@ -178,6 +178,7 @@ static Shortcut shortcuts[] = {
{ TERMMOD, XK_Y, selpaste, {.i = 0} },
{ TERMMOD, XK_Num_Lock, numlock, {.i = 0} },
{ TERMMOD, XK_I, iso14755, {.i = 0} },
+ { MODKEY, XK_l, copyurl, {.i = 0} },
};
/*
diff --git a/st.c b/st.c
index 46c954b..476eb31 100644
--- a/st.c
+++ b/st.c
@@ -2616,3 +2616,65 @@ redraw(void)
tfulldirt();
draw();
}
+
+/* select and copy the previous url on screen (do nothing if there's no url).
+ * known bug: doesn't handle urls that span multiple lines (wontfix)
+ * known bug: only finds first url on line (mightfix)
+ */
+void
+copyurl(const Arg *arg) {
+ /* () and [] can appear in urls, but excluding them here will reduce false
+ * positives when figuring out where a given url ends.
+ */
+ static char URLCHARS[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "abcdefghijklmnopqrstuvwxyz"
+ "0123456789-._~:/?#@!$&'*+,;=%";
+
+ int i, row, startrow;
+ char *linestr = calloc(sizeof(char), term.col+1); /* assume ascii */
+ char *c, *match = NULL;
+
+ row = (sel.ob.x >= 0 && sel.nb.y > 0) ? sel.nb.y-1 : term.bot;
+ LIMIT(row, term.top, term.bot);
+ startrow = row;
+
+ /* find the start of the last url before selection */
+ do {
+ for (i = 0; i < term.col; ++i) {
+ if (term.line[row][i].u > 127) /* assume ascii */
+ continue;
+ linestr[i] = term.line[row][i].u;
+ }
+ linestr[term.col] = '\0';
+ if ((match = strstr(linestr, "http://"))
+ || (match = strstr(linestr, "https://")))
+ break;
+ if (--row < term.top)
+ row = term.bot;
+ } while (row != startrow);
+
+ if (match) {
+ /* must happen before trim */
+ selclear();
+ sel.ob.x = strlen(linestr) - strlen(match);
+
+ /* trim the rest of the line from the url match */
+ for (c = match; *c != '\0'; ++c)
+ if (!strchr(URLCHARS, *c)) {
+ *c = '\0';
+ break;
+ }
+
+ /* select and copy */
+ sel.mode = 1;
+ sel.type = SEL_REGULAR;
+ sel.oe.x = sel.ob.x + strlen(match)-1;
+ sel.ob.y = sel.oe.y = row;
+ selnormalize();
+ tsetdirt(sel.nb.y, sel.ne.y);
+ xsetsel(getsel());
+ xclipcopy();
+ }
+
+ free(linestr);
+}
diff --git a/st.h b/st.h
index dac64d8..5a58f8f 100644
--- a/st.h
+++ b/st.h
@@ -85,6 +85,7 @@ void printscreen(const Arg *);
void printsel(const Arg *);
void sendbreak(const Arg *);
void toggleprinter(const Arg *);
+void copyurl(const Arg *);
int tattrset(int);
void tnew(int, int);
--
2.20.1

View File

@ -1,149 +0,0 @@
From 8b07fb9ab581eb31714f0dd25a419926a7f34cc6 Mon Sep 17 00:00:00 2001
From: Gildasio Junior <gildasiojunior@riseup.net>
Date: Thu, 6 Apr 2023 14:54:23 -0300
Subject: [PATCH] Loop through urls on screen in both directions
Using previous patches one can loop through urls in the screen in one
direction: botton-up. This patch add a way that can go in the opposite
direction: top-down.
This is usefull in a screen with lots of urls.
---
config.def.h | 2 ++
st.c | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++
st.h | 1 +
3 files changed, 93 insertions(+)
diff --git a/config.def.h b/config.def.h
index 91ab8ca..4df78eb 100644
--- a/config.def.h
+++ b/config.def.h
@@ -201,6 +201,8 @@ static Shortcut shortcuts[] = {
{ TERMMOD, XK_Y, selpaste, {.i = 0} },
{ ShiftMask, XK_Insert, selpaste, {.i = 0} },
{ TERMMOD, XK_Num_Lock, numlock, {.i = 0} },
+ { MODKEY, XK_l, copyurl, {.i = 0} },
+ { MODKEY|ShiftMask, XK_L, copyurl, {.i = 1} },
};
/*
diff --git a/st.c b/st.c
index 134e724..1b321ab 100644
--- a/st.c
+++ b/st.c
@@ -201,6 +201,7 @@ static void tdefutf8(char);
static int32_t tdefcolor(const int *, int *, int);
static void tdeftran(char);
static void tstrsequence(uchar);
+static const char *findlastany(const char *, const char**, size_t);
static void drawregion(int, int, int, int);
@@ -2666,3 +2667,92 @@ redraw(void)
tfulldirt();
draw();
}
+
+const char *
+findlastany(const char *str, const char**find, size_t len)
+{
+ const char *found = NULL;
+ int i = 0;
+
+ for (found = str + strlen(str) - 1; found >= str; --found) {
+ for(i = 0; i < len; i++) {
+ if (strncmp(found, find[i], strlen(find[i])) == 0) {
+ return found;
+ }
+ }
+ }
+
+ return NULL;
+}
+
+/*
+** Select and copy the previous url on screen (do nothing if there's no url).
+**
+** FIXME: doesn't handle urls that span multiple lines; will need to add support
+** for multiline "getsel()" first
+*/
+void
+copyurl(const Arg *arg) {
+ /* () and [] can appear in urls, but excluding them here will reduce false
+ * positives when figuring out where a given url ends.
+ */
+ static const char URLCHARS[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "abcdefghijklmnopqrstuvwxyz"
+ "0123456789-._~:/?#@!$&'*+,;=%";
+
+ static const char* URLSTRINGS[] = {"http://", "https://"};
+
+ int row = 0, /* row of current URL */
+ col = 0, /* column of current URL start */
+ colend = 0, /* column of last occurrence */
+ passes = 0; /* how many rows have been scanned */
+
+ char linestr[term.col + 1];
+ const char *c = NULL,
+ *match = NULL;
+
+ row = (sel.ob.x >= 0 && sel.nb.y > 0) ? sel.nb.y : term.bot;
+ LIMIT(row, term.top, term.bot);
+
+ colend = (sel.ob.x >= 0 && sel.nb.y > 0) ? sel.nb.x : term.col;
+ LIMIT(colend, 0, term.col);
+
+ /*
+ ** Scan from (term.row - 1,term.col - 1) to (0,0) and find
+ ** next occurrance of a URL
+ */
+ for (passes = 0; passes < term.row; passes++) {
+ /* Read in each column of every row until
+ ** we hit previous occurrence of URL
+ */
+ for (col = 0; col < colend; ++col)
+ linestr[col] = term.line[row][col].u < 128 ? term.line[row][col].u : ' ';
+ linestr[col] = '\0';
+
+ if ((match = findlastany(linestr, URLSTRINGS,
+ sizeof(URLSTRINGS)/sizeof(URLSTRINGS[0]))))
+ break;
+
+ /* .i = 0 --> botton-up
+ * .i = 1 --> top-down
+ * */
+ if (!arg->i) {
+ if (--row < 0)
+ row = term.row - 1;
+ } else {
+ if (++row >= term.row)
+ row = 0;
+ }
+
+ colend = term.col;
+ };
+
+ if (match) {
+ size_t l = strspn(match, URLCHARS);
+ selstart(match - linestr, row, 0);
+ selextend(match - linestr + l - 1, row, SEL_REGULAR, 0);
+ selextend(match - linestr + l - 1, row, SEL_REGULAR, 1);
+ xsetsel(getsel());
+ xclipcopy();
+ }
+}
diff --git a/st.h b/st.h
index fd3b0d8..baa8f29 100644
--- a/st.h
+++ b/st.h
@@ -85,6 +85,7 @@ void printscreen(const Arg *);
void printsel(const Arg *);
void sendbreak(const Arg *);
void toggleprinter(const Arg *);
+void copyurl(const Arg *);
int tattrset(int);
void tnew(int, int);
--
2.40.0

View File

@ -1,167 +0,0 @@
From 7405bdc89e4c43cfbeabd0d4d822bc62d1e76730 Mon Sep 17 00:00:00 2001
From: Gildasio Junior <gildasiojunior@riseup.net>
Date: Thu, 6 Apr 2023 14:51:06 -0300
Subject: [PATCH] Loop through urls on screen in both directions
Using previous patches one can loop through urls in the screen in one
direction: botton-up. This patch add a way that can go in the opposite
direction: top-down.
This is usefull in a screen with lots of urls.
---
config.def.h | 2 +
st.c | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++
st.h | 1 +
3 files changed, 104 insertions(+)
diff --git a/config.def.h b/config.def.h
index 91ab8ca..4df78eb 100644
--- a/config.def.h
+++ b/config.def.h
@@ -201,6 +201,8 @@ static Shortcut shortcuts[] = {
{ TERMMOD, XK_Y, selpaste, {.i = 0} },
{ ShiftMask, XK_Insert, selpaste, {.i = 0} },
{ TERMMOD, XK_Num_Lock, numlock, {.i = 0} },
+ { MODKEY, XK_l, copyurl, {.i = 0} },
+ { MODKEY|ShiftMask, XK_L, copyurl, {.i = 1} },
};
/*
diff --git a/st.c b/st.c
index 134e724..c451015 100644
--- a/st.c
+++ b/st.c
@@ -152,6 +152,11 @@ typedef struct {
int narg; /* nb of args */
} STREscape;
+typedef struct {
+ int state;
+ size_t length;
+} URLdfa;
+
static void execsh(char *, char **);
static void stty(char **);
static void sigchld(int);
@@ -201,6 +206,7 @@ static void tdefutf8(char);
static int32_t tdefcolor(const int *, int *, int);
static void tdeftran(char);
static void tstrsequence(uchar);
+static int daddch(URLdfa *, char);
static void drawregion(int, int, int, int);
@@ -2666,3 +2672,98 @@ redraw(void)
tfulldirt();
draw();
}
+
+int
+daddch(URLdfa *dfa, char c)
+{
+ /* () and [] can appear in urls, but excluding them here will reduce false
+ * positives when figuring out where a given url ends.
+ */
+ static const char URLCHARS[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "abcdefghijklmnopqrstuvwxyz"
+ "0123456789-._~:/?#@!$&'*+,;=%";
+ static const char RPFX[] = "//:sptth";
+
+ if (!strchr(URLCHARS, c)) {
+ dfa->length = 0;
+ dfa->state = 0;
+
+ return 0;
+ }
+
+ dfa->length++;
+
+ if (dfa->state == 2 && c == '/') {
+ dfa->state = 0;
+ } else if (dfa->state == 3 && c == 'p') {
+ dfa->state++;
+ } else if (c != RPFX[dfa->state]) {
+ dfa->state = 0;
+ return 0;
+ }
+
+ if (dfa->state++ == 7) {
+ dfa->state = 0;
+ return 1;
+ }
+
+ return 0;
+}
+
+/*
+** Select and copy the previous url on screen (do nothing if there's no url).
+*/
+void
+copyurl(const Arg *arg) {
+ int row = 0, /* row of current URL */
+ col = 0, /* column of current URL start */
+ colend = 0, /* column of last occurrence */
+ passes = 0; /* how many rows have been scanned */
+
+ const char *c = NULL,
+ *match = NULL;
+ URLdfa dfa = { 0 };
+
+ row = (sel.ob.x >= 0 && sel.nb.y > 0) ? sel.nb.y : term.bot;
+ LIMIT(row, term.top, term.bot);
+
+ colend = (sel.ob.x >= 0 && sel.nb.y > 0) ? sel.nb.x : term.col;
+ LIMIT(colend, 0, term.col);
+
+ /*
+ ** Scan from (term.row - 1,term.col - 1) to (0,0) and find
+ ** next occurrance of a URL
+ */
+ for (passes = 0; passes < term.row; passes++) {
+ /* Read in each column of every row until
+ ** we hit previous occurrence of URL
+ */
+ for (col = colend; col--;)
+ if (daddch(&dfa, term.line[row][col].u < 128 ? term.line[row][col].u : ' '))
+ break;
+
+ if (col >= 0)
+ break;
+
+ /* .i = 0 --> botton-up
+ * .i = 1 --> top-down
+ */
+ if (!arg->i) {
+ if (--row < 0)
+ row = term.row - 1;
+ } else {
+ if (++row >= term.row)
+ row = 0;
+ }
+
+ colend = term.col;
+ }
+
+ if (passes < term.row) {
+ selstart(col, row, 0);
+ selextend((col + dfa.length - 1) % term.col, row + (col + dfa.length - 1) / term.col, SEL_REGULAR, 0);
+ selextend((col + dfa.length - 1) % term.col, row + (col + dfa.length - 1) / term.col, SEL_REGULAR, 1);
+ xsetsel(getsel());
+ xclipcopy();
+ }
+}
diff --git a/st.h b/st.h
index fd3b0d8..baa8f29 100644
--- a/st.h
+++ b/st.h
@@ -85,6 +85,7 @@ void printscreen(const Arg *);
void printsel(const Arg *);
void sendbreak(const Arg *);
void toggleprinter(const Arg *);
+void copyurl(const Arg *);
int tattrset(int);
void tnew(int, int);
--
2.40.0

10
todo.md
View File

@ -1,6 +1,16 @@
- [ ] Create additional host configurations
- [ ] Implement the Impermanence module
* [Erase your darlings](https://grahamc.com/blog/erase-your-darlings/)
* [tmpfs as home](https://elis.nu/blog/2020/06/nixos-tmpfs-as-home/)
* [tmpfs as root](https://elis.nu/blog/2020/05/nixos-tmpfs-as-root/)
* [Impermanence - NixOS Wiki](https://nixos.wiki/wiki/Impermanence)
- [ ] Implement [Agenix](https://nixos.wiki/wiki/Agenix) or Sopsnix
* [Agenix Git Repo](https://github.com/ryantm/agenix)
* [Homeage Git Repo](https://github.com/jordanisaacs/homeage)
* [Handling Secrets in NixOS](https://lgug2z.com/articles/handling-secrets-in-nixos-an-overview/)
* [NixOS Secrets Management](https://onion.tube/watch?v=G5f6GC7SnhU)
- [ ] Implement [Stylix](https://danth.github.io/stylix/)
- [ ] Implement [MicroVM.nix](https://github.com/astro/microvm.nix)
- [ ] Figure out urlview and yank conflict with tmux plugins
- [ ] Implement [Nix-Colors](https://youtube.com/watch?v=jO2o0IN0LPE)
- [ ] Fix autoupdate with remote flake repo