mirror of
https://github.com/nwg-piotr/nwg-shell.git
synced 2024-09-11 14:17:12 +03:00
upgrade to 0.2.4
This commit is contained in:
parent
a14b12399d
commit
ed3926e742
@ -1,62 +1,17 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import json
|
||||
import os
|
||||
import subprocess
|
||||
import time
|
||||
|
||||
from nwg_shell.__about__ import __version__
|
||||
|
||||
from nwg_shell.tools import load_json, save_json, is_newer
|
||||
|
||||
data_home = os.getenv('XDG_DATA_HOME') if os.getenv('XDG_DATA_HOME') else os.path.join(os.getenv("HOME"),
|
||||
".local/share")
|
||||
|
||||
|
||||
def load_json(path):
|
||||
try:
|
||||
with open(path, 'r') as f:
|
||||
return json.load(f)
|
||||
except Exception as e:
|
||||
print("Error loading json: {}".format(e))
|
||||
return None
|
||||
|
||||
|
||||
def save_json(src_dict, path):
|
||||
with open(path, 'w') as f:
|
||||
json.dump(src_dict, f, indent=2)
|
||||
|
||||
|
||||
def is_newer(string_new, string_existing):
|
||||
"""
|
||||
Compares versions in format 'major.minor.patch' (just numbers allowed).
|
||||
:param string_new: new version to compare with existing one
|
||||
:param string_existing: existing version
|
||||
:return: True if new is newer then existing
|
||||
"""
|
||||
new = major_minor_path(string_new)
|
||||
existing = major_minor_path(string_existing)
|
||||
if new and existing:
|
||||
if new[0] > existing[0]:
|
||||
return True
|
||||
elif new[1] > existing[1]:
|
||||
return True
|
||||
elif new[2] > existing[2]:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
def major_minor_path(string):
|
||||
parts = string.split(".")
|
||||
if len(parts) != 3:
|
||||
return None
|
||||
try:
|
||||
return int(parts[0]), int(parts[1]), int(parts[2])
|
||||
except:
|
||||
return None
|
||||
|
||||
|
||||
def main():
|
||||
shell_data_file = os.path.join(data_home, "nwg-shell/data")
|
||||
|
||||
@ -70,10 +25,7 @@ def main():
|
||||
save_json(shell_data, shell_data_file)
|
||||
|
||||
# Shell versions that need to trigger upgrade
|
||||
need_upgrade = ["0.2.0"]
|
||||
|
||||
# last_upgrade = ver2int(shell_data["last-upgrade"])
|
||||
# ver = ver2int(__version__)
|
||||
need_upgrade = ["0.2.0", "0.2.4"]
|
||||
|
||||
if shell_data["last-upgrade"] and __version__:
|
||||
if is_newer(__version__, shell_data["last-upgrade"]) and __version__ in need_upgrade:
|
||||
|
@ -3,7 +3,7 @@
|
||||
"""
|
||||
nwg-shell installer, to copy all the components' configs and style sheets to their locations,
|
||||
or to restore original files. Pass the `--all` argument on first run or none to select files interactively.
|
||||
Interned to work/tested with Arch Linux.
|
||||
Intended to work/tested with Arch Linux.
|
||||
The package dependencies should pull all the packages needed for the nwg-shell to run.
|
||||
|
||||
Project: https://github.com/nwg-piotr/nwg-shell
|
||||
@ -14,7 +14,6 @@ License: MIT
|
||||
|
||||
import argparse
|
||||
import datetime
|
||||
import json
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
@ -22,6 +21,8 @@ from shutil import copy, copy2, copytree
|
||||
|
||||
from nwg_shell.__about__ import __version__
|
||||
|
||||
from nwg_shell.tools import load_json, save_json
|
||||
|
||||
dir_name = os.path.dirname(__file__)
|
||||
|
||||
config_home = os.getenv('XDG_CONFIG_HOME') if os.getenv('XDG_CONFIG_HOME') else os.path.join(os.getenv("HOME"),
|
||||
@ -34,37 +35,6 @@ shell_data = []
|
||||
shell_data_file = os.path.join(data_home, "nwg-shell/data")
|
||||
|
||||
|
||||
def load_json(path):
|
||||
try:
|
||||
with open(path, 'r') as f:
|
||||
return json.load(f)
|
||||
except Exception as e:
|
||||
print("Error loading json: {}".format(e))
|
||||
return None
|
||||
|
||||
|
||||
def save_json(src_dict, path):
|
||||
with open(path, 'w') as f:
|
||||
json.dump(src_dict, f, indent=2)
|
||||
|
||||
|
||||
def load_text_file(path):
|
||||
try:
|
||||
with open(path, 'r') as file:
|
||||
data = file.read()
|
||||
return data
|
||||
except Exception as e:
|
||||
print(e)
|
||||
return None
|
||||
|
||||
|
||||
def save_text_file(data, file):
|
||||
f = open(file, "w")
|
||||
for item in data:
|
||||
f.write(item + "\n")
|
||||
f.close()
|
||||
|
||||
|
||||
def is_command(cmd):
|
||||
cmd = cmd.split()[0] # strip arguments
|
||||
cmd = "command -v {}".format(cmd)
|
||||
@ -147,78 +117,96 @@ def main():
|
||||
sys.exit(0)
|
||||
else:
|
||||
# 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)
|
||||
changed = False
|
||||
for panel in panel_config:
|
||||
if "custom-items" in panel["controls-settings"]:
|
||||
for i in panel["controls-settings"]["custom-items"]:
|
||||
# replace lxappearance with nwg-look
|
||||
if "lxappearance" in i["cmd"]:
|
||||
print("replacing 'lxappearance' with 'nwg-look' in '{}'".format(item))
|
||||
i["name"] = "GTK settings"
|
||||
i["icon"] = "nwg-look"
|
||||
i["cmd"] = "nwg-look"
|
||||
changed = True
|
||||
if __version__ == "0.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)
|
||||
changed = False
|
||||
for panel in panel_config:
|
||||
if "custom-items" in panel["controls-settings"]:
|
||||
for i in panel["controls-settings"]["custom-items"]:
|
||||
# replace lxappearance with nwg-look
|
||||
if "lxappearance" in i["cmd"]:
|
||||
print("replacing 'lxappearance' with 'nwg-look' in '{}'".format(item))
|
||||
i["name"] = "GTK settings"
|
||||
i["icon"] = "nwg-look"
|
||||
i["cmd"] = "nwg-look"
|
||||
changed = True
|
||||
|
||||
# replace wdisplays with nwg-displays
|
||||
if "wdisplays" in i["cmd"]:
|
||||
print("replacing 'wdisplays' with 'nwg-displays' in '{}'".format(item))
|
||||
i["name"] = "Displays"
|
||||
i["icon"] = "nwg-displays"
|
||||
i["cmd"] = "nwg-displays"
|
||||
changed = True
|
||||
# replace wdisplays with nwg-displays
|
||||
if "wdisplays" in i["cmd"]:
|
||||
print("replacing 'wdisplays' with 'nwg-displays' in '{}'".format(item))
|
||||
i["name"] = "Displays"
|
||||
i["icon"] = "nwg-displays"
|
||||
i["cmd"] = "nwg-displays"
|
||||
changed = True
|
||||
|
||||
# update nwg-shell-config
|
||||
if "nwg-shell-config" in i["cmd"] and i["icon"] != "nwg-shell-config":
|
||||
print("updating 'nwg-shell-config' in '{}'".format(item))
|
||||
i["icon"] = "nwg-shell-config"
|
||||
changed = True
|
||||
# update nwg-shell-config
|
||||
if "nwg-shell-config" in i["cmd"] and i["icon"] != "nwg-shell-config":
|
||||
print("updating 'nwg-shell-config' in '{}'".format(item))
|
||||
i["icon"] = "nwg-shell-config"
|
||||
changed = True
|
||||
|
||||
if changed:
|
||||
print("Saving '{}'".format(src))
|
||||
save_json(panel_config, src)
|
||||
if changed:
|
||||
print("Saving '{}'".format(src))
|
||||
save_json(panel_config, src)
|
||||
|
||||
if not changed:
|
||||
print("No change needed.")
|
||||
if not changed:
|
||||
print("No change needed.")
|
||||
|
||||
# Update sway config
|
||||
# backup original file
|
||||
print("\n[Updating sway config file]")
|
||||
now = datetime.datetime.now()
|
||||
new_name = now.strftime("config-backup-%Y%m%d-%H%M%S")
|
||||
src = os.path.join(config_home, "sway/config")
|
||||
dst = os.path.join(config_home, "sway/{}".format(new_name))
|
||||
try:
|
||||
if os.path.isfile(src):
|
||||
copy(src, dst)
|
||||
print("Your old sway config file has been saved as '{}'".format(new_name))
|
||||
except Exception as e:
|
||||
print("Couldn't back up your old sway config: {}".format(e))
|
||||
|
||||
a = input("Your sway config file needs to be overwritten. Proceed? y/N ")
|
||||
proceed = a.strip().upper() == "Y"
|
||||
|
||||
if proceed:
|
||||
src = os.path.join(dir_name, "skel/config/sway/config")
|
||||
dst = os.path.join(config_home, "sway/config")
|
||||
print("Copying '{}'".format(dst), end=" ")
|
||||
# Update sway config
|
||||
# backup original file
|
||||
print("\n[Updating sway config file]")
|
||||
now = datetime.datetime.now()
|
||||
new_name = now.strftime("config-backup-%Y%m%d-%H%M%S")
|
||||
src = os.path.join(config_home, "sway/config")
|
||||
dst = os.path.join(config_home, "sway/{}".format(new_name))
|
||||
try:
|
||||
copy(src, dst)
|
||||
print("OK")
|
||||
if os.path.isfile(src):
|
||||
copy(src, dst)
|
||||
print("Your old sway config file has been saved as '{}'".format(new_name))
|
||||
except Exception as e:
|
||||
print(e)
|
||||
else:
|
||||
print("Sway config file update skipped.")
|
||||
print("Couldn't back up your old sway config: {}".format(e))
|
||||
|
||||
# Use nwg-look to apply default GTK settings if it has not been done yet
|
||||
if not os.path.isfile(os.path.join(data_home, "nwg-look/gsettings")):
|
||||
print("\nApplying default GTK settings. Run 'nwg-look' utility to set your preferences.")
|
||||
print("You'll find it in the 'Controls' menu as 'GTK settings'.")
|
||||
copy_from_skel("nwg-look", folder="data", skip_confirmation=True)
|
||||
launch("nwg-look -a")
|
||||
a = input("Your sway config file needs to be overwritten. Proceed? y/N ")
|
||||
proceed = a.strip().upper() == "Y"
|
||||
|
||||
if proceed:
|
||||
src = os.path.join(dir_name, "skel/config/sway/config")
|
||||
dst = os.path.join(config_home, "sway/config")
|
||||
print("Copying '{}'".format(dst), end=" ")
|
||||
try:
|
||||
copy(src, dst)
|
||||
print("OK")
|
||||
except Exception as e:
|
||||
print(e)
|
||||
else:
|
||||
print("Sway config file update skipped.")
|
||||
|
||||
# Use nwg-look to apply default GTK settings if it has not been done yet
|
||||
if not os.path.isfile(os.path.join(data_home, "nwg-look/gsettings")):
|
||||
print("\nApplying default GTK settings. Run 'nwg-look' utility to set your preferences.")
|
||||
print("You'll find it in the 'Controls' menu as 'GTK settings'.")
|
||||
copy_from_skel("nwg-look", folder="data", skip_confirmation=True)
|
||||
launch("nwg-look -a")
|
||||
|
||||
elif __version__ == "0.2.4":
|
||||
print("* nwg-shell 0.2.4 adds two buttons to default panel presets. *")
|
||||
print("* Also some minor bugs in related css files have been fixed. *")
|
||||
print("* Would you like to overwrite your `preset*` *")
|
||||
print("* and `preset=*.css` files for nwg-panel with defaults now? *")
|
||||
print("* Your changes to panel presets 0-3, if any, will be lost. *\n")
|
||||
print("* You may also do it later with the `nwg-shell-installer` *")
|
||||
print("* or `nwg-shell-installer -a` command. *\n")
|
||||
|
||||
a = input("Overwrite nwg-panel config files? y/N ")
|
||||
proceed = a.strip().upper() == "Y"
|
||||
|
||||
if proceed:
|
||||
copy_from_skel("nwg-panel", folder="config", skip_confirmation=True)
|
||||
else:
|
||||
print("nwg-panel configs update cancelled.")
|
||||
|
||||
print("\n-------------------------------------------")
|
||||
print("| Reload sway for changes to take effect. |")
|
||||
@ -226,7 +214,7 @@ def main():
|
||||
|
||||
# Inform about no longer needed stuff
|
||||
# Packages
|
||||
for item in ["lxappearance", "wdisplays"]:
|
||||
for item in ["lxappearance", "wdisplays", "nwg-wrapper"]:
|
||||
if is_command(item):
|
||||
print("The '{}' package is no longer necessary, you may uninstall it now.".format(item))
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
window {
|
||||
background-color: rgba (23, 53, 63, 0.95);
|
||||
background-color: rgba(23, 53, 63, 0.95);
|
||||
color: #eeeeee;
|
||||
border-radius: 0px
|
||||
border-radius: 0
|
||||
}
|
||||
|
||||
list {
|
||||
@ -10,7 +10,7 @@ list {
|
||||
}
|
||||
|
||||
entry {
|
||||
background-color: rgba (0, 0, 0, 0.2)
|
||||
background-color: rgba(0, 0, 0, 0.2)
|
||||
}
|
||||
|
||||
button {
|
||||
@ -19,5 +19,5 @@ button {
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background-color: rgba (255, 255, 255, 0.1)
|
||||
background-color: rgba(255, 255, 255, 0.1)
|
||||
}
|
@ -17,6 +17,7 @@
|
||||
"icons": "light",
|
||||
"menu-start": "off",
|
||||
"modules-left": [
|
||||
"button-launcher",
|
||||
"playerctl"
|
||||
],
|
||||
"modules-center": [
|
||||
@ -25,7 +26,8 @@
|
||||
"modules-right": [
|
||||
"scratchpad",
|
||||
"executor-updates",
|
||||
"tray"
|
||||
"tray",
|
||||
"button-help"
|
||||
],
|
||||
"controls": "right",
|
||||
"controls-settings": {
|
||||
@ -162,6 +164,27 @@
|
||||
"icon-size": 16,
|
||||
"interval": 1,
|
||||
"always-show-icon": true
|
||||
},
|
||||
"exclusive-zone": true,
|
||||
"openweather": {},
|
||||
"brightness-slider": {},
|
||||
"button-launcher": {
|
||||
"command": "nwg-drawer",
|
||||
"icon": "grid",
|
||||
"label": "",
|
||||
"label-position": "right",
|
||||
"tooltip": "Application drawer [Alt]+F1",
|
||||
"css-name": "",
|
||||
"icon-size": 16
|
||||
},
|
||||
"button-help": {
|
||||
"command": "nwg-shell-help",
|
||||
"icon": "help-about",
|
||||
"label": "",
|
||||
"label-position": "right",
|
||||
"tooltip": "Show/hide help [S]+F1",
|
||||
"css-name": "",
|
||||
"icon-size": 16
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -284,6 +307,11 @@
|
||||
"icon-placement": "left"
|
||||
},
|
||||
"playerctl": {},
|
||||
"sway-workspaces": {}
|
||||
"sway-workspaces": {},
|
||||
"exclusive-zone": true,
|
||||
"openweather": {},
|
||||
"brightness-slider": {},
|
||||
"dwl-tags": {},
|
||||
"tray": {}
|
||||
}
|
||||
]
|
@ -14,7 +14,7 @@ button {
|
||||
padding-right: 4px
|
||||
}
|
||||
#task-box-focused {
|
||||
background-color: rgba (255, 255, 255, 0.12);
|
||||
background-color: rgba(255, 255, 255, 0.12);
|
||||
padding-left: 4px;
|
||||
padding-right: 4px
|
||||
}
|
||||
@ -24,7 +24,7 @@ button {
|
||||
|
||||
/* Sample button in sample config w/ no background nor border */
|
||||
#button-custom {
|
||||
background: rgba (0, 0, 0, 0.0);
|
||||
background: rgba(0, 0, 0, 0.0);
|
||||
border: 0
|
||||
}
|
||||
|
||||
@ -42,23 +42,23 @@ button {
|
||||
|
||||
/* Controls window in sample config uses this name */
|
||||
#controls-window {
|
||||
background-color: rgba (37, 37, 37, 0.95);
|
||||
border-radius: 0px;
|
||||
background-color: rgba(37, 37, 37, 0.95);
|
||||
border-radius: 0;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
border-color: rgba (0, 0, 0, 1.0);
|
||||
border-color: rgba(0, 0, 0, 1.0);
|
||||
color: #eeeeee
|
||||
}
|
||||
|
||||
/* Executors usually behave better in monospace fonts */
|
||||
#executor-label {
|
||||
font-family: DejaVu Sans Mono;
|
||||
font-family: DejaVu Sans Mono, monospace;
|
||||
font-size: 16px
|
||||
}
|
||||
|
||||
/* and so does the Clock */
|
||||
#clock {
|
||||
font-family: DejaVu Sans Mono;
|
||||
font-family: DejaVu Sans Mono, monospace;
|
||||
font-size: 16px
|
||||
}
|
||||
|
||||
@ -84,7 +84,7 @@ button {
|
||||
#dwl-tag-free {
|
||||
font-family: monospace;
|
||||
color: #eee;
|
||||
background-color: rgba (32, 50, 90, 1.0);
|
||||
background-color: rgba(32, 50, 90, 1.0);
|
||||
padding-left: 3px;
|
||||
padding-right: 3px;
|
||||
}
|
||||
@ -98,6 +98,5 @@ button {
|
||||
}
|
||||
|
||||
#dwl-tag-selected {
|
||||
border: solid 2px;
|
||||
border-color: #81a1c1
|
||||
border: 2px solid #81a1c1;
|
||||
}
|
@ -16,6 +16,7 @@
|
||||
"css-name": "panel-top",
|
||||
"icons": "light",
|
||||
"modules-left": [
|
||||
"button-launcher",
|
||||
"sway-workspaces"
|
||||
],
|
||||
"modules-center": [
|
||||
@ -26,7 +27,8 @@
|
||||
"executor-cpubar",
|
||||
"scratchpad",
|
||||
"executor-updates",
|
||||
"tray"
|
||||
"tray",
|
||||
"button-help"
|
||||
],
|
||||
"sway-taskbar": {},
|
||||
"controls-settings": {
|
||||
@ -131,14 +133,6 @@
|
||||
"icon-placement": "left"
|
||||
},
|
||||
"width": "auto",
|
||||
"button-config": {
|
||||
"command": "nwg-panel-config",
|
||||
"icon": "nwg-panel",
|
||||
"label": "",
|
||||
"label-position": "right",
|
||||
"css-name": "button-custom",
|
||||
"icon-size": 16
|
||||
},
|
||||
"sway-workspaces": {
|
||||
"numbers": [
|
||||
"1",
|
||||
@ -212,6 +206,27 @@
|
||||
"icon-size": 16,
|
||||
"interval": 1,
|
||||
"always-show-icon": true
|
||||
},
|
||||
"exclusive-zone": true,
|
||||
"openweather": {},
|
||||
"brightness-slider": {},
|
||||
"button-launcher": {
|
||||
"command": "nwg-drawer",
|
||||
"icon": "grid",
|
||||
"label": "",
|
||||
"label-position": "right",
|
||||
"tooltip": "Application drawer [Alt]+F1",
|
||||
"css-name": "",
|
||||
"icon-size": 16
|
||||
},
|
||||
"button-help": {
|
||||
"command": "nwg-shell-help",
|
||||
"icon": "help-about",
|
||||
"label": "",
|
||||
"label-position": "right",
|
||||
"tooltip": "Show/hide help [S]+F1",
|
||||
"css-name": "",
|
||||
"icon-size": 16
|
||||
}
|
||||
}
|
||||
]
|
@ -1,8 +1,10 @@
|
||||
/***** SUGGESTED TO CHANGE CAREFULLY *****/
|
||||
|
||||
/* Recommended if panel "height" unset or smaller then your theme default button height */
|
||||
/* Recommended if panel "height" unset or smaller then your theme default button height */
|
||||
button {
|
||||
margin: 2px
|
||||
margin: 2px;
|
||||
background: none;
|
||||
border: none
|
||||
}
|
||||
|
||||
/* SwayTaskBar and SwayWorkspaces use custom widgets, that need this and the next name
|
||||
@ -13,7 +15,7 @@ button {
|
||||
}
|
||||
|
||||
#task-box-focused {
|
||||
background-color: rgba (255, 255, 255, 0.12);
|
||||
background-color: rgba(255, 255, 255, 0.12);
|
||||
padding-left: 4px;
|
||||
padding-right: 4px
|
||||
}
|
||||
@ -23,7 +25,7 @@ button {
|
||||
|
||||
/* Sample button in sample config w/ no background nor border */
|
||||
#button-custom {
|
||||
background: rgba (0, 0, 0, 0.0);
|
||||
background: rgba(0, 0, 0, 0.0);
|
||||
border: 0
|
||||
}
|
||||
|
||||
@ -48,12 +50,12 @@ button {
|
||||
|
||||
/* Executors usually behave better in monospace fonts */
|
||||
#executor-label {
|
||||
font-family: DejaVu Sans Mono
|
||||
font-family: DejaVu Sans Mono, monospace
|
||||
}
|
||||
|
||||
/* and so does the Clock */
|
||||
#clock {
|
||||
font-family: DejaVu Sans Mono;
|
||||
font-family: DejaVu Sans Mono, monospace;
|
||||
font-size: 16px
|
||||
}
|
||||
|
||||
@ -79,7 +81,7 @@ button {
|
||||
#dwl-tag-free {
|
||||
font-family: monospace;
|
||||
color: #eee;
|
||||
background-color: rgba (32, 50, 90, 1.0);
|
||||
background-color: rgba(32, 50, 90, 1.0);
|
||||
padding-left: 3px;
|
||||
padding-right: 3px;
|
||||
}
|
||||
@ -93,6 +95,5 @@ button {
|
||||
}
|
||||
|
||||
#dwl-tag-selected {
|
||||
border: solid 2px;
|
||||
border-color: #81a1c1
|
||||
border: 2px solid #81a1c1;
|
||||
}
|
@ -25,7 +25,8 @@
|
||||
"scratchpad",
|
||||
"executor-updates",
|
||||
"clock",
|
||||
"tray"
|
||||
"tray",
|
||||
"button-help"
|
||||
],
|
||||
"sway-taskbar": {
|
||||
"workspace-buttons": false,
|
||||
@ -225,6 +226,18 @@
|
||||
"icon-size": 16,
|
||||
"interval": 1,
|
||||
"always-show-icon": true
|
||||
},
|
||||
"exclusive-zone": true,
|
||||
"openweather": {},
|
||||
"brightness-slider": {},
|
||||
"button-help": {
|
||||
"command": "nwg-shell-help",
|
||||
"icon": "help-about",
|
||||
"label": "",
|
||||
"label-position": "right",
|
||||
"tooltip": "Show/hide help [S]+F1",
|
||||
"css-name": "",
|
||||
"icon-size": 16
|
||||
}
|
||||
}
|
||||
]
|
@ -14,7 +14,7 @@ button {
|
||||
padding-right: 4px
|
||||
}
|
||||
#task-box-focused {
|
||||
background-color: rgba (255, 255, 255, 0.12);
|
||||
background-color: rgba(255, 255, 255, 0.12);
|
||||
padding-left: 4px;
|
||||
padding-right: 4px
|
||||
}
|
||||
@ -24,7 +24,7 @@ button {
|
||||
|
||||
/* Sample button in sample config w/ no background nor border */
|
||||
#button-custom {
|
||||
background: rgba (0, 0, 0, 0.0);
|
||||
background: rgba(0, 0, 0, 0.0);
|
||||
border: 0
|
||||
}
|
||||
|
||||
@ -42,20 +42,20 @@ button {
|
||||
|
||||
/* Controls window in sample config uses this name */
|
||||
#controls-window {
|
||||
border-radius: 0px;
|
||||
background-color: rgba (23, 53, 63, 0.95);
|
||||
border-radius: 0;
|
||||
background-color: rgba(23, 53, 63, 0.95);
|
||||
color: #eeeeee
|
||||
}
|
||||
|
||||
/* Executors usually behave better in monospace fonts */
|
||||
#executor-label {
|
||||
font-family: DejaVu Sans Mono;
|
||||
font-family: DejaVu Sans Mono, monospace;
|
||||
font-size: 16px
|
||||
}
|
||||
|
||||
/* and so does the Clock */
|
||||
#clock {
|
||||
font-family: DejaVu Sans Mono;
|
||||
font-family: DejaVu Sans Mono, monospace;
|
||||
font-size: 16px
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@ button {
|
||||
#dwl-tag-free {
|
||||
font-family: monospace;
|
||||
color: #eee;
|
||||
background-color: rgba (32, 50, 90, 1.0);
|
||||
background-color: rgba(32, 50, 90, 1.0);
|
||||
padding-left: 3px;
|
||||
padding-right: 3px;
|
||||
}
|
||||
@ -95,6 +95,5 @@ button {
|
||||
}
|
||||
|
||||
#dwl-tag-selected {
|
||||
border: solid 2px;
|
||||
border-color: #81a1c1
|
||||
border: 2px solid #81a1c1;
|
||||
}
|
@ -24,7 +24,8 @@
|
||||
"modules-right": [
|
||||
"scratchpad",
|
||||
"executor-updates",
|
||||
"tray"
|
||||
"tray",
|
||||
"button-help"
|
||||
],
|
||||
"controls-settings": {
|
||||
"alignment": "right",
|
||||
@ -173,6 +174,18 @@
|
||||
"icon-size": 16,
|
||||
"interval": 1,
|
||||
"always-show-icon": true
|
||||
},
|
||||
"exclusive-zone": true,
|
||||
"openweather": {},
|
||||
"brightness-slider": {},
|
||||
"button-help": {
|
||||
"command": "nwg-shell-help",
|
||||
"icon": "help-about",
|
||||
"label": "",
|
||||
"label-position": "right",
|
||||
"tooltip": "Show/hide help [S]+F1",
|
||||
"css-name": "",
|
||||
"icon-size": 16
|
||||
}
|
||||
}
|
||||
]
|
@ -2,12 +2,14 @@
|
||||
|
||||
/* Recommended if panel "height" unset or smaller then your theme default button height */
|
||||
button {
|
||||
margin: 2px
|
||||
margin: 2px;
|
||||
background: none;
|
||||
border: none
|
||||
}
|
||||
|
||||
#button-start {
|
||||
background: none;
|
||||
border: 0px
|
||||
border: 0
|
||||
}
|
||||
|
||||
/* WindowBox in SwayTaskBar is a custom widget, that needs this and the next name
|
||||
@ -17,7 +19,7 @@ button {
|
||||
padding-right: 4px
|
||||
}
|
||||
#task-box-focused {
|
||||
background-color: rgba (255, 255, 255, 0.12);
|
||||
background-color: rgba(255, 255, 255, 0.12);
|
||||
padding-left: 4px;
|
||||
padding-right: 4px
|
||||
}
|
||||
@ -27,37 +29,37 @@ button {
|
||||
|
||||
/* Sample button in sample config w/ no background nor border */
|
||||
#button-custom {
|
||||
background: rgba (0, 0, 0, 0.0);
|
||||
border: 0px
|
||||
background: rgba(0, 0, 0, 0.0);
|
||||
border: 0
|
||||
}
|
||||
|
||||
/* Top panel in sample config uses this name */
|
||||
#panel-top {
|
||||
background-color: rgba (11, 11, 11, 0.9);
|
||||
background-color: rgba(11, 11, 11, 0.9);
|
||||
color: #eeeeee
|
||||
}
|
||||
|
||||
/* Bottom panel in sample config uses this name */
|
||||
#panel-bottom {
|
||||
background-color: rgba (0, 0, 0, 0.9);
|
||||
background-color: rgba(0, 0, 0, 0.9);
|
||||
color: #eeeeee
|
||||
}
|
||||
|
||||
/* Controls window in sample config uses this name */
|
||||
#controls-window {
|
||||
border-radius: 0px;
|
||||
border-radius: 0;
|
||||
background: #27132e;
|
||||
color: #eeeeee
|
||||
}
|
||||
|
||||
/* Executors usually behave better in monospace fonts */
|
||||
#executor-label {
|
||||
font-family: DejaVu Sans Mono
|
||||
font-family: DejaVu Sans Mono, monospace
|
||||
}
|
||||
|
||||
/* and so does the Clock */
|
||||
#clock {
|
||||
font-family: DejaVu Sans Mono;
|
||||
font-family: DejaVu Sans Mono, monospace;
|
||||
font-size: 14px
|
||||
}
|
||||
|
||||
@ -97,6 +99,5 @@ button {
|
||||
}
|
||||
|
||||
#dwl-tag-selected {
|
||||
border: solid 2px;
|
||||
border-color: #81a1c1
|
||||
border: 2px solid #81a1c1;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ include keyboard
|
||||
include pointer
|
||||
include touchpad
|
||||
|
||||
# ArchLabs sway config
|
||||
# nwg-shell sway config
|
||||
# Read `man 5 sway` for reference.
|
||||
|
||||
# border & title
|
||||
@ -59,6 +59,8 @@ bindsym $Mod+Return exec $term
|
||||
bindsym Mod1+Shift+Return exec $term
|
||||
bindsym Control+Shift+t exec $term
|
||||
bindsym $Mod+t exec $term
|
||||
bindsym $Mod+F2 exec $term
|
||||
bindsym $Mod+s exec nwg-shell-config
|
||||
bindsym $Mod+d exec $dock
|
||||
bindsym $Mod+e exec $editor
|
||||
bindsym $Mod+w exec $browser
|
||||
@ -66,6 +68,8 @@ bindsym Control+space exec $launcher
|
||||
bindsym Mod1+F1 exec $launcher
|
||||
bindsym $Mod+f exec $filemanager
|
||||
bindsym $Mod+c exec swaync-client -t
|
||||
bindsym Mod1+l exec nwg-lock
|
||||
bindsym $Mod+F1 exec nwg-shell-help
|
||||
|
||||
# Exit menu
|
||||
bindsym $Mod+x exec $exit
|
||||
@ -210,7 +214,7 @@ bindsym Mod1+Left resize shrink width 10 px or 1 ppt
|
||||
bindsym Mod1+Right resize grow width 10 px or 1 ppt
|
||||
|
||||
# layout toggle
|
||||
bindsym Mod1+Tab layout toggle tabbed split
|
||||
bindsym Mod1+Tab layout toggle tabbed stacking split
|
||||
bindsym $Mod+Tab layout toggle splitv splith
|
||||
|
||||
# switch to workspace with urgent window
|
||||
@ -229,27 +233,21 @@ default_orientation horizontal
|
||||
# make the current focus fullscreen
|
||||
bindsym $Mod+Shift+f fullscreen
|
||||
|
||||
# show/hide help
|
||||
bindsym Mod1+h exec pkill -f -12 nwg-wrapper
|
||||
# move help to front/back
|
||||
bindsym Mod1+Shift+h exec pkill -f -10 nwg-wrapper
|
||||
|
||||
############### Border & Gaps ###############
|
||||
|
||||
# changing border style
|
||||
bindsym $Mod+n border normal
|
||||
bindsym $Mod+y border pixel 1
|
||||
bindsym $Mod+u border none
|
||||
bindsym $Mod+b border toggle
|
||||
|
||||
# change gaps
|
||||
bindsym $Mod+plus gaps inner current plus 5
|
||||
bindsym $Mod+minus gaps inner current minus 5
|
||||
bindsym $Mod+Shift+plus gaps outer current plus 5
|
||||
bindsym $Mod+Shift+minus gaps outer current minus 5
|
||||
bindsym $Mod+Control+plus gaps inner all plus 5
|
||||
bindsym $Mod+Control+minus gaps inner all minus 5
|
||||
bindsym $Mod+Control+Shift+plus gaps outer all plus 5
|
||||
bindsym $Mod+Control+Shift+minus gaps outer all minus 5
|
||||
bindsym Mod1+plus gaps outer current plus 5
|
||||
bindsym Mod1+minus gaps outer current minus 5
|
||||
|
||||
bindsym $Mod+KP_Add gaps inner current plus 5
|
||||
bindsym $Mod+KP_Subtract gaps inner current minus 5
|
||||
bindsym Mod1+KP_Add gaps outer current plus 5
|
||||
bindsym Mod1+KP_Subtract gaps outer current minus 5
|
||||
|
||||
############ application settings ############
|
||||
|
||||
|
49
nwg_shell/tools.py
Normal file
49
nwg_shell/tools.py
Normal file
@ -0,0 +1,49 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import json
|
||||
|
||||
|
||||
def load_json(path):
|
||||
try:
|
||||
with open(path, 'r') as f:
|
||||
return json.load(f)
|
||||
except Exception as e:
|
||||
print("Error loading json: {}".format(e))
|
||||
return None
|
||||
|
||||
|
||||
def save_json(src_dict, path):
|
||||
with open(path, 'w') as f:
|
||||
json.dump(src_dict, f, indent=2)
|
||||
|
||||
|
||||
def is_newer(string_new, string_existing):
|
||||
"""
|
||||
Compares versions in format 'major.minor.patch' (just numbers allowed).
|
||||
:param string_new: new version to compare with existing one
|
||||
:param string_existing: existing version
|
||||
:return: True if new is newer then existing
|
||||
"""
|
||||
new = major_minor_path(string_new)
|
||||
existing = major_minor_path(string_existing)
|
||||
if new and existing:
|
||||
if new[0] > existing[0]:
|
||||
return True
|
||||
elif new[1] > existing[1]:
|
||||
return True
|
||||
elif new[2] > existing[2]:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
def major_minor_path(string):
|
||||
parts = string.split(".")
|
||||
if len(parts) != 3:
|
||||
return None
|
||||
try:
|
||||
return int(parts[0]), int(parts[1]), int(parts[2])
|
||||
except:
|
||||
return None
|
Loading…
Reference in New Issue
Block a user