Code Monkey home page Code Monkey logo

Comments (18)

terrycain avatar terrycain commented on May 25, 2024 1

@lah7 Having some example scripts or commonly used scripts would be useful I think :).

Also the resize and react solution is used far more that you might think, though normally a framework will abstract from that. Back when I was doing some opengl, that's exactly what you have to do if you want to keep aspect ratio

from polychromatic.

lah7 avatar lah7 commented on May 25, 2024

Hi. Support for multiple keyboard layouts has been implemented in the past by @terrycain. The SVG image has "layers", the default being en-gb and supports fr-latin9 and en-us (which sounds similar to your keyboard's layout)

What is the output of:

setxkbmap -query

I just imported a script from the other repository which needs to ran if the keyboard SVG needs to be edited to support another layout.

The layout is currently retrieved by the driver's Python library: razer.keyboard.get_keyboard_layout()

This may change when the new driver daemon in progress by @terrycain is pushed to the drivers repo.


I didn't know about 4K display being tiny, it's possible to zoom in the page with WebKit2.WebView.set_zoom_level(1.0), but getting the resolution or font DPI information will vary across distributions. For now, this could be a future toggle option until we know a reliable way to "zoom" the application if the DPI is high.


I'll note this down on the to-do list, since the internal code will continue to see some re-structural changes to support multiple devices.

Thanks for your input on your "chainsaw" work. If it's in Python and works by reading parameters, this sounds like a good idea to be part of the main application as a non-GUI alternate controller, for example:

polychromatic-controller --set-profile="Game"

To avoid conflicts, it may be best to hold off contributions until a class for processing parameters is added.

from polychromatic.

terrycain avatar terrycain commented on May 25, 2024

@tnais @lah7 The SVG has layers with the small enter key layout. There is no way (in hardware) to get what layout the keyboard has so there is some hacky function in the library that does this, I believe there is a comment there somewhere which say something along the lines of "this code will need edited and improved to handle every layout many times :("

from polychromatic.

tnais avatar tnais commented on May 25, 2024

First of all my apologies, a little time after sending my message I finally started the new polychromatic configuration tool and found that the feature was already there. Fine job, thank you!

BTW, I had to comment the lines in set_process_name because something faulty in my Python installation (Ubuntu 16) barfed on line 155. Any idea on how to fix my Python3 installation?

For the zoom thing, adding a zoom-in/zoom-out and letting the user configure the size as she wishes could be a viable solution. We could even leave the window resizable and handle resizing events keeping the window aspect ratio, even if I admit I saw such code only in VB6 business management programs... Ouch...

About the command line tool, I did my tool by removing anything it was not necessary. The resulting python program is really small, much less than the size of a single block. But handles nicely profiles with spaces in the name without resorting to single or double quotes.

At this time I use it as a callback for xscreeensaver, to reset my keyboard configuration once the screen is unlocked (the keyboard is shut off on screen blanking/locking). I would like to hack xscreensaver to send events for "asking authentication" and maybe "authentication failed", so that the user can type is password on a lit keyboard.
Adding a command line option to the controller could be using a too large tool for the job in my humble opinion (when webtoolkit shared libraries are loaded? When the use is declared or at the first access?), but it could be the paranoia of someone who had only 3.5kbytes of ram available. Or had to manage 200 users on 80 Mbytes of disk space. :) :) :)

from polychromatic.

terrycain avatar terrycain commented on May 25, 2024

The resizing and keeping the aspect ratio would be difficult as all the interface is written in HTML (correct me if I'm wrong). The proper solution for this would be (I think anyway) to set the window size to maybe a percentage of the screen size and make sure you have css media queries to deal with the differing sizes.

Just my 2-cents worth

from polychromatic.

lah7 avatar lah7 commented on May 25, 2024

BTW, I had to comment the lines in set_process_name because something faulty in my Python installation (Ubuntu 16) barfed on line 155. Any idea on how to fix my Python3 installation?

Hmm, Ubuntu MATE 16.04 here, please open a new issue and paste the error from the terminal, I'll have a look at some point. It may affect other distros too.


Adding a command line option to the controller could be using a too large tool for the job in my humble opinion (when webtoolkit shared libraries are loaded?

I agree it's probably too much, but would any one really use the controller GUI as a command line tool for convenience or would they study and write scripts using the driver's actual module instead?


For the scaling, the easiest solution would be to set a scale factor and adjust the window size. That's just like zooming in with a web browser, and I found it works well with another WebKit-based program.

from polychromatic.

terrycain avatar terrycain commented on May 25, 2024

BTW, I had to comment the lines in set_process_name because something faulty in my Python installation (Ubuntu 16) barfed on line 155. Any idea on how to fix my Python3 installation?

I used that exact code (different variable names) in my Uni final project 😉, I too found it can be a bit finicky but the reward is definitely worth it and has reminded me to use it in my new daemon 😄.

Adding a command line option to the controller

Wouldn't a seperate script that can do profiles (something similar to the current razer_bcd_controller) be more useful?

from polychromatic.

tnais avatar tnais commented on May 25, 2024

@Lah,aye, the error will arrive ASAP. I think that the fault is in my installation.
For the scaling I agree. I had to do the "listen to resize and react" and it was a nightmare (possibly resulting in the program dying by stack overflow).

@terrycain : my opinion is that a program that does nothing except loading pre-built profiles should be a small one. It can restore a whole configuration and work along razer_bcd_controller. I use it, I could be a lone bear but there could be other users interested.

(please note: the words in italics patch a buggy sentence :) )

from polychromatic.

lah7 avatar lah7 commented on May 25, 2024

Wouldn't a seperate script that can do profiles (something similar to the current razer_bcd_controller) be more useful?

@terrycain: Polychromatic's profiles can be manipulated via its Python library, so a user could write their own. I think individual "ready to use" scripts would be more appropriate.

In future, I'm thinking of ditching the tray applet's "auto start" options too in favour of having generated Python scripts the user can run at start-up.


@tnais: Great, it's on the to-do list after some upcoming changes.
"Resize and react" sounds like a poor Microsoft practice. 😉

from polychromatic.

lah7 avatar lah7 commented on May 25, 2024

I think that the fault is in my installation.

@tnais, Sorry, that's actually my fault. I just realised I didn't stage the imports needed for that function to work! I just pushed them: bdb2f85

from polychromatic.

lah7 avatar lah7 commented on May 25, 2024

Some example scripts have been added: 03be59d


Now to hang tight to properly add the scaling option.

@tnais If you like, have a fiddle with WebKit2.WebView.set_zoom_level(1.0) in AppView.__init__ just before # Load the starting page, which will help decide if we need a slider or just a checkbox for 2x the size.

from polychromatic.

tnais avatar tnais commented on May 25, 2024

@lah7 going to download the new code and start fiddling with the resizing this evening...

from polychromatic.

tnais avatar tnais commented on May 25, 2024

O.K., I have something that could be a proof-of-concept of what I thought it could be the standalone command. Here it comes.

BTW, I noticed that I can scale most of the text in the desktop via the display settings app (at least in Ubuntu it has a slider for that). It could be interesting to understand where that value goes and read it back to scale the controller window.

Starting with my fiddle soon... (BTW, is there a forum for discuss this subject or this issue is a place good enough for the discussion?

loadprofile.zip

from polychromatic.

tnais avatar tnais commented on May 25, 2024

@lah7: setting the zoom level increases the text size but not the window size. I have to understand how to invoke some javascript code to use the window.resizeTo...

from polychromatic.

lah7 avatar lah7 commented on May 25, 2024

A few imports could be taken out -- here's a bare minimal script needed for setting profiles committed a few days ago - if it helps.

BTW, is there a forum for discuss this subject or this issue is a place good enough for the discussion?

Please do open a new issue to discuss this command line scripting stuff, it'll help keep this issue dedicated to the scaling.


Thanks for testing, I forgot about the fixed window - the size will need to "adapt" depending on the scale - I have some code for that, it's done by GTK than JavaScript.

I know in Ubuntu MATE, the option is in gsettings under schema org.mate.font-rendering... supporting automatic adaption to "work" across many distros seems quite complex.

Would you say a slider is needed or just a simple "2x" option? A screenshot of the application running compared to running apps will help too please.

from polychromatic.

tnais avatar tnais commented on May 25, 2024

I think that something like a slider or a couple of buttons could be better than a single option. The image shows the controller in front of its source and Gimp. I hope it is helpful, feel free to specify details. Sorry, it's rather big.

untitled

from polychromatic.

terrycain avatar terrycain commented on May 25, 2024

+1 for using emacs 😉

from polychromatic.

lah7 avatar lah7 commented on May 25, 2024

Thanks for the screenshot, 2x the size looks good on your display when it comes to the size of the text.

I'll look into adding 1.5x, 2x and 2.5x scaling options and adjust the window accordingly.

from polychromatic.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.