Skip to content

rb-andrade/nwg-shell-config

 
 

Repository files navigation

nwg-shell config utility

Contributing: please read the general contributing rules for the nwg-shell project.

The nwg-shell project is a collection of components to build a GTK-based user interface for sway and Hyprland Wayland compositor. It consists of a panel, launcher, dock, traditional menu, wallpaper manager, as well as some helper scripts. This program is a GUI to configure all the components in one place. It also integrates several third party components, which we arbitrarily found the best to build a coherent user experience.

Learn more about nwg-shell on the project website

Packaging status

2022-06-20-233635_screenshot

2022-06-20-233644_screenshot

2022-06-20-233702_screenshot

2022-06-20-233707_screenshot

2022-06-20-233713_screenshot

Idle & Lock screen (since v0.3.7)

image

You may use either gtklock or swaylock as the locker, and either local or Unsplash random images as the background. Of course you may also opt-out, by unchecking the "Use these settings" box.

Hint: use the nwg-lock command system-wide (well, wlroots only) to lock screen with the locker and background defined in this tab.

Safety: for the media player buttons to work with gtklock, we use the --no-input-inhibit argument. If safety is more important to you than appearance, consider using swaylock. The playerctl window will display no buttons, however

Desktop styles

Every preset is bound to its own nwg-panel config file and css style sheet. Along with it come settings for the launcher (nwg-drawer), exit menu (nwg-bar), and the dock (nwg-dock). The latter is only turned on by default in preset-1 and preset-3.

preset-0
preset-1
preset-2
preset-3

For key bindings help, press [Super]+F1.

Command line arguments

$ nwg-shell-config -h
usage: nwg-shell-config-hyprland [-h] [-v] [-r] [-b RESTORE_BACKUP] [-s]

options:
  -h, --help            show this help message and exit
  -v, --version         display version information
  -r, --restore         restore default presets
  -b RESTORE_BACKUP, --restore_backup RESTORE_BACKUP
                        restore all configs from a backup file (given path)
  -s, --save            load settings & Save includes (for use w/ external scripts)

-s | --save argument:

If set, the program will read current settings, export the ~/.config/hypr/includes.conf file and die. This is for use with external scripts. See: https://www.reddit.com/r/nwg_shell/comments/14by0by/request_keyboard_layout_switching.

Sample nwg-panel executor:

#!/usr/bin/env python3

# nwg-panel executor to display keyboard layout and switch it with `nwg-shell-config -s` command
# 1. Save anywhere on $PATH as e.g. `kb-layout-hyprland` file.
# 2. Enter `kb-layout-hyprland` in the executor "Script" field.
# 3. Enter `kb-layout-hyprland -s` in the executor "On left clock" field.

import os
import sys
import json
import subprocess

# We need to change the "input-kb_layout" value in the "settings-hyprland" json file.
settings_file = os.path.join(os.getenv("HOME"), ".local/share/nwg-shell-config/settings-hyprland")


def main():
    # load settings-hyprland to a dictionary
    try:
        with open(settings_file, 'r') as f:
            settings = json.load(f)
    except Exception as e:
        print("Error loading json: {}".format(e))
        sys.exit(1)

    if len(sys.argv) > 1 and sys.argv[1] == "-s":  # argument `-s` given
        # switch keyboard layout in the dictionary
        settings["input-kb_layout"] = "pl" if settings["input-kb_layout"] == "us" else "us"
        # save to the json file
        with open(settings_file, 'w') as f:
            json.dump(settings, f, indent=2, ensure_ascii=True)

        # run `nwg-shell-config -s` to export settings to ~/.config/hypr/includes
        subprocess.Popen("nwg-shell-config -s", shell=True)

    # executor output in 2 lines (icon + text)
    print("input-keyboard")             # icon name
    print(settings["input-kb_layout"])  # current layout


if __name__ == "__main__":
    main()

image

About

nwg-shell configuration utility

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.5%
  • Other 0.5%