From 585834d31dc9be4dd8ed4b39eb29c11f84b52ff5 Mon Sep 17 00:00:00 2001
From: Stephan Raabe <mail@stephan-raabe.de>
Date: Sun, 20 Aug 2023 11:46:46 +0200
Subject: [PATCH] Updates

---
 .bashrc                   |  1 +
 1-install.sh              | 10 ++++
 alacritty/alacritty.yml   |  4 +-
 dunst/dunstrc             |  6 +--
 hypr/hyprland.conf        | 99 +++++++++++++++++++++------------------
 polybar/launch.sh         |  1 -
 scripts/powermenu-hypr.sh | 33 +++++++++++++
 scripts/updatewal-swww.sh | 12 +++++
 scripts/updatewal.sh      | 12 ++++-
 waybar/colors-waybar.css  | 20 ++++++++
 waybar/config             | 28 +++++++++--
 waybar/style.css          | 67 ++++++++++++++------------
 12 files changed, 205 insertions(+), 88 deletions(-)
 create mode 100755 scripts/powermenu-hypr.sh
 create mode 100644 waybar/colors-waybar.css

diff --git a/.bashrc b/.bashrc
index 0039b1c..335f7b4 100644
--- a/.bashrc
+++ b/.bashrc
@@ -17,6 +17,7 @@ PS1='[\u@\h \W]\$ '
 # ALIASES
 # -----------------------------------------------------
 
+alias Qtile='startx'
 alias c='clear'
 alias nf='neofetch'
 alias pf='pfetch'
diff --git a/1-install.sh b/1-install.sh
index 8020593..fa0ee12 100755
--- a/1-install.sh
+++ b/1-install.sh
@@ -98,6 +98,15 @@ else
     echo ".config folder created."
 fi
 
+# ------------------------------------------------------
+# Remove pywal folder from .config
+# ------------------------------------------------------
+echo ""
+if [ -d ~/.config/wal/ ]; then
+    rm -r ~/.config/wal/
+    echo "~/.config/wal/ removed."
+fi
+
 # ------------------------------------------------------
 # Create symbolic links
 # ------------------------------------------------------
@@ -110,6 +119,7 @@ _installSymLink ~/.config/rofi ~/dotfiles/rofi/ ~/.config
 _installSymLink ~/.config/vim ~/dotfiles/vim/ ~/.config
 _installSymLink ~/.config/nvim ~/dotfiles/nvim/ ~/.config
 _installSymLink ~/.config/dunst ~/dotfiles/dunst/ ~/.config
+_installSymLink ~/.config/wal ~/dotfiles/wal/ ~/.config
 _installSymLink ~/.config/starship.toml ~/dotfiles/starship/starship.toml ~/.config/starship.toml
 
 # ------------------------------------------------------
diff --git a/alacritty/alacritty.yml b/alacritty/alacritty.yml
index a9c9de2..23f66a7 100644
--- a/alacritty/alacritty.yml
+++ b/alacritty/alacritty.yml
@@ -131,7 +131,7 @@ font:
     family: FiraCode Nerd Font
 
     # The `style` can be specified to pick a specific face.
-    #style: Regular
+    style: Regular
 
   # Bold font face
   #bold:
@@ -167,7 +167,7 @@ font:
     #style: Bold Italic
 
   # Point size
-  size: 9.0
+  size: 11.0
 
   # Offset is the extra space around each character. `offset.y` can be thought
   # of as modifying the line spacing, and `offset.x` as modifying the letter
diff --git a/dunst/dunstrc b/dunst/dunstrc
index 89c31a4..5cb0b5e 100644
--- a/dunst/dunstrc
+++ b/dunst/dunstrc
@@ -323,21 +323,21 @@
 [urgency_low]
     # IMPORTANT: colors have to be defined in quotation marks.
     # Otherwise the "#" and following would be interpreted as a comment.
-    background = "#000000"
+    background = "#00000070"
     foreground = "#888888"
     timeout = 6
     # Icon for notifications with low urgency, uncomment to enable
     #default_icon = /path/to/icon
 
 [urgency_normal]
-    background = "#000000"
+    background = "#00000070"
     foreground = "#ffffff"
     timeout = 6
     # Icon for notifications with normal urgency, uncomment to enable
     #default_icon = /path/to/icon
 
 [urgency_critical]
-    background = "#900000"
+    background = "#90000070"
     foreground = "#ffffff"
     frame_color = "#ffffff"
     timeout = 6
diff --git a/hypr/hyprland.conf b/hypr/hyprland.conf
index 9fb5656..3b6f230 100644
--- a/hypr/hyprland.conf
+++ b/hypr/hyprland.conf
@@ -8,73 +8,83 @@
 # by Stephan Raabe (2023) 
 # ----------------------------------------------------- 
 
+# ----------------------------------------------------- 
+# Monitor Setup
 # See https://wiki.hyprland.org/Configuring/Monitors/
+# ----------------------------------------------------- 
 monitor=,preferred,auto,auto
 
-# See https://wiki.hyprland.org/Configuring/Keywords/ for more
+# ----------------------------------------------------- 
+# Autostart
+# ----------------------------------------------------- 
+exec-once = waybar
+exec-once = swww init 
+exec-once = ~/dotfiles/scripts/updatewal-swww.sh
+exec-once = dunst
 
-# Execute your favorite apps at launch
-exec-once = waybar & swww init & ~/dotfiles/scripts/updatewal-swww.sh
+# ----------------------------------------------------- 
+# Load pywal color file
+# ----------------------------------------------------- 
+source = /home/raabe/.cache/wal/colors-hyprland.conf
 
-# Source a file (multi-file configs)
-# source = ~/.config/hypr/myColors.conf
-
-# Some default env vars.
+# ----------------------------------------------------- 
+# Env vars
+# ----------------------------------------------------- 
 env = XCURSOR_SIZE,24
 
-# For all categories, see https://wiki.hyprland.org/Configuring/Variables/
+# ----------------------------------------------------- 
+# Keyboard layout and mouse
+# ----------------------------------------------------- 
 input {
     kb_layout = de
     kb_variant =
     kb_model =
     kb_options =
     kb_rules =
-
     follow_mouse = 1
-
     touchpad {
         natural_scroll = false
     }
-
     sensitivity = 0 # -1.0 - 1.0, 0 means no modification.
 }
 
+# ----------------------------------------------------- 
+# General window layout and colors
+# ----------------------------------------------------- 
 general {
-    # See https://wiki.hyprland.org/Configuring/Variables/ for more
-
     gaps_in = 10
     gaps_out = 20
     border_size = 3
-    col.active_border = rgba(33ccffee) rgba(00ff99ee) 45deg
-    col.inactive_border = rgba(595959aa)
-
+    # Single Color for active window
+    col.active_border = $color11
+    # Color Gradient for active window
+    # col.active_border = $color11 $background $background $color14 45deg    
+    col.inactive_border = rgba(ffffffee)
     layout = dwindle
 }
 
+# ----------------------------------------------------- 
+# General window decoration
+# ----------------------------------------------------- 
 decoration {
-    # See https://wiki.hyprland.org/Configuring/Variables/ for more
-
     rounding = 10
-
     blur {
         enabled = true
         size = 3
         passes = 1
     }
-
     drop_shadow = true
     shadow_range = 4
     shadow_render_power = 3
     col.shadow = rgba(1a1a1aee)
 }
 
+# ----------------------------------------------------- 
+# Animations
+# ----------------------------------------------------- 
 animations {
     enabled = true
-
-    # Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more
-
     bezier = myBezier, 0.05, 0.9, 0.1, 1.05
-
     animation = windows, 1, 7, myBezier
     animation = windowsOut, 1, 7, default, popin 80%
     animation = border, 1, 10, default
@@ -83,6 +93,9 @@ animations {
     animation = workspaces, 1, 6, default
 }
 
+# ----------------------------------------------------- 
+# Layouts
+# ----------------------------------------------------- 
 dwindle {
     # See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more
     pseudotile = true # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below
@@ -105,22 +118,19 @@ device:epic-mouse-v1 {
     sensitivity = -0.5
 }
 
-# Example windowrule v1
+# ----------------------------------------------------- 
+# Window rules
+# ----------------------------------------------------- 
 windowrule = tile,title:^(Outlook)(.*)$
-windowrule = tile,title:^(Teams)(.*)$
-# windowrule = tile, ^(brave)$
-# Example windowrule v2
-# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$
-# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more
+windowrule = tile,title:^(Microsoft)(.*)$
 
-
-# See https://wiki.hyprland.org/Configuring/Keywords/ for more
+# ----------------------------------------------------- 
+# Key bindings
+# ----------------------------------------------------- 
 $mainMod = SUPER
-
-# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more
 bind = $mainMod, RETURN, exec, alacritty
 bind = $mainMod, Q, killactive
-bind = $mainMod CTRL, Q, exit,
+bind = $mainMod CTRL, Q, exec, ~/dotfiles/scripts/powermenu-hypr.sh
 bind = $mainMod, E, exec, dolphin
 bind = $mainMod, T, togglefloating
 bind = $mainMod SHIFT, W, exec, ~/dotfiles/scripts/updatewal-swww.sh
@@ -128,14 +138,11 @@ bind = $mainMod, B, exec, brave
 bind = $mainMod CTRL, RETURN, exec, ~/dotfiles/scripts/applauncher.sh
 bind = $mainMod, P, pseudo # dwindle
 bind = $mainMod, J, togglesplit # dwindle
-
-# Move focus with mainMod + arrow keys
+bind = $mainMod SHIFT, B, exec, ~/dotfiles/waybar/reload.sh
 bind = $mainMod, left, movefocus, l
 bind = $mainMod, right, movefocus, r
 bind = $mainMod, up, movefocus, u
 bind = $mainMod, down, movefocus, d
-
-# Switch workspaces with mainMod + [0-9]
 bind = $mainMod, 1, workspace, 1
 bind = $mainMod, 2, workspace, 2
 bind = $mainMod, 3, workspace, 3
@@ -146,8 +153,6 @@ bind = $mainMod, 7, workspace, 7
 bind = $mainMod, 8, workspace, 8
 bind = $mainMod, 9, workspace, 9
 bind = $mainMod, 0, workspace, 10
-
-# Move active window to a workspace with mainMod + SHIFT + [0-9]
 bind = $mainMod SHIFT, 1, movetoworkspace, 1
 bind = $mainMod SHIFT, 2, movetoworkspace, 2
 bind = $mainMod SHIFT, 3, movetoworkspace, 3
@@ -158,11 +163,15 @@ bind = $mainMod SHIFT, 7, movetoworkspace, 7
 bind = $mainMod SHIFT, 8, movetoworkspace, 8
 bind = $mainMod SHIFT, 9, movetoworkspace, 9
 bind = $mainMod SHIFT, 0, movetoworkspace, 10
-
-# Scroll through existing workspaces with mainMod + scroll
 bind = $mainMod, mouse_down, workspace, e+1
 bind = $mainMod, mouse_up, workspace, e-1
-
-# Move/resize windows with mainMod + LMB/RMB and dragging
 bindm = $mainMod, mouse:272, movewindow
 bindm = $mainMod, mouse:273, resizewindow
+
+# ----------------------------------------------------- 
+# Misc settings
+# ----------------------------------------------------- 
+misc {
+    disable_hyprland_logo = true
+    disable_splash_rendering = true
+}
diff --git a/polybar/launch.sh b/polybar/launch.sh
index f06c018..94f4a2e 100755
--- a/polybar/launch.sh
+++ b/polybar/launch.sh
@@ -17,7 +17,6 @@ polybar-msg cmd quit
 # ----------------------------------------------------- 
 # Loading the configuration based on the username
 # ----------------------------------------------------- 
-
 if [[ $USER = "raabe" ]]
 then
     polybar -r mypolybar
diff --git a/scripts/powermenu-hypr.sh b/scripts/powermenu-hypr.sh
new file mode 100755
index 0000000..6833a4d
--- /dev/null
+++ b/scripts/powermenu-hypr.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+#  ____                                                    
+# |  _ \ _____      _____ _ __ _ __ ___   ___ _ __  _   _  
+# | |_) / _ \ \ /\ / / _ \ '__| '_ ` _ \ / _ \ '_ \| | | | 
+# |  __/ (_) \ V  V /  __/ |  | | | | | |  __/ | | | |_| | 
+# |_|   \___/ \_/\_/ \___|_|  |_| |_| |_|\___|_| |_|\__,_| 
+#                                                          
+#  
+# by Stephan Raabe (2023) 
+# ----------------------------------------------------- 
+
+option1="  lock"
+option2="  logout"
+option3="  reboot"
+option4="  power off"
+
+options="$option1\n"
+options="$options$option2\n"
+options="$options$option3\n$option4"
+
+choice=$(echo -e "$options" | rofi -dmenu -i -no-show-icons -l 4 -width 30 -p "Powermenu") 
+
+case $choice in
+	$option1)
+		slock ;;
+	$option2)
+		hyprctl dispatch exit ;;
+	$option3)
+		systemctl reboot ;;
+	$option4)
+		systemctl poweroff ;;
+esac
+
diff --git a/scripts/updatewal-swww.sh b/scripts/updatewal-swww.sh
index 610c20f..0ade2d2 100755
--- a/scripts/updatewal-swww.sh
+++ b/scripts/updatewal-swww.sh
@@ -19,6 +19,11 @@ wal -q -i ~/wallpaper/
 # ----------------------------------------------------- 
 source "$HOME/.cache/wal/colors.sh"
 
+# ----------------------------------------------------- 
+# Copy color file to waybar folder
+# ----------------------------------------------------- 
+cp ~/.cache/wal/colors-waybar.css ~/dotfiles/waybar/
+
 # ----------------------------------------------------- 
 # get wallpaper iamge name
 # ----------------------------------------------------- 
@@ -28,4 +33,11 @@ newwall=$(echo $wallpaper | sed "s|$HOME/wallpaper/||g")
 # Set the new wallpaper
 # ----------------------------------------------------- 
 swww img $wallpaper --transition-step 20 --transition-fps=20
+~/dotfiles/waybar/reload.sh
 
+# ----------------------------------------------------- 
+# Send notification
+# ----------------------------------------------------- 
+notify-send "Theme and Wallpaper updated" "With image $newwall"
+
+echo "DONE!"
diff --git a/scripts/updatewal.sh b/scripts/updatewal.sh
index 11dec5c..bad304a 100755
--- a/scripts/updatewal.sh
+++ b/scripts/updatewal.sh
@@ -11,22 +11,30 @@
 
 echo "Changing theme..."
 
+# ----------------------------------------------------- 
 # Update Wallpaper with pywal
+# ----------------------------------------------------- 
 wal -q -i ~/wallpaper/
 
+# ----------------------------------------------------- 
 # Wait for 1 sec
+# ----------------------------------------------------- 
 sleep 1
 
+# ----------------------------------------------------- 
 # Reload qtile to color bar
+# ----------------------------------------------------- 
 qtile cmd-obj -o cmd -f reload_config
 
+# ----------------------------------------------------- 
 # Get new theme
+# ----------------------------------------------------- 
 source "$HOME/.cache/wal/colors.sh"
-
 newwall=$(echo $wallpaper | sed "s|$HOME/wallpaper/||g")
 
+# ----------------------------------------------------- 
 # Send notification
+# ----------------------------------------------------- 
 notify-send "Theme and Wallpaper updated" "With image $newwall"
 
 echo "Done."
-
diff --git a/waybar/colors-waybar.css b/waybar/colors-waybar.css
new file mode 100644
index 0000000..7e39759
--- /dev/null
+++ b/waybar/colors-waybar.css
@@ -0,0 +1,20 @@
+@define-color foreground #bfc0c0;
+@define-color background #010304;
+@define-color cursor #bfc0c0;
+
+@define-color color0 #010304;
+@define-color color1 #325A65;
+@define-color color2 #24636E;
+@define-color color3 #466D76;
+@define-color color4 #35817E;
+@define-color color5 #347985;
+@define-color color6 #4CAFB5;
+@define-color color7 #bfc0c0;
+@define-color color8 #404242;
+@define-color color9 #325A65;
+@define-color color10 #24636E;
+@define-color color11 #466D76;
+@define-color color12 #35817E;
+@define-color color13 #347985;
+@define-color color14 #4CAFB5;
+@define-color color15 #bfc0c0;
diff --git a/waybar/config b/waybar/config
index 78dc2a4..e407e5f 100644
--- a/waybar/config
+++ b/waybar/config
@@ -2,9 +2,12 @@
     "layer": "top", // Waybar at top layer
     "height": 30, // Waybar height (to be removed for auto height)
     "spacing": 4, // Gaps between modules (4px)
-    "modules-left": ["hyprland/workspaces", "sway/mode", "sway/scratchpad", "custom/media"],
+    "modules-left": ["custom/appmenu", "wlr/workspaces"],
     "modules-center": ["hyprland/window"],
-    "modules-right": ["idle_inhibitor", "pulseaudio", "cpu", "memory", "keyboard-state", "hyprland/language", "battery", "battery#bat2", "clock", "tray"],
+    "modules-right": ["hyprland/language", "keyboard-state", "pulseaudio", "cpu", "memory", "battery", "clock", "custom/exit", "tray"],
+    "wlr/workspaces" : {
+        "on-click": "activate"
+    },
     //"hyprland/workspaces": {
     //    "disable-scroll": true,
     //    "all-outputs": true,
@@ -21,6 +24,21 @@
     //        "default": ""
     //    }
     //},
+    "custom/appmenu": {
+        "format": " ",
+        "on-click": "~/dotfiles/scripts/applauncher.sh"
+    },
+    "custom/exit": {
+        "format": "",
+        "on-click": "~/dotfiles/scripts/powermenu-hypr.sh"
+    },
+    "custom/reload": {
+        "format": "Reload",
+        "on-click": "~/dotfiles/waybar/reload.sh"
+    },
+    "hyprland/language": {
+        "format": "{short}"
+    },
     "keyboard-state": {
         "numlock": true,
         "capslock": true,
@@ -73,11 +91,11 @@
         "format-alt": "{:%Y-%m-%d}"
     },
     "cpu": {
-        "format": "{usage}% ",
+        "format": "  {usage}%",
         "tooltip": false
     },
     "memory": {
-        "format": "{}% "
+        "format": "  {}%"
     },
     "temperature": {
         // "thermal-zone": 2,
@@ -120,7 +138,7 @@
     },
     "pulseaudio": {
         // "scroll-step": 1, // %, can be a float
-        "format": "{volume}% {icon} {format_source}",
+        "format": "{icon} {volume}%",
         "format-bluetooth": "{volume}% {icon} {format_source}",
         "format-bluetooth-muted": " {icon} {format_source}",
         "format-muted": " {format_source}",
diff --git a/waybar/style.css b/waybar/style.css
index 03f262b..0d92314 100644
--- a/waybar/style.css
+++ b/waybar/style.css
@@ -1,30 +1,24 @@
+@import 'colors-waybar.css';
+
 * {
-    /* `otf-font-awesome` is required to be installed for icons */
     font-family: "Fira Sans Semibold", FontAwesome, Roboto, Helvetica, Arial, sans-serif;
-    font-size: 13px;
+    font-size: 14px;
+    border-radius: 4px;
 }
 
 window#waybar {
-    background-color: rgba(43, 48, 59, 0.8);
-    border-bottom: 3px solid rgba(100, 114, 125, 0.5);
-    color: #ffffff;
+    background-color: rgba(0,0,0,0.3);
+    /* border-bottom: 3px solid rgba(100, 114, 125, 0.5); */
+    color: #FFFFFF;
     transition-property: background-color;
     transition-duration: .5s;
+    border-radius: 0;
 }
 
 window#waybar.hidden {
     opacity: 0.2;
 }
 
-/*
-window#waybar.empty {
-    background-color: transparent;
-}
-window#waybar.solo {
-    background-color: #FFFFFF;
-}
-*/
-
 window#waybar.termite {
     background-color: #3F3F3F;
 }
@@ -35,32 +29,33 @@ window#waybar.chromium {
 }
 
 button {
-    /* Use box-shadow instead of border so the text isn't offset */
-    box-shadow: inset 0 -3px transparent;
-    /* Avoid rounded borders under each button name */
+    /* box-shadow: inset 0 -3px transparent; */
     border: none;
     border-radius: 0;
 }
 
-/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
 button:hover {
     background: inherit;
-    box-shadow: inset 0 -3px #ffffff;
+    box-shadow: inset 0 0px @foreground;
 }
 
 #workspaces button {
     padding: 0 5px;
-    background-color: transparent;
     color: #ffffff;
 }
 
 #workspaces button:hover {
-    background: rgba(0, 0, 0, 0.2);
+    background-color: @foreground;
+    color: @background;
+}
+
+#workspaces button.active {
+    background-color: @color11;
+    color: #FFFFFF;
 }
 
 #workspaces button.focused {
-    background-color: #64727D;
-    box-shadow: inset 0 -3px #ffffff;
+    background-color: @foreground;
 }
 
 #workspaces button.urgent {
@@ -88,6 +83,7 @@ button:hover {
 #idle_inhibitor,
 #scratchpad,
 #mpd {
+    margin: 6px 6px;
     padding: 0 10px;
     color: #ffffff;
 }
@@ -97,18 +93,24 @@ button:hover {
     margin: 0 4px;
 }
 
-/* If workspaces is the leftmost module, omit left margin */
 .modules-left > widget:first-child > #workspaces {
     margin-left: 0;
 }
 
-/* If workspaces is the rightmost module, omit right margin */
 .modules-right > widget:last-child > #workspaces {
     margin-right: 0;
 }
 
+#custom-appmenu {
+    margin-left:10;
+}
+
+#custom-exit {
+    margin-right: 10px;
+}
+
 #clock {
-    background-color: #64727D;
+    background-color: @color11;
 }
 
 #battery {
@@ -143,12 +145,13 @@ label:focus {
 }
 
 #cpu {
-    background-color: #2ecc71;
-    color: #000000;
+   background-color: @foreground;
+   color: #000000;
 }
 
 #memory {
-    background-color: #9b59b6;
+    background-color: @foreground;
+    color:#000000;
 }
 
 #disk {
@@ -168,13 +171,15 @@ label:focus {
 }
 
 #pulseaudio {
-    background-color: #f1c40f;
+    background-color: @foreground;
     color: #000000;
 }
 
 #pulseaudio.muted {
+    /*
     background-color: #90b1b1;
     color: #2a5c45;
+    */
 }
 
 #wireplumber {
@@ -248,11 +253,13 @@ label:focus {
 }
 
 #language {
+    /*
     background: #00b093;
     color: #740864;
     padding: 0 5px;
     margin: 0 5px;
     min-width: 16px;
+    */
 }
 
 #keyboard-state {