Browse Source

Stage changes

At this point I found out that there is an xlib implementation in python
and there is no need fo xutil. So, I stages these changes and I'm going
to delete/highly modify those utility files.
pull/2/head
Ali Hatami Tajik 2 years ago
parent
commit
90eb2582c6
  1. 0
      setup.sh
  2. 5
      src/scripts/python/changemouse.py
  3. 34
      src/scripts/python/setupmonitor.py
  4. 34
      src/scripts/python/xutil/randr.py

0
setup.sh

5
src/scripts/python/changemouse.py

@ -8,8 +8,7 @@ are the rules:
system system
+ Touchpanel should be connected to the master "touch-pointer" + Touchpanel should be connected to the master "touch-pointer"
NOTE: master "touch-pointer" should be available on the event of adding the NOTE: if master `touch` is not present in the system,
mouse. This could be reached by adding this master to the system on boot.
Steps: Steps:
+ List all pointer as we don't know what pointer is added to the system + List all pointer as we don't know what pointer is added to the system
@ -36,5 +35,5 @@ if __name__ == "__main__":
if not "eGalax" in pointer.name: if not "eGalax" in pointer.name:
com.reattach(pointer.id, core_master.id) com.reattach(pointer.id, core_master.id)
else: else:
# TODO: add touchpannel support
pass pass

34
src/scripts/python/setupmonitor.py

@ -0,0 +1,34 @@
"""Setup Monitor Script
Author: Ali Hatami Tajik [hatam](mailto:a.hatam008@gmail.com)
Date: 2023 Mar 04
This script should be used whenever a change happen in the rdm system, I
guess! But as I investigate a rdm change event will happen many time in case
of addition or removal of a monitor auto configuration is done by the
org.mate.SettingsDaemon.plugins.xrandr deamon. I'll searching for a way to
change that event to run our specified script.
This script will do the following:
1. List currently available monitors
2. Map those to config file
3. Replace default values for missing configs
4. Handle missing touch-screen/main monitor
NOTE: In general we use at least two monitoers with our system.
One is for touch screen and one is for regular screen. In
case of one missing a callback is run to handle that
occurance (an event may send to the software or a temp log
file may be updated so the software adjust ifself
correspondigly).
Config files are in JSON format and spesify screen output name and their
mode (xrandr resolution and stuff may be added but for now --auto/--prefered
option is used). The format is:
"""
if __name__ == "__main__":
pass

34
src/scripts/python/xutil/randr.py

@ -22,6 +22,7 @@ Utilities:
from enum import Enum from enum import Enum
from dataclasses import dataclass from dataclasses import dataclass
from typing import List
# TODO: Option class which can be applied by get_args method # TODO: Option class which can be applied by get_args method
@ -65,9 +66,42 @@ class ReflectDir(Enum):
@dataclass @dataclass
class Setting: class Setting:
"""Settings of a screen
This data struct will be used as the config of each screen. Note that
default screen cannot be use
"""
resolution = None, resolution = None,
is_primary = False, is_primary = False,
is_enabeled = True, is_enabeled = True,
rotation = None rotation = None
position = None position = None
reflection = None reflection = None
@dataclass
class Mode:
"""Mode
Mode of the screen including width, height, refresh rate(s)
"""
height: int = 0
width: int = 0
frequency: List[int] = []
class Screen:
"""Screen class
This class will hold screen properties and methods related to the screens.
At the time it will use xrandr (and not the verbose mode) to list the
screens and modes.
"""
class Monitor:
"""Monitor Class
List Monitor Outputs and their states
"""
Loading…
Cancel
Save