summaryrefslogtreecommitdiffstats
path: root/.config
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-08-26 16:10:08 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-08-26 16:10:08 +0200
commit07b6c6288308f05acb945eaf4e932411e5db4b62 (patch)
tree8d0fa02ae0c9502737c58492a616abfdd8cc79d5 /.config
parentinstall port script update (diff)
downloaddotfiles-bsd-07b6c6288308f05acb945eaf4e932411e5db4b62.tar.gz
dotfiles-bsd-07b6c6288308f05acb945eaf4e932411e5db4b62.tar.bz2
dotfiles-bsd-07b6c6288308f05acb945eaf4e932411e5db4b62.tar.xz
dotfiles-bsd-07b6c6288308f05acb945eaf4e932411e5db4b62.tar.zst
dotfiles-bsd-07b6c6288308f05acb945eaf4e932411e5db4b62.zip
No more multithread
Diffstat (limited to '.config')
-rwxr-xr-x.config/bspwm/bspwmrc196
-rwxr-xr-x.config/bspwm/network_thread.pl63
-rwxr-xr-x.config/bspwm/terms_thread.pl183
-rw-r--r--.config/zsh/alias.zsh38
4 files changed, 199 insertions, 281 deletions
diff --git a/.config/bspwm/bspwmrc b/.config/bspwm/bspwmrc
index cb7de0d..d64dfe4 100755
--- a/.config/bspwm/bspwmrc
+++ b/.config/bspwm/bspwmrc
@@ -3,6 +3,8 @@
use strict;
use warnings;
use Capture::Tiny qw(capture);
+use Time::HiRes;
+use WWW::Curl::Easy;
use constant {
SXHKD_PATH => '/usr/local/bin/sxhkd',
@@ -21,8 +23,16 @@ use constant {
LOWBAT_PATH => '/usr/local/bin/lowbat',
EMACS_PATH => '/usr/local/bin/emacs',
ALACRITTY_PATH => '/usr/local/bin/alacritty',
- TERMS_THREAD => '/usr/home/jozan/.config/bspwm/terms_thread.pl',
- NETWORK_THREAD => '/usr/home/jozan/.config/bspwm/network_thread.pl'
+ PGREP_PATH => '/bin/pgrep',
+ ESPEAK_PATH => '/usr/local/bin/espeak',
+ SH_PATH => '/bin/sh',
+ ZSH_PATH => '/usr/local/bin/zsh',
+ COWSAY_PATH => '/usr/local/bin/cowsay',
+ HTOP_PATH => '/usr/local/bin/htop',
+ GOTOP_PATH => '/usr/local/bin/gotop',
+ VIFM_PATH => '/usr/local/bin/vifm',
+ GIT_PATH => '/usr/local/bin/git',
+ QTOX_PATH => '/usr/local/bin/qtox'
};
use constant {
BSP_BORDER_WIDTH => 1,
@@ -33,9 +43,11 @@ use constant {
BSP_GAPLESS_MONOCLE => 'true',
BSP_SINGLE_MONOCLE => 'true',
XSET_R_RATE_DELAY => 200,
- XSET_R_RATE_RATE => 100,
+ XSET_R_RATE_RATE => 100
};
-use constant WALLPAPER_PATH => '/usr/home/jozan/Pictures/wallpaper.jpg';
+use constant WALLPAPER_PATH => '/usr/home/jozan/Pictures/wallpaper.jpg';
+use constant COWSAY_WELCOME => 'Welcome back, partner! And remember to try glest!';
+use constant NETWORK_TEST_URL => 'https://www.freebsd.org/';
sub run_if_dead
{
@@ -135,29 +147,181 @@ sub run_bg_programs
return;
}
-sub run_fg_programs
+sub run_espeak
{
- my ($screens) = @_;
- my $pid;
+ my $espeak_pid;
+
+ $espeak_pid = fork();
+ if (not $espeak_pid) {
+ exec(ESPEAK_PATH, COWSAY_WELCOME);
+ }
+ return;
+}
+
+sub fg_on_three_screens
+{
+ my @term_pid;
+
+ $term_pid[0] = fork();
+ if (not $term_pid[0]) {
+ exec(
+ ALACRITTY_PATH, '-e', SH_PATH, '-c',
+ COWSAY_PATH . ' "' . COWSAY_WELCOME . '"; ' . ZSH_PATH
+ );
+ exit;
+ }
+ Time::HiRes::sleep(3.6);
+ $term_pid[1] = fork();
+ if (not $term_pid[1]) {
+ exec(ALACRITTY_PATH, '-e', HTOP_PATH);
+ exit;
+ }
+ Time::HiRes::sleep(3.6);
+ $term_pid[2] = fork();
+ if (not $term_pid[2]) {
+ exec(ALACRITTY_PATH, '-e', GOTOP_PATH);
+ exit;
+ }
+ Time::HiRes::sleep(3.6);
+ system(BSPC_PATH, 'node', '-f', 'west');
+ $term_pid[3] = fork();
+ if (not $term_pid[3]) {
+ exec(ALACRITTY_PATH, '-e', VIFM_PATH);
+ exit;
+ }
+ Time::HiRes::sleep(3.6);
+ system(BSPC_PATH, 'node', '-z', 'right', '180', '0');
+ system(BSPC_PATH, 'node', '-z', 'top', '0', '70');
+ system(BSPC_PATH, 'node', '-f', 'east');
+ system(BSPC_PATH, 'node', '-f', 'north');
+ system(BSPC_PATH, 'node', '-z', 'bottom', '0', '-280');
+ system(BSPC_PATH, 'node', '-f', 'north');
+ system(BSPC_PATH, 'node', '-f', 'west');
+ return;
+}
+
+sub fg_on_two_screens
+{
+ my @term_pid;
+
+ $term_pid[0] = fork();
+ if (not $term_pid[0]) {
+ exec(
+ ALACRITTY_PATH, '-e', SH_PATH, '-c',
+ COWSAY_PATH . ' "' . COWSAY_WELCOME . '"; ' . ZSH_PATH
+ );
+ exit;
+ }
+ Time::HiRes::sleep(3.6);
+ $term_pid[1] = fork();
+ if (not $term_pid[1]) {
+ exec(ALACRITTY_PATH, '-e', HTOP_PATH);
+ exit;
+ }
+ Time::HiRes::sleep(3.6);
+ $term_pid[2] = fork();
+ if (not $term_pid[2]) {
+ exec(ALACRITTY_PATH, '-e', GOTOP_PATH);
+ exit;
+ }
+ Time::HiRes::sleep(3.6);
+ system(BSPC_PATH, 'node', '-f', 'west');
+ $term_pid[3] = fork();
+ if (not $term_pid[3]) {
+ exec(ALACRITTY_PATH, '-e', VIFM_PATH);
+ exit;
+ }
+ Time::HiRes::sleep(3.6);
+ system(BSPC_PATH, 'node', '-z', 'right', '180', '0');
+ system(BSPC_PATH, 'node', '-z', 'top', '0', '70');
+ system(BSPC_PATH, 'node', '-f', 'east');
+ system(BSPC_PATH, 'node', '-f', 'north');
+ system(BSPC_PATH, 'node', '-z', 'bottom', '0', '-280');
+ system(BSPC_PATH, 'node', '-f', 'north');
+ system(BSPC_PATH, 'node', '-f', 'west');
+ return;
+}
+
+sub fg_on_one_screen
+{
+ my @term_pid;
- $pid = fork();
- if (not $pid) {
- exec(TERMS_THREAD, $screens);
+ $term_pid[0] = fork();
+ if (not $term_pid[0]) {
+ exec(
+ ALACRITTY_PATH, '-e', SH_PATH, '-c',
+ COWSAY_PATH . ' "' . COWSAY_WELCOME . '"; ' . ZSH_PATH
+ );
exit;
}
- sleep(14);
+ Time::HiRes::sleep(3.6);
+ system(BSPC_PATH, 'node', '-p', 'west');
+ $term_pid[1] = fork();
+ if (not $term_pid[1]) {
+ exec(ALACRITTY_PATH, '-e', HTOP_PATH);
+ exit;
+ }
+ Time::HiRes::sleep(3.6);
+ $term_pid[2] = fork();
+ if (not $term_pid[2]) {
+ exec(ALACRITTY_PATH, '-e', GOTOP_PATH);
+ }
+ Time::HiRes::sleep(3.6);
+ system(BSPC_PATH, 'node', '-f', 'east');
+ $term_pid[3] = fork();
+ if (not $term_pid[3]) {
+ exec(ALACRITTY_PATH, '-e', VIFM_PATH);
+ }
+ Time::HiRes::sleep(3.6);
+ system(BSPC_PATH, 'node', '-f', 'west');
+ system(BSPC_PATH, 'node', '-f', 'north');
+ system(BSPC_PATH, 'node', '-z', 'bottom', '0', '-200');
+ system(BSPC_PATH, 'node', '-z', 'right', '-220', '0');
+ system(BSPC_PATH, 'node', '-f', 'east');
+ system(BSPC_PATH, 'node', '-z', 'bottom', '0', '70');
+ system(BSPC_PATH, 'node', '-f', 'north');
+ return;
+}
+
+sub run_terms
+{
+ my ($screens) = @_;
+
+ system(BSPC_PATH, 'desktop', '-f', '09');
+ if ($screens == 3) {
+ fg_on_three_screens();
+ }
+ elsif ($screens == 2) {
+ fg_on_two_screens();
+ }
+ else {
+ fg_on_one_screen();
+ }
+ system(BSPC_PATH, 'desktop', '-f', '01');
+ return;
+}
+
+sub run_fg_programs
+{
+ my ($screens) = @_;
+
+ run_espeak();
+ run_terms($screens);
run_if_dead(EMACS_PATH);
return;
}
sub run_network_programs
{
- my $pid;
+ my $curl;
+ my $response_body;
- $pid = fork();
- if (not $pid) {
- exec(NETWORK_THREAD);
- exit;
+ $curl = WWW::Curl::Easy->new;
+ $curl->setopt(CURLOPT_URL, NETWORK_TEST_URL);
+ $curl->setopt(CURLOPT_WRITEDATA, \$response_body);
+ if ($curl->perform == 0) {
+ system(GIT_PATH, '-C', '/usr/home/jozan/.elfeed', 'pull', 'origin', 'master');
+ run_if_dead(QTOX_PATH);
}
return;
}
diff --git a/.config/bspwm/network_thread.pl b/.config/bspwm/network_thread.pl
deleted file mode 100755
index 105d186..0000000
--- a/.config/bspwm/network_thread.pl
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/usr/local/bin/perl
-
-use strict;
-use warnings;
-use Capture::Tiny qw(capture);
-use WWW::Curl::Easy;
-
-use constant {
- PGREP_PATH => '/bin/pgrep',
- GIT_PATH => '/usr/local/bin/git',
- QTOX_PATH => '/usr/local/bin/qtox'
-};
-use constant NETWORK_TEST_URL => 'https://www.freebsd.org/';
-
-sub run_if_dead
-{
- my @argv = @_;
- my $bin;
- my $pid;
-
- $bin = $argv[0];
- $bin =~ s/.+\///g;
- my (undef, undef, $retval) = capture {
- system(
- PGREP_PATH,
- $bin
- );
- };
- $retval = ($retval >> 8) & 0xff;
- if ($retval != 0) {
- $pid = fork();
- if (not $pid) {
- exec(@argv);
- exit;
- }
- }
- return;
-}
-
-sub run_network_programs
-{
- my $curl;
- my $response_body;
-
- $curl = WWW::Curl::Easy->new;
- $curl->setopt(CURLOPT_URL, NETWORK_TEST_URL);
- $curl->setopt(CURLOPT_WRITEDATA, \$response_body);
- if ($curl->perform == 0) {
- system(GIT_PATH, '-C', '/usr/home/jozan/.elfeed', 'pull', 'origin', 'master');
- run_if_dead(QTOX_PATH);
- }
- return;
-}
-
-sub main
-{
- run_network_programs();
- return;
-}
-
-main();
-
-__END__
diff --git a/.config/bspwm/terms_thread.pl b/.config/bspwm/terms_thread.pl
deleted file mode 100755
index ca798a2..0000000
--- a/.config/bspwm/terms_thread.pl
+++ /dev/null
@@ -1,183 +0,0 @@
-#!/usr/local/bin/perl
-
-use strict;
-use warnings;
-use Time::HiRes;
-
-use constant {
- BSPC_PATH => '/usr/local/bin/bspc',
- ESPEAK_PATH => '/usr/local/bin/espeak',
- ALACRITTY_PATH => '/usr/local/bin/alacritty',
- SH_PATH => '/bin/sh',
- ZSH_PATH => '/usr/local/bin/zsh',
- COWSAY_PATH => '/usr/local/bin/cowsay',
- HTOP_PATH => '/usr/local/bin/htop',
- GOTOP_PATH => '/usr/local/bin/gotop',
- VIFM_PATH => '/usr/local/bin/vifm'
-};
-use constant COWSAY_WELCOME => 'Welcome back, partner! And remember to try glest!';
-
-sub run_espeak
-{
- my $espeak_pid;
-
- $espeak_pid = fork();
- if (not $espeak_pid) {
- exec(ESPEAK_PATH, COWSAY_WELCOME);
- }
- return;
-}
-
-sub fg_on_three_screens
-{
- my @term_pid;
-
- $term_pid[0] = fork();
- if (not $term_pid[0]) {
- exec(
- ALACRITTY_PATH, '-e', SH_PATH, '-c',
- COWSAY_PATH . ' "' . COWSAY_WELCOME . '"; ' . ZSH_PATH
- );
- exit;
- }
- Time::HiRes::sleep(3.6);
- $term_pid[1] = fork();
- if (not $term_pid[1]) {
- exec(ALACRITTY_PATH, '-e', HTOP_PATH);
- exit;
- }
- Time::HiRes::sleep(3.6);
- $term_pid[2] = fork();
- if (not $term_pid[2]) {
- exec(ALACRITTY_PATH, '-e', GOTOP_PATH);
- exit;
- }
- Time::HiRes::sleep(3.6);
- system(BSPC_PATH, 'node', '-f', 'west');
- $term_pid[3] = fork();
- if (not $term_pid[3]) {
- exec(ALACRITTY_PATH, '-e', VIFM_PATH);
- exit;
- }
- Time::HiRes::sleep(3.6);
- system(BSPC_PATH, 'node', '-z', 'right', '180', '0');
- system(BSPC_PATH, 'node', '-z', 'top', '0', '70');
- system(BSPC_PATH, 'node', '-f', 'east');
- system(BSPC_PATH, 'node', '-f', 'north');
- system(BSPC_PATH, 'node', '-z', 'bottom', '0', '-280');
- system(BSPC_PATH, 'node', '-f', 'north');
- system(BSPC_PATH, 'node', '-f', 'west');
- return;
-}
-
-sub fg_on_two_screens
-{
- my @term_pid;
-
- $term_pid[0] = fork();
- if (not $term_pid[0]) {
- exec(
- ALACRITTY_PATH, '-e', SH_PATH, '-c',
- COWSAY_PATH . ' "' . COWSAY_WELCOME . '"; ' . ZSH_PATH
- );
- exit;
- }
- Time::HiRes::sleep(3.6);
- $term_pid[1] = fork();
- if (not $term_pid[1]) {
- exec(ALACRITTY_PATH, '-e', HTOP_PATH);
- exit;
- }
- Time::HiRes::sleep(3.6);
- $term_pid[2] = fork();
- if (not $term_pid[2]) {
- exec(ALACRITTY_PATH, '-e', GOTOP_PATH);
- exit;
- }
- Time::HiRes::sleep(3.6);
- system(BSPC_PATH, 'node', '-f', 'west');
- $term_pid[3] = fork();
- if (not $term_pid[3]) {
- exec(ALACRITTY_PATH, '-e', VIFM_PATH);
- exit;
- }
- Time::HiRes::sleep(3.6);
- system(BSPC_PATH, 'node', '-z', 'right', '180', '0');
- system(BSPC_PATH, 'node', '-z', 'top', '0', '70');
- system(BSPC_PATH, 'node', '-f', 'east');
- system(BSPC_PATH, 'node', '-f', 'north');
- system(BSPC_PATH, 'node', '-z', 'bottom', '0', '-280');
- system(BSPC_PATH, 'node', '-f', 'north');
- system(BSPC_PATH, 'node', '-f', 'west');
- return;
-}
-
-sub fg_on_one_screen
-{
- my @term_pid;
-
- $term_pid[0] = fork();
- if (not $term_pid[0]) {
- exec(
- ALACRITTY_PATH, '-e', SH_PATH, '-c',
- COWSAY_PATH . ' "' . COWSAY_WELCOME . '"; ' . ZSH_PATH
- );
- exit;
- }
- Time::HiRes::sleep(3.6);
- system(BSPC_PATH, 'node', '-p', 'west');
- $term_pid[1] = fork();
- if (not $term_pid[1]) {
- exec(ALACRITTY_PATH, '-e', HTOP_PATH);
- exit;
- }
- Time::HiRes::sleep(3.6);
- $term_pid[2] = fork();
- if (not $term_pid[2]) {
- exec(ALACRITTY_PATH, '-e', GOTOP_PATH);
- }
- Time::HiRes::sleep(3.6);
- system(BSPC_PATH, 'node', '-f', 'east');
- $term_pid[3] = fork();
- if (not $term_pid[3]) {
- exec(ALACRITTY_PATH, '-e', VIFM_PATH);
- }
- Time::HiRes::sleep(3.6);
- system(BSPC_PATH, 'node', '-f', 'west');
- system(BSPC_PATH, 'node', '-f', 'north');
- system(BSPC_PATH, 'node', '-z', 'bottom', '0', '-200');
- system(BSPC_PATH, 'node', '-z', 'right', '-220', '0');
- system(BSPC_PATH, 'node', '-f', 'east');
- system(BSPC_PATH, 'node', '-z', 'bottom', '0', '70');
- system(BSPC_PATH, 'node', '-f', 'north');
- return;
-}
-
-sub run_terms
-{
- my ($screens) = @_;
-
- system(BSPC_PATH, 'desktop', '-f', '09');
- if ($screens == 3) {
- fg_on_three_screens();
- }
- elsif ($screens == 2) {
- fg_on_two_screens();
- }
- else {
- fg_on_one_screen();
- }
- system(BSPC_PATH, 'desktop', '-f', '01');
- return;
-}
-
-sub main
-{
- run_espeak();
- run_terms($ARGV[0]);
- return;
-}
-
-main();
-
-__END__
diff --git a/.config/zsh/alias.zsh b/.config/zsh/alias.zsh
index 3cf8e99..5ccc521 100644
--- a/.config/zsh/alias.zsh
+++ b/.config/zsh/alias.zsh
@@ -1,21 +1,21 @@
-alias ls='ls -lohGF'
-alias c='clear'
-alias less='less --tabs 4'
-alias bc='clear; bc -l'
-alias emacs='emacs -nw'
-alias mkf='gmake fclean'
-alias mkc='gmake clean'
-alias mk='gmake -j5'
-alias web='w3m https://duckduckgo.com/'
-alias cp='cp -iv'
-alias mv='mv -iv'
-alias rm='rm -v'
-alias ln='ln -v'
-alias mkdir='mkdir -v'
-alias rmdir='rmdir -v'
-alias chmod='chmod -v'
-alias chown='chown -v'
-alias grep='grep --color'
-alias tree='tree -C'
+alias ls='/usr/local/bin/exa -l'
+alias c='/usr/bin/clear'
+alias less='/usr/bin/less --tabs 4'
+alias bc='/usr/bin/clear; /usr/bin/bc -l'
+alias emacs='/usr/local/bin/emacs -nw'
+alias mkf='/usr/local/bin/gmake fclean'
+alias mkc='/usr/local/bin/gmake clean'
+alias mk='/usr/local/bin/gmake -j5'
+alias web='/usr/local/bin/w3m https://duckduckgo.com/'
+alias cp='/bin/cp -iv'
+alias mv='/bin/mv -iv'
+alias rm='/bin/rm -v'
+alias ln='/bin/ln -v'
+alias mkdir='/bin/mkdir -v'
+alias rmdir='/bin/rmdir -v'
+alias chmod='/bin/chmod -v'
+alias chown='/usr/sbin/chown -v'
+alias grep='/usr/bin/grep --color'
+alias tree='/usr/local/bin/tree -C'
alias ccache='/usr/local/bin/ccache'
alias dotgit='/usr/local/bin/git --git-dir=$HOME/Documents/dotfiles-bsd --work-tree=$HOME'