mirror of
https://github.com/nwg-piotr/nwg-shell.git
synced 2024-10-27 01:01:39 +03:00
update configs
This commit is contained in:
parent
ff4d3f9696
commit
be01b0d118
@ -115,15 +115,26 @@ def main():
|
||||
help="display version information")
|
||||
args = parser.parse_args()
|
||||
|
||||
# Upgrade
|
||||
if args.upgrade:
|
||||
print("You are about to upgrade nwg-shell to v{}.".format(__version__))
|
||||
print("This will modify your config files to use the recently added software.")
|
||||
print("--------------------------------------------------------------")
|
||||
print("| You are about to upgrade nwg-shell to v{}. |".format(__version__))
|
||||
print("| It'll modify your config files to use the recent software. |")
|
||||
print("| |")
|
||||
print("| This may have an unexpected result |")
|
||||
print("| if you tweaked you sway config file manually. |")
|
||||
print("| If it happens to you, run 'nwg-shell-installer -a' (all), |")
|
||||
print("| or 'nwg-shell-installer' (interactive mode), |")
|
||||
print("| in order to install default configs. |")
|
||||
print("--------------------------------------------------------------")
|
||||
|
||||
a = input("\nProceed? y/N ")
|
||||
if a.strip().upper() != "Y":
|
||||
print("Installation cancelled")
|
||||
sys.exit(0)
|
||||
else:
|
||||
# v2.0
|
||||
# v0.2.0
|
||||
print("\n[Updating panel presets]")
|
||||
for item in ["preset-0", "preset-1", "preset-2", "preset-3"]:
|
||||
src = os.path.join(config_home, "nwg-panel/{}".format(item))
|
||||
panel_config = load_json(src)
|
||||
@ -151,6 +162,9 @@ def main():
|
||||
print("Saving '{}'".format(src))
|
||||
save_json(panel_config, src)
|
||||
|
||||
if not changed:
|
||||
print("No change needed.")
|
||||
|
||||
# Update sway config
|
||||
sway_config = os.path.join(config_home, "sway/config")
|
||||
old_config = load_text_file(sway_config).splitlines()
|
||||
@ -158,9 +172,6 @@ def main():
|
||||
print("Couldn't load '{}'".format(sway_config))
|
||||
else:
|
||||
print("\n[Updating sway config file]")
|
||||
print("* This may have an unexpected result if you tweaked it manually.")
|
||||
print("* If it happens, run `nwg-shell-installer` w/o arguments, and install default configs"
|
||||
" from scratch.\n")
|
||||
|
||||
# backup original file
|
||||
now = datetime.datetime.now()
|
||||
@ -254,6 +265,7 @@ def main():
|
||||
if c:
|
||||
print("The '{}' script is no longer necessary, you may delete it now.".format(c))
|
||||
|
||||
# Installation
|
||||
else:
|
||||
print("-------------------------------------------------------------------")
|
||||
print("| This script installs/overwrites configs and style sheets |")
|
||||
@ -334,8 +346,7 @@ def main():
|
||||
proceed = a.strip().upper() == "Y"
|
||||
|
||||
if proceed:
|
||||
for item in ["gtk-3.0", "sway", "nwg-panel", "nwg-wrapper", "nwg-drawer", "nwg-dock", "nwg-bar",
|
||||
"swaync"]:
|
||||
for item in ["sway", "nwg-panel", "nwg-wrapper", "nwg-drawer", "nwg-dock", "nwg-bar", "swaync"]:
|
||||
copy_from_skel(item, folder="config", skip_confirmation=args.all)
|
||||
for item in ["nwg-look"]:
|
||||
copy_from_skel(item, folder="data", skip_confirmation=args.all)
|
||||
|
@ -1,15 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# usage: import-gsettings
|
||||
config="${XDG_CONFIG_HOME:-$HOME/.config}/gtk-3.0/settings.ini"
|
||||
if [ ! -f "$config" ]; then exit 1; fi
|
||||
|
||||
gnome_schema="org.gnome.desktop.interface"
|
||||
gtk_theme="$(grep 'gtk-theme-name' "$config" | sed 's/.*\s*=\s*//')"
|
||||
icon_theme="$(grep 'gtk-icon-theme-name' "$config" | sed 's/.*\s*=\s*//')"
|
||||
cursor_theme="$(grep 'gtk-cursor-theme-name' "$config" | sed 's/.*\s*=\s*//')"
|
||||
font_name="$(grep 'gtk-font-name' "$config" | sed 's/.*\s*=\s*//')"
|
||||
gsettings set "$gnome_schema" gtk-theme "$gtk_theme"
|
||||
gsettings set "$gnome_schema" icon-theme "$icon_theme"
|
||||
gsettings set "$gnome_schema" cursor-theme "$cursor_theme"
|
||||
gsettings set "$gnome_schema" font-name "$font_name"
|
@ -1,75 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import sys
|
||||
import argparse
|
||||
# from sway_save_outputs.__about__ import __version__
|
||||
|
||||
|
||||
def list_outputs():
|
||||
try:
|
||||
from i3ipc import Connection
|
||||
except ModuleNotFoundError:
|
||||
print("'python-i3ipc' package required, terminating", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
i3 = Connection()
|
||||
tree = i3.get_tree()
|
||||
outputs_dict = {}
|
||||
|
||||
for item in tree:
|
||||
if item.type == "output" and not item.name.startswith("__"):
|
||||
outputs_dict[item.name] = {"x": item.rect.x,
|
||||
"y": item.rect.y,
|
||||
"width": item.rect.width,
|
||||
"height": item.rect.height}
|
||||
|
||||
outputs_dict[item.name]["transform"] = item.ipc_data["transform"] if "transform" in item.ipc_data else None
|
||||
outputs_dict[item.name]["scale"] = float(item.ipc_data["scale"]) if "scale" in item.ipc_data else None
|
||||
outputs_dict[item.name]["refresh"] = int(
|
||||
round(item.ipc_data["current_mode"]["refresh"] / 1000, 0)) if "refresh" in item.ipc_data[
|
||||
"current_mode"] else None
|
||||
|
||||
return outputs_dict
|
||||
|
||||
|
||||
def save_list_to_text_file(data, file_path):
|
||||
text_file = open(file_path, "w")
|
||||
for line in data:
|
||||
text_file.write(line + "\n")
|
||||
text_file.close()
|
||||
|
||||
|
||||
def main():
|
||||
config_path = os.path.join(os.getenv("HOME"), ".config/sway/outputs")
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("-f",
|
||||
"--file",
|
||||
type=str,
|
||||
default=config_path,
|
||||
help="full path to save outputs to; default: {}".format(config_path))
|
||||
"""parser.add_argument("-v",
|
||||
"--version",
|
||||
action="version",
|
||||
version="%(prog)s version {}".format(__version__),
|
||||
help="display version information")"""
|
||||
args = parser.parse_args()
|
||||
|
||||
outputs = []
|
||||
outputs_dict = list_outputs()
|
||||
for key in outputs_dict:
|
||||
outputs.append('output "%s" {' % key)
|
||||
outputs.append(' mode %sx%s@%dHz' % (
|
||||
outputs_dict[key]["width"], outputs_dict[key]["height"], outputs_dict[key]["refresh"]))
|
||||
outputs.append(' pos {} {}'.format(outputs_dict[key]["x"], outputs_dict[key]["y"]))
|
||||
if outputs_dict[key]["transform"]:
|
||||
outputs.append(' transform {}'.format(outputs_dict[key]["transform"]))
|
||||
if outputs_dict[key]["scale"]:
|
||||
outputs.append(' scale {}'.format(outputs_dict[key]["scale"]))
|
||||
outputs.append("}")
|
||||
|
||||
print("Saving to {}".format(args.file))
|
||||
save_list_to_text_file(outputs, args.file)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
@ -1,15 +0,0 @@
|
||||
[Settings]
|
||||
gtk-theme-name=Adwaita-dark
|
||||
gtk-icon-theme-name=Papirus-Dark
|
||||
gtk-font-name=Cantarell 11
|
||||
gtk-cursor-theme-name=Adwaita
|
||||
gtk-cursor-theme-size=0
|
||||
gtk-toolbar-style=GTK_TOOLBAR_ICONS
|
||||
gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
|
||||
gtk-button-images=1
|
||||
gtk-menu-images=1
|
||||
gtk-enable-event-sounds=0
|
||||
gtk-enable-input-feedback-sounds=1
|
||||
gtk-xft-antialias=1
|
||||
gtk-xft-hinting=1
|
||||
gtk-xft-hintstyle=hintfull
|
@ -47,14 +47,14 @@
|
||||
"cmd": "azote"
|
||||
},
|
||||
{
|
||||
"name": "Look & Feel",
|
||||
"icon": "preferences-desktop-theme",
|
||||
"cmd": "lxappearance; import-gsettings gtk-theme:gtk-theme-name icon-theme:gtk-icon-theme-name cursor-theme:gtk-cursor-theme-name"
|
||||
"name": "GTK settings",
|
||||
"icon": "nwg-look",
|
||||
"cmd": "nwg-look"
|
||||
},
|
||||
{
|
||||
"name": "Outputs",
|
||||
"icon": "display",
|
||||
"cmd": "wdisplays && sway-save-outputs"
|
||||
"name": "Displays",
|
||||
"icon": "nwg-displays",
|
||||
"cmd": "nwg-displays"
|
||||
},
|
||||
{
|
||||
"name": "Panel settings",
|
||||
|
@ -48,14 +48,14 @@
|
||||
"cmd": "azote"
|
||||
},
|
||||
{
|
||||
"name": "Look & Feel",
|
||||
"icon": "preferences-desktop-theme",
|
||||
"cmd": "lxappearance; import-gsettings"
|
||||
"name": "GTK settings",
|
||||
"icon": "nwg-look",
|
||||
"cmd": "nwg-look"
|
||||
},
|
||||
{
|
||||
"name": "Outputs",
|
||||
"icon": "display",
|
||||
"cmd": "wdisplays && sway-save-outputs"
|
||||
"name": "Displays",
|
||||
"icon": "nwg-displays",
|
||||
"cmd": "nwg-displays"
|
||||
},
|
||||
{
|
||||
"name": "Panel settings",
|
||||
|
@ -69,14 +69,14 @@
|
||||
"cmd": "azote"
|
||||
},
|
||||
{
|
||||
"name": "Look & Feel",
|
||||
"icon": "preferences-desktop-theme",
|
||||
"cmd": "lxappearance; import-gsettings gtk-theme:gtk-theme-name icon-theme:gtk-icon-theme-name cursor-theme:gtk-cursor-theme-name"
|
||||
"name": "GTK settings",
|
||||
"icon": "nwg-look",
|
||||
"cmd": "nwg-look"
|
||||
},
|
||||
{
|
||||
"name": "Outputs",
|
||||
"icon": "display",
|
||||
"cmd": "wdisplays && sway-save-outputs"
|
||||
"name": "Displays",
|
||||
"icon": "nwg-displays",
|
||||
"cmd": "nwg-displays"
|
||||
},
|
||||
{
|
||||
"name": "Panel settings",
|
||||
|
@ -45,14 +45,14 @@
|
||||
"cmd": "azote"
|
||||
},
|
||||
{
|
||||
"name": "Look & Feel",
|
||||
"icon": "preferences-desktop-theme",
|
||||
"cmd": "lxappearance; import-gsettings gtk-theme:gtk-theme-name icon-theme:gtk-icon-theme-name cursor-theme:gtk-cursor-theme-name"
|
||||
"name": "GTK settings",
|
||||
"icon": "nwg-look",
|
||||
"cmd": "nwg-look"
|
||||
},
|
||||
{
|
||||
"name": "Outputs",
|
||||
"icon": "display",
|
||||
"cmd": "wdisplays && sway-save-outputs"
|
||||
"name": "Displays",
|
||||
"icon": "nwg-displays",
|
||||
"cmd": "nwg-displays"
|
||||
},
|
||||
{
|
||||
"name": "Panel settings",
|
||||
|
@ -187,16 +187,6 @@ bindsym $Mod+Shift+Mod2+KP_Right move container to workspace number 6; workspace
|
||||
bindsym $Mod+Shift+Mod2+KP_Home move container to workspace number 7; workspace number 7
|
||||
bindsym $Mod+Shift+Mod2+KP_Up move container to workspace number 8; workspace number 8
|
||||
|
||||
# Workspace to monitor assignment (edit & unhash)
|
||||
# workspace 1 output $Mon1
|
||||
# workspace 2 output $Mon1
|
||||
# workspace 3 output $Mon1
|
||||
# workspace 4 output $Mon1
|
||||
# workspace 5 output $Mon1
|
||||
# workspace 6 output $Mon1
|
||||
# workspace 7 output $Mon1
|
||||
# workspace 8 output $Mon1
|
||||
|
||||
############ Container/Window control ############
|
||||
|
||||
# Scratchpad, Floating
|
||||
|
Loading…
Reference in New Issue
Block a user