Compare commits
3 Commits
e196a5f96f
...
f2d4c7c364
Author | SHA1 | Date |
---|---|---|
stupidcomputer | f2d4c7c364 | |
stupidcomputer | 275fa01164 | |
stupidcomputer | 405fed6955 |
|
@ -35,6 +35,10 @@ super + e
|
||||||
super + shift + e
|
super + shift + e
|
||||||
systemctl suspend
|
systemctl suspend
|
||||||
|
|
||||||
|
# password menu
|
||||||
|
super + z
|
||||||
|
passmenu
|
||||||
|
|
||||||
# manipulate a node
|
# manipulate a node
|
||||||
super + {_,ctrl +,shift + }{h,j,k,l}
|
super + {_,ctrl +,shift + }{h,j,k,l}
|
||||||
bspc node -{f,p,s} {west,south,north,east}
|
bspc node -{f,p,s} {west,south,north,east}
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
, xrandr
|
, xrandr
|
||||||
, svkbd
|
, svkbd
|
||||||
, xkbset
|
, xkbset
|
||||||
|
, rbw
|
||||||
|
, xclip
|
||||||
, libsForQt5
|
, libsForQt5
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
@ -29,7 +31,7 @@ stdenv.mkDerivation rec {
|
||||||
src = ./utils;
|
src = ./utils;
|
||||||
|
|
||||||
nativeBuildInputs = [ makeWrapper pkg-config libxcb ];
|
nativeBuildInputs = [ makeWrapper pkg-config libxcb ];
|
||||||
buildInputs = [ libxcb bash feh xrandr jq curl fzy ytfzf ffmpeg sshuttle svkbd scrcpy xkbset libsForQt5.kolourpaint ];
|
buildInputs = [ libxcb bash feh xrandr jq curl fzy ytfzf ffmpeg sshuttle svkbd scrcpy xkbset rbw xclip libsForQt5.kolourpaint ];
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
ls
|
ls
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
LDFLAGS=`pkg-config --cflags --libs xcb`
|
LDFLAGS=`pkg-config --cflags --libs xcb`
|
||||||
CFLAGS=-ggdb -fsanitize=address
|
CFLAGS=-ggdb -fsanitize=address
|
||||||
main: battery.o bspwm.o time.o battstatus.o
|
main: battery.o bspwm.o time.o battstatus.o message.o
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm *.o main
|
rm *.o main
|
||||||
|
|
|
@ -17,12 +17,14 @@
|
||||||
#include "battstatus.h"
|
#include "battstatus.h"
|
||||||
#include "bspwm.h"
|
#include "bspwm.h"
|
||||||
#include "time.h"
|
#include "time.h"
|
||||||
|
#include "message.h"
|
||||||
|
|
||||||
struct module mods[] = {
|
struct module mods[] = {
|
||||||
{mod_battery, "battery", "BAT0", { '\0' }},
|
{mod_battery, "battery", "BAT0", { '\0' }},
|
||||||
{mod_battstatus, "battstatus", "BAT0", { '\0' }},
|
{mod_battstatus, "battstatus", "BAT0", { '\0' }},
|
||||||
{mod_time, "time", "", { '\0' }},
|
{mod_time, "time", "", { '\0' }},
|
||||||
{mod_bspwm, "bspwm", "", { '\0' }},
|
{mod_bspwm, "bspwm", "", { '\0' }},
|
||||||
|
{mod_message, "message", "/home/usr/.cache/statusbar_notification", { '\0' }},
|
||||||
};
|
};
|
||||||
|
|
||||||
void create_module_proc(int index, char *pipename) {
|
void create_module_proc(int index, char *pipename) {
|
||||||
|
@ -59,17 +61,12 @@ void redraw() {
|
||||||
static char NAMED_PIPE[] = "/home/usr/.cache/statusbar_pipe";
|
static char NAMED_PIPE[] = "/home/usr/.cache/statusbar_pipe";
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
char pipename[BUFFER_SIZE];
|
|
||||||
srand(time(NULL));
|
srand(time(NULL));
|
||||||
strcpy(pipename, &NAMED_PIPE);
|
mkfifo(&NAMED_PIPE, 0666); /* it's okay if this fails */
|
||||||
pipename[sizeof(NAMED_PIPE) - 1] = 'A' + (rand() % 26);
|
int fd = open(&NAMED_PIPE, O_RDWR);
|
||||||
pipename[sizeof(NAMED_PIPE)] = 'A' + (rand() % 26);
|
|
||||||
pipename[sizeof(NAMED_PIPE) + 1] = '\0';
|
|
||||||
mkfifo(pipename, 0666);
|
|
||||||
int fd = open(pipename, O_RDWR);
|
|
||||||
struct message msg;
|
struct message msg;
|
||||||
|
|
||||||
create_module_procs(pipename);
|
create_module_procs(&NAMED_PIPE);
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
int ret = read(fd, &msg, sizeof(msg));
|
int ret = read(fd, &msg, sizeof(msg));
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/inotify.h>
|
||||||
|
|
||||||
|
#include "message.h"
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
|
int mod_message(char *config, char *name, char *pipename) {
|
||||||
|
struct message msg;
|
||||||
|
struct inotify_event buf;
|
||||||
|
strcpy(msg.name, name);
|
||||||
|
|
||||||
|
int fd = inotify_init();
|
||||||
|
int outfd = open(pipename, O_WRONLY);
|
||||||
|
|
||||||
|
for(;;) {
|
||||||
|
int watchdesc = inotify_add_watch(fd, config, IN_MODIFY);
|
||||||
|
read(fd, &buf, sizeof(struct inotify_event));
|
||||||
|
|
||||||
|
/* the file's changed, so reread it */
|
||||||
|
int filefd = open(config, O_RDONLY, 0);
|
||||||
|
int read_in = read(filefd, msg.content, sizeof(msg.content));
|
||||||
|
msg.content[read_in - 1] = '\0';
|
||||||
|
close(filefd);
|
||||||
|
|
||||||
|
/* write the new */
|
||||||
|
write(outfd, &msg, sizeof(msg));
|
||||||
|
inotify_rm_watch(fd, watchdesc); /* not sure why this is needed */
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
#ifndef STATUS_MESSAGE_H
|
||||||
|
#define STATUS_MESSAGE_H
|
||||||
|
|
||||||
|
int mod_message(char *config, char *name, char *pipename);
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,3 @@
|
||||||
|
cssid=$(nmcli -t -f IN-USE,SSID device wifi list | grep '^\*' | awk -F':' '{print $2}')
|
||||||
|
|
||||||
|
[ "WCS-BYOT" = "$cssid" ]
|
|
@ -0,0 +1,7 @@
|
||||||
|
# wrapper around rbw
|
||||||
|
|
||||||
|
resp=$(rbw list | tmenu)
|
||||||
|
|
||||||
|
rbw get "$resp" | xclip -selection clipboard
|
||||||
|
sleep 15
|
||||||
|
echo "cleared" | xclip -selection clipboard
|
|
@ -0,0 +1,11 @@
|
||||||
|
is_school && echo "enable the vpn"
|
||||||
|
mbsync --config=$HOME/.config/isync/config main
|
||||||
|
vdirsyncer sync
|
||||||
|
rbw sync
|
||||||
|
|
||||||
|
# check if we have new mail, and if so, notify
|
||||||
|
new=$(ls ~/Mail/main/INBOX/new | wc -l)
|
||||||
|
if [ "$new" -gt 0 ]; then
|
||||||
|
inbox=$(ls ~/Mail/main/INBOX/cur | wc -l)
|
||||||
|
printf "%i new email(s); %i total in inbox" "$new" "$inbox" > ~/.cache/statusbar_notification
|
||||||
|
fi
|
Loading…
Reference in New Issue