From 984c69ea5904c17b135008475d7704b31d4a101a Mon Sep 17 00:00:00 2001 From: Stephan Raabe Date: Mon, 1 Jan 2024 11:40:15 +0100 Subject: [PATCH] Updates --- .install/cleanup.sh | 11 +++++ .install/general-packages.sh | 1 + .install/hook.sh | 2 + .install/restore.sh | 37 +++++++++++++---- .install/version.sh | 2 +- .install/version.txt | 2 +- .settings/networkmanager.sh | 2 +- CHANGELOG | 7 ++++ README.md | 2 +- hypr/conf/autostart.conf | 5 +++ hypr/conf/windowrules/default.conf | 1 + .../modules/system/nmapplet/config.sh | 2 + .../modules/system/nmapplet/module.sh | 35 ++++++++++++++++ .../modules/waybar/bluetooth/module.sh | 2 +- .../waybar/defaults/networkmanager/module.sh | 3 +- .../settings/modules/waybar/network/config.sh | 2 + .../settings/modules/waybar/network/module.sh | 40 +++++++++++++++++++ waybar/modules.json | 8 ++-- waybar/themes/ml4w-blur-bottom/config | 2 + waybar/themes/ml4w-blur/config | 2 + waybar/themes/ml4w-blur/style.css | 5 ++- waybar/themes/ml4w-bottom/config | 2 + waybar/themes/ml4w/config | 2 + waybar/themes/ml4w/style.css | 19 --------- 24 files changed, 157 insertions(+), 39 deletions(-) create mode 100644 hypr/settings/modules/system/nmapplet/config.sh create mode 100755 hypr/settings/modules/system/nmapplet/module.sh create mode 100644 hypr/settings/modules/waybar/network/config.sh create mode 100755 hypr/settings/modules/waybar/network/module.sh diff --git a/.install/cleanup.sh b/.install/cleanup.sh index f257100..cb19e13 100644 --- a/.install/cleanup.sh +++ b/.install/cleanup.sh @@ -4,6 +4,7 @@ echo -e "${GREEN}" figlet "Cleanup" echo -e "${NONE}" + # Check for ttf-ms-fonts if [[ $(_isInstalledPacman "ttf-ms-fonts") == 0 ]]; then echo "The script has detected ttf-ms-fonts. This can cause conflicts with icons in Waybar." @@ -11,4 +12,14 @@ if [[ $(_isInstalledPacman "ttf-ms-fonts") == 0 ]]; then sudo pacman --noconfirm -R ttf-ms-fonts fi fi + +# Check for running NetworkManager.service +# if [[ $(systemctl list-units --all -t service --full --no-legend "NetworkManager.service" | sed 's/^\s*//g' | cut -f1 -d' ') == "NetworkManager.service" ]];then +# echo "NetworkManager.service already running." +# else +# sudo systemctl enable NetworkManager.service +# sudo systemctl start NetworkManager.service +# echo "NetworkManager.service activated successfully." +# fi + echo "Cleanup done." \ No newline at end of file diff --git a/.install/general-packages.sh b/.install/general-packages.sh index 21d4d41..5d95529 100644 --- a/.install/general-packages.sh +++ b/.install/general-packages.sh @@ -38,6 +38,7 @@ packagesPacman=( "gum" "man-pages" "xdg-desktop-portal" + "nm-connection-editor" ); packagesYay=( diff --git a/.install/hook.sh b/.install/hook.sh index de93086..bf98385 100755 --- a/.install/hook.sh +++ b/.install/hook.sh @@ -9,5 +9,7 @@ echo -e "${NONE}" if gum confirm "Do you want to run the script now?"; then source ~/dotfiles-versions/hook.sh echo "hook.sh executed!" + else + echo "Execution of hook.sh skipped." fi fi diff --git a/.install/restore.sh b/.install/restore.sh index e28f2c9..dbd0524 100755 --- a/.install/restore.sh +++ b/.install/restore.sh @@ -175,14 +175,7 @@ _startRestore() { if [ -d ~/dotfiles ]; then echo -e "${GREEN}" -cat <<"EOF" - ____ _ -| _ \ ___ ___| |_ ___ _ __ ___ -| |_) / _ \/ __| __/ _ \| '__/ _ \ -| _ < __/\__ \ || (_) | | | __/ -|_| \_\___||___/\__\___/|_| \___| - -EOF +figlet "Restore" echo -e "${NONE}" restored=0 echo "The script will try to restore existing configurations." @@ -248,5 +241,33 @@ echo -e "${NONE}" echo "Waybar Systray restored." fi + # Restore Waybar Network + targetFile1="$HOME/dotfiles-versions/$version/waybar/themes/ml4w/config" + targetFile2="$HOME/dotfiles-versions/$version/waybar/themes/ml4w-blur/config" + targetFile3="$HOME/dotfiles-versions/$version/waybar/themes/ml4w-blur-bottom/config" + targetFile4="$HOME/dotfiles-versions/$version/waybar/themes/ml4w-bottom/config" + settingsFile="$HOME/dotfiles/.settings/waybar_network" + if [ -f $settingsFile ] ;then + startMarker="START NETWORK TOOGLE" + endMarker="END NETWORK TOOGLE" + customtext="$(cat $settingsFile)" + _replaceInFile "$startMarker" "$endMarker" "$customtext" "$targetFile1" + _replaceInFile "$startMarker" "$endMarker" "$customtext" "$targetFile2" + _replaceInFile "$startMarker" "$endMarker" "$customtext" "$targetFile3" + _replaceInFile "$startMarker" "$endMarker" "$customtext" "$targetFile4" + echo "Waybar Network restored." + fi + + # Restore Waybar nmapplet + targetFile="$HOME/dotfiles-versions/$version/hypr/conf/autostart.conf" + settingsFile="$HOME/dotfiles/.settings/waybar_nmapplet" + if [ -f $settingsFile ] ;then + startMarker="START NM APPLET" + endMarker="END NM APPLET" + customtext="$(cat $settingsFile)" + _replaceInFile "$startMarker" "$endMarker" "$customtext" "$targetFile" + echo "nm-applet restored." + fi + echo "" fi diff --git a/.install/version.sh b/.install/version.sh index 32b473f..3cb0e08 100644 --- a/.install/version.sh +++ b/.install/version.sh @@ -1 +1 @@ -version="2.7" +version="2.7.1BETA1" diff --git a/.install/version.txt b/.install/version.txt index e21ad0e..74de09f 100644 --- a/.install/version.txt +++ b/.install/version.txt @@ -1 +1 @@ -273 \ No newline at end of file +274 \ No newline at end of file diff --git a/.settings/networkmanager.sh b/.settings/networkmanager.sh index a3a46da..f3d8804 100755 --- a/.settings/networkmanager.sh +++ b/.settings/networkmanager.sh @@ -1 +1 @@ -alacritty -e nmtui \ No newline at end of file +nm-connection-editor \ No newline at end of file diff --git a/CHANGELOG b/CHANGELOG index b2cb80e..b57ad7f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,10 @@ +Version 2.7.1 +https://gitlab.com/stephan-raabe/dotfiles/-/releases/2.7.1 +-------------------------------------------------------- +Hyprland: +- Add optional network-manager applet support. Can be activated in Settings script System/nm-applet +- Settings: Show/Hide network module + Version 2.7 https://gitlab.com/stephan-raabe/dotfiles/-/releases/2.7 -------------------------------------------------------- diff --git a/README.md b/README.md index ece6e3c..f714f30 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# ML4W dotfiles 2.7 +# ML4W dotfiles 2.7.1BETA1 This is my configuration of Hyprland (Wayland) and Qtile (X11) for Arch Linux based distributions. This package includes an installation script to install and setup the required components. diff --git a/hypr/conf/autostart.conf b/hypr/conf/autostart.conf index b6abf38..b3abdeb 100644 --- a/hypr/conf/autostart.conf +++ b/hypr/conf/autostart.conf @@ -20,6 +20,11 @@ exec-once = ~/dotfiles/gtk/gtk.sh # Load swayidle and define the lock screen time exec-once = ~/dotfiles/hypr/scripts/lockscreentime.sh +# Load network manager applet +# START NM APPLET +# exec-once = nm-applet --indicator +# END NM APPLET + # Load cliphist history exec-once = wl-paste --watch cliphist store diff --git a/hypr/conf/windowrules/default.conf b/hypr/conf/windowrules/default.conf index 2e459a6..486a342 100644 --- a/hypr/conf/windowrules/default.conf +++ b/hypr/conf/windowrules/default.conf @@ -7,6 +7,7 @@ windowrule = tile,^(Brave-browser)$ windowrule = tile,^(Chromium)$ windowrule = float,^(pavucontrol)$ windowrule = float,^(blueman-manager)$ +windowrule = float,^(nm-connection-editor)$ windowrulev2 = float,class:(dotfiles-floating) windowrulev2 = size 60% 60%,class:(dotfiles-floating) diff --git a/hypr/settings/modules/system/nmapplet/config.sh b/hypr/settings/modules/system/nmapplet/config.sh new file mode 100644 index 0000000..d027bd2 --- /dev/null +++ b/hypr/settings/modules/system/nmapplet/config.sh @@ -0,0 +1,2 @@ +name="nw-applet " +order=1 diff --git a/hypr/settings/modules/system/nmapplet/module.sh b/hypr/settings/modules/system/nmapplet/module.sh new file mode 100755 index 0000000..0298a9b --- /dev/null +++ b/hypr/settings/modules/system/nmapplet/module.sh @@ -0,0 +1,35 @@ +#!/bin/bash +_getHeader "$name" "$author" + +echo "Enable or disable the network manager applet (nw-applet) in the Systray." +echo "(nw-applet must be installed on your system)" +echo "IMPORTANT: Please reboot your system after a change." +echo +# Define File +targetFile1="$HOME/dotfiles/hypr/conf/autostart.conf" +settingsFile="$HOME/dotfiles/.settings/waybar_nmapplet" + +# Define Markers +startMarker="START NM APPLET" +endMarker="END NM APPLET" + +# Select Value +customvalue=$(gum choose "Enable" "Disable") + +if [ ! -z $customvalue ]; then + if [ "$customvalue" == "Enable" ] ;then + customtext="exec-once = nm-applet" + else + customtext="# exec-once = nm-applet" + fi + + _replaceInFile $startMarker $endMarker $customtext $targetFile1 + _writeSettings $settingsFile $customtext + + # Reload Waybar + _goBack +else + echo "ERROR: Define a value." + sleep 2 + _goBack +fi diff --git a/hypr/settings/modules/waybar/bluetooth/module.sh b/hypr/settings/modules/waybar/bluetooth/module.sh index 42514e2..6546661 100755 --- a/hypr/settings/modules/waybar/bluetooth/module.sh +++ b/hypr/settings/modules/waybar/bluetooth/module.sh @@ -1,7 +1,7 @@ #!/bin/bash _getHeader "$name" "$author" -echo "Hide or show the bluetooth icon in ML4W waybar themes." +echo "Hide or show the bluetooth module in ML4W waybar themes." # Define File targetFile1="$HOME/dotfiles/waybar/themes/ml4w/config" diff --git a/hypr/settings/modules/waybar/defaults/networkmanager/module.sh b/hypr/settings/modules/waybar/defaults/networkmanager/module.sh index 7f25ba8..c38e5a4 100755 --- a/hypr/settings/modules/waybar/defaults/networkmanager/module.sh +++ b/hypr/settings/modules/waybar/defaults/networkmanager/module.sh @@ -1,7 +1,8 @@ #!/bin/bash _getHeader "$name" "$author" -echo "Define the start command to start the networkmanager." +echo "Define the start command to start the networkmanager (Must be installed on your system)." +echo "Possible values: alacritty -e nmtui, nm-connection-editor, etc." # Define File targetFile="$HOME/dotfiles/.settings/networkmanager.sh" diff --git a/hypr/settings/modules/waybar/network/config.sh b/hypr/settings/modules/waybar/network/config.sh new file mode 100644 index 0000000..8dc80aa --- /dev/null +++ b/hypr/settings/modules/waybar/network/config.sh @@ -0,0 +1,2 @@ +name="Show/Hide Network" +order=1 diff --git a/hypr/settings/modules/waybar/network/module.sh b/hypr/settings/modules/waybar/network/module.sh new file mode 100755 index 0000000..efd05c4 --- /dev/null +++ b/hypr/settings/modules/waybar/network/module.sh @@ -0,0 +1,40 @@ +#!/bin/bash +_getHeader "$name" "$author" + +echo "Hide or show the network module in ML4W waybar themes." + +# Define File +targetFile1="$HOME/dotfiles/waybar/themes/ml4w/config" +targetFile2="$HOME/dotfiles/waybar/themes/ml4w-blur/config" +targetFile3="$HOME/dotfiles/waybar/themes/ml4w-blur-bottom/config" +targetFile4="$HOME/dotfiles/waybar/themes/ml4w-bottom/config" +settingsFile="$HOME/dotfiles/.settings/waybar_network" + +# Define Markers +startMarker="START NETWORK TOOGLE" +endMarker="END NETWORK TOOGLE" + +# Select Value +customvalue=$(gum choose "SHOW" "HIDE") + +if [ ! -z $customvalue ]; then + if [ "$customvalue" == "SHOW" ] ;then + customtext=" \"network\"," + else + customtext=" \/\/\"network\"," + fi + + _replaceInFile $startMarker $endMarker $customtext $targetFile1 + _replaceInFile $startMarker $endMarker $customtext $targetFile2 + _replaceInFile $startMarker $endMarker $customtext $targetFile3 + _replaceInFile $startMarker $endMarker $customtext $targetFile4 + _writeSettings $settingsFile $customtext + + # Reload Waybar + setsid $HOME/dotfiles/waybar/launch.sh 1>/dev/null 2>&1 & + _goBack +else + echo "ERROR: Define a value." + sleep 2 + _goBack +fi diff --git a/waybar/modules.json b/waybar/modules.json index 6ddc6b5..7ef218a 100644 --- a/waybar/modules.json +++ b/waybar/modules.json @@ -285,11 +285,11 @@ "network": { "format": "{ifname}", "format-wifi": " {signalStrength}%", - "format-ethernet": " {ipaddr}", - "format-disconnected": "Not connected", //An empty format will hide the module. + "format-ethernet": " {ifname}", + "format-disconnected": "Disconnected", "tooltip-format": " {ifname} via {gwaddri}", - "tooltip-format-wifi": " {essid} ({signalStrength}%)", - "tooltip-format-ethernet": " {ifname} ({ipaddr}/{cidr})", + "tooltip-format-wifi": " {ifname} @ {essid}\nIP: {ipaddr}\nStrength: {signalStrength}%\nFreq: {frequency}MHz\nUp: {bandwidthUpBits} Down: {bandwidthDownBits}", + "tooltip-format-ethernet": " {ifname}\nIP: {ipaddr}\n up: {bandwidthUpBits} down: {bandwidthDownBits}", "tooltip-format-disconnected": "Disconnected", "max-length": 50, "on-click": "~/dotfiles/.settings/networkmanager.sh" diff --git a/waybar/themes/ml4w-blur-bottom/config b/waybar/themes/ml4w-blur-bottom/config index e959a03..f292359 100644 --- a/waybar/themes/ml4w-blur-bottom/config +++ b/waybar/themes/ml4w-blur-bottom/config @@ -55,7 +55,9 @@ "bluetooth", // END BT TOOGLE "battery", + // START NETWORK TOOGLE "network", + // END NETWORK TOOGLE "group/hardware", "group/settings", "custom/cliphist", diff --git a/waybar/themes/ml4w-blur/config b/waybar/themes/ml4w-blur/config index 04ca17f..4cbfe5d 100644 --- a/waybar/themes/ml4w-blur/config +++ b/waybar/themes/ml4w-blur/config @@ -55,7 +55,9 @@ "bluetooth", // END BT TOOGLE "battery", + // START NETWORK TOOGLE "network", + // END NETWORK TOOGLE "group/hardware", "custom/cliphist", "idle_inhibitor", diff --git a/waybar/themes/ml4w-blur/style.css b/waybar/themes/ml4w-blur/style.css index dede8df..4046175 100644 --- a/waybar/themes/ml4w-blur/style.css +++ b/waybar/themes/ml4w-blur/style.css @@ -408,6 +408,7 @@ window#waybar.empty #window { #tray { padding: 0px 15px 0px 0px; + color: @textcolor3; } #tray > .passive { @@ -421,7 +422,7 @@ window#waybar.empty #window { /* ----------------------------------------------------- * Other * ----------------------------------------------------- */ - +/* label:focus { background-color: #000000; } @@ -437,4 +438,4 @@ label:focus { #network.disconnected { background-color: #f53c3c; } - +*/ diff --git a/waybar/themes/ml4w-bottom/config b/waybar/themes/ml4w-bottom/config index 3ba950d..9b48987 100644 --- a/waybar/themes/ml4w-bottom/config +++ b/waybar/themes/ml4w-bottom/config @@ -55,7 +55,9 @@ "bluetooth", // END BT TOOGLE "battery", + // START NETWORK TOOGLE "network", + // END NETWORK TOOGLE "group/hardware", "custom/cliphist", "idle_inhibitor", diff --git a/waybar/themes/ml4w/config b/waybar/themes/ml4w/config index 3c5166c..24a3df3 100644 --- a/waybar/themes/ml4w/config +++ b/waybar/themes/ml4w/config @@ -55,7 +55,9 @@ "bluetooth", // END BT TOOGLE "battery", + // START NETWORK TOOGLE "network", + // END NETWORK TOOGLE "group/hardware", "custom/cliphist", "idle_inhibitor", diff --git a/waybar/themes/ml4w/style.css b/waybar/themes/ml4w/style.css index 475b52f..7037bf4 100644 --- a/waybar/themes/ml4w/style.css +++ b/waybar/themes/ml4w/style.css @@ -419,23 +419,4 @@ window#waybar.empty #window { -gtk-icon-effect: highlight; } -/* ----------------------------------------------------- - * Other - * ----------------------------------------------------- */ - -label:focus { - background-color: #000000; -} - -#backlight { - background-color: #90b1b1; -} - -#network { - background-color: #2980b9; -} - -#network.disconnected { - background-color: #f53c3c; -}