+ nwgp.sh (wip)

backup/restore nwg-panel settings
This commit is contained in:
committer@tuxwarrior
2026-03-05 08:33:31 -05:00
parent 0295655e50
commit 7fff68c02a
4 changed files with 428 additions and 0 deletions

80
dots/bin/nwgp.sh Executable file
View File

@@ -0,0 +1,80 @@
#!/usr/bin/env bash
# 26.03.05 :: klevstul
continue_if_yes() {
# -n 1: Reads only one character.
# -r: Prevents backslash interpretation.
# Case handling: Accepts both uppercase and lowercase y/Y and n/N.
# Default behavior: Pressing Enter defaults to n, avoiding accidental continuation.
# Loop: Repeats until valid input is given.
local prompt="${1:-continue?: }"
while true; do
echo ""
read -r -n 1 -p "$prompt [y/n]:" answer
case "$answer" in
[Yy])
echo # Move to next line after input
return 0 # Continue execution
;;
[Nn]|"")
echo # Move to next line
return 1 # Exit or skip action
;;
*)
echo -e "\nplease answer 'y' or 'n'."
;;
esac
done
}
backupDeploy() {
local operation=$1
local repo_dir="/home/poq/syncDir/gitRepos/gi.op.fo/lnx-arch/dots/nwg-panel"
local nwgp_dir="/home/poq/.config/nwg-panel"
local filenames=("common-settings.json" "config" "style.css")
local files=()
if [[ "${operation}" == "backup" ]]; then
echo -e "\nthe following files will be copied to the repository (old files in the repo will be overwritten):"
for filename in "${filenames[@]}"; do
local file="${nwgp_dir}/${filename}"
echo "- ${file}"
files+=(${file})
done
if continue_if_yes "would you like to proceed?"; then
echo "proceeding..."
for file in "${files[@]}"; do
cp ${file} ${repo_dir}/
done
else
echo "operation cancelled."
fi
elif [[ "${operation}" == "deploy" ]]; then
echo "deploy"
# pkill nwg-panel
# nwg-panel &
else
echo "error: unknown operation '${operation}'"
fi
}
this_file_name=`basename "$0"`
if [ $# -lt 1 ]; then
echo "error: operation {backup|deploy} is missing."
echo "usage: '$this_file_name {backup|deploy}'"
exit 1
fi
backupDeploy $1

View File

@@ -0,0 +1,6 @@
{
"restart-on-display": true,
"restart-delay": 500,
"processes-backgroud-only": true,
"processes-own-only": true
}

231
dots/nwg-panel/config Normal file
View File

@@ -0,0 +1,231 @@
[
{
"name": "panel-top",
"output": "DP-1",
"layer": "bottom",
"position": "top",
"controls": "right",
"width": "auto",
"height": 30,
"homogeneous": true,
"margin-top": 0,
"margin-bottom": 0,
"padding-horizontal": 0,
"padding-vertical": 0,
"spacing": 20,
"items-padding": 0,
"icons": "light",
"css-name": "panel-top",
"modules-left": [
"hyprland-workspaces"
],
"modules-center": [
"clock",
"playerctl",
"executor-temperature"
],
"modules-right": [
"tray"
],
"controls-settings": {
"components": [
"volume",
"battery"
],
"commands": {
"battery": ""
},
"show-values": false,
"interval": 1,
"icon-size": 16,
"hover-opens": false,
"leave-closes": true,
"click-closes": false,
"css-name": "controls-window",
"custom-items": [
{
"name": "Panel settings",
"icon": "nwg-panel",
"cmd": "nwg-panel-config"
}
],
"menu": {
"name": "Exit",
"icon": "system-shutdown-symbolic",
"items": []
},
"show-brightness": false,
"show-volume": false,
"show-battery": true,
"output-switcher": false,
"per-app-volume": false,
"backlight-controller": "brightnessctl",
"backlight-device": "",
"window-width": 0,
"window-margin-horizontal": 0,
"window-margin-vertical": 0,
"root-css-name": "controls-overview",
"battery-low-level": 20,
"battery-low-interval": 3,
"processes-label": "Processes",
"readme-label": "README",
"angle": 0.0
},
"tray": {
"root-css-name": "tray",
"inner-css-name": "inner-tray"
},
"sway-taskbar": {
"workspace-menu": [
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8"
],
"name-max-len": 20,
"image-size": 16,
"workspaces-spacing": 0,
"task-padding": 0,
"show-app-icon": true,
"show-app-name": true,
"show-layout": true,
"workspace-buttons": false,
"all-workspaces": true,
"mark-autotiling": true,
"mark-xwayland": true,
"all-outputs": true
},
"sway-workspaces": {
"numbers": [
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8"
]
},
"clock": {
"format": "%a %y.%m.%d @ %H:%M:%S",
"tooltip-text": "",
"on-left-click": "",
"on-middle-click": "",
"on-right-click": "",
"on-scroll-up": "",
"on-scroll-down": "",
"css-name": "clock",
"interval": 1,
"tooltip-date-format": false,
"root-css-name": "root-clock",
"angle": 0.0,
"calendar-path": "",
"calendar-css-name": "calendar-window",
"calendar-placement": "top",
"calendar-margin-horizontal": 0,
"calendar-margin-vertical": 0,
"calendar-icon-size": 24,
"calendar-interval": 60,
"calendar-on": true
},
"playerctl": {
"buttons-position": "left",
"icon-size": 16,
"chars": 30,
"scroll": false,
"button-css-name": "",
"label-css-name": "",
"interval": 1
},
"button-sample": {
"command": "notify-send 'sample button'",
"icon": "view-grid",
"label": "",
"label-position": "right",
"css-name": "button-custom",
"icon-size": 16
},
"menu-start": "off",
"exclusive-zone": true,
"sigrt": 64,
"use-sigrt": false,
"scratchpad": {},
"sway-mode": {},
"openweather": {},
"brightness-slider": {
"show-brightness": false,
"show-volume": false,
"show-battery": true,
"icon-size": 16,
"interval": 10,
"hover-opens": false,
"leave-closes": false,
"root-css-name": "brightness-module",
"css-name": "brightness-popup",
"angle": 0.0,
"icon-placement": "start",
"backlight-device": "",
"backlight-controller": "ddcutil",
"slider-orientation": "horizontal",
"slider-inverted": false,
"popup-icon-placement": "start",
"popup-horizontal-alignment": "left",
"popup-vertical-alignment": "top",
"popup-width": 256,
"popup-height": 64,
"popup-horizontal-margin": 0,
"popup-vertical-margin": 0,
"step-size": 1
},
"dwl-tags": {},
"hyprland-taskbar": {},
"hyprland-workspaces": {
"num-ws": 10,
"show-icon": true,
"show-inactive-workspaces": true,
"show-workspaces-from-all-outputs": true,
"image-size": 16,
"show-workspaces": true,
"show-name": false,
"name-length": 40,
"show-empty": true,
"mark-content": true,
"show-names": true,
"mark-floating": true,
"mark-xwayland": true,
"angle": 0.0
},
"run-if-output-exist": [],
"run-if-output-absent": [],
"monitor": "",
"width-as-percentage": false,
"start-hidden": false,
"hyprland-submap": {},
"keyboard-layout": {},
"niri-taskbar": {},
"random-wallpaper": {},
"pinned": {},
"executor-temperature": {
"script": "temperature.sh 60 65",
"tooltip-text": "",
"on-left-click": "",
"on-middle-click": "",
"on-right-click": "",
"on-scroll-up": "",
"on-scroll-down": "",
"root-css-name": "",
"css-name": "",
"icon-placement": "left",
"icon-size": 16,
"interval": 5,
"angle": 0.0,
"sigrt": 34,
"use-sigrt": false
}
}
]

111
dots/nwg-panel/style.css Normal file
View File

@@ -0,0 +1,111 @@
/***** SUGGESTED TO CHANGE CAREFULLY *****/
/* Recommended if panel "height" unset or smaller then your theme default button height */
button {
margin: 2px
}
/* SwayTaskBar and SwayWorkspaces use custom widgets, that need this and the next name
to highlight currently focused task / workspace. */
#task-box {
padding-left: 4px;
padding-right: 4px
}
#task-box-focused {
background-color: rgba (255, 255, 255, 0.12);
padding-left: 4px;
padding-right: 4px
}
/***** MODIFY TO YOUR TASTE *****/
/* Sample button in sample config w/ no background nor border */
#button-custom {
background: rgba (0, 0, 0, 0.0);
border: 0
}
/* Top panel in sample config uses this name */
#panel-top {
background: #3a0140;
color: #eeeeee
}
/* Bottom panel in sample config uses this name */
#panel-bottom {
background: #101010;
color: #eeeeee
}
/* Controls window in sample config uses this name */
#controls-window {
border-radius: 15px;
background: #36364f;
color: #eeeeee
}
#controls-window scale value {
color: #eeeeee
}
/* Brightness slider popup window in sample config uses this name */
#brightness-popup {
border-radius: 15px;
background: #36364f;
color: #eeeeee
}
#brightness-popup box {
padding: 15px;
}
/* Executors usually behave better in monospace fonts */
#executor-label {
font-family: monospace
}
/* and so does the Clock */
#clock {
font-family: monospace;
font-size: 16px
}
/* Sample executor-weather uses "css-name": "weather" */
#weather {
font-size: 16px
}
/* dwl-tags module */
#dwl-tag-box {
padding-top: 4px;
padding-bottom: 4px
}
#dwl-tag-occupied {
font-family: monospace;
color: #eee;
background-color: #006699;
padding-left: 3px;
padding-right: 3px;
}
#dwl-tag-free {
font-family: monospace;
color: #eee;
background-color: rgba (32, 50, 90, 1.0);
padding-left: 3px;
padding-right: 3px;
}
#dwl-tag-urgent {
font-family: monospace;
color: #eee;
background-color: #ee6600;
padding-left: 3px;
padding-right: 3px;
}
#dwl-tag-selected {
border: solid 2px;
border-color: #81a1c1
}