From 598f965e6278d89284bcb2d1db1302848426221b Mon Sep 17 00:00:00 2001 From: lucashemi Date: Sun, 18 Sep 2022 22:09:19 -0300 Subject: commit --- .Xresources | 7 ++ .config/gtk-2.0/.gtkrc-2.0 | 11 +++ .config/gtk-2.0/gtkfilechooser.ini | 11 +++ .config/gtk-3.0/colors.css | 77 +++++++++++++++++++ .config/gtk-3.0/gtk.css | 1 + .config/gtk-3.0/settings.ini | 13 ++++ .config/gtk-4.0/settings.ini | 9 +++ .config/mimeapps.list | 4 + .config/user-dirs.dirs | 9 +++ .config/user-dirs.locale | 1 + .config/wal/templates/colors-wal-dwm.h | 13 ++++ .config/x11/.xinitrc | 43 +++++++++++ .config/zsh/.zshrc | 131 +++++++++++++++++++++++++++++++++ .gitconfig | 5 ++ .local/bin/battery | 37 ++++++++++ .local/bin/clock | 29 ++++++++ .local/bin/cpu | 12 +++ .local/bin/current.txt | 2 + .local/bin/forecast | 35 +++++++++ .local/bin/internet | 26 +++++++ .local/bin/kbselect | 17 +++++ .local/bin/memory | 12 +++ .local/bin/volume | 30 ++++++++ .xinitrc | 1 + .zshrc | 1 + 25 files changed, 537 insertions(+) create mode 100644 .Xresources create mode 100644 .config/gtk-2.0/.gtkrc-2.0 create mode 100644 .config/gtk-2.0/gtkfilechooser.ini create mode 100644 .config/gtk-3.0/colors.css create mode 100644 .config/gtk-3.0/gtk.css create mode 100644 .config/gtk-3.0/settings.ini create mode 100644 .config/gtk-4.0/settings.ini create mode 100644 .config/mimeapps.list create mode 100644 .config/user-dirs.dirs create mode 100644 .config/user-dirs.locale create mode 100644 .config/wal/templates/colors-wal-dwm.h create mode 100644 .config/x11/.xinitrc create mode 100644 .config/zsh/.zshrc create mode 100644 .gitconfig create mode 100755 .local/bin/battery create mode 100755 .local/bin/clock create mode 100755 .local/bin/cpu create mode 100644 .local/bin/current.txt create mode 100755 .local/bin/forecast create mode 100755 .local/bin/internet create mode 100755 .local/bin/kbselect create mode 100755 .local/bin/memory create mode 100755 .local/bin/volume create mode 120000 .xinitrc create mode 120000 .zshrc diff --git a/.Xresources b/.Xresources new file mode 100644 index 0000000..15b138f --- /dev/null +++ b/.Xresources @@ -0,0 +1,7 @@ +Xft.autohint: 0 +Xft.lcdfilter: lcddefault +Xft.hintstyle: hintslight +Xft.hinting: 1 +Xft.antialias: 1 +Xft.rgba: rgb +Xcursor.theme: Simple-Tokyo-Night diff --git a/.config/gtk-2.0/.gtkrc-2.0 b/.config/gtk-2.0/.gtkrc-2.0 new file mode 100644 index 0000000..236cb25 --- /dev/null +++ b/.config/gtk-2.0/.gtkrc-2.0 @@ -0,0 +1,11 @@ +gtk-enable-animations=1 +gtk-primary-button-warps-slider=0 +gtk-toolbar-style=3 +gtk-menu-images=1 +gtk-button-images=1 +gtk-cursor-theme-size=24 +gtk-font-name="Noto Sans, Medium 10" +gtk-icon-theme-name="Material-Black-Blueberry-Suru" +gtk-theme-name="Material-Black-Blueberry" +gtk-cursor-theme-name="Simple-Tokyo-Night" + diff --git a/.config/gtk-2.0/gtkfilechooser.ini b/.config/gtk-2.0/gtkfilechooser.ini new file mode 100644 index 0000000..45d15d1 --- /dev/null +++ b/.config/gtk-2.0/gtkfilechooser.ini @@ -0,0 +1,11 @@ +[Filechooser Settings] +LocationMode=path-bar +ShowHidden=false +ShowSizeColumn=true +GeometryX=0 +GeometryY=20 +GeometryWidth=780 +GeometryHeight=609 +SortColumn=name +SortOrder=ascending +StartupMode=recent diff --git a/.config/gtk-3.0/colors.css b/.config/gtk-3.0/colors.css new file mode 100644 index 0000000..e54adbf --- /dev/null +++ b/.config/gtk-3.0/colors.css @@ -0,0 +1,77 @@ +@define-color borders_breeze #5f6265; +@define-color content_view_bg_breeze #1b1e20; +@define-color error_color_backdrop_breeze #da4453; +@define-color error_color_breeze #da4453; +@define-color error_color_insensitive_backdrop_breeze #592930; +@define-color error_color_insensitive_breeze #592930; +@define-color insensitive_base_color_breeze #1a1d1f; +@define-color insensitive_base_fg_color_breeze #656768; +@define-color insensitive_bg_color_breeze #282c30; +@define-color insensitive_borders_breeze #3a3d41; +@define-color insensitive_fg_color_breeze #6e7173; +@define-color insensitive_selected_bg_color_breeze #282c30; +@define-color insensitive_selected_fg_color_breeze #6e7173; +@define-color insensitive_unfocused_bg_color_breeze #282c30; +@define-color insensitive_unfocused_fg_color_breeze #6e7173; +@define-color insensitive_unfocused_selected_bg_color_breeze #282c30; +@define-color insensitive_unfocused_selected_fg_color_breeze #6e7173; +@define-color link_color_breeze #1d99f3; +@define-color link_visited_color_breeze #9b59b6; +@define-color success_color_backdrop_breeze #27ae60; +@define-color success_color_breeze #27ae60; +@define-color success_color_insensitive_backdrop_breeze #1e4d34; +@define-color success_color_insensitive_breeze #1e4d34; +@define-color theme_base_color_breeze #1b1e20; +@define-color theme_bg_color_breeze #2a2e32; +@define-color theme_button_background_backdrop_breeze #31363b; +@define-color theme_button_background_backdrop_insensitive_breeze #2f3338; +@define-color theme_button_background_insensitive_breeze #2f3338; +@define-color theme_button_background_normal_breeze #31363b; +@define-color theme_button_decoration_focus_backdrop_breeze #3daee9; +@define-color theme_button_decoration_focus_backdrop_insensitive_breeze #335c72; +@define-color theme_button_decoration_focus_breeze #3daee9; +@define-color theme_button_decoration_focus_insensitive_breeze #335c72; +@define-color theme_button_decoration_hover_backdrop_breeze #3daee9; +@define-color theme_button_decoration_hover_backdrop_insensitive_breeze #335c72; +@define-color theme_button_decoration_hover_breeze #3daee9; +@define-color theme_button_decoration_hover_insensitive_breeze #335c72; +@define-color theme_button_foreground_active_backdrop_breeze #fcfcfc; +@define-color theme_button_foreground_active_backdrop_insensitive_breeze #6e7173; +@define-color theme_button_foreground_active_breeze #fcfcfc; +@define-color theme_button_foreground_active_insensitive_breeze #6e7173; +@define-color theme_button_foreground_backdrop_breeze #fcfcfc; +@define-color theme_button_foreground_backdrop_insensitive_breeze #727679; +@define-color theme_button_foreground_insensitive_breeze #727679; +@define-color theme_button_foreground_normal_breeze #fcfcfc; +@define-color theme_fg_color_breeze #fcfcfc; +@define-color theme_hovering_selected_bg_color_breeze #3daee9; +@define-color theme_selected_bg_color_breeze #3daee9; +@define-color theme_selected_fg_color_breeze #fcfcfc; +@define-color theme_text_color_breeze #fcfcfc; +@define-color theme_titlebar_background_backdrop_breeze #2a2e32; +@define-color theme_titlebar_background_breeze #31363b; +@define-color theme_titlebar_background_light_breeze #2a2e32; +@define-color theme_titlebar_foreground_backdrop_breeze #a1a9b1; +@define-color theme_titlebar_foreground_breeze #fcfcfc; +@define-color theme_titlebar_foreground_insensitive_backdrop_breeze #a1a9b1; +@define-color theme_titlebar_foreground_insensitive_breeze #a1a9b1; +@define-color theme_unfocused_base_color_breeze #1b1e20; +@define-color theme_unfocused_bg_color_breeze #2a2e32; +@define-color theme_unfocused_fg_color_breeze #fcfcfc; +@define-color theme_unfocused_selected_bg_color_alt_breeze #1f485e; +@define-color theme_unfocused_selected_bg_color_breeze #1f485e; +@define-color theme_unfocused_selected_fg_color_breeze #fcfcfc; +@define-color theme_unfocused_text_color_breeze #fcfcfc; +@define-color theme_unfocused_view_bg_color_breeze #1a1d1f; +@define-color theme_unfocused_view_text_color_breeze #656768; +@define-color theme_view_active_decoration_color_breeze #3daee9; +@define-color theme_view_hover_decoration_color_breeze #3daee9; +@define-color tooltip_background_breeze #31363b; +@define-color tooltip_border_breeze #64686b; +@define-color tooltip_text_breeze #fcfcfc; +@define-color unfocused_borders_breeze #5f6265; +@define-color unfocused_insensitive_borders_breeze #3a3d41; +@define-color warning_color_backdrop_breeze #f67400; +@define-color warning_color_breeze #f67400; +@define-color warning_color_insensitive_backdrop_breeze #633914; +@define-color warning_color_insensitive_breeze #633914; diff --git a/.config/gtk-3.0/gtk.css b/.config/gtk-3.0/gtk.css new file mode 100644 index 0000000..c9763f7 --- /dev/null +++ b/.config/gtk-3.0/gtk.css @@ -0,0 +1 @@ +@import 'colors.css'; \ No newline at end of file diff --git a/.config/gtk-3.0/settings.ini b/.config/gtk-3.0/settings.ini new file mode 100644 index 0000000..ca5b9d0 --- /dev/null +++ b/.config/gtk-3.0/settings.ini @@ -0,0 +1,13 @@ +[Settings] +gtk-application-prefer-dark-theme=true +gtk-button-images=true +gtk-cursor-theme-name=Simple-Tokyo-Night +gtk-cursor-theme-size=24 +gtk-decoration-layout=icon:minimize,maximize,close +gtk-enable-animations=true +gtk-font-name=Noto Sans, Medium 10 +gtk-icon-theme-name=Material-Black-Blueberry-Suru +gtk-menu-images=true +gtk-primary-button-warps-slider=false +gtk-theme-name=Material-Black-Blueberry +gtk-toolbar-style=3 diff --git a/.config/gtk-4.0/settings.ini b/.config/gtk-4.0/settings.ini new file mode 100644 index 0000000..eaccca6 --- /dev/null +++ b/.config/gtk-4.0/settings.ini @@ -0,0 +1,9 @@ +[Settings] +gtk-application-prefer-dark-theme=true +gtk-cursor-theme-name=breeze_cursors +gtk-cursor-theme-size=24 +gtk-decoration-layout=icon:minimize,maximize,close +gtk-enable-animations=true +gtk-font-name=Noto Sans, Medium 10 +gtk-icon-theme-name=breeze-dark +gtk-primary-button-warps-slider=false diff --git a/.config/mimeapps.list b/.config/mimeapps.list new file mode 100644 index 0000000..d277893 --- /dev/null +++ b/.config/mimeapps.list @@ -0,0 +1,4 @@ +[Default Applications] +x-scheme-handler/geo=google-maps-geo-handler.desktop; +x-scheme-handler/http=firefox.desktop; +x-scheme-handler/https=firefox.desktop; diff --git a/.config/user-dirs.dirs b/.config/user-dirs.dirs new file mode 100644 index 0000000..20393b0 --- /dev/null +++ b/.config/user-dirs.dirs @@ -0,0 +1,9 @@ +XDG_DOWNLOAD_DIR="$HOME/Downloads" +XDG_DOCUMENTS_DIR="$HOME/Documents" +XDG_MUSIC_DIR="$HOME/Music" +XDG_PICTURES_DIR="$HOME/Pictures" +XDG_VIDEOS_DIR="$HOME/Videos" + +XDG_PUBLICSHARE_DIR="$HOME/" +XDG_DESKTOP_DIR="$HOME/" +XDG_TEMPLATES_DIR="$HOME/" diff --git a/.config/user-dirs.locale b/.config/user-dirs.locale new file mode 100644 index 0000000..7741b83 --- /dev/null +++ b/.config/user-dirs.locale @@ -0,0 +1 @@ +en_US diff --git a/.config/wal/templates/colors-wal-dwm.h b/.config/wal/templates/colors-wal-dwm.h new file mode 100644 index 0000000..872bc1a --- /dev/null +++ b/.config/wal/templates/colors-wal-dwm.h @@ -0,0 +1,13 @@ +static const char norm_fg[] = "{color15}"; +static const char norm_bg[] = "{color0}"; +static const char norm_border[] = "{color8}"; + +static const char sel_fg[] = "{color15}"; +static const char sel_bg[] = "{color2}"; +static const char sel_border[] = "{color15}"; + +static const char *colors[][3] = {{ + /* fg bg border */ + [SchemeNorm] = {{ norm_fg, norm_bg, norm_border }}, // unfocused wins + [SchemeSel] = {{ sel_fg, sel_bg, sel_border }}, // the focused win + }}; diff --git a/.config/x11/.xinitrc b/.config/x11/.xinitrc new file mode 100644 index 0000000..ccca54b --- /dev/null +++ b/.config/x11/.xinitrc @@ -0,0 +1,43 @@ +#!/bin/sh + +userresources=$HOME/.Xresources +usermodmap=$HOME/.Xmodmap +sysresources=/etc/X11/xinit/.Xresources +sysmodmap=/etc/X11/xinit/.Xmodmap + +# merge in defaults and keymaps + +if [ -f $sysresources ]; then + xrdb -merge $sysresources +fi + +if [ -f $sysmodmap ]; then + xmodmap $sysmodmap +fi + +if [ -f "$userresources" ]; then + xrdb -merge "$userresources" +fi + +if [ -f "$usermodmap" ]; then + xmodmap "$usermodmap" +fi + +# start some nice programs + +if [ -d /etc/X11/xinit/xinitrc.d ] ; then + for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do + [ -x "$f" ] && . "$f" + done + unset f +fi + +dwmblocks & +setxkbmap en & +xcompmgr & +dunst & +xset r rate 200 30 & +unclutter & +xwallpaper --zoom /home/lucashemi/Documents/Wallpapers/wallpaper.jpg & +wal -Rn & +exec dwm diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc new file mode 100644 index 0000000..e106907 --- /dev/null +++ b/.config/zsh/.zshrc @@ -0,0 +1,131 @@ +# If you come from bash you might have to change your $PATH. +# export PATH=$HOME/bin:/usr/local/bin:$PATH + +# Path to your oh-my-zsh installation. +export ZSH="$HOME/.config/zsh/.oh-my-zsh" + +# Set name of the theme to load --- if set to "random", it will +# load a random theme each time oh-my-zsh is loaded, in which case, +# to know which specific one was loaded, run: echo $RANDOM_THEME +# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes +ZSH_THEME="alanpeabody" + +# Set list of themes to pick from when loading at random +# Setting this variable when ZSH_THEME=random will cause zsh to load +# a theme from this variable instead of looking in $ZSH/themes/ +# If set to an empty array, this variable will have no effect. +# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) + +# Uncomment the following line to use case-sensitive completion. +# CASE_SENSITIVE="true" + +# Uncomment the following line to use hyphen-insensitive completion. +# Case-sensitive completion must be off. _ and - will be interchangeable. +# HYPHEN_INSENSITIVE="true" + +# Uncomment one of the following lines to change the auto-update behavior +# zstyle ':omz:update' mode disabled # disable automatic updates +# zstyle ':omz:update' mode auto # update automatically without asking +# zstyle ':omz:update' mode reminder # just remind me to update when it's time + +# Uncomment the following line to change how often to auto-update (in days). +# zstyle ':omz:update' frequency 13 + +# Uncomment the following line if pasting URLs and other text is messed up. +# DISABLE_MAGIC_FUNCTIONS="true" + +# Uncomment the following line to disable colors in ls. +# DISABLE_LS_COLORS="true" + +# Uncomment the following line to disable auto-setting terminal title. +# DISABLE_AUTO_TITLE="true" + +# Uncomment the following line to enable command auto-correction. +# ENABLE_CORRECTION="true" + +# Uncomment the following line to display red dots whilst waiting for completion. +# You can also set it to another string to have that shown instead of the default red dots. +# e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f" +# Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765) +# COMPLETION_WAITING_DOTS="true" + +# Uncomment the following line if you want to disable marking untracked files +# under VCS as dirty. This makes repository status check for large repositories +# much, much faster. +# DISABLE_UNTRACKED_FILES_DIRTY="true" + +# Uncomment the following line if you want to change the command execution time +# stamp shown in the history command output. +# You can set one of the optional three formats: +# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" +# or set a custom format using the strftime function format specifications, +# see 'man strftime' for details. +# HIST_STAMPS="mm/dd/yyyy" + +# Would you like to use another custom folder than $ZSH/custom? +# ZSH_CUSTOM=/path/to/new-custom-folder + +# Which plugins would you like to load? +# Standard plugins can be found in $ZSH/plugins/ +# Custom plugins may be added to $ZSH_CUSTOM/plugins/ +# Example format: plugins=(rails git textmate ruby lighthouse) +# Add wisely, as too many plugins slow down shell startup. +plugins=(git) + +source $ZSH/oh-my-zsh.sh + +# User configuration + +# export MANPATH="/usr/local/man:$MANPATH" + +# You may need to manually set your language environment +# export LANG=en_US.UTF-8 + +# Preferred editor for local and remote sessions +# if [[ -n $SSH_CONNECTION ]]; then +# export EDITOR='vim' +# else +# export EDITOR='mvim' +# fi + +# Compilation flags +# export ARCHFLAGS="-arch x86_64" + +# Set personal aliases, overriding those provided by oh-my-zsh libs, +# plugins, and themes. Aliases can be placed here, though oh-my-zsh +# users are encouraged to define aliases within the ZSH_CUSTOM folder. +# For a full list of active aliases, run `alias`. +# +# Example aliases +# alias zshconfig="mate ~/.zshrc" +# alias ohmyzsh="mate ~/.oh-my-zsh" +# My custom aliases +alias config='/usr/bin/git --git-dir=/home/lucashemi/.dotfiles/ --work-tree=/home/lucashemi' +alias weather="curl wttr.in" +alias grep="grep --color=auto" +export PATH=$PATH:~/scripts + +export EDITOR="vim" +export TERMINAL="st" +export BROWSER="firefox" + +export XDG_CONFIG_HOME="$HOME/.config" +export XDG_DATA_HOME="$HOME/.local/share" +export XDG_CACHE_HOME="$HOME/.cache" + +export XINITRC="$XDG_CONFIG_HOME/x11/xinitrc" +export ZDOTDIR="$XDG_CONFIG_HOME/zsh" +export XAUTHORITY="$HOME/.Xauthority" + + +#PS1 +#PROMPT="%n@%m:%~ $ " +# Bash profile +export PATH=$HOME/.local/bin:$PATH + +#[[ -f ~/.bashrc ]] && . ~/.bashrc + +# StartX auto +if [ -z "${DISPLAY}" ] && [ "${XDG_VTNR}" -eq 1 ]; then + exec startx +fi diff --git a/.gitconfig b/.gitconfig new file mode 100644 index 0000000..307db95 --- /dev/null +++ b/.gitconfig @@ -0,0 +1,5 @@ +[user] + email = lucasxberger@gmail.com + name = lucashemi +[init] + defaultBranch = main diff --git a/.local/bin/battery b/.local/bin/battery new file mode 100755 index 0000000..3397395 --- /dev/null +++ b/.local/bin/battery @@ -0,0 +1,37 @@ +#!/bin/sh + +# Prints all batteries, their percentage remaining and an emoji corresponding +# to charge status (🔌 for plugged up, 🔋 for discharging on battery, etc.). + +case $BLOCK_BUTTON in + 3) notify-send "🔋 Battery module" "🔋: discharging +🛑: not charging +♻: stagnant charge +🔌: charging +: charged +❗: battery very low! +- Scroll to change adjust xbacklight." ;; + 4) xbacklight -inc 10 ;; + 5) xbacklight -dec 10 ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +# Loop through all attached batteries and format the info +for battery in /sys/class/power_supply/BAT?*; do + # If non-first battery, print a space separator. + [ -n "${capacity+x}" ] && printf " " + # Sets up the status and capacity + case "$(cat "$battery/status" 2>&1)" in + "Full") status="" ;; + "Discharging") status="🔋" ;; + "Charging") status="🔌" ;; + "Not charging") status="🛑" ;; + "Unknown") status="♻️" ;; + *) exit 1 ;; + esac + capacity="$(cat "$battery/capacity" 2>&1)" + # Will make a warn variable if discharging and low + [ "$status" = "🔋" ] && [ "$capacity" -le 25 ] && warn="❗" + # Prints the info + printf "%s%s%d%%" "$status" "$warn" "$capacity"; unset warn +done && printf "\\n" diff --git a/.local/bin/clock b/.local/bin/clock new file mode 100755 index 0000000..906401b --- /dev/null +++ b/.local/bin/clock @@ -0,0 +1,29 @@ +#!/bin/sh + +clock=$(date '+%I') + +case "$clock" in + "00") icon=" " ;; + "01") icon=" " ;; + "02") icon=" " ;; + "03") icon=" " ;; + "04") icon=" " ;; + "05") icon=" " ;; + "06") icon=" " ;; + "07") icon=" " ;; + "08") icon=" " ;; + "09") icon=" " ;; + "10") icon=" " ;; + "11") icon=" " ;; + "12") icon=" " ;; +esac + +case $BLOCK_BUTTON in + 1) notify-send "This Month" "$(cal --color=always | sed "s/..7m//;s/..27m/<\/span><\/b>/")" && notify-send "Appointments" "$(calcurse -d3)" ;; + 2) setsid -f "$TERMINAL" -e calcurse ;; + 3) notify-send "📅 Time/date module" "\- Left click to show upcoming appointments for the next three days via \`calcurse -d3\` and show the month via \`cal\` +- Middle click opens calcurse if installed" ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +date "+%Y %b %d (%a) $icon%I:%M%p" diff --git a/.local/bin/cpu b/.local/bin/cpu new file mode 100755 index 0000000..6f5da6d --- /dev/null +++ b/.local/bin/cpu @@ -0,0 +1,12 @@ +#!/bin/sh + +case $BLOCK_BUTTON in + 1) notify-send "🖥 CPU hogs" "$(ps axch -o cmd:15,%cpu --sort=-%cpu | head)\\n(100% per core)" ;; + 2) setsid -f "$TERMINAL" -e htop ;; + 3) notify-send "🖥 CPU module " "\- Shows CPU temperature. +- Click to show intensive processes. +- Middle click to open htop." ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +sensors | awk '/temp1:/ {print "[ " $3 "]"}' diff --git a/.local/bin/current.txt b/.local/bin/current.txt new file mode 100644 index 0000000..c1a07cb --- /dev/null +++ b/.local/bin/current.txt @@ -0,0 +1,2 @@ +Weather, Volume, Memory, KeyB, DateNHour +Thanks LukeSmith for making these scripts! diff --git a/.local/bin/forecast b/.local/bin/forecast new file mode 100755 index 0000000..a169dc7 --- /dev/null +++ b/.local/bin/forecast @@ -0,0 +1,35 @@ +#!/bin/sh + +# Displays todays precipication chance (☔) and daily low (🥶) and high (🌞). +# Usually intended for the statusbar. + +# If we have internet, get a weather report from wttr.in and store it locally. +# You could set up a shell alias to view the full file in a pager in the +# terminal if desired. This function will only be run once a day when needed. +weatherreport="${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" +getforecast() { curl -sf "wttr.in/$LOCATION" > "$weatherreport" || exit 1 ;} + +# Some very particular and terse stream manipulation. We get the maximum +# precipitation chance and the daily high and low from the downloaded file and +# display them with coresponding emojis. +showweather() { printf "%s" "$(sed '16q;d' "$weatherreport" | + grep -wo "[0-9]*%" | sort -rn | sed "s/^/[ /g;1q" | tr -d '\n')" +sed '13q;d' "$weatherreport" | grep -o "m\\([-+]\\)*[0-9]\\+" | sed 's/+//g' | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print "  " $1 "°"," " $2 "°]"}' ;} + +case $BLOCK_BUTTON in + 1) setsid -f "$TERMINAL" -e less -Srf "$weatherreport" ;; + 2) getforecast && showweather ;; + 3) notify-send "🌈 Weather module" "\- Left click for full forecast. +- Middle click to update forecast. +☔: Chance of rain/snow +🥶: Daily low +🌞: Daily high" ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +# The test if our forcecast is updated to the day. If it isn't download a new +# weather report from wttr.in with the above function. +[ "$(stat -c %y "$weatherreport" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] || + getforecast + +showweather diff --git a/.local/bin/internet b/.local/bin/internet new file mode 100755 index 0000000..534f25d --- /dev/null +++ b/.local/bin/internet @@ -0,0 +1,26 @@ +#!/bin/sh + +# Show wifi 📶 and percent strength or 📡 if none. +# Show 🌐 if connected to ethernet or ❎ if none. +# Show 🔒 if a vpn connection is active + +case $BLOCK_BUTTON in + 1) "$TERMINAL" -e nmtui; pkill -RTMIN+4 dwmblocks ;; + 3) notify-send "🌐 Internet module" "\- Click to connect +❌: wifi disabled +📡: no wifi connection +: wifi connection with quality +❎: no ethernet +🌐: ethernet working +🔒: vpn is active +" ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +if grep -xq 'up' /sys/class/net/w*/operstate 2>/dev/null ; then + wifiicon="$(awk '/^\s*w/ { print "", int($3 * 100 / 70) "% " }' /proc/net/wireless)" +elif grep -xq 'down' /sys/class/net/w*/operstate 2>/dev/null ; then + grep -xq '0x1003' /sys/class/net/w*/flags && wifiicon="📡 " || wifiicon="❌ " +fi + +printf "%s%s%s\n" "[$wifiicon" "$(sed "s/down/❎/;s/up/🌐/" /sys/class/net/e*/operstate 2>/dev/null)" "$(sed "s/.*/🔒/" /sys/class/net/tun*/operstate 2>/dev/null)]" diff --git a/.local/bin/kbselect b/.local/bin/kbselect new file mode 100755 index 0000000..4b294f5 --- /dev/null +++ b/.local/bin/kbselect @@ -0,0 +1,17 @@ +#!/bin/sh +# works on any init system +# requirements: dmenu, xorg-setxkbmap +kb="$(setxkbmap -query | grep -oP 'layout:\s*\K\w+')" || exit 1 + +case $BLOCK_BUTTON in + 1) kb_choice="$(awk '/! layout/{flag=1; next} /! variant/{flag=0} flag {print $2, "- " $1}' /usr/share/X11/xkb/rules/base.lst | dmenu -l 15)" + kb="$(echo "$kb_choice" | awk '{print $3}')" + setxkbmap "$kb" + pkill -RTMIN+30 "${STATUSBAR:-dwmblocks}";; + 3) notify-send " Keyboard/language module" "$(printf "%s" "\- Current layout: $(setxkbmap -query | grep -oP 'layout:\s*\K\w+')") +- Left click to change keyboard.";; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +xdotool key super+F5 +echo "[$kb]" diff --git a/.local/bin/memory b/.local/bin/memory new file mode 100755 index 0000000..a8eac97 --- /dev/null +++ b/.local/bin/memory @@ -0,0 +1,12 @@ +#!/bin/sh + +case $BLOCK_BUTTON in + 1) notify-send "🧠 Memory hogs" "$(ps axch -o cmd:15,%mem --sort=-%mem | head)" ;; + 2) setsid -f "$TERMINAL" -e htop ;; + 3) notify-send "🧠 Memory module" "\- Shows Memory Used/Total. +- Click to show memory hogs. +- Middle click to open htop." ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +free --mebi | sed -n '2{p;q}' | awk '{printf ("[ %2.2f]\n", ( $3 / 1024))}' diff --git a/.local/bin/volume b/.local/bin/volume new file mode 100755 index 0000000..e9d43c8 --- /dev/null +++ b/.local/bin/volume @@ -0,0 +1,30 @@ +#!/bin/sh + +# Prints the current volume or 🔇 if muted. + +case $BLOCK_BUTTON in + 1) setsid -f "$TERMINAL" -e pulsemixer ;; + 2) pamixer -t ;; + 4) pamixer --allow-boost -i 1 ;; + 5) pamixer --allow-boost -d 1 ;; + 3) notify-send "📢 Volume module" "\- Shows volume 🔊, 🔇 if muted. +- Middle click to mute. +- Scroll to change." ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +[ $(pamixer --get-mute) = true ] && echo  && exit + +vol="$(pamixer --get-volume)" + +if [ "$vol" -gt "70" ]; then + icon="🔊 " +elif [ "$vol" -gt "30" ]; then + icon=" " +elif [ "$vol" -gt "0" ]; then + icon="🔈 " +else + echo  && exit +fi + +echo "[$icon$vol%]" diff --git a/.xinitrc b/.xinitrc new file mode 120000 index 0000000..19c70e0 --- /dev/null +++ b/.xinitrc @@ -0,0 +1 @@ +.config/x11/.xinitrc \ No newline at end of file diff --git a/.zshrc b/.zshrc new file mode 120000 index 0000000..4d9150c --- /dev/null +++ b/.zshrc @@ -0,0 +1 @@ +.config/zsh/.zshrc \ No newline at end of file -- cgit v1.2.3-18-g5258