Skip to content

Commit

Permalink
Merge pull request #144 from nwg-piotr/display-names
Browse files Browse the repository at this point in the history
[sway] generic display names
  • Loading branch information
nwg-piotr authored Mar 28, 2021
2 parents 241aca8 + fbd34bc commit b689af5
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# CHANGELOG

## v1.9.1 (2021.03.28)

- Added the "Use generic display names" preferences switch.
See [#143](https://github.com/nwg-piotr/azote/issues/143).

## v1.9.0 (2021.03.13)

- Restore wallpapers in use on startup;
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,11 @@ Azote wallpaper manager version 1.x.y

## Troubleshooting

### [sway] My outputs use random names, wallpapers get lost after restart

Turn the "Use generic display names" preferences switch on (since v1.9.1).
See [#143](https://github.com/nwg-piotr/azote/issues/143).

### No pictures in thumbnails / display preview

As well thumbnails, as displays preview inherit from the Gtk.Button class. In case you don't see images inside them,
Expand Down
1 change: 1 addition & 0 deletions azote/languages/de_DE
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,5 @@ split_selection_between_displays = Auswahl zwischen Bildschirmen aufteilen
thumbnail_tooltip = Einfach-Klicken zum Auswählen, Doppel-Klicken zum sofortigen Verwenden, Rechts-Klick für mehr Optionen
thumbnails_in_cache = {} Vorschaubilder im Zwischenspeicher ({})
track_file_changes = Dateiänderungen überwachen
use_display_names = Verwend generische Anzeigenamen
width = Breite
1 change: 1 addition & 0 deletions azote/languages/en_EN
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,5 @@ split_selection_between_displays = Split selection between displays
thumbnail_tooltip = Click to select, double to set, right for menu
thumbnails_in_cache = {} thumbnails in cache ({})
track_file_changes = Track file changes
use_display_names = Use generic display names
width = Width
1 change: 1 addition & 0 deletions azote/languages/fr_FR
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,5 @@ split_selection_between_displays = Répartition de la sélection entre les écra
thumbnail_tooltip = Click to select, double to set, right for menu
thumbnails_in_cache = {} miniatures en cache ({})
track_file_changes = Suivre les modifications du fichier
use_display_names = Utiliser des noms d'affichage génériques
width = Largeur
1 change: 1 addition & 0 deletions azote/languages/pl_PL
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,5 @@ split_selection_between_displays = Podziel wybrany obraz pomiędzy ekrany
thumbnail_tooltip = Kliknij by wybrać, podwójnie by ustawić, prawym dla menu
thumbnails_in_cache = {} miniatur w cache ({})
track_file_changes = Śledź zmiany w plikach
use_display_names = Używaj ogólnych nazw wyświetlaczy
width = Szerokość
25 changes: 24 additions & 1 deletion azote/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,17 @@ def on_apply_button(button):
# if a color chosen, the wallpaper won't appear
batch_content.append("swaybg -o {} -c{} &".format(box.display_name, box.color))
elif box.wallpaper_path:
# see: https://github.com/nwg-piotr/azote/issues/143
if common.settings.generic_display_names:
display_name = ""
for item in common.displays:
if item["name"] == box.display_name:
display_name = item["generic-name"]
else:
display_name = box.display_name

batch_content.append(
"swaybg -o {} -i '{}' -m {} &".format(box.display_name, box.wallpaper_path, box.mode))
"swaybg -o '{}' -i '{}' -m {} &".format(display_name, box.wallpaper_path, box.mode))

# build the json file content
if box.wallpaper_path.startswith("{}/backgrounds-sway/flipped-".format(common.data_home)):
Expand Down Expand Up @@ -1084,6 +1093,11 @@ def on_settings_button(button):
item.connect('activate', switch_tracking_files)
menu.append(item)

item = Gtk.CheckMenuItem.new_with_label(common.lang['use_display_names'])
item.set_active(common.settings.generic_display_names)
item.connect('activate', switch_generic_display_names)
menu.append(item)

menu.show_all()
menu.popup_at_widget(button, Gdk.Gravity.CENTER, Gdk.Gravity.NORTH_WEST, None)

Expand Down Expand Up @@ -1212,6 +1226,15 @@ def switch_tracking_files(item):
common.indicator.switch_indication(item)


def switch_generic_display_names(item):
if item.get_active():
common.settings.generic_display_names = True
common.settings.save()
else:
common.settings.generic_display_names = False
common.settings.save()


class ColorPaletteDialog(Gtk.Window):
def __init__(self, thumb_file, filename, palette):
super().__init__()
Expand Down
9 changes: 8 additions & 1 deletion azote/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ def check_displays():
'x': output['rect']['x'],
'y': output['rect']['y'],
'width': output['rect']['width'],
'height': output['rect']['height']}
'height': output['rect']['height'],
'generic-name': "{} {} {}".format(output["make"], output["model"], output["serial"])}
displays.append(display)
log("Output found: {}".format(display), common.INFO)
try:
Expand Down Expand Up @@ -754,6 +755,7 @@ def __init__(self):
self.color_dictionary = False
self.image_menu_button = False
self.track_files = True
self.generic_display_names = False

# Runtime config (json) location
self.rc_file = os.path.join(common.azote_config_home, "azoterc")
Expand Down Expand Up @@ -818,6 +820,11 @@ def load(self):
except AttributeError:
save_needed = True

try:
self.generic_display_names = settings.generic_display_names
except AttributeError:
save_needed = True

self.load_rc()
# overwrite self.old_thumb_width with self.thumb_width if changed in azoterc
if self.old_thumb_width != self.thumb_width:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def read(f_name):

setup(
name='azote',
version='1.9.0',
version='1.9.1',
description='Wallpaper manager for Sway, i3 and some other WMs',
packages=['azote'],
include_package_data=True,
Expand Down

0 comments on commit b689af5

Please sign in to comment.