Linux.com

E_force

E_force

  • Linux.com Member
  • Posts: 10
  • Member Since: 15 Oct 09
  • Last Logged In: 11 Jul 10

Latest Posts

Posted by
Topic
Post Preview
Posted
  • E_force
    RE: Changing a text cursor in GNOME
    After about an hour of coding I get a simple application which changes the cursor's color according to the layout. I used two third party scripts: your Python script which reloads GTK settings and the [url=http://sourceforge.net/projects/xkblayout/]xkblayout[/url] application written on the C language which returns the current keyboard layout. I combined this two in my own Ruby script which checks the current layout, changes the style of the text cursor and reloads settings for all of the opened applications. Yet it can only work with GTK applications but I would like to enable Qt and the console support. The application has a simple structure. [code='Application sturcture'] layout_indicator/ - reload_gtk_settings.py # a Python script - show_the_current_layout # a C script - switch_layout_style.rb # a Ruby scirpt [/code] To enable this application to work you should have Python and Ruby installed. You should also create a bunch of GTK configuration files. First you need to create ~/.gtkrc-2.0: [i]touch ~/.gtkrc-2.0[/i]. The file should contain a single line. [code='~/.gtkrc'] include ".gtkrc-custom" [/code] Second you need to to create ~/.gtkrc-custom-us, ~/.gtkrc-custom- and ~/.gtk-custom-default: [i]touch ~/.gtkrc-custom-us ~/.gtkrc-custom- ~/.gtk-custom-default[/i]. They should contain the following. ~/.gtk-custom-us [code] style "custom" { GtkWidget::cursor-color = "#0000FF" GtkWidget::secondary-cursor-color = "#0000FF" } widget_class "*" style "custom" [/code] This style specifies the blue color for the en-us layout. ~/.gtk-custom- [code] style "custom" { GtkWidget::cursor-color = "#FF0000" GtkWidget::secondary-cursor-color = "#FF0000" } widget_class "*" style "custom" [/code] This style specifies the red color for your layout. ~/.gtk-custom-default [code] style "custom" { GtkWidget::cursor-color = "#000000" GtkWidget::secondary-cursor-color = "#000000" } widget_class "*" style "custom" [/code] This style specifies the black color for the default layout. Third you need to create a symlink to the ~/.gtkrc-custom-us file: [i]ln -sf /home//.gtkrc-custom-us /home//.gtkrc-custom[/i]. Note the symlink should be named .gtkrc-custom. Fourth you need to place an application directory somewhere. You could move it to the ~/my_scripts directory for example. Fifth you should change the lines 30, 31 and 32 of the ruby script replacing the default Russian layout to your own. [code] 30. when 'RU' # change to your layout 31. if File.readlink("#{home}/.gtkrc-custom") != "#{home}/.gtkrc-custom-ru" # change the .gtkrc-custom-ru file to .gtkrc-custom- here 32. ln_sf("#{home}/.gtkrc-custom-ru", "#{home}/.gtkrc-custom") # and here [/code] And after all of that you can run the script /switch_layout_style.rb. Of course you should have the reload_gtk_settings.py, switch_layout_style.rb and show_the_current_layout files executable. You can use the [i]chmod u+x [/i] command to change ther modes. To have an ability to autoload that script you can add it to the application list which GNOME loads on the start. To achieve it you should start the application launcher (usually Alt+F2) and then type [i]gnome-session-properties[/i] there. The session window should appear and after that you can add the script to the autoloaded application list. Here's the list of the features that I would like to add to the application. - an ability to load the application at the start of the system but not GNOME's; - an ability to change another properties of the text cursor such as its width, blink rate etc.; - an ability to change the cursor's properties not only for GTK applications but also for Qt and XUL.; - an ability to change the cursor's color in the console; - an ability to change the color of the rectangular selection box. I'd like to hear what you think about how to realise them. I attach the files of the application to the post. The archive contains the application itself in the layout_indicator directory and the source code of xkblayout. Probably, you'll need to compile it by itself. If so don't forget to rename the output executable file to [i]show_the_current_layout[/i] and add it to the layout_indicator dir. [file name=layout_indicator_source.tar.gz size=4086]http://www.linux.com/media/kunena/attachments/legacy/files/layout_indicator_source-fca906721321cd80791ca9b06754da7e.gz[/file]
    Link to this post 19 May 10

    After about an hour of coding I get a simple application which changes the cursor's color according to the layout. I used two third party scripts: your Python script which reloads GTK settings and the xkblayout application written on the C language which returns the current keyboard layout. I combined this two in my own Ruby script which checks the current layout, changes the style of the text cursor and reloads settings for all of the opened applications. Yet it can only work with GTK applications but I would like to enable Qt and the console support.

    The application has a simple structure.

    [code='Application sturcture']
    layout_indicator/
    - reload_gtk_settings.py # a Python script
    - show_the_current_layout # a C script
    - switch_layout_style.rb # a Ruby scirpt
    [/code]

    To enable this application to work you should have Python and Ruby installed. You should also create a bunch of GTK configuration files.

    First you need to create ~/.gtkrc-2.0: touch ~/.gtkrc-2.0.

    The file should contain a single line.

    [code='~/.gtkrc']
    include ".gtkrc-custom"
    [/code]

    Second you need to to create ~/.gtkrc-custom-us, ~/.gtkrc-custom-<your_language> and ~/.gtk-custom-default: touch ~/.gtkrc-custom-us ~/.gtkrc-custom-<your_language> ~/.gtk-custom-default.

    They should contain the following.

    ~/.gtk-custom-us


    style "custom" {
    GtkWidget::cursor-color = "#0000FF"
    GtkWidget::secondary-cursor-color = "#0000FF"
    }

    widget_class "*" style "custom"

    This style specifies the blue color for the en-us layout.

    ~/.gtk-custom-<your-language>


    style "custom" {
    GtkWidget::cursor-color = "#FF0000"
    GtkWidget::secondary-cursor-color = "#FF0000"
    }

    widget_class "*" style "custom"

    This style specifies the red color for your layout.

    ~/.gtk-custom-default


    style "custom" {
    GtkWidget::cursor-color = "#000000"
    GtkWidget::secondary-cursor-color = "#000000"
    }

    widget_class "*" style "custom"

    This style specifies the black color for the default layout.

    Third you need to create a symlink to the ~/.gtkrc-custom-us file: ln -sf /home/<username>/.gtkrc-custom-us /home/<username>/.gtkrc-custom.

    Note the symlink should be named .gtkrc-custom.

    Fourth you need to place an application directory somewhere. You could move it to the ~/my_scripts directory for example.

    Fifth you should change the lines 30, 31 and 32 of the ruby script replacing the default Russian layout to your own.


    30. when 'RU' # change to your layout
    31. if File.readlink("#{home}/.gtkrc-custom") != "#{home}/.gtkrc-custom-ru" # change the .gtkrc-custom-ru file to .gtkrc-custom-<your_language> here
    32. ln_sf("#{home}/.gtkrc-custom-ru", "#{home}/.gtkrc-custom") # and here

    And after all of that you can run the script <path_to_layout_indicator>/switch_layout_style.rb. Of course you should have the reload_gtk_settings.py, switch_layout_style.rb and show_the_current_layout files executable. You can use the chmod u+x <filename> command to change ther modes.

    To have an ability to autoload that script you can add it to the application list which GNOME loads on the start. To achieve it you should start the application launcher (usually Alt+F2) and then type gnome-session-properties there. The session window should appear and after that you can add the script to the autoloaded application list.

    Here's the list of the features that I would like to add to the application.

    - an ability to load the application at the start of the system but not GNOME's;
    - an ability to change another properties of the text cursor such as its width, blink rate etc.;
    - an ability to change the cursor's properties not only for GTK applications but also for Qt and XUL.;
    - an ability to change the cursor's color in the console;
    - an ability to change the color of the rectangular selection box.

    I'd like to hear what you think about how to realise them.

    I attach the files of the application to the post. The archive contains the application itself in the layout_indicator directory and the source code of xkblayout. Probably, you'll need to compile it by itself. If so don't forget to rename the output executable file to show_the_current_layout and add it to the layout_indicator dir.

    [file name=layout_indicator_source.tar.gz size=4086]http://www.linux.com/media/kunena/attachments/legacy/files/layout_indicator_source-fca906721321cd80791ca9b06754da7e.gz[/file]

  • E_force
    RE: Changing a text cursor in GNOME
    Interesting approach but how about to base the script on some variable which contains the current layout or some method which returns it? This variable or method should exist in the system. Otherwise, how the GNOME's keyboard applet would determine the layout. Here's how it would work. [code] case system('echo $CURR_LAYOUT') # or ENV['CURR_LAYOUT'] or curr_layout() or smth. when 'us' then symlink('~/.gtkrc-custom-1', '~/.gtkrc-2.0') when 'ru' then symlink('~/.gtkrc-custom-2', '~/.gtkrc-2.0') else symlink('~/.gtkrc-custom-default', '~/.gtkrc-2.0') end [/code] What do you think about it?
    Link to this post 19 May 10

    Interesting approach but how about to base the script on some variable which contains the current layout or some method which returns it? This variable or method should exist in the system. Otherwise, how the GNOME's keyboard applet would determine the layout.

    Here's how it would work.


    case system('echo $CURR_LAYOUT') # or ENV['CURR_LAYOUT'] or curr_layout() or smth.
    when 'us' then symlink('~/.gtkrc-custom-1', '~/.gtkrc-2.0')
    when 'ru' then symlink('~/.gtkrc-custom-2', '~/.gtkrc-2.0')
    else symlink('~/.gtkrc-custom-default', '~/.gtkrc-2.0')
    end

    What do you think about it?

  • E_force
    RE: Changing a text cursor in GNOME
    Thanks for the help, Jabir. My point is to improve my experience working with multiple layouts. When you type you usually look at the text cursor thus there's no better way to show the current layout as setting an indicator right before your eyes.
    Link to this post 18 May 10

    Thanks for the help, Jabir.

    My point is to improve my experience working with multiple layouts. When you type you usually look at the text cursor thus there's no better way to show the current layout as setting an indicator right before your eyes.

  • E_force
    RE: Changing a text cursor in GNOME
    Can I change it dynamically depending on, for example, the currently keyboard layout?
    Link to this post 18 May 10

    Can I change it dynamically depending on, for example, the currently keyboard layout?

  • E_force
    Changing a text cursor in GNOME
    Hi. Is it possible to change a color of the text cursor for all GUI applications in GNOME? If it is, how can I achieve it? Thanks.
    Link to this post 18 May 10

    Hi.

    Is it possible to change a color of the text cursor for all GUI applications in GNOME? If it is, how can I achieve it?

    Thanks.

  • E_force
    RE: Hanging on a boot while checking a file system
    I tried to make an fsck disk check. I made it for both partitions: /dev/sda2 where my root directory is and /dev/sda3 where my home is. Here's the output: [color=#888888][i]# begin code[/i][/color] [color=#FF0000]#[/color] fsck /dev/sda2 fsck 1.41.3 (12-Oct-2008) e2fsck 1.41.3 (12-Oct-2008) /dev/sda2 is mounted. WARNING!!! Running e2fsck on a mounted filesystem may cause SEVERE filesystem damage. Do you really want to continue (y/n)? yes /dev/sda2: recovering journal Clearing orphaned inode 57245 (uid=1000, gid=1000, mode=0140755, size=0) /dev/sda2: clean, 191656/1283632 files, 1211592/5120718 blocks [color=#FF0000]#[/color] fsck /dev/sda3 fsck 1.41.3 (12-Oct-2008) e2fsck 1.41.3 (12-Oct-2008) /dev/sda3 is mounted. WARNING!!! Running e2fsck on a mounted filesystem may cause SEVERE filesystem damage. Do you really want to continue (y/n)? yes /dev/sda3: recovering journal /dev/sda3 has been mounted 29 times without being checked, check forced. Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information /dev/sda3: 316061/8372224 files (1.9% non-contiguous), 24838247/33463395 blocks [color=#888888][i]# end code[/i][/color] As far as I can understand fsck works correctly. If so, may be there's a script which contains the fsck launch command. It might be this script must execute the check disk command with some options at the boot time. I assume if this script exist may be the bug is in it. What about [i]to push or not to push[/i] the “Enter” button in GRUB for successful loading I checked it and it simply was coincidence. My system hang on the check stage regardless of my actions in GRUB. I changed /etc/fstab. This file contains the partitions which have to check at boot. It includes the strings: [color=#888888][i]# begin code[/i][/color] … /dev/sda2 / ext3 errors=remount-ro 0 1 /dev/sda3 /home ext3 defaults 0 2 … [color=#888888][i]# end code[/i][/color] I changed the values of the last two parameters from 1 and 2 to 0 for preventing the HDD check at boot. Now my system doesn't hang but you know this doesn't solve the problem.
    Link to this post 24 Nov 09

    I tried to make an fsck disk check. I made it for both partitions: /dev/sda2 where my root directory is and /dev/sda3 where my home is.

    Here's the output:

    # begin code
    # fsck /dev/sda2
    fsck 1.41.3 (12-Oct-2008)
    e2fsck 1.41.3 (12-Oct-2008)
    /dev/sda2 is mounted.

    WARNING!!! Running e2fsck on a mounted filesystem may cause
    SEVERE filesystem damage.

    Do you really want to continue (y/n)? yes

    /dev/sda2: recovering journal

    Clearing orphaned inode 57245 (uid=1000, gid=1000, mode=0140755, size=0)
    /dev/sda2: clean, 191656/1283632 files, 1211592/5120718 blocks

    # fsck /dev/sda3
    fsck 1.41.3 (12-Oct-2008)
    e2fsck 1.41.3 (12-Oct-2008)
    /dev/sda3 is mounted.

    WARNING!!! Running e2fsck on a mounted filesystem may cause
    SEVERE filesystem damage.

    Do you really want to continue (y/n)? yes

    /dev/sda3: recovering journal

    /dev/sda3 has been mounted 29 times without being checked, check forced.
    Pass 1: Checking inodes, blocks, and sizes
    Pass 2: Checking directory structure
    Pass 3: Checking directory connectivity
    Pass 4: Checking reference counts
    Pass 5: Checking group summary information
    /dev/sda3: 316061/8372224 files (1.9% non-contiguous), 24838247/33463395 blocks
    # end code

    As far as I can understand fsck works correctly. If so, may be there's a script which contains the fsck launch command. It might be this script must execute the check disk command with some options at the boot time. I assume if this script exist may be the bug is in it.

    What about to push or not to push the “Enter” button in GRUB for successful loading I checked it and it simply was coincidence. My system hang on the check stage regardless of my actions in GRUB.

    I changed /etc/fstab. This file contains the partitions which have to check at boot. It includes the strings:

    # begin code
    …
    /dev/sda2 / ext3 errors=remount-ro 0 1
    /dev/sda3 /home ext3 defaults 0 2
    …
    # end code

    I changed the values of the last two parameters from 1 and 2 to 0 for preventing the HDD check at boot. Now my system doesn't hang but you know this doesn't solve the problem.

  • E_force
    RE: Hanging on a boot while checking a file system
    Here's what I think about the situation. I'm sure, I haven't got any problems with BIOS, the motherboard or other hardware. Also, I think that the problem is in the fsck utility. It seems, it can't perform an HDD check. Early when I started my system, fsck worked correctly and performed the check regulary after 26 system boots. It said something like [i]/dev/sda3 was mount 26 times without checking, bla-bla-bla, check forced[/i] after that it showed me a progress bar and I could see the progress of checking. Now the situation has changed. I push the “Power” button, the system starts, I see the boot operation sequence on the screen and [i]sometimes[/i] when the boot process goes to the “Checking file systems…” stage the system just hang. The HDD's led is [i]off[/i] and [i]it doesn't blink[/i]. The system is in that state five, ten, fifteen minutes and nothing happens. I push the “Reset” button, the system reboot and if I push the “Enter” key in GRUB the system boot without problems, “Checking file systems…” returns some info that I think relevant to the last successful check. But if I don't push “Enter” the system hangs again. I have to notice also I performed partitions size change about month ago. I reduced the partition where the root directory was and increased the partition with the “home” directory. I performed this operation booting with Ubuntu live CD and using the GParted utility. Partition size changing completed without any errors or warnings.
    Link to this post 22 Nov 09

    Here's what I think about the situation.

    I'm sure, I haven't got any problems with BIOS, the motherboard or other hardware. Also, I think that the problem is in the fsck utility. It seems, it can't perform an HDD check. Early when I started my system, fsck worked correctly and performed the check regulary after 26 system boots. It said something like /dev/sda3 was mount 26 times without checking, bla-bla-bla, check forced after that it showed me a progress bar and I could see the progress of checking.

    Now the situation has changed. I push the “Power” button, the system starts, I see the boot operation sequence on the screen and sometimes when the boot process goes to the “Checking file systems…” stage the system just hang. The HDD's led is off and it doesn't blink. The system is in that state five, ten, fifteen minutes and nothing happens. I push the “Reset” button, the system reboot and if I push the “Enter” key in GRUB the system boot without problems, “Checking file systems…” returns some info that I think relevant to the last successful check. But if I don't push “Enter” the system hangs again.

    I have to notice also I performed partitions size change about month ago. I reduced the partition where the root directory was and increased the partition with the “home” directory. I performed this operation booting with Ubuntu live CD and using the GParted utility. Partition size changing completed without any errors or warnings.

  • E_force
    Hanging on a boot while checking a file system
    Hi. Last time my system starts to hang on boot. It occurs while the "Checking file systems..." process. I noticed that it happens only when I wait established time in GRUB. If I press the "Enter" key in the GRUB menu the system will boot without any errors. What is the reason of the bug? How can I fix it? Thanks. Debian 5.0.3; GRUB 0.97.
    Link to this post 21 Nov 09

    Hi.

    Last time my system starts to hang on boot. It occurs while the "Checking file systems..." process. I noticed that it happens only when I wait established time in GRUB. If I press the "Enter" key in the GRUB menu the system will boot without any errors.

    What is the reason of the bug? How can I fix it?

    Thanks.

    Debian 5.0.3;
    GRUB 0.97.

  • E_force
    RE: Using a virtual terminal
    [b]Set_Killer [/b] Thank you very much for you answer. I don't use any of the desktop environments. In my question I meant virtual terminals or virtual consoles (Ctrl + Alt + F[i]n[/i]) not a terminal emulator program. It is difficult for me to find any info or clear tutorial about how to set up a virtual terminal using native instruments i. e. without any third-party applications. If you have any information concern to my question please let me know. My OS is Debian GNU/Linux 5.0.2. Thanks.
    Link to this post 17 Oct 09

    Set_Killer

    Thank you very much for you answer. I don't use any of the desktop environments. In my question I meant virtual terminals or virtual consoles (Ctrl + Alt + Fn) not a terminal emulator program. It is difficult for me to find any info or clear tutorial about how to set up a virtual terminal using native instruments i. e. without any third-party applications. If you have any information concern to my question please let me know.

    My OS is Debian GNU/Linux 5.0.2.

    Thanks.

  • E_force
    Using a virtual terminal
    Hi. When I’m using the virtual terminal I have some things which I want to change. The font size is too small. How can I change it? Also, is any method to change a typeface? How can I achieve it? The background color is also inappropriate for me. How can I change background and font colors? Thanks in advance.
    Link to this post 15 Oct 09

    Hi.

    When I’m using the virtual terminal I have some things which I want to change.

    The font size is too small. How can I change it? Also, is any method to change a typeface? How can I achieve it?
    The background color is also inappropriate for me. How can I change background and font colors?

    Thanks in advance.

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board