Skip to content

Commit

Permalink
Rewrite FAQ entry, reformat pkg lists
Browse files Browse the repository at this point in the history
Rewrite FAQ entry, reformat pkg lists

Merge pull request #77 from RedBearAK/dev_beta
  • Loading branch information
RedBearAK authored Aug 22, 2023
2 parents d93cb37 + 45038d8 commit a529c4a
Show file tree
Hide file tree
Showing 4 changed files with 123 additions and 53 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*.env
*.pyc
.pytest_cache/

# Supposed to be able to use `**` but it doesn't work for me
__pycache__/
*/__pycache__/
Expand Down
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ As noted elsewhere in the README, there is no Windows version of Toshy, unlike K
- CentOS 7 (RHEL 7 clone) - Partial support:

- You must first install `python3` to run `toshy_setup.py`
- GUI preferences app will not work (Tk too old for `sv_ttk` theme)
- systemd "user" services are not supported in CentOS/RHEL 7
- Auto-start at login with systemd services not available
- Cmd+Space (Alt+F1) shortcut must be assigned to app launcher menu
Expand Down Expand Up @@ -809,11 +810,17 @@ Which RC file you need to `source` depends on your shell.

In the case that the path was already added to the RC file, another way of getting a new environment where you can see the `toshy-*` commands is to just close your terminal window (or tab) and open a new one.

### Touchpads/Trackpads and `keyszer` Suspend Timer
### Mod+clicking blocked by `keyszer` Suspend Timeout

The `keyszer` (fork of `xkeysnail`) keymapper is pretty good, but there is an issue with [modifier key] + [tap or click] when using a touchpad versus a mouse. The keymapper uses a technique that "suspends" modifier key presses briefly (default is 1 second) to try and keep certain applications from seeing those modifier presses and performing some unwanted action. Notable apps that have issues with doing the wrong thing just from seeing a modifier key press are Visual Studio Code (and it's more Open Source variants VSCodium and Code - OSS) and the Firefox web browser. They will frequently focus or open items on the menu bar then they see the `Option/Alt` key in any way.
The `keyszer` (fork of `xkeysnail`) keymapper is pretty good, but there can be an issue with [modifier key] + [tap or click], depending on the type of pointing device you're using, and whether the keymapper automatically "grabs" it at startup.

The suspend timer scheme works well for mouse usage, letting you do things like `Alt+click`, `Ctrl+click/Cmd+click` and `Shift+click`, but with a touchpad, you may need to reduce the one-second timer to zero or 0.1 seconds in order for those operations to work as you would expect. Look for this near the top of the `toshy_config.py` file:
The keymapper uses a technique that "suspends" modifier key presses briefly (default is 1 second) to try and keep certain applications from seeing the original (pre-modmapped) physical modifier key press event, and performing some unwanted action. Notable apps that have issues with doing the wrong thing just from seeing a modifier key press are `Visual Studio Code` (and its more Open Source variants `VSCodium` and `Code - OSS`) and the `Firefox` web browser. They will frequently focus or open items on the menu bar then they see the `Option/Alt` key in any way.

If the modifier key press is combined with a non-modifier key, the suspend timeout is immediately broken, and the app will see the combo. The suspend timeout is only in effect as long as the modifier is by itself, as happens in a Mod+click situation.

If the suspend timeout scheme is not working for you, you may need to reduce the timeout length to zero or 0.1 seconds in order for Mod+click operations (Shift+Cmd+click, Cmd+click, Shift+click, Alt+click, anything like that) to work as you would expect.

Look for this API function near the top of the `toshy_config.py` file:

```py
timeouts(
Expand Down
11 changes: 9 additions & 2 deletions toshy_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,8 @@ def fn_stop_toshy_services():
import tkinter.font as tkfont
import sv_ttk # "Sun Valley" tkinter theme module

# CentOS 7 can't handle the PNG icon file, so use Pillow to open it
from PIL import Image, ImageTk

TOSHY_GUI_APP_CLASSNAME = 'Toshy-Prefs'

Expand All @@ -395,8 +397,13 @@ def fn_stop_toshy_services():
# (desktop entry file shows nice icon in launcher but doesn't set icon in task switcher)
icon_file = os.path.join(current_folder_path, 'assets', 'toshy_app_icon_rainbow_512px.png')

app_icon_image_path = tk.PhotoImage(file = icon_file)
root.wm_iconphoto(False, app_icon_image_path)
# app_icon_image_path = tk.PhotoImage(file = icon_file)
# root.wm_iconphoto(False, app_icon_image_path)

# Use Pillow to open the image, to make it work on CentOS 7
image = Image.open(icon_file)
app_icon_image = ImageTk.PhotoImage(image)
root.wm_iconphoto(False, app_icon_image)

# Set a font style to use for switch text
switch_text_font_dict = {"family": "Helvetica", "size": 13}
Expand Down
151 changes: 103 additions & 48 deletions toshy_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ def verify_user_groups():
"""Check if the `input` group exists and user is in group"""
print(f'\n\n§ Checking if user is in "input" group...\n{cnfg.separator}')

if cnfg.DISTRO_NAME == 'silverblue':
if cnfg.DISTRO_NAME == 'silverblue-experimental':
# https://docs.fedoraproject.org/en-US/fedora-silverblue/troubleshooting/
# Special command to make Fedora Silverblue/uBlue work, or usermod will fail:
# grep -E '^input:' /usr/lib/group | sudo tee -a /etc/group
Expand Down Expand Up @@ -509,55 +509,101 @@ def verify_user_groups():
# 'test-based': ["git"],
'test-based': ["git"],

'fedora-based': ["gcc", "git", "cairo-devel", "cairo-gobject-devel", "dbus-devel",
'fedora-based': ["cairo-devel", "cairo-gobject-devel",
"evtest",
"gcc", "git",
"dbus-daemon", "dbus-devel",
"gobject-introspection-devel",
"libappindicator-gtk3", "libnotify",
"python3-dbus", "python3-devel", "python3-pip", "python3-tkinter",
"gobject-introspection-devel", "libappindicator-gtk3", "xset",
"libnotify", "systemd-devel", "zenity", "evtest"],

'rhel-based': ["gcc", "git", "cairo-devel", "cairo-gobject-devel", "dbus-devel",
"systemd-devel",
"xset",
"zenity"],

'rhel-based': ["cairo-devel", "cairo-gobject-devel",
"dbus-daemon", "dbus-devel",
"gcc", "git", "gobject-introspection-devel",
"libappindicator-gtk3", "libnotify",
"python3-dbus", "python3-devel", "python3-pip", "python3-tkinter",
"gobject-introspection-devel", "libappindicator-gtk3", "xset",
"libnotify", "systemd-devel", "zenity"],

'tumbleweed-based':["gcc", "git", "cairo-devel", "dbus-1-devel", f"python{py_pkg_ver}-tk",
f"python{py_pkg_ver}-dbus-python-devel", f"python{py_pkg_ver}-devel",
"gobject-introspection-devel", "libappindicator3-devel", "tk",
"libnotify-tools", "typelib-1_0-AyatanaAppIndicator3-0_1",
"systemd-devel", "zenity"],
"systemd-devel",
"xset",
"zenity"],

# openSUSE:
# How to get rid of the need to use specific version numbers in packages:
# pkgconfig(packagename)>=N.nn (version symbols optional)
# How to query a package to see what the equivalent pkgconfig(packagename) syntax would be:
# rpm -q --provides packagename | grep -i pkgconfig
'tumbleweed-based':["cairo-devel",
"dbus-1-daemon", "dbus-1-devel",
"gcc", "git", "gobject-introspection-devel",
"libappindicator3-devel", "libnotify-tools",
# f"python{py_pkg_ver}-dbus-python-devel",
"python3-dbus-python-devel",
# f"python{py_pkg_ver}-devel",
"python3-devel",
# f"python{py_pkg_ver}-tk",
"python3-tk",
"systemd-devel",
"tk", "typelib-1_0-AyatanaAppIndicator3-0_1",
"zenity"],

# TODO: update Leap Python package versions as it makes newer Python available
'leap-based': ["gcc", "git", "cairo-devel", "dbus-1-devel", "python311-tk",
"python3-dbus-python-devel", "python311-devel", "python311",
"gobject-introspection-devel", "libappindicator3-devel", "tk",
"libnotify-tools", "typelib-1_0-AyatanaAppIndicator3-0_1",
"systemd-devel", "zenity"],

'mandriva-based': ["git", "cairo-devel", "dbus-daemon", "dbus-devel",
"gobject-introspection-devel", "lib64ayatana-appindicator3_1",
"lib64ayatana-appindicator3-gir0.1", "lib64cairo-gobject2",
"lib64python-devel", "lib64systemd-devel", "libnotify",
"python-dbus-devel", "python-dbus", "python-ensurepip",
"python3-pip", "task-devel", "tkinter", "xset", "zenity"],

'ubuntu-based': ["curl", "git", "input-utils", "libcairo2-dev", "libnotify-bin",
"python3-dbus", "python3-dev", "python3-pip", "python3-venv",
"python3-tk", "libdbus-1-dev", "libgirepository1.0-dev",
# "gir1.2-appindicator3-0.1", "libsystemd-dev", "zenity"],
"gir1.2-ayatanaappindicator3-0.1", "libsystemd-dev", "zenity"],

'debian-based': ["curl", "git", "input-utils", "libcairo2-dev", "libnotify-bin",
"python3-dbus", "python3-dev", "python3-pip", "python3-venv",
"python3-tk", "libdbus-1-dev", "libgirepository1.0-dev",
"gir1.2-ayatanaappindicator3-0.1", "libsystemd-dev", "zenity"],

'arch-based': ["cairo", "dbus", "evtest", "git", "gobject-introspection", "tk",
"libappindicator-gtk3", "pkg-config", "python-dbus", "python-pip",
"python", "libnotify", "systemd", "zenity"],

'solus-based': ["gcc", "git", "libcairo-devel", "python3-devel", "pip",
"python3-tkinter", "python3-dbus", "python-gobject-devel",
"python-dbus-devel", "libayatana-appindicator",
"libnotify", "systemd-devel", "zenity"],
'leap-based': ["cairo-devel",
"dbus-1-devel",
"gcc", "git", "gobject-introspection-devel",
"libappindicator3-devel", "libnotify-tools",
"python3-dbus-python-devel",
"python311",
"python311-devel",
"python311-tk",
"systemd-devel",
"tk", "typelib-1_0-AyatanaAppIndicator3-0_1",
"zenity"],

'mandriva-based': ["cairo-devel",
"dbus-daemon", "dbus-devel",
"git", "gobject-introspection-devel",
"lib64ayatana-appindicator3_1", "lib64ayatana-appindicator3-gir0.1",
"lib64cairo-gobject2", "lib64python-devel", "lib64systemd-devel",
"libnotify",
"python-dbus", "python-dbus-devel", "python-ensurepip", "python3-pip",
"task-devel", "tkinter",
"xset",
"zenity"],

'ubuntu-based': ["curl",
"git", "gir1.2-ayatanaappindicator3-0.1",
"input-utils",
"libcairo2-dev", "libdbus-1-dev", "libgirepository1.0-dev",
"libnotify-bin", "libsystemd-dev",
"python3-dbus", "python3-dev", "python3-pip", "python3-tk", "python3-venv",
"zenity"],

'debian-based': ["curl",
"git", "gir1.2-ayatanaappindicator3-0.1",
"input-utils",
"libcairo2-dev", "libdbus-1-dev", "libgirepository1.0-dev",
"libnotify-bin", "libsystemd-dev",
"python3-dbus", "python3-dev", "python3-pip", "python3-tk", "python3-venv",
"zenity"],

'arch-based': ["cairo",
"dbus",
"evtest",
"git", "gobject-introspection",
"libappindicator-gtk3", "libnotify",
"pkg-config", "python", "python-dbus", "python-pip",
"systemd",
"tk",
"zenity"],

'solus-based': ["gcc", "git",
"libayatana-appindicator", "libcairo-devel", "libnotify",
"pip", "python3-dbus", "python3-devel", "python3-tkinter",
"python-dbus-devel", "python-gobject-devel",
"systemd-devel",
"zenity"],
}

extra_pkgs_map = {
Expand All @@ -583,7 +629,7 @@ def install_distro_pkgs():
print(f'Try some options in "./toshy_setup.py --help"')
safe_shutdown(1)

cnfg.pkgs_for_distro = pkg_groups_map[pkg_group]
cnfg.pkgs_for_distro: list = pkg_groups_map[pkg_group]

# Add extra packages for specific distros
if cnfg.DISTRO_NAME in extra_pkgs_map:
Expand Down Expand Up @@ -703,6 +749,12 @@ def show_pkg_install_success():
cnfg.DISTRO_VER and
cnfg.DISTRO_VER[0] == '7'):
print('Doing prep/checks for CentOS 7...')
# remove 'dbus-daemon' from package list, not available on CentOS 7
pkgs_to_remove = ['dbus-daemon']
for pkg in pkgs_to_remove:
if pkg in cnfg.pkgs_for_distro:
cnfg.pkgs_for_distro.remove(pkg)

if py_interp_ver_tup >= (3, 8):
print(f"Good, Python version is 3.8 or later: "
f"'{cnfg.py_interp_ver}'")
Expand All @@ -717,6 +769,9 @@ def show_pkg_install_success():
# sudo yum install rh-python38-python-devel
subprocess.run(['sudo', 'yum', 'install', '-y', 'rh-python38-python-devel'],
check=True)
# sudo yum install rh-python38-python-tkinter
subprocess.run(['sudo', 'yum', 'install', '-y', 'rh-python38-python-tkinter'],
check=True)
#
# set new Python interpreter version and path to reflect what was installed
cnfg.py_interp_path = '/opt/rh/rh-python38/root/usr/bin/python3.8'
Expand Down Expand Up @@ -783,7 +838,7 @@ def show_pkg_install_success():
if cnfg.DISTRO_NAME in distro_groups_map['rhel-based'] + distro_groups_map['fedora-based']:
try:
call_attention_to_password_prompt()
if cnfg.DISTRO_NAME == 'silverblue':
if cnfg.DISTRO_NAME == 'silverblue-experimental':
check_for_pkg_mgr_cmd('rpm-ostree')
print(f'Distro is Silverblue type. Using "rpm-ostree" instead of DNF.')

Expand Down

0 comments on commit a529c4a

Please sign in to comment.