Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • T thunarx-python
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1
    • Issues 1
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Bindings
  • thunarx-python
  • Issues
  • #2
Closed
Open
Created Nov 28, 2020 by Yann Büchau@nobodyinperson

Setting the current working directory from a plugin

Hi ,

Thanks very much for thunarx-python. I am currently writing a set of plugins using thunarx-python and everything is great so far.

But what I can't figure out is how to set Thunar's current directory from within a plugin. For example I'd like to have a context menu entry which when clicked changes Thunar's current working directory to a specific folder.

This is what I tried:

def get_file_menu_items(window, elements):
    ...
    window.props.current_directory  # contains a ThunarFile
    window.get_property("current-directory") # same
    window.props.current_directory = "/path"  # doesn't work, needs to be a ThunarFile
    window.set_property("current-directory","/path")  # same
    ThunarFile = window.props.current_directory.__class__
    path = ThunarFile("path") # doesn't work, constructor takes no arguments
    path = ThunarFile()
    path.set_path("/path")  # doesn't exist
    window.props.current_directory = path  # crashes Thunar 

So how does one do this? 😣

Any help is much appreciated!

Assignee
Assign to
Time tracking