Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] generate default configs and exit #289

Open
nazarewk opened this issue Apr 24, 2024 · 3 comments
Open

[Feature Request] generate default configs and exit #289

nazarewk opened this issue Apr 24, 2024 · 3 comments

Comments

@nazarewk
Copy link

Is your feature request related to a problem? Please describe.
I am trying to configure nwg-shell pieces as a home-manager (Nix) module. In high-level overview it expects a static file to load as defaults and is able to merge it with some piece of configuration to produce a complete (also static) configuration file.

I am loading supposedly default config from https://github.com/nwg-piotr/nwg-panel/blob/dfc5104548cc6d047a9fe4a5d6a2f86e544f8cec/nwg_panel/config/config , but it is incomplete.

From what I'm seeing defaults are mostly set at runtime

defaults = {
"show-default": False,
"show-icon": True,
"css-name": "",
"icon-size": 16,
"angle": 0.0
}

Describe the solution you'd like
I would like to be able to run nwg-panel with a flag that would result in filling in configuration structure and exiting without actually displaying any window.

Describe alternatives you've considered
I think I could run it once to generate config at build time of Nix package, but I am not sure it would work.

Additional context
Add any other context or screenshots about the feature request here.

@nazarewk
Copy link
Author

I'm actually getting pa_context_connect() failed: Connection refused when trying to run it in build context

@nazarewk
Copy link
Author

nazarewk commented Apr 24, 2024

actually I'm not sure those settings are filled in at all, seems like file from the first run is EXACTLY the same as the static file available in repository.

are they purely runtime defaults not stored inside config?

@nwg-piotr
Copy link
Owner

nwg-piotr commented Apr 24, 2024

Well, each "defaults" are being added to prevent the panel from crashing in case some keys are missing from the config file. The provided config is very basic, and honestly, I haven't touched it for months, or even years. I distribute the panel as a part of the nwg-shell project, together with a bunch of more sophisticated config files.

I exported a config file for you, together with all the substitutions done programmatically, as seen from the program point of view just before entering the Gtk.main() loop.

[
  {
    "name": "panel-top",
    "output": "eDP-1",
    "layer": "bottom",
    "position": "top",
    "controls": "right",
    "height": 30,
    "homogeneous": true,
    "margin-top": 0,
    "margin-bottom": 0,
    "padding-horizontal": 0,
    "padding-vertical": 0,
    "spacing": 0,
    "items-padding": 0,
    "icons": "light",
    "css-name": "panel-top",
    "modules-left": [
      "button-sample",
      "playerctl"
    ],
    "modules-center": [
      "clock"
    ],
    "modules-right": [
      "sway-mode"
    ],
    "controls-settings": {
      "components": [
        "brightness",
        "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": [
          {
            "name": "Lock",
            "cmd": "swaylock -f -c 000000"
          },
          {
            "name": "Logout",
            "cmd": "swaymsg exit"
          },
          {
            "name": "Reboot",
            "cmd": "systemctl reboot"
          },
          {
            "name": "Shutdown",
            "cmd": "systemctl -i poweroff"
          }
        ]
      },
      "window-width": 0,
      "window-margin": 0,
      "show-brightness": false,
      "show-volume": false,
      "show-battery": true,
      "root-css-name": "controls-overview",
      "angle": 0,
      "battery-low-level": 20,
      "battery-low-interval": 3,
      "readme-label": "README",
      "processes-label": "Processes",
      "backlight-controller": "brightnessctl",
      "backlight-device": "",
      "output-switcher": false,
      "window-margin-vertical": 0,
      "window-margin-horizontal": 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, %d. %b  %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,
      "root-css-name": "root-clock",
      "tooltip-date-format": false,
      "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,
      "show-cover": true,
      "cover-size": 24,
      "angle": 0.0
    },
    "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": {},
    "dwl-tags": {},
    "hyprland-taskbar": {},
    "hyprland-workspaces": {},
    "start-hidden": false,
    "width": 1920,
    "menu-start-settings": {
      "cmd-lock": "swaylock -f -c 000000",
      "cmd-logout": "swaymsg exit",
      "cmd-restart": "systemctl reboot",
      "cmd-shutdown": "systemctl -i poweroff",
      "autohide": true,
      "file-manager": "thunar",
      "height": 0,
      "icon-size-large": 32,
      "icon-size-small": 16,
      "icon-size-button": 16,
      "margin-bottom": 0,
      "margin-left": 0,
      "margin-right": 0,
      "margin-top": 0,
      "padding": 2,
      "terminal": "foot",
      "width": 0
    },
    "swaync": {
      "interval": 1,
      "root-css-name": "root-executor",
      "css-name": "executor-label",
      "icon-placement": "left",
      "icon-size": 18,
      "tooltip-text": "",
      "on-left-click": "swaync-client -t",
      "on-right-click": "",
      "on-middle-click": "",
      "on-scroll-up": "",
      "on-scroll-down": "",
      "always-show-icon": true
    }
  },
  {
    "name": "panel-bottom",
    "output": "eDP-1",
    "layer": "bottom",
    "position": "bottom",
    "controls": "off",
    "height": 30,
    "margin-top": 0,
    "margin-bottom": 0,
    "padding-horizontal": 6,
    "padding-vertical": 0,
    "spacing": 0,
    "items-padding": 0,
    "icons": "",
    "css-name": "panel-bottom",
    "modules-left": [
      "sway-taskbar"
    ],
    "modules-center": [],
    "modules-right": [
      "executor-weather"
    ],
    "controls-settings": {
      "components": [
        "brightness",
        "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": "unnamed",
        "icon": "",
        "items": []
      },
      "window-width": 0,
      "window-margin": 0
    },
    "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": false
    },
    "sway-workspaces": {
      "numbers": [
        "1",
        "2",
        "3",
        "4",
        "5",
        "6",
        "7",
        "8"
      ]
    },
    "clock": {
      "format": "%a, %d. %b  %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
    },
    "playerctl": {
      "buttons-position": "left",
      "icon-size": 16,
      "chars": 30,
      "scroll": false,
      "button-css-name": "",
      "label-css-name": "",
      "interval": 1
    },
    "executor-weather": {
      "script": "curl https://wttr.in/?format=1 -s",
      "interval": 1800,
      "css-name": "weather",
      "on-right-click": "",
      "icon-size": 16,
      "show-icon": true,
      "tooltip-text": "",
      "on-left-click": "",
      "on-middle-click": "",
      "on-scroll-up": "",
      "on-scroll-down": "",
      "root-css-name": "root-executor",
      "icon-placement": "left",
      "angle": 0.0,
      "sigrt": 34,
      "use-sigrt": false
    },
    "sigrt": 0,
    "use-sigrt": false,
    "start-hidden": false,
    "width": 1920,
    "menu-start": "off",
    "menu-start-settings": {
      "cmd-lock": "swaylock -f -c 000000",
      "cmd-logout": "swaymsg exit",
      "cmd-restart": "systemctl reboot",
      "cmd-shutdown": "systemctl -i poweroff",
      "autohide": true,
      "file-manager": "thunar",
      "height": 0,
      "icon-size-large": 32,
      "icon-size-small": 16,
      "icon-size-button": 16,
      "margin-bottom": 0,
      "margin-left": 0,
      "margin-right": 0,
      "margin-top": 0,
      "padding": 2,
      "terminal": "foot",
      "width": 0
    },
    "homogeneous": false,
    "exclusive-zone": true
  }
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants