diff options
author | HimbeerserverDE <himbeerserverde@gmail.com> | 2022-04-23 19:17:20 +0200 |
---|---|---|
committer | HimbeerserverDE <himbeerserverde@gmail.com> | 2022-04-23 19:17:20 +0200 |
commit | dcb24ca3d6c873af26af921f4b42b4c8b8ef1566 (patch) | |
tree | f4c6eff81ff75b9d8d21b19fdf80ab3bfdad9671 | |
parent | 7a40939b9ee6acb2c5932a1f3917e48f3d13b295 (diff) |
Add polybar setup
-rw-r--r-- | polybar/config.ini | 163 | ||||
-rwxr-xr-x | polybar/launch.sh | 4 | ||||
-rwxr-xr-x | polybar/scripts/checkupdates | 117 | ||||
-rwxr-xr-x | polybar/scripts/launcher.sh | 13 | ||||
-rwxr-xr-x | polybar/scripts/powermenu.sh | 94 | ||||
-rw-r--r-- | polybar/scripts/rofi/colors.rasi | 10 | ||||
-rw-r--r-- | polybar/scripts/rofi/confirm.rasi | 24 | ||||
-rw-r--r-- | polybar/scripts/rofi/launcher.rasi | 115 | ||||
-rw-r--r-- | polybar/scripts/rofi/message.rasi | 24 | ||||
-rw-r--r-- | polybar/scripts/rofi/networkmenu.rasi | 123 | ||||
-rw-r--r-- | polybar/scripts/rofi/powermenu.rasi | 123 | ||||
-rw-r--r-- | polybar/scripts/rofi/styles.rasi | 123 | ||||
-rwxr-xr-x | polybar/scripts/style-switch.sh | 15 | ||||
-rwxr-xr-x | polybar/scripts/styles.sh | 76 | ||||
-rwxr-xr-x | polybar/scripts/updates.sh | 45 |
15 files changed, 1069 insertions, 0 deletions
diff --git a/polybar/config.ini b/polybar/config.ini new file mode 100644 index 0000000..7949e24 --- /dev/null +++ b/polybar/config.ini @@ -0,0 +1,163 @@ +[bar/main] +monitor = eDP-1 +monitor-strict = true +override-redirect = false +fixed-center = true +width = 100% +height = 40 +background = #f2282828 +foreground = #fbf1c7 +border-bottom-size = 2 +border-bottom-color = #fabd2f +padding = 2 +module-margin-left = 1 +module-margin-right = 1 +font-0 = "Terminus:size=10;3" +font-1 = "Noto Color Emoji:pixelsize=16:style=Regular:scale=10;3" + +modules-left = workspaces sep wifi sep ethernet +modules-center = disk sep memory sep cpu +modules-right = volume sep battery sep brightness sep date + +wm-name = bspwm +wm-restack = true +enable-ipc = true + +[bar/opt] +monitor = DP-2 +monitor-strict = true +override-redirect = false +fixed-center = true +width = 100% +height = 40 +background = #f2282828 +foreground = #fbf1c7 +border-bottom-size = 2 +border-bottom-color = #fabd2f +padding = 2 +module-margin-left = 1 +module-margin-right = 1 +font-0 = "Terminus:size=10;3" +font-1 = "Noto Color Emoji:pixelsize=16:style=Regular:scale=10;3" + +modules-left = workspaces sep wifi sep ethernet +modules-center = disk sep memory sep cpu +modules-right = volume sep battery sep brightness sep date + +wm-name = bspwm +wm-restack = true +enable-ipc = true + +[settings] +throttle-output = 5 +throttle-output-for = 10 + +; @see: https://www.cairographics.org/manual/cairo-cairo-t.html#cairo-operator-t +compositing-background = source +compositing-foreground = over +compositing-overline = over +compositing-underline = over +compositing-border = over + +[module/workspaces] +type = internal/xworkspaces +pin-workspaces = true +enable-click = false +enable-scroll = false +format = <label-state> +label-active = "%{F#458588}O" +label-occupied = "%{F#689d6a}O" +label-urgent = "%{F#cc241d}O" +label-empty = "%{F#fbf1c7}O" +label-active-padding = 1 +label-urgent-padding = 1 +label-occupied-padding = 1 +label-empty-padding = 1 + +[module/sep] +type = custom/text +content = | +content-foreground = #7c6f64 + +[module/disk] +type = internal/fs +mount-0 = / +interval = 30 +fixed-values = true +format-mounted = <label-mounted> +label-mounted = "💾 %{F#fb4934}%used% %{F#8ec07c}%free% %{F#fabd2f}%total%" + +[module/memory] +type = internal/memory +interval = 1 +format = <label> +label = "🐏 %{F#fb4934}%gb_used% %{F#8ec07c}%gb_free% %{F#fabd2f}%gb_total%" + +[module/cpu] +type = internal/cpu +interval = 1 +format = <label> +label = "💻 %percentage-cores%" + +[module/battery] +type = internal/battery +full-at = 100 +battery = BAT0 +adapter = AC +poll-interval = 2 +time-format = %H:%M +format-charging = <label-charging> +format-discharging = <label-discharging> +format-full = <label-full> +label-charging = "🔌 %percentage%% %time%" +label-discharging = "🔋 %percentage%% %time%" +label-full = "🔌 %percentage%%" + +[module/brightness] +type = internal/backlight +card = intel_backlight +format = <label> +label = "💡 %percentage%%" + +[module/wifi] +type = internal/network +interface = wlp3s0 +interval = 1.0 +accumulate-stats = false +format-connected = <label-connected> +format-disconnected = <label-disconnected> +label-connected = "📶 %essid% %{F#458588}%upspeed%↑ %downspeed%↓" +label-disconnected = "%{F#fb4934}no wifi" + +[module/ethernet] +type = internal/network +interface = enp0s25 +interval = 1.0 +accumulate-stats = false +format-connected = <label-connected> +format-disconnected = <label-disconnected> +label-connected = "🌐 Ethernet 🔗%linkspeed% %{F#458588}%upspeed%↑ %downspeed%↓" +label-disconnected = "%{F#fb4934}no ethernet" + +[module/date] +type = internal/date +interval = 1.0 +date = %d. %b %Y +time = %H:%M:%S +format = <label> +label = %date% %time% + +[module/volume] +type = internal/alsa +master-soundcard = default +speaker-soundcard = default +headphone-soundcard = default +master-mixer = Master +interval = 1 +format-volume = <ramp-volume> <label-volume> +format-muted = <label-muted> +label-volume = "%percentage%%" +label-muted = "🔇%percentage%%" +ramp-volume-0 = 🔈 +ramp-volume-1 = 🔉 +ramp-volume-2 = 🔊 diff --git a/polybar/launch.sh b/polybar/launch.sh new file mode 100755 index 0000000..cd8aef1 --- /dev/null +++ b/polybar/launch.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +polybar --reload -q main -c "$HOME/.config/polybar/config.ini" & +polybar --reload -q opt -c "$HOME/.config/polybar/config.ini" & diff --git a/polybar/scripts/checkupdates b/polybar/scripts/checkupdates new file mode 100755 index 0000000..4d8a5e8 --- /dev/null +++ b/polybar/scripts/checkupdates @@ -0,0 +1,117 @@ +#!/usr/bin/bash +# +# checkupdates: Safely print a list of pending updates. +# +# Copyright (c) 2013 Kyle Keen <keenerd@gmail.com> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# + +declare -r myname='checkupdates' +declare -r myver='1.0.0' + +plain() { + (( QUIET )) && return + local mesg=$1; shift + printf "${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&1 +} + +msg() { + (( QUIET )) && return + local mesg=$1; shift + printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&1 +} + +msg2() { + (( QUIET )) && return + local mesg=$1; shift + printf "${BLUE} ->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&1 +} + +ask() { + local mesg=$1; shift + printf "${BLUE}::${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}" "$@" >&1 +} + +warning() { + local mesg=$1; shift + printf "${YELLOW}==> $(gettext "WARNING:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 +} + +error() { + local mesg=$1; shift + printf "${RED}==> $(gettext "ERROR:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 +} + +# check if messages are to be printed using color +unset ALL_OFF BOLD BLUE GREEN RED YELLOW +if [[ -t 2 && ! $USE_COLOR = "n" ]]; then + # prefer terminal safe colored and bold text when tput is supported + if tput setaf 0 &>/dev/null; then + ALL_OFF="$(tput sgr0)" + BOLD="$(tput bold)" + BLUE="${BOLD}$(tput setaf 4)" + GREEN="${BOLD}$(tput setaf 2)" + RED="${BOLD}$(tput setaf 1)" + YELLOW="${BOLD}$(tput setaf 3)" + else + ALL_OFF="\e[1;0m" + BOLD="\e[1;1m" + BLUE="${BOLD}\e[1;34m" + GREEN="${BOLD}\e[1;32m" + RED="${BOLD}\e[1;31m" + YELLOW="${BOLD}\e[1;33m" + fi +fi +readonly ALL_OFF BOLD BLUE GREEN RED YELLOW + + +if (( $# > 0 )); then + echo "${myname} v${myver}" + echo + echo "Safely print a list of pending updates" + echo + echo "Usage: ${myname}" + echo + echo 'Note: Export the "CHECKUPDATES_DB" variable to change the path of the temporary database.' + exit 0 +fi + +if ! type -P fakeroot >/dev/null; then + error 'Cannot find the fakeroot binary.' + exit 1 +fi + +if [[ -z $CHECKUPDATES_DB ]]; then + CHECKUPDATES_DB="${TMPDIR:-/tmp}/checkup-db-${USER}/" +fi + +trap 'rm -f $CHECKUPDATES_DB/db.lck' INT TERM EXIT + +DBPath="$(pacman-conf DBPath)" +if [[ -z "$DBPath" ]] || [[ ! -d "$DBPath" ]]; then + DBPath="/var/lib/pacman/" +fi + +mkdir -p "$CHECKUPDATES_DB" +ln -s "${DBPath}/local" "$CHECKUPDATES_DB" &> /dev/null +if ! fakeroot -- pacman -Sy --dbpath "$CHECKUPDATES_DB" --logfile /dev/null &> /dev/null; then + error 'Cannot fetch updates' + exit 1 +fi +pacman -Qu --dbpath "$CHECKUPDATES_DB" 2> /dev/null | grep -v '\[.*\]' + +exit 0 + +# vim: set noet: diff --git a/polybar/scripts/launcher.sh b/polybar/scripts/launcher.sh new file mode 100755 index 0000000..b853625 --- /dev/null +++ b/polybar/scripts/launcher.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +FILE="$HOME/.config/polybar/forest/scripts/rofi/colors.rasi" + +## random accent color +#COLORS=('#EC7875' '#EC6798' '#BE78D1' '#75A4CD' '#00C7DF' '#00B19F' '#61C766' \ +# '#B9C244' '#EBD369' '#EDB83F' '#E57C46' '#AC8476' '#6C77BB' '#6D8895') +#AC="${COLORS[$(( $RANDOM % 14 ))]}" +#SE="${COLORS[$(( $RANDOM % 14 ))]}" +#sed -i -e "s/ac: .*/ac: ${AC}FF;/g" $FILE +#sed -i -e "s/se: .*/se: ${SE}FF;/g" $FILE + +rofi -no-config -no-lazy-grab -show drun -modi drun -theme ~/.config/polybar/forest/scripts/rofi/launcher.rasi diff --git a/polybar/scripts/powermenu.sh b/polybar/scripts/powermenu.sh new file mode 100755 index 0000000..84eddf4 --- /dev/null +++ b/polybar/scripts/powermenu.sh @@ -0,0 +1,94 @@ +#!/usr/bin/env bash + +## Author : Aditya Shakya +## Mail : adi1090x@gmail.com +## Github : @adi1090x +## Twitter : @adi1090x + +dir="~/.config/polybar/forest/scripts/rofi" +uptime=$(uptime -p | sed -e 's/up //g') + +rofi_command="rofi -theme $dir/powermenu.rasi" + +# Options +shutdown=" Shutdown" +reboot=" Restart" +lock=" Lock" +suspend=" Sleep" +logout=" Logout" + +# Confirmation +confirm_exit() { + rofi -dmenu\ + -i\ + -no-fixed-num-lines\ + -p "Are You Sure? : "\ + -theme $dir/confirm.rasi +} + +# Message +msg() { + rofi -theme "$dir/message.rasi" -e "Available Options - yes / y / no / n" +} + +# Variable passed to rofi +options="$lock\n$suspend\n$logout\n$reboot\n$shutdown" + +chosen="$(echo -e "$options" | $rofi_command -p "Uptime: $uptime" -dmenu -selected-row 0)" +case $chosen in + $shutdown) + ans=$(confirm_exit &) + if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then + systemctl poweroff + elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then + exit 0 + else + msg + fi + ;; + $reboot) + ans=$(confirm_exit &) + if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then + systemctl reboot + elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then + exit 0 + else + msg + fi + ;; + $lock) + if [[ -f /usr/bin/i3lock ]]; then + i3lock + elif [[ -f /usr/bin/betterlockscreen ]]; then + betterlockscreen -l + fi + ;; + $suspend) + ans=$(confirm_exit &) + if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then + mpc -q pause + amixer set Master mute + systemctl suspend + elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then + exit 0 + else + msg + fi + ;; + $logout) + ans=$(confirm_exit &) + if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then + if [[ "$DESKTOP_SESSION" == "Openbox" ]]; then + openbox --exit + elif [[ "$DESKTOP_SESSION" == "bspwm" ]]; then + bspc quit + elif [[ "$DESKTOP_SESSION" == "i3" ]]; then + i3-msg exit + fi + elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then + exit 0 + else + msg + fi + ;; +esac diff --git a/polybar/scripts/rofi/colors.rasi b/polybar/scripts/rofi/colors.rasi new file mode 100644 index 0000000..cd1f090 --- /dev/null +++ b/polybar/scripts/rofi/colors.rasi @@ -0,0 +1,10 @@ +/* colors */ + +* { + al: #00000000; + bg: #212B30FF; + bga: #263035FF; + fg: #C4C7C5FF; + ac: #EC407AFF; + se: #4DD0E1FF; +} diff --git a/polybar/scripts/rofi/confirm.rasi b/polybar/scripts/rofi/confirm.rasi new file mode 100644 index 0000000..7382580 --- /dev/null +++ b/polybar/scripts/rofi/confirm.rasi @@ -0,0 +1,24 @@ +/* Confirm Dialog */ + +@import "colors.rasi" + +* { + background-color: @bg; + text-color: @fg; + font: "Terminus 9"; +} + +window { + width: 210px; + padding: 25px; + border: 0px 0px 1px 0px; + border-radius: 0px; + border-color: @se; + location: center; + y-offset: -2em; +} + +entry { + expand: true; + text-color: @ac; +} diff --git a/polybar/scripts/rofi/launcher.rasi b/polybar/scripts/rofi/launcher.rasi new file mode 100644 index 0000000..8c112cd --- /dev/null +++ b/polybar/scripts/rofi/launcher.rasi @@ -0,0 +1,115 @@ +/* + * + * Author : Aditya Shakya + * Mail : adi1090x@gmail.com + * Github : @adi1090x + * Twitter : @adi1090x + * + */ + +configuration { + font: "Terminus 9"; + show-icons: true; + icon-theme: "Papirus"; + display-drun: ""; + drun-display-format: "{name}"; + disable-history: false; + fullscreen: false; + hide-scrollbar: true; + sidebar-mode: false; +} + +@import "colors.rasi" + +window { + transparency: "real"; + background-color: @bg; + text-color: @fg; + border: 0px 0px 0px 0px; + border-color: @ac; + border-radius: 0px; + width: 500px; + location: center; + x-offset: 0; + y-offset: 0; +} + +prompt { + enabled: true; + padding: 0px; + background-color: @bga; + text-color: @ac; + font: "feather 8"; +} + +entry { + background-color: @al; + text-color: @fg; + placeholder-color: @fg; + expand: true; + horizontal-align: 0; + placeholder: "Search..."; + padding: 0px 0px 0px 5px; + blink: true; +} + +inputbar { + children: [ prompt, entry ]; + background-color: @bga; + text-color: @fg; + expand: false; + border: 0px 0px 1px 0px; + border-radius: 0px; + border-color: @se; + margin: 0px; + padding: 10px; +} + +listview { + background-color: @al; + padding: 0px; + columns: 1; + lines: 6; + spacing: 5px; + cycle: true; + dynamic: true; + layout: vertical; +} + +mainbox { + background-color: @al; + border: 0px; + border-radius: 0px; + border-color: @ac; + children: [ inputbar, listview ]; + spacing: 5px; + padding: 5px; +} + +element { + background-color: @al; + text-color: @fg; + orientation: horizontal; + border-radius: 0px; + padding: 8px; +} + +element-icon { + size: 24px; + border: 0px; +} + +element-text { + expand: true; + horizontal-align: 0; + vertical-align: 0.5; + margin: 0px 2.5px 0px 2.5px; +} + +element selected { + background-color: @se; + text-color: @bg; + border: 0px 0px 0px 0px; + border-radius: 0px; + border-color: @ac; +} diff --git a/polybar/scripts/rofi/message.rasi b/polybar/scripts/rofi/message.rasi new file mode 100644 index 0000000..dcc2093 --- /dev/null +++ b/polybar/scripts/rofi/message.rasi @@ -0,0 +1,24 @@ +/* Confirm Dialog */ + +@import "colors.rasi" + +* { + background-color: @bg; + text-color: @fg; + font: "Terminus 9"; +} + +window { + width: 320px; + padding: 25px; + border: 0px 0px 1px 0px; + border-radius: 0px; + border-color: @se; + location: center; + y-offset: -2em; +} + +entry { + expand: true; + text-color: @ac; +} diff --git a/polybar/scripts/rofi/networkmenu.rasi b/polybar/scripts/rofi/networkmenu.rasi new file mode 100644 index 0000000..7935698 --- /dev/null +++ b/polybar/scripts/rofi/networkmenu.rasi @@ -0,0 +1,123 @@ +/* + * + * Author : Aditya Shakya + * Mail : adi1090x@gmail.com + * Github : @adi1090x + * Twitter : @adi1090x + * + */ + +configuration { + font: "Terminus 9"; + show-icons: true; + icon-theme: "Papirus"; + display-drun: ""; + drun-display-format: "{name}"; + disable-history: false; + fullscreen: false; + hide-scrollbar: true; + sidebar-mode: false; +} + +@import "colors.rasi" + +window { + transparency: "real"; + background-color: @bg; + text-color: @fg; + border: 0px 0px 0px 0px; + border-color: @ac; + border-radius: 0px; + width: 400px; + location: center; + x-offset: 0; + y-offset: 0; +} + +prompt { + enabled: true; + padding: 0px 0px 0px 10px; + background-color: @bga; + text-color: @fg; +} + +textbox-prompt-colon { + padding: 0px; + background-color: @bga; + text-color: @ac; + expand: false; + str: ""; + font: "feather 8"; +} + +entry { + background-color: @al; + text-color: @fg; + placeholder-color: @fg; + expand: true; + horizontal-align: 0; + placeholder: "Search..."; + padding: 0px 0px 0px 5px; + blink: true; +} + +inputbar { + children: [ textbox-prompt-colon, prompt ]; + background-color: @bga; + text-color: @fg; + expand: false; + border: 0px 0px 1px 0px; + border-radius: 0px; + border-color: @se; + margin: 0px; + padding: 10px; +} + +listview { + background-color: @al; + padding: 0px; + columns: 1; + lines: 8; + spacing: 5px; + cycle: true; + dynamic: true; + layout: vertical; +} + +mainbox { + background-color: @al; + border: 0px; + border-radius: 0px; + border-color: @ac; + children: [ inputbar, listview ]; + spacing: 5px; + padding: 5px; +} + +element { + background-color: @al; + text-color: @fg; + orientation: horizontal; + border-radius: 0px; + padding: 8px 8px 8px -15px; +} + +element-icon { + size: 24px; + border: 0px; +} + +element-text { + expand: true; + horizontal-align: 0; + vertical-align: 0.5; + margin: 0px 2.5px 0px 2.5px; +} + +element selected { + background-color: @se; + text-color: @bg; + border: 0px 0px 0px 0px; + border-radius: 0px; + border-color: @ac; +} diff --git a/polybar/scripts/rofi/powermenu.rasi b/polybar/scripts/rofi/powermenu.rasi new file mode 100644 index 0000000..d265945 --- /dev/null +++ b/polybar/scripts/rofi/powermenu.rasi @@ -0,0 +1,123 @@ +/* + * + * Author : Aditya Shakya + * Mail : adi1090x@gmail.com + * Github : @adi1090x + * Twitter : @adi1090x + * + */ + +configuration { + font: "Terminus 9"; + show-icons: true; + icon-theme: "Papirus"; + display-drun: ""; + drun-display-format: "{name}"; + disable-history: false; + fullscreen: false; + hide-scrollbar: true; + sidebar-mode: false; +} + +@import "colors.rasi" + +window { + transparency: "real"; + background-color: @bg; + text-color: @fg; + border: 0px 0px 0px 0px; + border-color: @ac; + border-radius: 0px; + width: 350px; + location: center; + x-offset: 0; + y-offset: 0; +} + +prompt { + enabled: true; + padding: 0px 0px 0px 10px; + background-color: @bga; + text-color: @fg; +} + +textbox-prompt-colon { + padding: 0px; + background-color: @bga; + text-color: @ac; + expand: false; + str: ""; + font: "feather 8"; +} + +entry { + background-color: @al; + text-color: @fg; + placeholder-color: @fg; + expand: true; + horizontal-align: 0; + placeholder: "Search..."; + padding: 0px 0px 0px 5px; + blink: true; +} + +inputbar { + children: [ textbox-prompt-colon, prompt ]; + background-color: @bga; + text-color: @fg; + expand: false; + border: 0px 0px 1px 0px; + border-radius: 0px; + border-color: @se; + margin: 0px; + padding: 10px; +} + +listview { + background-color: @al; + padding: 0px; + columns: 1; + lines: 5; + spacing: 5px; + cycle: true; + dynamic: true; + layout: vertical; +} + +mainbox { + background-color: @al; + border: 0px; + border-radius: 0px; + border-color: @ac; + children: [ inputbar, listview ]; + spacing: 5px; + padding: 5px; +} + +element { + background-color: @al; + text-color: @fg; + orientation: horizontal; + border-radius: 0px; + padding: 8px 8px 8px -20px; +} + +element-icon { + size: 24px; + border: 0px; +} + +element-text { + expand: true; + horizontal-align: 0; + vertical-align: 0.5; + margin: 0px 2.5px 0px 2.5px; +} + +element selected { + background-color: @se; + text-color: @bg; + border: 0px 0px 0px 0px; + border-radius: 0px; + border-color: @ac; +} diff --git a/polybar/scripts/rofi/styles.rasi b/polybar/scripts/rofi/styles.rasi new file mode 100644 index 0000000..c95983d --- /dev/null +++ b/polybar/scripts/rofi/styles.rasi @@ -0,0 +1,123 @@ +/* + * + * Author : Aditya Shakya + * Mail : adi1090x@gmail.com + * Github : @adi1090x + * Twitter : @adi1090x + * + */ + +configuration { + font: "Terminus 9"; + show-icons: true; + icon-theme: "Papirus"; + display-drun: ""; + drun-display-format: "{name}"; + disable-history: false; + fullscreen: false; + hide-scrollbar: true; + sidebar-mode: false; +} + +@import "colors.rasi" + +window { + transparency: "real"; + background-color: @bg; + text-color: @fg; + border: 0px 0px 0px 0px; + border-color: @ac; + border-radius: 0px; + width: 350px; + location: center; + x-offset: 0; + y-offset: 0; +} + +prompt { + enabled: true; + padding: 0px 0px 0px 5px; + background-color: @bga; + text-color: @fg; +} + +textbox-prompt-colon { + padding: 0px; + background-color: @bga; + text-color: @ac; + expand: false; + str: ""; + font: "feather 8"; +} + +entry { + background-color: @al; + text-color: @fg; + placeholder-color: @fg; + expand: true; + horizontal-align: 0; + placeholder: "Search..."; + padding: 0px 0px 0px 10px; + blink: true; +} + +inputbar { + children: [ textbox-prompt-colon, entry ]; + background-color: @bga; + text-color: @fg; + expand: false; + border: 0px 0px 1px 0px; + border-radius: 0px; + border-color: @se; + margin: 0px; + padding: 10px; +} + +listview { + background-color: @al; + padding: 0px; + columns: 1; + lines: 5; + spacing: 5px; + cycle: true; + dynamic: true; + layout: vertical; +} + +mainbox { + background-color: @al; + border: 0px; + border-radius: 0px; + border-color: @ac; + children: [ inputbar, listview ]; + spacing: 5px; + padding: 5px; +} + +element { + background-color: @al; + text-color: @fg; + orientation: horizontal; + border-radius: 0px; + padding: 8px 8px 8px -20px; +} + +element-icon { + size: 24px; + border: 0px; +} + +element-text { + expand: true; + horizontal-align: 0; + vertical-align: 0.5; + margin: 0px 2.5px 0px 2.5px; +} + +element selected { + background-color: @se; + text-color: @bg; + border: 0px 0px 0px 0px; + border-radius: 0px; + border-color: @ac; +} diff --git a/polybar/scripts/style-switch.sh b/polybar/scripts/style-switch.sh new file mode 100755 index 0000000..e0188f3 --- /dev/null +++ b/polybar/scripts/style-switch.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +SDIR="$HOME/.config/polybar/forest/scripts" + +# Launch Rofi +MENU="$(rofi -no-config -no-lazy-grab -sep "|" -dmenu -i -p '' \ +-theme $SDIR/rofi/styles.rasi \ +<<< " Default| Nord| Gruvbox| Dark| Cherry|")" + case "$MENU" in + *Default) "$SDIR"/styles.sh --default ;; + *Nord) "$SDIR"/styles.sh --nord ;; + *Gruvbox) "$SDIR"/styles.sh --gruvbox ;; + *Dark) "$SDIR"/styles.sh --dark ;; + *Cherry) "$SDIR"/styles.sh --cherry ;; + esac diff --git a/polybar/scripts/styles.sh b/polybar/scripts/styles.sh new file mode 100755 index 0000000..35899a9 --- /dev/null +++ b/polybar/scripts/styles.sh @@ -0,0 +1,76 @@ +#!/usr/bin/env bash + +# Color files +PFILE="$HOME/.config/polybar/forest/colors.ini" +RFILE="$HOME/.config/polybar/forest/scripts/rofi/colors.rasi" + +# Change colors +change_color() { + # polybar + sed -i -e "s/background = #.*/background = $BG/g" $PFILE + sed -i -e "s/foreground = #.*/foreground = $FG/g" $PFILE + sed -i -e "s/sep = #.*/sep = $SEP/g" $PFILE + + # rofi + cat > $RFILE <<- EOF + /* colors */ + + * { + al: #00000000; + bg: ${BG}FF; + bga: ${BGA}FF; + fg: ${FG}FF; + ac: ${AC}FF; + se: ${SE}FF; + } + EOF + + polybar-msg cmd restart +} + +if [[ $1 = "--default" ]]; then + BG="#212B30" + FG="#C4C7C5" + BGA="#263035" + SEP="#3F5360" + AC="#EC407A" + SE="#4DD0E1" + change_color +elif [[ $1 = "--nord" ]]; then + BG="#3B4252" + FG="#E5E9F0" + BGA="#454C5C" + SEP="#5B6579" + AC="#BF616A" + SE="#88C0D0" + change_color +elif [[ $1 = "--gruvbox" ]]; then + BG="#282828" + FG="#EBDBB2" + BGA="#313131" + SEP="#505050" + AC="#FB4934" + SE="#8EC07C" + change_color +elif [[ $1 = "--dark" ]]; then + BG="#141C21" + FG="#93A1A1" + BGA="#1E262B" + SEP="#3C4449" + AC="#D12F2C" + SE="#33C5BA" + change_color +elif [[ $1 = "--cherry" ]]; then + BG="#1F1626" + FG="#FFFFFF" + BGA="#292030" + SEP="#473F4E" + AC="#D94084" + SE="#4F5D95" + change_color +else + cat <<- _EOF_ + No option specified, Available options: + --default --nord --gruvbox --dark --cherry + _EOF_ +fi diff --git a/polybar/scripts/updates.sh b/polybar/scripts/updates.sh new file mode 100755 index 0000000..70edf26 --- /dev/null +++ b/polybar/scripts/updates.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash + +NOTIFY_ICON=/usr/share/icons/Papirus/32x32/apps/system-software-update.svg + +get_total_updates() { UPDATES=$(checkupdates 2>/dev/null | wc -l); } + +while true; do + get_total_updates + + # notify user of updates + if hash notify-send &>/dev/null; then + if (( UPDATES > 50 )); then + notify-send -u critical -i $NOTIFY_ICON \ + "You really need to update!!" "$UPDATES New packages" + elif (( UPDATES > 25 )); then + notify-send -u normal -i $NOTIFY_ICON \ + "You should update soon" "$UPDATES New packages" + elif (( UPDATES > 2 )); then + notify-send -u low -i $NOTIFY_ICON \ + "$UPDATES New packages" + fi + fi + + # when there are updates available + # every 10 seconds another check for updates is done + while (( UPDATES > 0 )); do + if (( UPDATES == 1 )); then + echo "$UPDATES" + elif (( UPDATES > 1 )); then + echo "$UPDATES" + else + echo "None" + fi + sleep 10 + get_total_updates + done + + # when no updates are available, use a longer loop, this saves on CPU + # and network uptime, only checking once every 30 min for new updates + while (( UPDATES == 0 )); do + echo "None" + sleep 1800 + get_total_updates + done +done |